Monday, April 16, 2007

XQuery in XML syntax...


On 4/15/07, Brandon Mechtley <> wrote:
Prof. Rao,

I was working through the homework, and a question popped into my head:
Perhaps it is totally irrelevant, but is there any particular reason that the XQuery syntax itself doesn't leverage the structure of XML? With some clever use of oid's, I have a feeling queries could be just expressive without requiring a non-XML grammar. Maybe that's where XML Schema comes into play, though . . .

no--XQuery  is allowed to have XML syntax, and there is a W3C working group recommendation standard called XqueryX for this:

Here is an excerpt from the introduction that is self-explanatory:


The [XML Query 1.0 Requirements] states that "The XML Query Language MAY have more than one syntax binding. One query language syntax MUST be convenient for humans to read and write. One query language syntax MUST be expressed in XML in a way that reflects the underlying structure of the query."

XQueryX is an XML representation of an XQuery. It was created by mapping the productions of the XQuery grammar into XML productions. The result is not particularly convenient for humans to read and write, but it is easy for programs to parse, and because XQueryX is represented in XML, standard XML tools can be used to create, interpret, or modify queries.


Notice the part about human readability of current Xquery syntax. This "certification" was no doubt given by geeks who think SQL is more readable than English ;-)


No comments: