XQuery John Annechino Steven Pow. Agenda What is XQuery? Uses of XQuery XQuery vs. XSLT Syntax –Built-In Functions –FLWOR –if-then-else –User-Defined.

Slides:



Advertisements
Similar presentations
RDF Tutorial.
Advertisements

1 XML Data Management Course Outline and Organisation Werner Nutt.
XQuery Or, what about REAL databases?. XQuery - its place in the XML team XLink XSLT XQuery XPath XPointer.
XQUERY. What is XQuery? XQuery is the language for querying XML data The best way to explain XQuery is to say that XQuery is to XML what SQL is to database.
1 XQuery Web and Database Management System. 2 XQuery XQuery is to XML what SQL is to database tables XQuery is designed to query XML data What is XQuery?
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
Friday, September 4 th, 2009 The Systems Group at ETH Zurich XML and Databases Exercise Session 6 courtesy of Ghislain Fourny/ETH © Department of Computer.
IS432: Semi-Structured Data Dr. Azeddine Chikh. 7. XQuery.
1 COS 425: Database and Information Management Systems XML and information exchange.
XML and The Relational Data Model
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Overview of XPath Author: Dan McCreary Date: October, 2008 Version: 0.2 with TEI Examples M D.
XMLII XSchema XSchema XQuery XQuery. XML Schema XML Schema is a more sophisticated schema language which addresses the drawbacks of DTDs. Supports XML.
2.2 SQL Server 2005 的 XML 支援功能. Overview XML Enhancements in SQL Server 2005 The xml Data Type Using XQuery.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
1 COS 425: Database and Information Management Systems XML and information exchange continued Last time: XML document structure XML querying with XQuery.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
XML Processing Moves Forward XSLT 2.0 and XQuery 1.0 Michael Kay Prague 2005.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
XML TECHNOLOGY FAMILY XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data[carry data],
XSLT for Data Manipulation By: April Fleming. What We Will Cover The What, Why, When, and How of XSLT What tools you will need to get started A sample.
Comparing XSLT and XQuery Michael Kay XTech 2005.
XML DOCUMENTS & DATABASES. Summary of Introduction to XML HTML vs. XML HTML vs. XML Types of Data Types of Data Basics of XML Basics of XML XML Syntax,
ColdFusion’s XML Capabilities Maryland CFUG April 12, 2005 Presented by Doug Ward.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
1 Querying XML Documents. 2 Objectives How XML generalizes relational databases The XQuery language How XML may be supported in databases.
1 XPath XPath became a W3C Recommendation 16. November 1999 XPath is a language for finding information in an XML document XPath is used to navigate through.
Session II Chapter 2 – Chapter 2 – XSLhttp://
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
1 XML Data Management Course Outline and Organisation Werner Nutt.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation eXist Update Lecturer.
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro.
Introduction to XQuery Bun Yue Professor, CS/CIS UHCL.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Utilizing XML in ColdFusion MX by Attila Domokos.
Unit 04 : XQuery COMP 5323 Web Database Technologies and Applications 2014.
Namespace information are represented as namespace node which maps in scope on an element Attach to every element node where namespace is declared root.
XQuery Leah Andrews. Overview  Queries data stored in XML trees  Declarative  High-level  Functional (no side effects)  Strongly typed  Nodes 
XML query. introduction An XML document can represent almost anything, and users of an XML query language expect it to perform useful queries on whatever.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
CS 157B: Database Management Systems II February 20 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Submitted To: Ms. Poonam Saini, Asst. Prof., NITTTR Submitted By: Rohit Handa ME (Modular) CSE 2011 Batch.
XML Query: xQuery Reference: Xquery By Priscilla Walmsley, Published by O’Reilly.
What is XLink? XLink is short for XML Linking Language XLink is used to create hyperlinks in XML documents Any element in an XML document can behave as.
IS432 Semi-Structured Data Lecture 6: XQuery Dr. Gamal Al-Shorbagy.
Friday, September 4 th, 2009 The Systems Group at ETH Zurich XML and Databases Exercise Session 5 courtesy of Ghislain Fourny/ETH © Department of Computer.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
1 XPath. 2 Agenda XPath Introduction XPath Nodes XPath Syntax XPath Operators XPath Q&A.
XML Schema – XSLT Week 8 Web site:
XQUERY The contents of this slide are obtained from various sources including, Wikipedia, W3School, Stanford website etc. January 2011 Dr.Kwanchai Eurviriyanukul.
XML. What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
XML: Extensible Markup Language
Querying and Transforming XML Data
Session IV Chapter 16 – XQuery
What is XLink? What is XPointer?
{ XML Technologies } BY: DR. M’HAMED MATAOUI
Querying XML XQuery.
Querying XML XQuery.
Querying XML XPath.
Querying XML XPath.
2/18/2019.
Session II Chapter 16 – XQuery
XML DOCUMENTS & DATABASES
Presentation transcript:

XQuery John Annechino Steven Pow

Agenda What is XQuery? Uses of XQuery XQuery vs. XSLT Syntax –Built-In Functions –FLWOR –if-then-else –User-Defined Functions Examples Future of XQuery References

What is XQuery? The best way to explain XQuery is to say that XQuery is to XML what SQL is to database tables. It is the language for querying XML data. XQuery is a language for finding and extracting elements and attributes from XML documents. XQuery is designed to query XML data – not just XML files, but anything that can appear as XML.

Uses of XQuery Extract information to use in a Web Service Query XML documents Read data from databases and generate reports Transform XML data Search Web documents for relevant information

XQuery vs. XSLT XSLT has a “processing engine” that automatically goes through the document tree and applies templates as it finds nodes With XQuery, the the programmer is responsible for directing the process.

Syntax Elements, attributes, and variables must be valid XML names XQuery is built up with XPath expressions XML Schema datatypes are used XQuery variable is defined with a $ followed by a name Comments are delimited by (: and :) (: this is a comment :)

books.xml Learning XML Erik T. Ray Harry Potter J K. Rowling

Built-In Functions doc(‘books.xml’)/bookstore/book[price>30] Learning XML Erik T. Ray XQuery includes over 100 built-in functions

FLWOR For – binds a variable to each item returned by the in expression Let – allows variable assignments Where – used to specify criteria for result Order by – defines the sort-order Return – specifies what is to be returned

FLWOR doc(‘books.xml’)/bookstore/book[price>30]/title Learning XML for $x in doc(‘books.xml’)/store/book where $x/price>30 return $x/title Learning XML

FLWOR { for $x in doc(“books.xml”)/bookstore/book order by $x/title return {data($x/title)} } Harry Potter Learning XML

if-then-else for $x in doc("books.xml")/bookstore/book return if then {data($x/title)} else {data($x/title)} Learning XML Harry Potter

User-Defined Functions declare function prefix:function_name($parameter AS datatype) AS returnDatatype { (:...function code here... :) }; XQuery shares the same datatypes as XML Schema, including Date, String, Numeric, and other Misc types

User-Defined Functions declare function local:minPrice( $price as xs:decimal, $discount as xs:decimal) AS xs:decimal { let $disc := ($price * $discount) div 100 return ($price - $disc) }; { local:minPrice($book/price, $book/discount) }

XQuery Examples

Future of XQuery XQuery is currently a Working Draft XQuery is compatible with several W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema XQuery 1.0 is not yet a W3C Recommendation. Hopefully it will be a recommendation in the near future.

References XQuery: The XML Query Language, by Michael Brundage