I finally got on the Wordle bandwandwagon and ran the Discovering XQuery Blog through their clever wordcloud generator thingy. Actually, I ran it more than a couple of times since it's a lot of fun to let it create random patterns (warning: time suck!).
Here is what the most recent posts (it uses the RSS feed) produced:
(click here to see in on Wordle)
What a shocker! Yup, XQuery is front and center here at Discovering XQuery and with XML to base it on you have all you need to create and work with content (of course using MarkLogic Server). I also like the accidental sentence 'XQuery can script'. Youbetcha!
A good example of this is this paper from the upcoming International Conference on Music Information Retrieval (ISMIR2008). In between the sessions on music recognition and automated transcription (my favorite: Multiple-Feature Fusion Based Onset Detection for Solo Singing Voice) is this session on working with MusicML: Using XQuery on MusicXML Databases for Musicological Analysis. The authors got some MusicXML from wikifonia (a free site that collects MusicXML and provides a nice rendering of the music) and used XQuery like a buzzsaw to slice up the content sorting out duplicate titles, listing key signatures and time signatures and even trying to find motives (sequences of chords or rhythms) in the corpus. Pretty cool stuff!
I thought I'd give it a try myself and add maybe add to their collection of queries.
The first step is to get some content. Lloading XML from an external source looks like this in MarkLogic:
for $i in (1 to 200)
let $song-source := concat("http://static.wikifonia.org/" ,$i , "/musicxml.xml")
let $database-uri := concat("/songs/" ,$i , "/music.xml")
This grabs the first 200 songs and inserts them into a database.
The XML is pretty neat and, like all good XML, nicely self-describing:
<creator type="composer">Bob Haggard</creator>
<!-- Then the actual music in measures -->
<lyric number="1" name="verse">
Having loaded some MusicXML, it's time to run use some XQuery to explore the music. You can run the ones in the paper like this one that lists the titles that have no rests:
for $i in //score-partwise
$i[count($i//rest) eq 0]//movement-title
This gives us a sequence of titles:
Zachtjes gaan de paardenvoetjes
Sinterklaas is jarig
let $notes := //score-partwise[.//score-instrument/instrument-name eq "Grand Piano"]//note
let $rest-notes := //score-partwise[.//score-instrument/instrument-name eq "Grand Piano"]//note[./rest]
$notes except $rest-notes
This shows the feasibility of automated musicological
analysis on digital score libraries using the latest software
tools. Bottom line: it’s easy.