Skip to content

Instantly share code, notes, and snippets.

@cwulfman
Created April 7, 2017 21:25
Show Gist options
  • Save cwulfman/8d5b58a1dc7b584d75fc523a5faff54c to your computer and use it in GitHub Desktop.
Save cwulfman/8d5b58a1dc7b584d75fc523a5faff54c to your computer and use it in GitHub Desktop.
Music constituents published after 1900
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare function local:w3cdtf-to-xsdate($d as xs:string) as xs:date
{
let $dstring :=
if ($d castable as xs:gYear) then $d || "-01-01"
else if ($d castable as xs:gYearMonth) then $d || "-01"
else if ($d castable as xs:date) then $d
else error($d, "not valid w3cdtf")
return xs:date($dstring)
};
let $issuesOfInterest := collection('/db/bmtn-data/transcriptions')//tei:date[./@when > "1900-01-01"]/ancestor::tei:TEI
let $AllMusicSections := $issuesOfInterest//tei:classCode[.='Music']/ancestor::tei:relatedItem[@type='constituent']
return $AllMusicSections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment