Skip to content

Instantly share code, notes, and snippets.

View cwulfman's full-sized avatar

Cliff Wulfman cwulfman

  • Princeton University
View GitHub Profile
@cwulfman
cwulfman / music-data.xquery
Created April 21, 2017 16:21
For Vanderbilt XQuery group: sample XQuery to retrieve data about musical notation in Blue Mountain
xquery version "3.1";
(:~
: A query to retrieve interesting data about
: music publication in the Blue Mountain
: data set.
:
: @author Cliff Wulfman
: @version 1.0
: April 21, 2017
:)
@cwulfman
cwulfman / post1900Music.xql
Created April 7, 2017 21:25
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")