Xml algebra
This presentation is the property of its rightful owner.
Sponsored Links
1 / 16

XML Algebra PowerPoint PPT Presentation


  • 99 Views
  • Uploaded on
  • Presentation posted in: General

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

Download Presentation

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Xml algebra

XML Algebra

By

Sailaja P.

KReSIT

IIT Bombay


Algebra and the world of db

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


Why algebra for xml

Why Algebra for XML

  • Structure of data

    • Deeply structured

    • Exact structure not specific

  • Recursion

    • Structurally recursive

Sailaja P., KReSIT XML Workshop, IITBombay


Xml algebra1

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


Xml algebra2

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


Projection

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


Projection1

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


Selection

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


Xml algebra

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


Xml algebra

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


Xml algebra

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


Querying order

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


Aggregation

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


Additional features

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


Conclusions

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


Resources

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


  • Login