July 29, 2003
Souped up Soapbox

I've improved the Soapbox page to list all the articles I've been publishing lately and some interesting historical articles (like my news article breaking the news on the formation of Apache Jakarta).

Posted by Jason Hunter at 02:31 PM
July 25, 2003
XQuery Q&A

(Q1) What's the status of "update", "insert" and "delete" in XQuery? Is it a few months away, or a couple of years? Are there current proprietary implementations?

(A1) XQuery 1.0 is not scoped to have any update functionality. I've seen proposals for what might go in after 1.0 and they look reasonable and elegant. In the meanwhile what you'll see is custom vendor functions to handle the job. Cerisent for example has functions for inserting and deleting nodes and documents, and these functions work against path expressions nicely. It's really amazing what you can do when you can generate XML that you feed back into the database as input for later queries.

(Q2) Is JDOM going to support XQuery sometime? soon? since it already supports XPath (quite nice, by the way, just used it in my project.)

(A2) I don't really see the situation where you'd want JDOM to "support XQuery". To do XQuery well you want to operate against an indexed data set, and that's not what JDOM is striving to be. It's better if XQuery implementations support JDOM, meaning you could navigate XQuery results with JDOM rather than DOM. This is already possible with Cerisent where their XDBC API lets you get the raw bytes for a result document and you can feed that into JDOM's SAXBuilder. (I keep mentioning Cerisent because it's the engine I'm using myself, as it's by far the most complete.) Keep an eye on the JSR-225 XQJ activity.

(Q3) How much is this query part of XQuery overlapping XSLT? They're certainly of a different type of language. Is XSLT a good analogy for the "View" concept in RDBM?

(A3) XQuery and XSLT are dramatically different languages, although they do have some overlapping uses. I personally find XQuery much more natural to use, and expect other traditional programmers will as well. I wouldn't be surprised if XQuery saw uses where traditionally one might have used XSLT previously. In classes I've taught on XQuery, students seemed to catch on faster than with XSLT.

(Q4) Are there datatypes in XQuery? Or just all variables are intepreted from its context like in most scripting languages?

(A4) XQuery is a strongly typed language, with typing mostly based on the XML Schema types (i.e. xs:decimal) with a few new types added by XQuery itself. You can also define your own types using Schema. If you don't like Schema (who does?) the wonderful thing is that in the absence of typing the data values are typed as xdt:untypedAtomic (xdt is the custom namespace prefix for the set of types added by XQuery) and the rules for this untyped type allow automatic casting to string and numeric values as required. Thus the simple uses work in a way that will remind you of Perl, but you can also strongly type your data if you want. I personally think the strong typing is most important when your data source is an RDBMS where values are naturally typed and so it's more efficient and easier if you don't have to artificially "untype" them.

Posted by Jason Hunter at 02:06 AM
July 21, 2003

A friend just set up a new site. As he said, " I know this is cool - because I will use this. Everyone I describe it to says they want to use it to. It just makes sense." Don't miss the FAQ.

Posted by Jason Hunter at 04:12 PM