[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XQuery and DTD/Schema?


xquery schema
Michael Kay wrote:
> The input to an XQuery query consists of (at compile time) a set of type
> definitions and (at run time) a set of documents/trees with type
> annotations. The set of type definitions can be empty, and the type
> annotations can be defaulted, so queries can therefore be written
> against documents that have not been subjected to schema processing.

Correct.

> As far as the XQuery spec is concerned, although the type system is
> chosen to be compatible with XML Schema, there is no requirement for the
> type definitions and type annotations actually to be produced by XML
> Schema processing (just as XSLT can process a source tree that wasn't
> created by parsing source XML).

Correct, although the XQuery community is a little schizophrenic on 
this.  Up front in the XQuery spec they point out that the type 
information might come out of a relational database or ... well, 
anywhere ... but at later points in the documentation, and in the 
conversation of many of the query people, there lurks this bizarre 
belief that type knowledge can only exist in the aftermath of an XML 
schema validation pass.

I've invested some time in understanding the relationship between XSD 
and XQuery.  My understanding is like this:

- XQuery really needs some atomic-type semantics, so that you can do
   range queries on numbers and dates
- XQuery is semantically wired into the XSD basic type system, with
   the exception that the Duration type is underspecified so they use
   a custom restriction of it
- XQuery supports queries on type names (qnames) which however don't
   seem to carry any builtin knowledge of the associated semantics.
- XQuery has some casting and validation operators which assume that
   you'll apply schema machinery at runtime to figure out whether
   (a) your query can possibly work or (b) the constructed result is
   kosher.

At the moment this latter assumes that the schema validation is done by 
XSD because as far as I can tell nobody ever asked for the ability to 
use a different validation facility.  I see no architectural reason why 
you couldn't add an argument or environment variable or something saying 
  "here's the identifier of the schema language I'm using".

It's going to be tough to tear XQuery away from XML Schema's base data 
types, and probably not worth doing; they ain't perfect but the code to 
deal with them is written and out there, so why fight it.  Note that XSD 
base types are effectively built-in to RELAX software too these days.

Beyond that, I see no architectural difficulty in making XQuery 
schema-language agnostic.  -Tim


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.