XML Query Algebra Demo 




         "As increasing amounts of information are stored, exchanged, and presented using XML, the ability to intelligently query XML data sources becomes increasingly important. One of the great strengths of XML is its flexibility in representing many different kinds of information from diverse sources. To exploit this flexibility, an XML query language must provide features for retrieving and interpreting information from these diverse sources." ( from http://www.w3.org).

        XML Query Algebra is used to define the formal semantics of XML query language.  Our demo site provides several  default XML data sources and some queries .You can  run the sample queries and verify the query results.  You can modify any sample queries or compose your own queries, you can also query against your own data sources by supplying them in the demo's query data window.

         How it works  first, the XML Algebra query is translated into an XCQL Algebra plan;  then the XCQL plan is executed;  the query result is returned as a XML document.  The query syntax follows XML Query Algebra syntax described in http://www.w3.org/TR/query-algebra/.   To guarantee that any query produces an XML document with a top-level element,   a Root element is placed on top of any query result.   The query result is returned as a frame. The left side pane contains the produced XCQL(XMAS)  algebra plan, and the right side contains the resulting XML document.  For best view, use a browser that supports XML format like IE5.0.

        Data Sources  There are two sources that are used for all sample queries: books and  reviews .  If you want to query against your own data sources, simply copy your sources into the " XML Data Window", and give them unique names separated by @@@@. There is a sample on how to query against your own data sources in the sample query list.  You can use the two default data sources and your own sources defined in the "XML Data Window" together as long as there are no name conflicts. (If you define a source name  more than once, the last definition will win. Also, your definitions of data sources have higher  priority than the two default sources, that is, if you define books and reviews in the   "XML Data Window", your sources will be used in the query execution, not the default ones. ) 

        Some detail issues   You may use "//"  in the query to make comments. This may save you some time to create a new query from an old one by just commenting some part of the old query.  Please notice /* */  is  not allowed to make comments because  * can be used as wildcats in a query like books/*/*/data().   One issue about the usage of parenthesis in concatenation of multiple expressions.  "for a in E1 do e2,e3,e4"     really means   " for a in E1 do (e2,e3,e4)", so don't be surprised if   "for a in E1 do E2,  for b in E3 do E4"  don't give you the result as  "(for a in E1 do E2),( for b in E3 do E4)".  The first expression really means "for a in E1 do (E2,   for b in E3 do E4)".   To achieve the latter result, you can  write "for a in E1 do (E2),  for b in E3 do E4", then the parser  knows E2 is the only body of the first "for" expression.


Wonder why you don't get the query results you are expecting ?


Try the Demo!   Have fun!

back to Yu Xu's homepage.