Query Processing with XML CSE 350 – Advanced Database Topics Jeffrey R. Ellis.

Slides:



Advertisements
Similar presentations
Inside an XSLT Processor Michael Kay, ICL 19 May 2000.
Advertisements

Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
A Prototype Implementation of a Framework for Organising Virtual Exhibitions over the Web Ali Elbekai, Nick Rossiter School of Computing, Engineering and.
XML: Extensible Markup Language
Visual Web Information Extraction With Lixto Robert Baumgartner Sergio Flesca Georg Gottlob.
Survey of XML Query Languages Josh Spiegel. What is an XML Query Language? John Coltrane Maceo Parker Josh Spiegel I want all the employees.
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.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
XML Query Language Changki Kim July MSE. 2 2 Contents  Introduction  XQuery Data Model  XQuery Expression Types  Implementations of XQuery.
Technical Track Session XML Techie Tools Tim Bornholt.
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.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
JSP Standard Tag Library
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
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.
1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.
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.
XML and its applications: 4. Processing XML using PHP.
Lecture 6 of Advanced Databases XML Querying & Transformation Instructor: Mr.Eyad Almassri.
ColdFusion’s XML Capabilities Maryland CFUG April 12, 2005 Presented by Doug Ward.
School of Computing and Management Sciences © Sheffield Hallam University To understand the Oracle XML notes you need to have an understanding of all these.
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.
Session II Chapter 2 – Chapter 2 – XSLhttp://
XML과 Database 홍기형 성신여자대학교 성신여자대학교 홍기형.
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro.
Advanced Java Session 9 New York University School of Continuing and Professional Studies.
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Electronic Commerce COMP3210 Session 4: Designing, Building and Evaluating e-Commerce Initiatives – Part II Dr. Paul Walcott Department of Computer Science,
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Computing & Information Sciences Kansas State University Thursday, 15 Mar 2007CIS 560: Database System Concepts Lecture 24 of 42 Thursday, 15 March 2007.
Optimization in XSLT and XQuery Michael Kay. 2 Challenges XSLT/XQuery are high-level declarative languages: performance depends on good optimization Performance.
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.
Declaratively Producing Data Mash-ups Sudarshan Murthy 1, David Maier 2 1 Applied Research, Wipro Technologies 2 Department of Computer Science, Portland.
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
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.
XML and Its Applications Ben Y. Zhao, CS294-7 Spring 1999.
XML and Database.
Sept. 27, 2002 ISDB’02 Transforming XPath Queries for Bottom-Up Query Processing Yoshiharu Ishikawa Takaaki Nagai Hiroyuki Kitagawa University of Tsukuba.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Dom and XSLT Dom – document object model DOM – collection of nodes in a tree.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
XML Query: xQuery Reference: Xquery By Priscilla Walmsley, Published by O’Reilly.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
Computing & Information Sciences Kansas State University Friday, 20 Oct 2006CIS 560: Database System Concepts Lecture 24 of 42 Friday, 20 October 2006.
©Silberschatz, Korth and Sudarshan10.1Database System Concepts W3C - The World Wide Web Consortium W3C - The World Wide Web Consortium.
Martin Kruliš by Martin Kruliš (v1.1)1.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
XML and Distributed Applications By Quddus Chong Presentation for CS551 – Fall 2001.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
XML: Extensible Markup Language
Querying and Transforming XML Data
{ XML Technologies } BY: DR. M’HAMED MATAOUI
XML in Web Technologies
Database Processing with XML
More Sample XML By Sadia Anjum.
XML Problems and Solutions
XML and its applications: 4. Processing XML using PHP
More XML XML schema, XPATH, XSLT
Presentation transcript:

Query Processing with XML CSE 350 – Advanced Database Topics Jeffrey R. Ellis

Query Processing Topics Why? Java and Other Programming Languages XPath/XSLT XQuery (W3C-sponsored Query Language) Current Research – Other Query Languages – XISS (XML Indexing and Storage System)

FIRST – Distinction between XML and HTML/Web Technologies XML spotlight is analogous to Java – Immediate benefits applied to World Wide Web – Long-range, more exciting benefits in applications XML IS NOT AN HTML REPLACEMENT – HTML marks pages up for presentation on the web – XML marks text for semantic information purposes XML can encode HTML pages, but HTML works well on the Web

XML Data Storage XML Documents – Data is delineated semantically – Schemas/DTDs control contents of elements – Semi-structured attitude allows flexibility – Text is human-readable and machine-parsable – Open standards work with common tools – File data storage allows for easy sharing – Can queries control access to data?

Traditional Database Storage Databases – Data is delineated semantically – Schemas control contents of rows – No flexibility from semi-structured storage – Data is not human-readable, but only machine- parsable – Proprietary standards prevent interoperability – Proprietary storage prevents data sharing – Queries control access to data

XML for Query Processing If we can get efficient query processing, XML document storage provides many benefits over traditional database storage. Sample application – Employee database document – XML Schema assumed to exist – Employee information queried as per standard HR processing

Bissell Brian IT Specialist 35,000 CT Pham Hung Q Senior IT Specialist 45,000 CT …

Tree Structure of XML Document Remember that XML documents are trees emp gendernamepositionsalarylocation lastfirstmi

Query Processing – Programming Languages XML Documents are flat files Any language with file I/O can read XML document Any language with string parsing capabilities can use XML data Query processing done through language syntax “Obvious” result different from traditional databases

