Download presentation
Presentation is loading. Please wait.
Published byStewart Bruce Modified over 9 years ago
1
XQuery Leah Andrews
2
Overview Queries data stored in XML trees Declarative High-level Functional (no side effects) Strongly typed Nodes Atomic values (integers, strings, booleans)
3
Origins Became a W3 standard in January, 2007 Developed by Jonathan Robie, Don Chamberlin and Daniela Florescu Compatible with other W3 standards XML (namespaces, Schema), XSLT, XPath
4
XQuery v. XSLT Overlapping capabilities Share a data model, type system, function library and XPath
5
XQuery > XSLT Better usability More concise Other languages can be embedded More Orthogonal Can be expressed in XML syntax (XQueryX)
6
XSLT > XQuery Better for small-scale changes to XML documents Widespread use More flexible for transformations
7
XQuery does NOT support: Full text search capacity Updating XML documents or databases Dynamic typing Polymorphism
8
FLWOR FOR LET WHERE ORDER BY RETURN
9
1 MacBook olive 2 WinBook orange 3 Toshiba orange 4 Gateway green 5 Asus rainbow 6 ZT black 7 IMB unknown 8 MacBook German
10
xquery version "1.0"; All students { for $x in doc("students.xml")/class/students order by $x/studentId return { $x } }
11
xquery version "1.0"; Students with an id less than 5 { for $x in doc("students.xml")/class/students where $x/studentId<5 order by $x/studentId return {data($x/@name)} }
12
xquery version "1.0"; Favorite (student) colors { for $x in doc("students.xml")/class/students/favoritecolor return {data($x)} }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.