OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XQuery and DTD/Schema?

[ Lists Home | Date Index | Thread Index ]

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS