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

RE: XQuery and DTD/Schema?

  • To: "Rick Jelliffe" <ricko@a...>,<xml-dev@l...>
  • Subject: RE: XQuery and DTD/Schema?
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Wed, 3 Jul 2002 12:54:09 -0700
  • Thread-index: AcIixzSQBvEfUPgwTAu7qF11kSgD3gAAI7+w
  • Thread-topic: XQuery and DTD/Schema?

unique particle attribute
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
schema 

<xs:schema  targetNamespace="urn:xmlns:example-com" 
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">   
 <xs:element name="root">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="child" maxOccurs="3" />
   </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>

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{

	  $r/child
  }


  get_children(<ex:root>{
	
document("http://www.25hoursaday.com/root.xml")//child
	          }</ex:root>)

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 

 
get_children(validate(<ex:root>{document("http://www.25hoursaday.com/roo
t.xml")//child}</ex:root>))

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

-- 
PITHY WORDS OF WISDOM 
Lynch's Law: When the going gets tough, everyone leaves.

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



> -----Original Message-----
> From: Rick Jelliffe [mailto:ricko@a...] 
> Sent: Wednesday, July 03, 2002 12:38 PM
> To: xml-dev@l...
> Subject: Re:  XQuery and DTD/Schema?
> 
> 
> From: "Dare Obasanjo" <dareo@m...>
> 
> > 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 
<http://www.oasis-open.org>

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>


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.