1 / 16

XML Algebra

XML Algebra. By Sailaja P. KReSIT IIT Bombay. Algebra and the World of DB. Why Algebra Gives semantics for a query language For efficient query processing Few algebrae Relational Algebra: For relational data Nested Relational Algebra: For nested relational model

josh
Télécharger la présentation

XML Algebra

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. XML Algebra By Sailaja P. KReSIT IIT Bombay

  2. Algebra and the World of DB • Why Algebra • Gives semantics for a query language • For efficient query processing • Few algebrae • Relational Algebra: For relational data • Nested Relational Algebra: For nested relational model • Schema Algebra: For MultiDB interoperability Sailaja P., KReSIT XML Workshop, IITBombay

  3. Why Algebra for XML • Structure of data • Deeply structured • Exact structure not specific • Recursion • Structurally recursive Sailaja P., KReSIT XML Workshop, IITBombay

  4. XML Algebra • Sample Data <bib> <book> <title>Data on the Web</title> <year>1999</year> <author>Abiteboul</author> <author>Buneman</author> </book> <book> <title> XML Query</title> <year>2000</year> <author>Mary</author> </book> </bib> Sailaja P., KReSIT XML Workshop, IITBombay

  5. XML Algebra type Bib = bib [ Book{0,*}] type Book = book [ title [String ], year [Integer], author[ String]{1,*} ] let bib0: Bib = bib [ book [ title [“Data on the Web”], year [1999], author[“Abiteboul”], author[“Buneman”] ] book[ title[“XML Query”],year[2000], author[“Mary”] ] ] Sailaja P., KReSIT XML Workshop, IITBombay

  6. Projection Eg:project book( children (bib0) ) • Allows a more convenient notation as well (similar to Xpath notation) • Eg. bib0/book/author ==> author [“Abiteboul”] author [“Buneman”] author [“Mary”] :author [ String ] {0,*} Sailaja P., KReSIT XML Workshop, IITBombay

  7. Projection Provides for an iterator • bib0/book/author • Equivalent : for b  project book(children(bib0)) inproject author(children(b)) Sailaja P., KReSIT XML Workshop, IITBombay

  8. Selection Eg: for b  bib0/book in where value(b/year) <= 2000 then b ==> book [ title [ “Data on the web”], year [“1999”], author[“Abiteboul”], author[“Buneman”] ] : Book{0,*} Sailaja P., KReSIT XML Workshop, IITBombay

  9. Join type Reviews = reviews [ book [ title [String], review [ String] ]{0,*} ] let review0: Reviews = reviews[ book [ title[“XMLQuery”], review[“A fine book”] ], book [ title[“Data on Web”], review[“This is great”] ] ] Sailaja P., KReSIT XML Workshop, IITBombay

  10. Join • Expression for b  bib0/book in for r  review0/book in where value(b/title) = value(r/title) then book [ b/title, b/author, r/review] ==> book [ title [“Data on the web”], author[“Abiteboul”], author[“Buneman”] review[“A fine book”] ], Sailaja P., KReSIT XML Workshop, IITBombay

  11. Join book[ title[“XML Query”], author[“Mary”], review[“This is great”] ] : book[ title[String ], author[String]{1,*}, review[String] ]{0,*} Sailaja P., KReSIT XML Workshop, IITBombay

  12. Querying Order • Index function pairs an integer index with each element in a forest • Eg: index(book0/author) ==> pair[fst[1],snd[author[“Abiteboul”]]], pair[fst[2],snd [author[“Buneman”]]], pair[fst[3],snd [author[“Suciu”]]] :pair[fst[Integer],snd[author[String]]]{1,*} Sailaja P., KReSIT XML Workshop, IITBombay

  13. Aggregation • Has five built-in aggregation functions: avg,count, max, min and sum • Eg: for b  bib0/book in where count(b/author) >= 2 then b/title ==> title[“Data on the web”] : title{0,*} Sailaja P., KReSIT XML Workshop, IITBombay

  14. Additional Features • Structural Recursion • To define documents with recursive structure, recursive types are used • Sorting • sort(pairs) • Grouping • Group(pairs) Sailaja P., KReSIT XML Workshop, IITBombay

  15. Conclusions • Important contributions • Operators are orthogonal, strongly typed • Operators do obey laws of equivalence and optimization • Issues to be resolved • Querying over global order is not defined • Equality and relational operators on element and scalar types are not defined. Sailaja P., KReSIT XML Workshop, IITBombay

  16. Resources • http://www.cs.bell-labs.com/~wadler/topics/xml.html#algebra • For an implementation of the algebra: http://www-db.research.bell-labs.com/user/simeon/xa.html • http://www.w3.org/TR/query-datamodel • This presentation will be put up: • http://www.it.iitb.ernet.in/~sailu/Algebra.html Sailaja P., KReSIT XML Workshop, IITBombay

More Related