Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL."— Presentation transcript:

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

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 XSL pattern 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 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. 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.

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 :Result return all elements from the current search context.

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

11 Basics of XQL The root of a document may be indicated by a leading "/" operator. XQL query : /store/book/front/author Result :Result Starting the navigation from the root: returns elements that are children of 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 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 :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 :Result This query will find any address in the document

15 Basics of XQL The filter operator ("[ ]") filters the set of nodes to its left, based on the conditions inside the brackets. XQL query : book/front/author/address[@type='email'] Result :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 :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


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

Similar presentations


Ads by Google