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 ]

You miss my point which is understandable since most people don't have
to deal with the aggravations of XML Query on a daily basis. Here's an
example of where type inferencing breaks down. Given the following

<xs:schema  targetNamespace="urn:xmlns:example-com" 
 <xs:element name="root">
    <xs:element name="child" maxOccurs="3" />

And the following XQuery expression 

  schema "urn:xmlns:example-com" at "http://www.example.com/schema.xsd"; 
  namespace ex = "urn:xmlns:example-com"

  define function get_children(element of type ex:root $r) 
     returns element of type ex:child{



How do you statically infer the type passed to the get_children()
function call? The correct answer is that you can't. So what is the best
workaround? Push it to a dynamic evaluation like so 


This example is relatively simple and could be made hairier by adding
substitution groups or derived types.

Lynch's Law: When the going gets tough, everyone leaves.

This posting is provided "AS IS" with no warranties, and confers no

> -----Original Message-----
> From: Rick Jelliffe [mailto:ricko@allette.com.au] 
> Sent: Wednesday, July 03, 2002 12:38 PM
> To: xml-dev@lists.xml.org
> Subject: Re: [xml-dev] XQuery and DTD/Schema?
> From: "Dare Obasanjo" <dareo@microsoft.com>
> > Type inference can be ridiculously expensive and in some cases 
> > undecidable for complex types. Named typing and enforcing explicit 
> > casts by users via operations such as validate() are the 
> best option 
> > in creating something reasonably implementable and 
> understandable. Of 
> > course, these things are only issues because XQuery is 
> supposed to be 
> > "statically typed"
> Is inferencing always that difficult? 
> If we assume DTDs, then we have both a kind of Unique 
> Particle Attribute rule and no local elements or equivalents. 
> If the DTDs were 
> namespace aware and allowed declarations of the WXS builtin 
> datatypes, it seems pretty trivial to annotate a query with 
> the correct casts. 
> If we have local elements, then the path in a query would 
> have to also be augmented with enough of a path to ensure 
> locality, and other definitions of the same element name 
> would have to be similarly augmented so they exclude the 
> local element.
> Presumably XQuery expects the Unique Particle Attribute rule, 
> then presumably it just means that the intersection of 
> ambiguous elements in RELAX would have to be used. 
> Cheers
> Rick Jelliffe
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>


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

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