XQuery 1.0: An XQL Query Language Attempt by W3C at a standard query language for XML. Has been called the “SQL.

Slides:



Advertisements
Similar presentations
XML Data Management 8. XQuery Werner Nutt. Requirements for an XML Query Language David Maier, W3C XML Query Requirements: Closedness: output must be.
Advertisements

XML: Extensible Markup Language
1 XML Data Management Course Outline and Organisation Werner Nutt.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 346 Day 24.
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.
XQuery Or, what about REAL databases?. XQuery - its place in the XML team XLink XSLT XQuery XPath XPointer.
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.
Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. Francis Lau (HKU)
Lecture 10. Back to the table example We can now return to considering in detail the first XSLT style-sheet we saw –The one which, when applied to the.
Survey of XML Query Languages Josh Spiegel. What is an XML Query Language? John Coltrane Maceo Parker Josh Spiegel I want all the employees.
Introduction to XQuery and eXist DSA. XSLT Tutorial Problems Bad language : – No ! – for XML schema –Some XSLT engines tolerant of extra tags (permissive),
1 COS 425: Database and Information Management Systems XML and information exchange.
XQuery – The W3C XML Query Language Jonathan Robie, Software AG Don Chamberlin, IBM Research Daniela Florescu, INRIA.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
XML Query Language Changki Kim July MSE. 2 2 Contents  Introduction  XQuery Data Model  XQuery Expression Types  Implementations of XQuery.
XMLII XSchema XSchema XQuery XQuery. XML Schema XML Schema is a more sophisticated schema language which addresses the drawbacks of DTDs. Supports XML.
4/20/2017.
XQuery Your gateway to manipulating XML in SQL Server 2005.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
XMLII XSchema XSchema XQuery XQuery Oracle XSU Oracle XSU.
Lecture 7 of Advanced Databases XML Querying & Transformation Instructor: Mr.Ahmed Al Astal.
Lecture 21 XML querying. 2 XSL (eXtensible Stylesheet Language) In HTML, default styling is built into browsers as tag set for HTML is predefined and.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
Maziar Sanaii Ashtiani – SCT – EMU, Fall 2011/12.
Query Processing with XML CSE 350 – Advanced Database Topics Jeffrey R. Ellis.
Lecture 6 of Advanced Databases XML Querying & Transformation Instructor: Mr.Eyad Almassri.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XQuery.
And Di s t r i b u t e d Databases on the Web Nathaniel Ayewah CSE 8330 Presentation SMU.
Introduction to XSLT By Ed Rosenthal And Dave Pion.
IT420: Database Management and Organization XML 21 April 2006 Adina Crăiniceanu
Another PillowTalk Presentation  2004 Dynamic Systems, Inc. Introduction to XML for SOA Lee H. Burstein,
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
Session II Chapter 2 – Chapter 2 – XSLhttp://
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XQuery.
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
Demystifying the eXtensible Markup Language Nick Roberts & Jim Few
1 XML Data Management Course Outline and Organisation Werner Nutt.
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
Ontologies and Lexical Semantic Networks, Their Editing and Browsing Pavel Smrž and Martin Povolný Faculty of Informatics,
Paul Cotton, XML Query WG1 Querying XML Documents Paul Cotton ZIG Washington, Dec 7, 2000.
XML and Database COSC643 Sungchul Hong. Is XML a Database? Yes but only in the strictest sense of the term. It is a collection of data. (some sort) XML.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Exam and Lecture Overview.
Oracle DML Dr. Bernard Chen Ph.D. University of Central Arkansas.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
XQuery Leah Andrews. Overview  Queries data stored in XML trees  Declarative  High-level  Functional (no side effects)  Strongly typed  Nodes 
XML Databases by Sebastian Graf Hier beginnt mein toller Vortrag.
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.
© 2006 Altova GmbH. All Rights Reserved. Altova ® Product Line Overview.
Dom and XSLT Dom – document object model DOM – collection of nodes in a tree.
+ 1 XML eXtensible Markup Language. + 2 XML Lecture Adapted from the work of Dr. Praveen Madiraju of Marquette University.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
How to students in your class using Owl Link Updated
XML: Extensible Markup Language
XML Related Technologies
Querying and Transforming XML Data
{ XML Technologies } BY: DR. M’HAMED MATAOUI
Database Processing with XML
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Introduction to Internet Programming
Querying XML XQuery.
Querying XML XQuery.
Querying XML XPath.
Querying XML XPath.
2/18/2019.
Presentation transcript:

XQuery 1.0: An XQL Query Language Attempt by W3C at a standard query language for XML. Has been called the “SQL for XML” W3C Candidate Recommendation (3 November 2005) Current Status: Waiting for implementations.... Next: W3C Proposed Recommendation ??

XQuery 1.0: Miscellany What Came Before? XQL: XML Query Language XML-QL: A Query Language for XML XPath: XML Path Language (W3C 1999) Related Technologies: XSLT: XML Stylesheet Language Transformations (W3C 1999) XPointer: XML Pointer Language (W3C 2001) XMLBeans: a technology for accessing XML by binding it to Java types A bunch of other stuff XStuff……

XQuery: Early Implementations Commercial Implementations Relational XQuery : Abacus Systems. 30 day trial. XMLSpy 2005: Altova. 30 day trial. XHive/DB: X-Hive. Commercial. Web demo. Oracle; SQL Server Open Source Implementations Galax: Open Source Mono Project: Open Source XMLBeans: a technology for accessing XML by binding it to Java types More implementations….

Tree Representation of an XML Document, D Figure 1 from TIMBER: A native XML Database

The personnel of a department can be faculty, facultyid A Relational Schema staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

The personnel of a department can be faculty, lecturers, facultyid lecturersid 9 A Relational Schema staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

The personnel of a department can be faculty, lecturers, or scientists. facultyid lecturersid 9 scientistsid 5 A Relational Schema staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

staff idname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King facultyid lecturersid 9 scientistsid 5 They may or may not have a secretary. secretariessec_idboss_id A Relational Schema

facultyid lecturersid 9 scientistsid 5 tasnameboss_id Peter3 Bob3 Mark9 Andy9 Chris9 A lecturer can have TAs, no RAs. staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

facultyid lecturersid 9 scientistsid 5 rasnameboss_id Tom1 Pam3 DJ3 Tod5 Max5 Ann5 Lisa5 Jerry7 Tony7 Rich7 Grey7 A scientist can have RAs, but no TAs. staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

facultyid lecturersid 9 scientistsid 5 Each faculty may have both TAs and RAs. tasnameboss_id Peter3 Bob 3 Mark9 Andy9 Chris9 rasnameboss_id Tom1 Pam3 DJ3 Tod5 Max5 Ann5 Lisa5 Jerry7 Tony7 Rich7 Grey7 staffidname 1J.Smith 2T.Brown 3K.Blue 4M.Black 5L.Young 6P.White 7H.Grey 8 9R.King

z <!DOCTYPE department [ ]> The personnel of a department can be staff, faculty, lecturers, or scientists. Data Type Definition (DTD) for Amber XML document

The personnel of a department can be staff, faculty, lecturers, or scientists. ….. …. …. …. …. XML

z <!DOCTYPE department [ ]> Each of them has a name as identification. DTD

z <!DOCTYPE department [ ]> They may or may not have a secretary. DTD

They may or may not have a secretary. T.Brown K.Blue M.Black Each of them has a name as identification. XML

z <!DOCTYPE department [ ]> Each faculty may have both TAs and RAs. DTD

Each faculty may have both TAs and RAs. K.Blue M.Black Peter Bob Pam DJ XML

z <!DOCTYPE department [ ]> A lecturer can have one or more TAs, but no RA.. DTD

z <!DOCTYPE department [ ]> A scientist can have any number of RAs, but no TA. DTD

Bring up the Timber XML document in a web browser. In a separate browser, connect to the Timber 2 relational DB.

SELECT [ DISTINCT | ALL ] column_expression1, column_expression2,.... [ FROM from_clause ] [ WHERE where_expression ] [ GROUP BY expression1, expression2,.... ] [ HAVING having_expression ] [ ORDER BY order_column_expr1, order_column_expr2,.... ] column_expression ::= expression [ AS ] [ column_alias ] from_clause ::= select_table1, select_table2,... from_clause ::= select_table1 LEFT [OUTER] JOIN select_table2 ON expr... from_clause ::= select_table1 RIGHT [OUTER] JOIN select_table2 ON expr... from_clause ::= select_table1 [INNER] JOIN select_table2... select_table ::= table_name [ AS ] [ table_alias ] select_table ::= ( sub_select_statement ) [ AS ] [ table_alias ] order_column_expr ::= expression [ ASC | DESC ] SQL SELECT Syntax

Querying Timber 2 relational DB with SQL See Relational DB Design #2 on handout (page ??) Write an SQL Query to: List the names of all faculty members. select staff.name from faculty, staff where faculty.id = staff.id Enter the query in the text box of the web page and click “Submit Query”

The XQuery FLWOR expression For-Let-Where-Order-Return pronounced "flower" generalizes SELECT-FROM-HAVING-WHERE from SQL

XQuery FLWOR See d.xml on handout pg ? or at 1. List the names of all faculty members. for $fac in doc(" return $fac/name K.Blue M.Black

XQuery FLWOR – Let’s Try one. See d.xml on handout pg ? or at List the names of all faculty members. for $faculty in doc(" return $faculty/name K.Blue M.Black 1. Web browse to: 2. Select XQuery Updates 1 from dropdown menu 3. Enter this XQuery expression in the left text box, then Submit Query.

XQuery FLWOR See d.xml on handout pg ? or at 2. List the names of all TAs working for faculty, (not for lecturers) for $fac in doc(" return $fac/name K.Blue M.Black Peter Bob Pam DJ Who can build this XQuery first? for $fac in doc(" return $fac/ta

XQuery FLWOR See d.xml on handout pg ? or at 3. List the names of all faculty members (without XML tags) for $fac in doc(" return $fac/name K.Blue M.Black Peter Bob Pam DJ for $fac in doc(" return data($fac/name)

XQuery FLWOR See d.xml on handout pg ? or at 4. List the names of all faculty members (without tags) in an unordered list K.Blue M.Black Peter Bob Pam DJ { for $fac in doc(" return {data($fac/name)} }

{ for $ra in doc(" order by data ( $ra) return {data($ra) } } 5. List the names of all RAs working for scientists (without XML tags) sorted alphabetically, in an ordered html list. { for $fac in doc(" return {data($fac/name)} } Who can solve first? L.Young P.White Todd Ann Lisa

for $sec in doc(" order by data( $sec) return data($sec) 6. List the secretary names (without XML tags or HTML tags) of all employees, sorted alphabetically Who can solve first? L.Young P.White Todd Ann Lisa { for $ra in doc(" order by data ( $ra) return {data($ra)} }

References