diff --git a/res/xml/xquery/allchapters.xq b/res/xml/xquery/allchapters.xq new file mode 100644 index 0000000..2a7b667 --- /dev/null +++ b/res/xml/xquery/allchapters.xq @@ -0,0 +1,51 @@ +xquery version "3.1"; + + +declare namespace tei = "http://www.tei-c.org/ns/1.0"; + + + +{ + for $book in collection('/db/xml_files/publications') + let $series := $book//tei:seriesStmt/tei:title/text() + let $number := xs:int($book//tei:seriesStmt/tei:idno/text()) + let $title := $book//tei:titleStmt/tei:title[@type = 'main']/node() + let $chapter := $book//tei:text//tei:div[@type = 'chapter'] + for $bit in $chapter + let $chaptertitle := $bit/tei:head/node() + let $chapterlanguage := xs:string($bit/@xml:lang) + let $chapterabstract := $bit/ab[@type='chapterabstract'] + let $nonumber := $bit/@n + let $order := index-of($chapter, $bit) + let $resp := xs:string($bit/@resp) + let $resplist := tokenize($resp, " ") + order by $series, $number, $order + return + { + { $chaptertitle }, { $title }, { $series }, + { $number }, { $order }, {$chapterlanguage}, {$chapterabstract},{$resplist},{if ($nonumber = 'nonumber') then ("false") else ("true")}, + + { + for $pp in $resplist + let $localname := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/tei:persName/@xml:lang) + let $inbookid := xs:string($book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/@xml:id) + let $firstname := + $book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/tei:persName/tei:forename/node() + let $lastname := + $book/*//tei:respStmt[@xml:id = substring-after($pp, "#")]/tei:persName/tei:surname/node() + return + { + if ($localname = "zh") then + (concat($lastname, ' ', $firstname)) + else + (concat($firstname, ' ', $lastname)) + } + {$firstname} + {$lastname} + {$inbookid} + + } + } + +} + diff --git a/res/xml/xquery/allpublications.xq b/res/xml/xquery/allpublications.xq new file mode 100644 index 0000000..66e4adf --- /dev/null +++ b/res/xml/xquery/allpublications.xq @@ -0,0 +1,23 @@ +xquery version "3.1"; + + +declare namespace tei = "http://www.tei-c.org/ns/1.0"; + + + +{ + for $book in collection('/db/xml_files/publications') + let $series := $book//tei:seriesStmt/tei:title/text() + let $number := xs:int($book//tei:seriesStmt/tei:idno/text()) + let $abstract := $book//tei:profileDesc/tei:abstract[@n = 'brief']/tei:p + let $title := $book//tei:titleStmt/tei:title[@type = 'main']/node() + let $coverimage := $book//tei:text/tei:front/tei:figure[@type = 'cover']/tei:graphic/@url + return + { + { $title }, { $series }, { $number }, + { $abstract }, + { concat("/", lower-case($series), "/", $number, "/", $coverimage) } + } + +} +