Query Processing – Programming Languages Strategy – Basic File I/O through language – Basic String matching to identify elements – Processing possible, but not necessarily efficient Languages have gathered XML processing tools in libraries – xerces – Apache library for Java and C++ Two methods for parsing XML data – DOM – SAX

DOM Document Object Model Defined by W3C for XML, HTML, and stylesheets Provides an hierarchical, object-view of the document DOMParser parses through file, then provides access to nodes Key: Every item in XML document is a node

DOM Example Node (Element) name=“emp” attribute1 child1 Node (Attr) name=“gender” value=“m” parent Node (Element) name=“name” parent child1 Node (Element) name=“last” parent child1 Node (Text) value=“Bissell” parent

SAX Simple API for XML Defined by XML-DEV mailing list Provides an event-driven processing of the document XMLReader parses through file and activates different methods and functions based on the elements retrieved Key: Methods are defined in interface, implemented in user code

DOM versus SAX SAX is primarily Java-based; DOM defined for most languages DOM requires storage of entire document in memory; SAX processes as it reads DOM mirrors a document that can be revisited; suited for document processing SAX mirrors object lifecycles; suited for data processing

Query Processing - XPath/XSLT Standard XML technologies XPath and XSLT provide a ready-made querying infrastructure XPath identifies the location of various document elements XSL Stylesheets provide methods for tranforming data from one format to another Combining XPath and XSLT provides easy generation of result sets based on queries

XPath Provides element, value, and attribute identification employees/emp/name/first = “Brian”, “Hung”, “Sara”, “Brian” //salary = “35,000”, “40,000”, “35,000”, “60,000” count(/employees/emp) = 4 //mi = “Q”

XSLT Stylesheet transforms data from one form into another = Brian Bissell, Hung Pham, Sara Menillo, Brian Chicos

Combine XPath and XSLT for Queries Query: Find the last name and position of each employee named Brian : ;

Combine XPath and XSLT for Queries Query: Find the average salary of all non-managers

Results XSLT/XPath Many SQL queries can be accomplished – XPath provides element (data) access – XPath provides basic functions (e.g., sum() ) – XPath provides WHERE functionality – XSLT provides SELECT functionality – XSLT provides ORDER BY functionality (sort) – XSLT provides result set formatting – UNION functionality provided..?

Querying with XPath and XSLT Important questions – Is it sufficient? – Is it efficient? – Is there a better way? XML community has need to design a full query language XQuery – Working draft published 7 June 2001

Query Processing - XQuery XML provides flexibility in representing many kinds of information Good query language must be likewise flexible – Pre-XQuery languages are good for specific types of data Goal: “[S]mall, easily implementable language in which queries are concise and easily understood.”

XQuery Forms 1. Path expressions 2. Element constructors 3. FLWR expressions 4. Operator/Function expressions 5. Conditional expressions 6. Quantified expressions 7. Data Type expressions

XQuery – Path Expressions Contribution of XPath XQuery 1.0 and XPath 2.0 Data Model document(“sample1.xml”)//emp/salary //emp[1 TO 3]/name/first

XQuery – Element Constructors Queries can generate new elements Similar to XSLT abilities {$name/last} {$position}

XQuery – FLWR Expressions For clause/Let clause/Where clause/Return Similar to SQL FOR $e IN document(“sample1.xml”)//emp WHERE $e/salary > AND = ‘f’ RETURN $e/name

XQuery – Operator/Function Expressions Pre-defined and user-defined operators and functions Still under development: Union, Intersect, Except FOR $e IN //employees/emp WHERE not(empty($e//mi)) RETURN $e/name

XQuery – Conditional Expressions If-then-else expressions are not yet limited to boolean (ongoing discussion) FOR $e IN /employees/emp RETURN {$name} IF ($e/position=“Manager”) THEN

Quanitifed Expressions Some/Every conditions Some/Every evaluates to True or False FOR $e IN //employees WHERE SOME $p IN $e//emp/position = “Manager” RETURN $e

Data Types Data Types based on those available from XML Schema Data types can be literal (“Brian”), from constructor functions (date(“ ”) ), or from casting ( CAST AS xsd:integer(24) ) User-defined data types are also allowable and parsable

XQuery More choices than XSLT/XPath combination Work in progress Current W3C efforts into query language Influencing the future design of the core XML technologies (XPath) Hopes to be fully flexible for all future XML applications

Query Processing – Research XQuery specification continues to undergo review and change – 6 of 7 specification documents released since June – All specifications released in 2001 Other avenues of research – Other Query languages – Indexing strategies – Implementation

Query Processing – Other Query Languages Many query languages exist – Quilt (basis for XQuery) – W3C early languages (XML-QL, XQL) – Adopted traditional languages (OQL, XSQL) – Research papers (XML-GL, YATL, Lorel) Other query languages often optimized for a particular subset of XML documents Query language field *MAY* be standardizing to XQuery

Query Processing – Indexing Strategy Query language less important; better indexing techniques lead to efficiency XISS (XML Indexing and Storage System) – September 19, 2001 publishing – Builds sets of indexes on XML data elements and attributes on initial parse of XML document – Lookup becomes constant-time through the various built indexes – Demonstrated successes in test runs

Query Processing - Implementation XML is currently in state of flux – Standards are still being revised – Industry cautious before embracing a new technology – Economic slowdown may prevent new research and development efforts XML still waiting for its “Killer App”, application that forces immediate acceptance

XML Query Processing XML is a functional database storage language Efficient query language needed to turn XML into a viable database Query language solutions are being developed – Java/C++ hooks first developed – OK – XSLT/XPath implemented – GOOD – XQuery being designed – GREAT? – Future additions – ????