Presentation is loading. Please wait.

Presentation is loading. Please wait.

4/15/2002Bo Du 1 - Bo Du, April 15, 2002. XML - QL A Query Language for XML.

Similar presentations


Presentation on theme: "4/15/2002Bo Du 1 - Bo Du, April 15, 2002. XML - QL A Query Language for XML."— Presentation transcript:

1 4/15/2002Bo Du 1 - Bo Du, April 15, 2002

2 XML - QL A Query Language for XML

3 4/15/2002Bo Du 3 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

4 4/15/2002Bo Du 4 Why do we need a query language XML standard doesn't address: Extraction : How will data be extracted from large XML documents? Transformation : How will XML data be exchanged between user communities using different but related DTDs? Integration : How will XML data from multiple XML sources be integrated? Conversion of data between relational or OO to XML

5 4/15/2002Bo Du 5 Useful References http://www.w3.org/XML/Query http://www.w3.org/TR/NOTE-xml-ql/ http://www.ibiblio.org/xql/ http://groups.yahoo.com/group/xml-dev/ ……

6 4/15/2002Bo Du 6 Is this X?L a standard? NO! It is a submission to the World Wide Web Consortium. It is intended for review and comment by W3C members and is subject to change!!!

7 4/15/2002Bo Du 7 What does XML-QL do exactly?  Extraction - of data pieces from XML documents  Transformation - Map XML data between different DTDs  Integration/Combination of XML data from different sources

8 4/15/2002Bo Du 8 How will data be extracted from large XML documents?

9 4/15/2002Bo Du 9 Data Transformation

10 4/15/2002Bo Du 10 Data Integration

11 4/15/2002Bo Du 11 Requirements for the XML Query Language Selection and extraction Preserve structure Reduction Restructuring Join (more detail in next section)

12 4/15/2002Bo Du 12 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

13 4/15/2002Bo Du 13 Bib.xml An Introduction to Database Systems Date Addison-Wesley Foundation for Object/Relational Databases: The Third Manifesto Date Darwen Addison-Wesley

14 4/15/2002Bo Du 14 Bib.dtd

15 4/15/2002Bo Du 15 Basic Examples: Selection/Extraction Find all the names of the authors whose publisher is Addison-Wesley: WHERE Addison-Wesley $t $a IN "www.a.b.c/bib.xml" CONSTRUCT $a

16 4/15/2002Bo Du 16 Basic Examples(contd.) The use of instead of : WHERE Addison-Wesley $t $a IN "www.a.b.c/bib.xml" CONSTRUCT $a

17 4/15/2002Bo Du 17 Results of our first query The output is in XML form: Date Darwen Date

18 4/15/2002Bo Du 18 Use the current XML to construct a new XML structure An Introduction to DB Systems Date Addison-Wesley Foundations for OR Databases Date Darwen Addison-Wesley

19 4/15/2002Bo Du 19 Construct new XML data (Query) WHERE Addison-Wesley $t $a IN "www.a.b.c/bib.xml" CONSTRUCT $a $t

20 4/15/2002Bo Du 20 Construct new XML data (Result) Date An Introduction to DB Systems Date Foundation for OR Databases Darwen Foundation for OR Databases

21 4/15/2002Bo Du 21 Grouping with Nested Queries: Preserve structure WHERE $p IN "www.a.b.c/bib.xml”, Addison-Wesley IN $p, $t IN $p CONSTRUCT $t WHERE $a IN $p CONSTRUCT $a

22 4/15/2002Bo Du 22 Reduction of previous slide Where Addition-wesley $t Element_As $x  $a Element_As $y  IN www.a.b.c/bib/xmlwww.a.b.c/bib/xml Construct $x $y

23 4/15/2002Bo Du 23 Another way: WHERE Addison-Wesley $t CONTENT_AS $p IN "www.a.b.c/bib.xml” CONSTRUCT $t WHERE $a IN $p CONSTRUCT $a

24 4/15/2002Bo Du 24 Result An Introduction to Database Systems Date Foundation for Object/Relational Databases: The Third Manifesto Date Darwen

25 4/15/2002Bo Du 25 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

26 4/15/2002Bo Du 26 XML Data model XML Graph Syntax for Data Mapping of XML graphs into XML documents Element identities an ID references …… (talked in previous presentations)

27 4/15/2002Bo Du 27 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

28 4/15/2002Bo Du 28 Advanced examples in XML-QL Tag Variables Regular - path Expressions Transforming XML data Integrating from multiple XML sources Functions definitions and DTDs External functions Ordered model - Sorting, Indexing

