At Recordare we have developed a MusicXML format for representing musical scores. The DTDs and more information are available at www.musicxml.org/xml.html. Naturally, we would like to store music in a database and be able to search on it.
The W3C’s XQuery Use Cases and XQuery 1.0 documents are very helpful for learning the basics of XQuery (the use cases in particular). However, I cannot find a simple way to do one of the most fundamental types of music queries. I would appreciate it if people could tell me either 1) what I’ve missed in XQuery or 2) suggestions on how to modify XQuery to better support this type of query.
Say we are trying to search for “Frere Jacques” sung in the key of C. We just want to look for a sequence of pitches: C, D, E, C. We do not want to assume, though, that all these pitches are in the same measure - both of these XML data should be found (this is not real MusicXML, but simplified for this example):
C
D
E
C
as well as
C
D
E
C
In both cases, we want to return the 4 notes in sequence, regardless of whether they are in the same parent or consecutive parents. However, the following would not match, since there is an F in the middle of the sequence:
C
D
F
E
C
I know there are brute force ways to do this, but this is already a much simpler than real-world query example, and needs to be 1) handled simply and 2) retrieved quickly from an XML database.
Is there some convenient mechanism to specify that I want to match a sequence of elements that share, not necessarily a common parent, but a common grandparent, great-grandparent, or arbitrary level ancestor? Goodness knows there is a lot in XQuery, so please let me know if I have missed the easy way to handle this type of query.
Thanks for any assistance that you can offer.
Regards,
Michael Good
Recordare
#webMethods#API-Management#Tamino