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

Re: XQuery types was Re: Yet another plea for XUpdat


xquery compare date
At 02:35 PM 5/7/2002 -0700, Joe English wrote:

>Jonathan Robie wrote:
> >
> > As you point out, static typing can definitely improve runtime performance.
> > Consider comparisons. In XQuery, $a = $b can mean a lot of things. If you
> > know both are singleton integers, you can just do an integer compare. If $b
> > is a sequence, you have to do existential quantification. If both are
> > strings, you need a string compare. The static type system can rewrite the
> > query to do the appropriate compare without needing to examine the data.
> > Without it, you have to pick your way through the data and use conditional
> > logic to figure out which comparison to use.
>
>You have been asking for concrete examples where XQuery's
>type system imposes an additional cost on users.  I think
>the above counts as such an example.

Ah, I love concrete examples! Let's see where this leads....

>If there is no efficient way to implement '=' without static
>type analysis, and static type analysis requires a W3C XML Schema
>as an input (which is my interpretation of [XQuery] section 3.1,
>please correct me if I'm wrong), then anybody who uses '=' has
>to pay, either by decreased efficiency or by having to use a W3C
>XML Schema.

Static analysis does not require an XML Schema as input, once our DTD 
mapping (marked as unfinished in the Data Model document) is done. What 
static analysis will tell you for documents that do not use schemas and 
have no datatypes is this: all the compares are typeless, and should be 
treated as string compares. Actually, your static analysis will often tell 
you also whether you will always be comparing two strings or comparing 1 to 
N, N to 1, or N to N, so it can rewrite the query to do the right thing 
without doing superfluous existential quantification when it already knows 
you are always comparing one string to another.

If you *do* have an XML schema, and that schema uses types, then the static 
analysis will also tell you which typed comparisons to make, and whether 
they are well defined for a given comparison.

Jonathan


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.