29 4/15/2002Bo Du 29 Tag variables WHERE -- $p can be {article, book} $t 1995 Date IN "bib.xml", $e IN {author, editor} CONSTRUCT $t Date All publications published in 1995 in which Date is either an author, or an editor

30 4/15/2002Bo Du 30 Query result Date An Introduction to Database Systems Date The New Jersey Machine-Code Toolkit

31 4/15/2002Bo Du 31 payroll.xml 100-00-0001 J. Doe 35000 100-00-0002 M. Smith 73000 100-00-0003 R. Johnson 1400000 100-00-0004 P. Kent 33000

32 4/15/2002Bo Du 32 taxpayers.xml 100-00-0001 35000 7000 100-00-0002 55000 3000 100-00-0003 1430000 25000 100-00-0005 120000 30000

33 4/15/2002Bo Du 33 Integrating data from multiple XML sources WHERE ELEMENT_AS $n $ssn IN ”payroll.xml", -- take a look at payroll.XML $ssn ELEMENT_AS $i IN "taxpayers.xml” -- take a look at taxpayer.xml CONSTRUCT $n $i

34 4/15/2002Bo Du 34 Integration result 35000 J. Doe 55000 M.Smith 1430000 R. Johnson

35 4/15/2002Bo Du 35 Functions definitions and DTDs function query() { CONSTRUCT findDeclaredIncomes("taxpayers.xml","payroll.xml") } function findDeclaredIncome($Taxpayers,$Employees) { WHERE $s $x IN $Taxpayer, $s $n IN $Employees CONSTRUCT $n $x }

36 4/15/2002Bo Du 36 Functions definitions and DTDs (cont) Restrictions by DTD’s: function findDeclaredIncome ( $Taxpayers:”www.irs.gov/tp.dtd”, $Employees:”www.employees.org/employeess. dtd” :“www.my.site.com/myresult.dtd” ) { WHERE …. CONSTRUCT …. }

37 4/15/2002Bo Du 37 Embedding queries in data WHERE $t $y IN “www.a.b.c/bib.xml”, $y > 1995 CONSTRUCT $t WHERE $t $y IN “www.a.b.c/bib.xml”, $y >1995 CONSTRUCT $t

38 4/15/2002Bo Du 38 Indexes for element: XML support element-order variables. Example: … here $i and $j are bind to an integer 0, 1, 2 … that represent the index in the local order of the edges.

39 4/15/2002Bo Du 39 Indexes for element (graph) (year=“1995”) book [0] book[1] title[0] author[2] publisher[1] title[0] author[3] author[2] name[0] An introduction … Addison- Wesley Foundations for... name[0] lastname[0] Date Datwen lastname[0] publisher[1] (year=“1998”) ( 1 ) ( 13 ) ( 12 ) ( 11 ) ( 10 ) ( 9 ) ( 8 ) ( 7 ) ( 5 ) ( 6 ) ( 4)( 3 ) ( 2 ) ( 15 ) ( 14 ) root

40 4/15/2002Bo Du 40 Indexes for element: (cont.) Example : retrieves all the persons whose lastname precedes the firstname : WHERE $p IN “www.a.b.c/people.xml” $x IN $p, $y IN $p, $j < $k CONSTRUCT $p

41 4/15/2002Bo Du 41 ORDER-BY: (cont.) Reverse the order of all authors in a publication: WHERE $p IN “www.a.b.c/people.xml”, CONSTRUCT WHERE $a IN $p ORDER-BY $k DESCENDING CONSTRUCT $a WHERE $v IN $p $e != “author” CONSTRUCT $v

42 4/15/2002Bo Du 42 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

43 4/15/2002Bo Du 43 Extensions and open issues: Entities User-defined predicates String regular expressions Name spaces Aggregates XML syntax Extensions to other XML-related standard

44 4/15/2002Bo Du 44 OUTLINE  Introduction * Examples in XML-QL * A Data Model for XML * Advanced Examples in XML-QL * Extensions and Open Issues  Summary

45 4/15/2002Bo Du 45 Summary/Conclusions XML-QL is a declarative language which provides support for querying, constructing, transforming, and integrating XML data XML-QL supports both ordered and unordered view on XML document XML-QL is based on similar database research suggested model of Semi-structured data XML-QL satisfy the absolute set of requirements from query language cited in XML Query Requirements of W3C Working Draft XML-QL is good candidate to be the new XML standard query language

46 4/15/2002Bo Du 46 End ???…


Download ppt "4/15/2002Bo Du 1 - Bo Du, April 15, 2002. XML - QL A Query Language for XML."

Similar presentations


Ads by Google