xquery how to handle databases with the xml standard?

11
XQuery How to handle databases with the XML standard? Peter van Keeken Industrial trainee, Evitech 4 th period 2002

Upload: blake-greer

Post on 30-Dec-2015

21 views

Category:

Documents


1 download

DESCRIPTION

XQuery How to handle databases with the XML standard?. Peter van Keeken Industrial trainee, Evitech 4 th period 2002. What is XQuery?. XQuery is a data query language for XML designed by W3C. XQuery is designed to be broadly applicable across all types of XML data sources - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: XQuery How to handle databases with  the XML standard?

XQuery

How to handle databases with the XML standard?

Peter van Keeken

Industrial trainee, Evitech

4th period 2002

Page 2: XQuery How to handle databases with  the XML standard?

What is XQuery?

XQuery is a data query language for

XML designed by W3C.

XQuery is designed to be broadly applicable across all types of XML data sources

(eg. Databases).

Page 3: XQuery How to handle databases with  the XML standard?

XQuery history

XQuery is derived from Quilt• an XML query language • which borrowed features from languages like:

– XPath 1.0 – XQL (XML Query Language)– XML-QL (a query language for XML)– SQL (Structured Query Language)– OQL (ODMG, Object Database Standard)

Page 4: XQuery How to handle databases with  the XML standard?

XQuery specifications:

• Able to query databases and data from (XML) documents

• XQuery is a data model describing how a XQuery processor should process an XML document or datasource that is available to an XQuery processor.

• XQuery is also based on:1. XML Schema2. XPath (version 2.0)

• a human-readable syntax and an XML-based syntax is required

Page 5: XQuery How to handle databases with  the XML standard?

More practical decription:

• Allows joins between XML documents• Allows sorting and grouping• Language is SQL like but works on

trees rather then relational tables

Page 6: XQuery How to handle databases with  the XML standard?

An simple example:

• You have for instance the next list of recipes in an XML Document: recipes.xml

• Example XQuery:FOR $t IN document (“recipes.xml”) // title

RETURN $t

• The result:The query will return all the titles

of the recipes in the file.

Page 7: XQuery How to handle databases with  the XML standard?

Another example:• A more complex query based on the same resource:

recipes.xml

• Example XQuery:FOR $i IN distinct(document("recipes.xml") //ingredient/@name)

RETURN <ingredient name={$i}>

{ FOR $r IN document("recipes.xml")//recipe

WHERE $r//ingredient[@name=$i] RETURN $r/title

}

</ingredient>

• The result:The query will return for each ingredient,

the recipes that it is used in.

Page 8: XQuery How to handle databases with  the XML standard?

The Good about XQuery

• Can store document or data style XML• Tremendous flexibility• Complement RDBMS with XML mapping

solutions• Performance can be very good

Page 9: XQuery How to handle databases with  the XML standard?

The Bad about XQuery

• Standard is still in development• Techniques are unfamiliar to people• Not good at transaction processing• Some expected database practices are still

unsupported• Interoperability between products is minimal

Page 10: XQuery How to handle databases with  the XML standard?

Resources:

WWW:• www.w3.org/TR/xquery/• people.cs.uct.ac.za/~agelderb/hons/coursXMLAarhus.pdf

Book (for XML Schemas):D. Hunter, Beginning XML, 2nd Edition, Wrox P2P serie

Page 11: XQuery How to handle databases with  the XML standard?

THE END

Questions?