[seek-dev] XQuery and XQueryX

Dan Higgins higgins at nceas.ucsb.edu
Thu May 15 18:39:31 PDT 2003


Hi All,

An interesting introduction to XQuery is on IBMs DeveloperWorks site at

http://www-106.ibm.com/developerworks/xml/library/x-xquery.html

One item that I remembered being discussed in San Diego is whether an 
XQuery is just an expression. Apparently an alternate XML syntax  called 
'XQueryX' exists for machine parsing. See the example below from the 
refernced article

*Listing 1. A simple query in standard syntax*

|
   let $authors := /book/author
   return 
      <AUTHORS>
      {
         $authors
      }
      </AUTHORS>
|

and Listing 2 shows the equivalent in XQueryX:

*Listing 2. The same query in XQueryX format*

|
   <q:query xmlns:q="http://www.w3.org/2001/06/xqueryx">
      <q:flwr>
         <q:letAssignment variable="$authors">
            <q:step axis="CHILD">
               <q:identifier/>
	       <q:step axis="CHILD">
                  <q:identifier>book</q:identifier>
                  <q:identifier>author</q:identifier>
               </q:step>        
            </q:step>          
         </q:letAssignment>
         <q:return>
            <q:elementConstructor>
               <q:tagName>
                  <q:identifier>AUTHORS</q:identifier>
               </q:tagName>
               <q:variable>$authors</q:variable>
            </q:elementConstructor>
         </q:return>
      </q:flwr>
   </q:query>
|

Verbosity won't matter much to the machine that's processing this 
(unless we're talking /really/ big queries), but it would be a bit of a 
struggle for a human operator doing some actual debugging.

-- 
*******************************************************************
Dan Higgins                                  higgins at nceas.ucsb.edu
http://www.nceas.ucsb.edu/    Ph: 805-892-2531
National Center for Ecological Analysis and Synthesis (NCEAS) 
735 State Street - Room 205
Santa Barbara, CA 93195
*******************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/seek-dev/attachments/20030515/6fca47bb/attachment.htm


More information about the Seek-dev mailing list