Database Application Design Winter 2004 Dragomir R. Radev © 2002 by Prentice Hall
XQuery © 2002 by Prentice Hall
Background Successor to XML-QL, YAML, Lorel, Quilt Supported by the W3C Draft only © 2002 by Prentice Hall
DTD <!ELEMENT bib (book* )> <!ELEMENT book (title, (author+ | editor+ ), publisher, price )> <!ATTLIST book year CDATA #REQUIRED > <!ELEMENT author (last, first )> <!ELEMENT editor (last, first, affiliation )> <!ELEMENT title (#PCDATA )> <!ELEMENT last (#PCDATA )> <!ELEMENT first (#PCDATA )> <!ELEMENT affiliation (#PCDATA )> <!ELEMENT publisher (#PCDATA )> <!ELEMENT price (#PCDATA )> © 2002 by Prentice Hall
Sample database © 2002 by Prentice Hall <bib> <book year="1994"> <title>TCP/IP Illustrated</title> <author> <last>Stevens</last> <first>W.</first> </author> <publisher>Addison-Wesley</publisher> <price> 65.95</price> </book> <book year="1992"> <title>Advanced Programming in the Unix environment</title> <price>65.95</price> <book year="2000"> <title>Data on the Web</title> <last>Abiteboul</last> <first>Serge</first></author> <last>Buneman</last> <first>Peter</first> <last>Suciu</last> <first>Dan</first> <publisher>Morgan Kaufmann Publishers</publisher> <price>39.95</price> </bib> © 2002 by Prentice Hall
Sample query <bib> { for $b in document("http://www.bn.com/bib.xml")/bib/book where $b/publisher = "Addison-Wesley“ and $b/@year > 1991 return <book year="{ $b/@year }"> { $b/title } </book> } </bib> © 2002 by Prentice Hall
Expected result <bib> <book year="1994"> <title>TCP/IP Illustrated</title> </book> <book year="1992"> <title>Advanced Programming in the Unix environment</title> </bib> © 2002 by Prentice Hall
Pointers and Demos http://www.w3.org/TR/xquery/ http://www.w3.org/TR/xmlquery-use-cases/ http://xml.org/ http://131.107.228.20/Default.aspx?case=XMP&example=Q1#Query http://www.db.ucsd.edu/people/yannis/XQueryTutorial.htm http://www.ex.ac.uk/~pellison/xml/multiple.htm http://seacow.eecs.umich.edu:8080/timberweb/ © 2002 by Prentice Hall