Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonathanrobie/9ab7ac412cd0f2aacad4 to your computer and use it in GitHub Desktop.
Save jonathanrobie/9ab7ac412cd0f2aacad4 to your computer and use it in GitHub Desktop.
declare default element namespace "http://www.tei-c.org/ns/1.0";
(:
Which actors appear in each scene?
- group by scenes
- show unique actors in each scene
:)
for $act in //div1[@type='act']
for $act-number in $act/@n
for $scene in $act//div2[@type='scene']
for $scene-number in $scene/@n
for $whoville in $scene//*[@who]
for $person in $whoville/@who ! tokenize(., "(#)|( #)")
group by $act-number, $scene-number
order by $act-number, $scene-number
return
<scene act="{$act-number}" scene="{$scene-number}">
{
for $p in $person
group by $p
order by $p
return $p
}
</scene>
@jonathanrobie
Copy link
Author

Query from http://xqueryinstitute.org/ workshop, June 2014. Input is Folger's edition of Julius Caesar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment