XML2 - Suciua/Ramakrishnan Gehrke/Borgida 1 Querying XML...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Suciua/Ramakrishnan/ Gehrke/Borgida 1 Querying XML Documents based on notes by D.Suciu/UofW Suciua/Ramakrishnan/ Gehrke/Borgida 2 XPath • http://www.w3.org/xpath • Building block for other W3C standards: – XSL Transformations (XSLT) – XML Query • Was originally part of XSL Suciua/Ramakrishnan/ Gehrke/Borgida 3 Example doc for XPath Queries < bib > < book > < publisher > Addison-Wesley </ publisher > < author > Serge Abiteboul </ author > < author > < frst-name > Rick </ frst-name > < last-name > Hull </ last-name > </ author > < author > Victor Vianu </ author > < title > Foundations o¡ Databases </ title > < year > 1995 </ year > </ book > < book price =“55”> < publisher > Freeman </ publisher > < author > Je¡¡rey D. Ullman </ author > < title > Principles o¡ Database and Knowledge Base Systems </ title > < year > 1998 </ year > </ book > </ bib > Suciua/Ramakrishnan/ Gehrke/Borgida 4 < bib > < book price =“55 > < publisher > Addison-Wesley </ publisher > < author > Serge Abiteboul </ author > < author > < frst-name > Rick </ frst-name > < last-name > Hull </ last-name > </ author > < author > Victor Vianu </ author > < title > Foundations o¡ Databases </ title > < year > 1995 </ year > </ book > bib A-W book book publisher author publisher author frst name last name Rick Hull Freeman Je¡¡U price 55 author < book > < publisher > Freeman </ publisher > < author > Je¡¡rey D. Ullman </ author > < title > Principles o¡ Knowledge Bases </ title > < year > 1998 </ year > </ book > </ bib > VictorV author SergeA title Fnds o¡ DB year 1995 title Pples o¡ KB year 1998 root Suciua/Ramakrishnan/ Gehrke/Borgida 5 XPath: Simple Expressions Result: < year > 1995 </ year > < year > 1998 </ year > Result: empty (there were no papers) /bib/book/year /bib/paper/year Suciua/Ramakrishnan/ Gehrke/Borgida 6 XPath: Restricted Kleene Closure Result: < author > Serge Abiteboul </ author > < author > < frst-name > Rick </ frst-name > < last-name > Hull </ last-name > </ author > < author > Victor Vianu </ author > < author > JeFFrey D. Ullman </ author > Result: < frst-name > Rick </ frst-name > //author /bib//frst-name Suciua/Ramakrishnan/ Gehrke/Borgida 7 Xpath: Wildcard Result: < frst-name > Rick </ frst-name > < last-name > Hull </ last-name > * Matches any element /*/*/author/ //author/* “authors at 3rd level” Suciua/Ramakrishnan/ Gehrke/Borgida 8 Xpath: Local Info About Nodes Result: “ Serge Abiteboul” “Victor Vianu” “Jeffrey D. Ullman” Rick Hull doesn’t appear because he has frstname , lastname Functions in XPath: – text () = matches a text value – name () = returns the name of the current tag /bib/book/author/ text() /bib/book/* /name ()! ~~> “ author” Suciua/Ramakrishnan/ Gehrke/Borgida 9 Xpath: Attribute Nodes Result: “55” @price means that there is a price attribute with a value present /bib/book/ @ price Suciua/Ramakrishnan/ Gehrke/Borgida 10 Xpath: Qualifers [ frstname ] means ‘ has frstname element...
View Full Document

Page1 / 53

XML2 - Suciua/Ramakrishnan Gehrke/Borgida 1 Querying XML...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online