Forked from davidamichelson/gist:857733cac083c270013b
Last active
August 29, 2015 14:25
-
-
Save wsalesky/64f0203da8cd37857bf9 to your computer and use it in GitHub Desktop.
Get all Syriac names and English counterparts from Syriaca.org data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0"; | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
<root> | |
{ | |
( | |
for $place in collection('/db/apps/srophe-data/data/places/tei')//tei:place[tei:placeName[matches(@xml:lang, '^syr')]] | |
let $id := $place/tei:idno[starts-with(.,'http://syriaca.org/')]/text() | |
return | |
<row> | |
<uri>{$id}</uri> | |
{ | |
for $name in $place/tei:placeName[matches(@xml:lang, '^syr') or matches(@xml:lang, '^en')] | |
return | |
(<name>{string-join($name,' ')}</name>, | |
<lang>{string($name/@xml:lang)}</lang>) | |
} | |
</row>, | |
for $person in collection('/db/apps/srophe-data/data/persons/tei')//tei:person[tei:persName[matches(@xml:lang, '^syr')]] | |
let $id := $person/tei:idno[starts-with(.,'http://syriaca.org/')]/text() | |
return | |
<row> | |
<uri>{$id}</uri> | |
{ | |
for $name in $person/tei:persName[matches(@xml:lang, '^syr') or matches(@xml:lang, '^en')] | |
return | |
(<name>{if($name/child::*) then string-join($name/child::*,' ') | |
else string-join($name,' ') | |
}</name>, | |
<lang>{string($name/@xml:lang)}</lang>) | |
} | |
</row> ) | |
} | |
</root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment