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] Fwd: War of Attrition (was: [xml-dev] Underwhelmed (WAS:

[ Lists Home | Date Index | Thread Index ]

At 12:39 PM 9/25/2002 -0500, Bullard, Claude L (Len) wrote:

>I'm curious, Jonathan, because this corresponds to the integration
>thread I was posting to.  What are the cost benefits of X-Query
>over say, SQL?  Is this simply to be able to program to a document
>model API (ie, Infoset-based?)

One of the benefits of XQuery is that it takes XML as input and creates XML 
as output, without requiring the user to work in several different 
languages with several different type systems. Most data is exchanged as 
XML, but stored as relational data, and the tools used to transform between 
the two representations may involve Java, XSLT, SQL, the DOM...and that 
means they are also dealing with distinct type systems.

Another advantage of XQuery is that it is particularly good for views of 
data. An example of this is a query that joins an XML document to an 
SQL/XML view of a relational database. Consider the SOAP primer. For the 
first example, I need to be able to join departurer cities to airports. You 
can do that with an XQuery like this:

let $src := "jdbc:datadirect:sqlserver://localhost:1433;database='airports'"
for $city in input()//p:departing
     let $airports := xq:collection($src)/AIRPORTS/row[CITY = $city]
        if (count($airports) = 0) then <error> No airports found for 
        else if (count($airports) = 1) then <airport>{ 
string-value($airports/CITY) }</airport>
        else if (count($airports) > 1) then
                      for $c in $airports/AIRPORT
                      return (string-value( $c ), " ")
        else ()

The user need not be concerned with the details of how the database is 
represented as XML or the input document is parsed and bound.

This approach is high-level, declarative, and requires very little code.



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

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