1 / 19

[ Part III of The XML seminar ]

A Introduction of XQL. [ Part III of The XML seminar ]. Presenter: Xiaogeng Zhao. I. What is XQL?. XML Query Language ( XQL ) It is a notation for addressing and filtering the elements and text of XML documents. XQL is a natural extension to the XSL pattern syntax . It

Download Presentation

[ Part III of The XML seminar ]

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Introduction of XQL [ Part III of The XML seminar ] Presenter: Xiaogeng Zhao

  2. I. What is XQL? XML Query Language ( XQL ) It is a notation for addressing and filtering the elements and text of XML documents. XQL is a natural extension to the XSLpattern syntax. It provides a concise, understandable notation for pointing to specific elements and for searching for nodes with particular characteristics.

  3. II. XQL Features • XQL is a query language designed specifically for XML. • In XQL it is possible to combine information from heterogeneous data sources in powerful ways. • XQL specification does not indicate the output format.

  4. III. The XML Data Model • A document is an ordered, labeled tree, with nodes to represent the: • document entity • elements • attributes • processing instructions • comments

  5. The XML Data Model (Cont.) The Tree Structure ( XQL uses the tree structure for navigation) • Hierarchy • Sequence • Position

  6. III. SQL vs. XQL • XQL • 1) The database is a set of one or more XML documents. • 2) Queries are done in XQL, a query language that uses the structure of XML documents as a basic model. • 3) A query is given a list of input nodes from one or more documents. • 4) The result of a query is a list of XML document nodes, which may serve as the basis for further queries. • SQL 1) The database is a set of tables. 2) Queries are done in SQL, a query language that uses the structure of tables as a basic model. 3) The FROM clause determines the tables which are examined by the query. 4) The result of a query is a table containing a set of rows; this table may serve as the basis for further queries.

  7. IV. Basics of XQL • Context • start context • Context operators ( /, //, [] )

  8. Search Context • XML Document

  9. Basics of XQL • A simple string is interpreted as an element name. • XQL query : book • Result : return all <book> elements from the current search context.

  10. Basics of XQL • The child operator ("/") indicates hierarchy. • XQL query : book/front/author • Result : returns <author> elements that are children of <front> elements

  11. Basics of XQL • The root of a document may be indicated by a leading "/" operator. • XQL query : /store/book/front/author • Result : Starting the navigation from the root: returns <author> elements that are children of <front> elements

  12. Basics of XQL • The content of an element or the value of an attribute may be specified using the equals operator ("="). • XQL query : book/front/author=‘Danny’ • Result : return all authors with the name ”Danny" that are children of the <front> element

  13. Basics of XQL • Attribute names begin with "@".They are treated as children of the elements to which they belong. • XQL query : book/front/author/address/@type • Result : Finding values of the “type” attribute in addresses of authors:

  14. Basics of XQL • The descendant operator ("//") indicates any number of intervening levels. When the descendant operator is found at the start of a path, it means all nodes descended from the document. • XQL query : //address • Result : This query will find any address in the document

  15. Basics of XQL • The filteroperator ("[ ]") filters the set of nodes to its left, based on the conditions inside the brackets. • XQL query : book/front/author/address[@type='email'] • Result : This query returns addresses; each of these addresses must have an attribute called "type" with the value "email"

  16. Basics of XQL • Multiple conditions may be combined using Boolean operators. • XQL query : book/front/author=‘Tom'[@gender='male' and @description =‘good guy'] • Result : • Return the author element with the name of Tom whose gender is male and is a good guy

  17. Advance XQL • Join • Comprehension • Methods…

  18. Other XML Query Languages • XML-QL • Lorel • YATL XQL is A Query Language for ”Documents” while XML-QL Lorel and YATL are more ”Database” oriented

  19. END of PART III

More Related