Standards Issues

[Editor's note] Below you'll find information on the current status of the W3C recommendation efforts for XQuery and related technologies. Watch this space for future updates.

XQuery 1.0 (and XPath 2.0 and XSLT 2.0)

XQuery is defined by a fairly large assemblage of recommendations developed by the World Wide Web Consortium (W3C). A set of Last Call Working Drafts for most of them was published on November 12, 2003. The XQuery Working Group received over 1,500 comments on these drafts and has been working through the issues noted in those comments, but much work yet remains.

Updated Working Drafts for most of the recommendations, incorporating the comments addressed to date, were published on July 23, 2004.

Many changes have been made in response to the comments received. In addition to various minor syntax changes, some of the highlights are:

Unordered Results
New 'ordered' and 'unordered' operators have been introduced to permit some control of ordering semantics of various expressions to be controlled within a query.
Modules
Module imports now accept multiple locations, representing multiple physical resources in the same module. A "module resource" is a fragment of XQuery code that can independently undergo static analysis, and that has its own context. A module may comprise several module resources. However, an error is raised if a module resource attempts to import a module resource if they happen to be in the same namespace, regardless of whether the module locations are different, or whether conflicts or circularities in fact would arise.
Function Overloading
User-defined functions are now allowed to have the same name as long as they have different numbers of arguments.
Validation
Validation and construction have been separated. Validation now occurs only as a result of an explicit validate expression. Construction may preserve type annotations or strip them. The notion of "validation context" has been deleted.
Namespaces
The specification now clearly distinguishes between "statically-known namespaces" (a static property of an expression) and "in-scope namespaces" (a dynamic property of an element). Computed namespace constructors are now completely static and are allowed only inside a computed element constructor. Namespace declarations must consist entirely of literals.
Fewer Spurious Errors
  • xs:anyURI will automatically convert to xs:string where needed
  • The expression
    element foo {
       fn:doc("bar.xml")
    }
    will put the children of bar.xml as children of the new element, instead of producing an error.
More spurious Errors
  • text {}
    will now produce an error, since it not possible to construct an empty text node.
  • fn:error( "Dang! It failed!" )
    will now produce a static error, as the error function requires an xs:QName as the first argument now, if it has any arguments at all.
Simplified Matching
The schema context path part of element() and attribute() matching has gone.
Things We Would Still Like To See
And if you agree, make your feelings known to public-qt-comments@w3.org
try/catch
So many errors, so little error recovery. As it stands, any error is expected to terminate the whole application.
The n in fn: Stands For Nuisance
Having to put prefixes on every definition of every function, even if you change the default function namespace (in which case you end up having to put the prefix on every use of every built-in function) and the inability to even add your own functions to the default function namespace... it's a big pain in the patoose. No other language manages function namespaces and modules in such a poor way.

The W3C process will require at least another Last Call draft, a Candidate Recommendation Draft, a Proposed Recommendation Draft, and then the Final Recommendation, with Public Comment periods for each of these drafts.

The document that gives an alternative XML syntax for XQuery lags behind the rest: it was last updated December 19, 2003 as a working draft.

The XML Query working group has also been working on full-text extensions to XQuery, to be added after the XQuery 1.0 Recommendation has been finalized. The first Public Working Draft of the proposed full-text additions was published July 9, 2004.

Links

XML Schema

Meanwhile, the XML Schema working group produced its first Public Working Draft of XML Schema 1.1, which will focus on alignment with XML Query, overall simplification and clarity, and versioning hooks. The drafts came out July 16. 2004, along with a new working draft of the Schema Component Designators Specification.

Links