1 / 9

XQuery

XQuery. Student: Paul Curry Class: 90.306 Introduction to XML – Spring 2013 Instructor: Professor Dave Sciuto.

tamera
Download Presentation

XQuery

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XQuery Student: Paul Curry Class: 90.306 Introduction to XML – Spring 2013 Instructor: Professor Dave Sciuto

  2. XQuery Is a programming language that allows the developer to extract data from an Extensible Markup Language(XML) or XML-like file. With this extraction comes the ability to also transform. XQuery has a rich set of features and operations. XQuery is the SQL of XML data. Features: • Logical/Physical Data Independence • Declarative • High Level • Side-effect Free • Strongly Typed WHAT IS XQUERY?

  3. XQuery is a tool that can be used across all XML applications. For example XQuery can be used on MathML, VoiceXML and MusicXML. XML that is stored in a XML enabled database would be able to generate reports using XQuery. Industry usage

  4. XQuery was developed by the World Wide Web Consortium. During this time the XML Query group worked closely with the XSL group. Together these two groups came up with XPath 2.0. XPath is a subset of XQuery. The W3C recommended XQuery on January 23, 2007. • "The mission of the XML Query project is to provide flexible query facilities to extract data from real and virtual documents on the World Wide Web, therefore finally providing the needed interaction between the Web world and the database world. Ultimately, collections of XML files will be accessed like databases“ W3C (2003-10-25). "cited by J.Robie". History of XQuery

  5. Selecting information out of files using specific criteria • Filtering out unwanted information • Extracting information from: • XML or XML-like files • A relational database • One or more XML-Like Files • Sorting and Grouping of data • Performs arithmatic calculations Capablities

  6. Example Books.xml XQuery for $x in doc("books.xml")/bookstore/bookwhere $x/price>30order by $x/titlereturn $x/title <?xml version="1.0" encoding="ISO-8859-1"?><bookstore><book category="COOKING">  <title lang="en">Everyday Italian</title>  <price>30.00</price></book><book category="CHILDREN">  <title lang="en">Harry Potter</title>  <price>39.99</price></book></bookstore> Result   <title lang="en">Harry Potter</title> Explanation The Query will first open up the books.xml file. The query will then loop thru the file searching for all books where the price is greater than 30. When the query finishes the loop thru the file it will then sort the books selected by the tittle. The query will return all tittles where where the book is priced greater that 30. In this case only one book/tittle was found. See the next page for the FLWER methodology.

  7. flwor Flw0r (pronounced flower) is an acronym for: • for: Sets up a looping action thru the product elements returned by the path expression and in this case /bookstore/book • let: This clause binds the $x variable to the value in the book attribute. • where: This clause selects elements where the price is greater than 30. • order by: • return for $x in doc("books.xml")/bookstore/book let $book_tittle := $x/tittlewhere $x/price>30order by $x/titlereturn $x/title These are the 5 clauses that make up an XQuery expression. The only clause that is required is the Return clause.

  8. Future Features The future of XQuery is very bright. • XQuery Updates and Transformations within the next two years. • XQuery 3.o, formerly 1.1, is current candidate for Recommendation by the W3C. • A procedural extensions to XQuery

  9. Bibliography "W3C XML Query (XQuery)." RSS. N.p., n.d. Web. 03 Apr. 2013. http://www.w3.org/XML/Query/ "XQuery Tutorial." XQuery Tutorial. N.p., n.d. Web. 02 Apr. 2013. http://www.w3schools.com/xquery/ "XQuery." What Is ?N.p., n.d. Web. 04 Apr. 2013. http://searchsqlserver.techtarget.com/definition/XQuery "XQuery." Wikipedia. Wikimedia Foundation, 04 Feb. 2013. Web. 03 Apr. 2013. http://en.wikipedia.org/wiki/XQuery

More Related