Managing XML and Semistructured Data Lecture 17: Publishing XML Data From Relations Prof. Dan Suciu Spring 2001.

Slides:



Advertisements
Similar presentations
XML: Extensible Markup Language
Advertisements

Composing XSL Transformations with XML Publishing Views Chengkai LiUniversity of Illinois at Urbana-Champaign Philip Bohannon Lucent Technologies, Bell.
Managing XML and Semistructured Data Lecture 12: XML Schema Prof. Dan Suciu Spring 2001.
CSE 6331 © Leonidas Fegaras XML and Relational Databases 1 XML and Relational Databases Leonidas Fegaras.
SilkRoute: A Framework for Publishing Relational Data in XML Mary Fernández, AT&T Labs - Research Dan Suciu, Univ. of Washington Yada Kadiyska, Univ. of.
Relational Databases for Querying XML Documents: Limitations & Opportunities VLDB`99 Shanmugasundaram, J., Tufte, K., He, G., Zhang, C., DeWitt, D., Naughton,
The Relational Model Class 2 Book Chapter 3 Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) (From ER to Relational)
Managing XML and Semistructured Data Lecture 8: Query Languages - XML-QL Prof. Dan Suciu Spring 2001.
Dec 4, 2003Murali Mani SQL B term 2004: lecture 14.
XML Views El Hazoui Ilias Supervised by: Dr. Haddouti Advanced XML data management.
2005rel-xml-ii1 The SilkRoute system  The system goals  Scenario, examples  View Forests  View forest and query composition  View forest efficient.
1 COS 425: Database and Information Management Systems XML and information exchange.
The Relational Model Lecture 3 Book Chapter 3 Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) From ER to Relational.
2005rel-xml-i1 Relational to XML Transformations  Background & Issues  Preliminaries  Execution strategies  The SilkRoute System.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
Database Systems and XML David Wu CS 632 April 23, 2001.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Managing XML and Semistructured Data Lecture 1: Preliminaries and Overview Prof. Dan Suciu Spring 2001.
Managing XML and Semistructured Data Lecture 18: Publishing XML Data From Relations Prof. Dan Suciu Spring 2001.
Efficiently Publishing Relational Data as XML Documents Jayavel Shanmugasundaram University of Wisconsin-Madison/ IBM Almaden Research Center Joint work.
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.
Viewing relational data as XML Using Microsoft SQL Server.
Using SQL Queries to Generate XML- Formatted Data Joline Morrison Mike Morrison Department of Computer Science University of Wisconsin-Eau Claire.
Main challenges in XML/Relational mapping Juha Sallinen Hannes Tolvanen.
XML, distributed databases, and OLAP/warehousing The semantic web and a lot more.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
XML, CFMX CFML & SQL XML Kevin Penny, MMCP
XML in SQL Server Overview XML is a key part of any modern data environment It can be used to transmit data in a platform, application neutral form.
Dan SuciuTools for XML Data Exchange Dan Suciu AT&T Labs Joint work with Mary Fernandez.
1 The Relational Model Chapter 3. 2 Why Study the Relational Model?  Most widely used model  Vendors: IBM, Informix, Microsoft, Oracle, Sybase  Recent.
CSCE 520- Relational Data Model Lecture 2. Relational Data Model The following slides are reused by the permission of the author, J. Ullman, from the.
1 Maintaining Semantics in the Design of Valid and Reversible SemiStructured Views Yabing Chen, Tok Wang Ling, Mong Li Lee Department of Computer Science.
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.
5/24/01 Leveraging SQL Server 2000 in ColdFusion Applications December 9, 2003 Chris Lomvardias SRA International
Module 18 Querying XML Data in SQL Server® 2008 R2.
Lecture 5: XML Tuesday, January 16, Outline XML, DTDs (Data on the Web, 3.1) Semistructured data in XML (3.2) Exporting Relational Data in XML (8.3.1)
Lecture A/18-849B/95-811A/19-729A Internet-Scale Sensor Systems: Design and Policy Lecture 24 – Part 2 XML Query Processing Phil Gibbons April.
Retrieving XML Data from SQL server.  Using the FOR XML Clause to Retrieve Data Retrieving Data in XML Format How SQL Server Generates XML Using the.
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.
1 Automatic Generation of XQuery View Definitions from ORA-SS Views Ya Bing Chen Tok Wang Ling Mong Li Lee School of Computing National University of Singapore.
CSCE 520- Relational Data Model Lecture 2. Oracle login Login from the linux lab or ssh to one of the linux servers using your cse username and password.
Computing & Information Sciences Kansas State University Friday, 20 Oct 2006CIS 560: Database System Concepts Lecture 24 of 42 Friday, 20 October 2006.
Dec. 13, 2002 WISE2002 Processing XML View Queries Including User-defined Foreign Functions on Relational Databases Yoshiharu Ishikawa Jun Kawada Hiroyuki.
Chapter 14 1 Chapter 14 Storing and Retrieving XML in SQL Server 2000 November 6, 2001 Sook-Kyo Kwon.
SQLXML XML Technology For SQL Server Brian Moore Developer and Platform Strategy Group Microsoft Corporation.
Module 3: Using XML. Overview Retrieving XML by Using FOR XML Shredding XML by Using OPENXML Introducing XQuery Using the xml Data Type.
Web Data and the Resurrection of Database Theory Dan Suciu University of Washington.
Experience with XML Schema Ashok Malhotra Schema Usage  Mapping XML Schema and XML documents controlled by the Schema to object classes and instances.
1 Lecture 15 Monday, May 20, 2002 Size Estimation, XML Processing.
1 Storing and Maintaining Semistructured Data Efficiently in an Object- Relational Database Mo Yuanying and Ling Tok Wang.
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
C10. SQL-S + XML Date Semistructurate,
Chapter 3 The Relational Model. Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. “Legacy.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Efficiently Publishing Relational Data as XML Documents IBM Almaden Research Center Eugene Shekita Rimon Barr Michael Carey Bruce Lindsay Hamid Pirahesh.
XPERANTO: A Middleware for Publishing Object-Relational Data as XML Documents Michael Carey Daniela Florescu Zachary Ives Ying Lu Jayavel Shanmugasundaram.
XML Databases Presented By: Pardeep MT15042 Anurag Goel MT15006.
Creating Database Objects
XML: Extensible Markup Language
Management of XML and Semistructured Data
Relational Algebra Chapter 4, Part A
SQL : Query Language Part II CS3431.
Database.
SilkRoute: A Framework for Publishing Rational Data in XML
Alin Deutsch, University of Pennsylvania Mary Mernandez, AT&T Labs
JSON for the Data Mortal
Lecture 14: Database Theory in XML Processing
Wednesday, May 22, 2002 XML Publishing, Storage
Creating Database Objects
Presentation transcript:

Managing XML and Semistructured Data Lecture 17: Publishing XML Data From Relations Prof. Dan Suciu Spring 2001

In this lecture XML Publishing Example XML Publishing Languages Virtual XML Publishing Materialized XML Publishing (next time) Resources SilkRoute: Trading between relations and XML by Fernandez, Suciu, Tan R, in WWW9, 2000SilkRoute: Trading between relations and XML Efficient Evaluation of XML Middle-ware Queries in SIGMOD'2001Efficient Evaluation of XML Middle-ware Queries

XML Publishing Today: Legacy data –fragmented into many flat relations –3rd normal form –proprietary XML data –nested –un-normalized –public (450 schemas at

XML Publishing: an Example Eu-Stores US-Stores Products Eu-SalesUS-Sales namecountrynameurl date tax name priceUSD euSidusSid pid Legacy data in E/R:

XML Publishing: an Example XML view France Nicolas Blanc de Blanc 10/10/ /10/2000 … … … …. … In summary: group by country store product

allsales country namestore nameproduct namesold datetax url PCDATA * * * * ? ? Output “schema”:

XML Publishing Need a language for specifying the Relational  XML mapping SilkRoute: –a SQL/XML-QL blend IBM (formerly Experanto project) –extension of SQL SQL Server: –“FOR XML” – and extension of SQL –XDR’s

{ FROM EuStores $S, EuSales $L, Products $P WHERE $S.euSid = $L.euSid AND $L.pid = $P.pid CONSTRUCT $S.country $S.name $P.name $P.priceUSD } /* union….. */ { FROM EuStores $S, EuSales $L, Products $P WHERE $S.euSid = $L.euSid AND $L.pid = $P.pid CONSTRUCT $S.country $S.name $P.name $P.priceUSD } /* union….. */ XML Publishing: SilkRoute In SilkRoute [Fernandez, Suciu, Tan ’00]

XML Publishing : SilkRoute …. /* union */ { FROM USStores $S, EuSales $L, Products $P WHERE $S.usSid = $L.euSid AND $L.pid = $P.pid CONSTRUCT USA $S.name $S.url $P.name $P.priceUSD $L.tax } …. /* union */ { FROM USStores $S, EuSales $L, Products $P WHERE $S.usSid = $L.euSid AND $L.pid = $P.pid CONSTRUCT USA $S.name $S.url $P.name $P.priceUSD $L.tax }

Non-recursive datalog (SELECT DISTINCT … ) allsales() country(c) name(c)store(c,x) name(n)product(c,x,y) name(n)sold(c,x,y,d) date(c,x,y,d) Tax(c,x,y,d,t) url(c,x,u) c n n d t u Internal Representation country(c) :-EuStores(x,_,c), EuSales(x,y,_), Products(y,_,_) country(“USA”) :- store(c,x) :- EuStores(x,_,c), EuSales(x,y,_), Products(y,_,_) store(c,x) :- USStores(x,_,_), USSales(x,y,_), Products(y,_,_), c=“USA” url(c,x,u):-USStores(x,_,u), USSales(x,y,_),Products(y,_,_) allsales():- * * * * ? View Tree:

XML Publishing : IBM XPERANTO: Publishing Object-Relational Data as XML, Carey, Florescu, Ives, Lu, Shanmugasundaram, Shekita, Subramanian, WebDB’2000 Efficiently Publishing Relational Data as XML Documents, Shanmugasundaram, Shekita, Barr, Carey, Lindsay, Pirahesh, Reinwald, VLDB’2000

XML Publishing : IBM (Select S.name, STORE(S.euSid, S.name, (Select XMLAGG(PRODUCT(P.pid, P.name, P.priceUSD)) From EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid)) From EuStores S) Union All..... (Select S.name, STORE(S.euSid, S.name, (Select XMLAGG(PRODUCT(P.pid, P.name, P.priceUSD)) From EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid)) From EuStores S) Union All..... Define XML Constructor STORE(storeID: integer, name: varchar(20), prodList: xml) AS { $name $prodList } Define XML Constructor STORE(storeID: integer, name: varchar(20), prodList: xml) AS { $name $prodList } Define XML Constructor PRODUCT(...) AS {... } Define XML Constructor PRODUCT(...) AS {... } SQL + User defined functions

XML Publishing : SQL Server Three modes RAW mode Auto Mode Explicit Mode

XML Publishing : SQL Server, RAW Mode Select S.euSid, L.euSid, P.name, P.price From Stores S, EuSales L, Products P Where S.euSid != L.euSid AND L.pid = P.pid For XML Raw Select S.euSid, L.euSid, P.name, P.price From Stores S, EuSales L, Products P Where S.euSid != L.euSid AND L.pid = P.pid For XML Raw.... flat XML default tag and attribute names

XML Publishing : SQL Server Auto Mode Select S.euSid, P.name, P.price From Stores S, EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid For XML Auto Select S.euSid, P.name, P.price From Stores S, EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid For XML Auto nested XML default tag and attribute names

XML Publishing : SQL Server Explicit Mode Nested XML User defined tags and attributes Idea: write SQL queries with complex column names Ad-hoc, order dependent semantics

XML Publishing : SQL Server Explicit Mode (Select 1 as Tag, null as Parent, S.euSid as [Store!1!id], S.name as [Store!1!name!element], null as [Product!2!name!element], null as [Product!2!price!element] From Stores S) Union All (Select 2 as Tag, 1 as Parent, S.euSid as [Store!1!id], null as [Store!1!name!element], P.name as [Product!2!name!element], P.price as [Product!2!name!element] From Stores S, EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid) Order By [Store!1!id] (Select 1 as Tag, null as Parent, S.euSid as [Store!1!id], S.name as [Store!1!name!element], null as [Product!2!name!element], null as [Product!2!price!element] From Stores S) Union All (Select 2 as Tag, 1 as Parent, S.euSid as [Store!1!id], null as [Store!1!name!element], P.name as [Product!2!name!element], P.price as [Product!2!name!element] From Stores S, EuSales L, Products P Where S.euSid = L.euSid AND L.pid = P.pid) Order By [Store!1!id]

XML Publishing : SQL Server Explicit Mode All column names are legal SQL names –Special form: [tagname!k!something], –Or [tagname!k!something!element] –Or other variations... Hence everything is legal SQL But what does it mean ? Construct the universal table first Then process the table sequentially

XML Publishing : SQL Server Explicit Mode TagParentStore!1!idStore!1!name!elementProduct!2!name!elementProduct!2!price!element 1ABCDENicolas 21ABCDESaint Emilion ABCDELoire FDKLSFNAC 21FDKLSDatabases Universal table:

XML Publishing : SQL Server Explicit Mode Converting universal table to XML: scan each row sequentially let Tag=k –look up only columns with that tag –all are called [tagname!k!something] with the same tagname What happens if one has a different tagname ? –Create an element called tagname Output –Columns become its children Either subelements or attributes if Parent is specified, last element with that tag is the parent otherwise it is a root element

XML Publishing : SQL Server Explicit Mode Nicolas Saint Emilion Loire FNAC... Nicolas Saint Emilion Loire FNAC...

XML Publishing : SQL Server Explicit Mode Seems complex, but also powerful Can construct arbitrarily deeply nested hierarchies –How ? However, they are very, very limited –Why ?