1 / 39

Updating XML Views of Relational Data

Updating XML Views of Relational Data. Master’s Thesis Update Talk For Mukesh Mulchandani Advisor : Prof. Elke Rundensteiner Reader : Prof. George Heineman. Outline. Motivation Background Material Rainbow System My Extension to Rainbow System Work in Literature

bat
Download Presentation

Updating XML Views of Relational Data

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. Updating XML Views of Relational Data Master’s Thesis Update Talk For Mukesh Mulchandani Advisor : Prof. Elke Rundensteiner Reader : Prof. George Heineman Updating XML Views of Relational Data

  2. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  3. Motivation • XML is here to stay … • Universal representation of data • De facto standard for information exchange • But RDBMS is mature • Mature query optimization techniques • High query performance • Hence Extensive research on storing XML into RDBs and publishing XML • Florescu and Kossman, Storing and Querying XML Data Using RDBMS, In Bulletin of Technical Committee on Data Engineering, 1999 • Shanmugasundaram, He, Tufte, Zhang, DeWitt and Naughton, Relational Databases for Querying XML Documents : Limitations and Opportunities, VLDB 1999 • Zhang, Lee, Mitchell and Rundensteiner, Clock: Synchronizing Internal Relational Storage with External XML Documents, RIDE-DM 2000 Updating XML Views of Relational Data

  4. RDBMS Query Executor Relations SQL Tuples Bridging XML & RDBs XPERANTO & Rainbow XML Virtual View XQuery XQuery Default XML View • XQuery to Query • Translation • Query Composition • Query Rewriting • Computation Pushdown • SQL Generation XML Documents • Updates ? – Not yet supported Updating XML Views of Relational Data

  5. My Thesis Goals • Specify updates on XML views • Push updates correctly into underlying relations • Irrespective of mapping chosen between XML to RDB • Issues to be addressed: • How to specify updates ? • What kind of updates? • Meaning of updates at RDB end (Schema or Data Updates) • How to propagate ? • How to know that propagation is correct ? • How is the performance ? Updating XML Views of Relational Data

  6. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  7. Example of XML document & XQuery User XQuery: <SavitchBooks> FOR $author IN document(“authorview”)/author WHERE $author/last = “Savitch” RETURN $author/title </SavitchBooks> <authors> <author> <first>Michael</first> <last>Savitch</last> <title>Data Structures in C++</title> <year>2000</year> </author> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authors> Result : <SavitchBooks> <title>Data Structures in C++</title> </SavitchBooks> Updating XML Views of Relational Data

  8. XML views of Relational Data <DB> <Author> <row> <first>Michael</first> <last>Savitch</last> <bookid>1</bookid> </row> <row> <first>Peter</first> <last>Naughton</last> <bookid>2</bookid> </row> </Author> <Book> <row> <bookid>1</bookid> <title>Data Structures in C++</title> <year>2000</year> </row> <row> <bookid>2</bookid> <title>JAVA 2 Reference</title> <year>1998</year> </row> </Book> </DB> Default View Author Book Updating XML Views of Relational Data

  9. XML views of Relational Data (Contd) Mapping View <authorview> <author> <first>Michael</first> <last>Savitch</last> <title>Data Structures in C++</title> <year>2000</year> </author> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authorview> <authorview> FOR $authortuple IN document(“Default.xml”)/author/row $booktuple IN document(“Default.xml”)/book/row WHERE $authortuple/bookid = $booktuple/bookid RETURN <author> $authortuple/first $authortuple/last $booktuple/title $booktuple/year </author> </authorview> Updating XML Views of Relational Data

  10. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  11. Mapping Query Default Schema Rainbow Query Engine User Query User Query Results in XML XQuery Parsed Tree Kweelt XQuery Parser XAT Generator Mapping Query XAT View Composition XML View Manager XAT XAT Rewrite XAT XAT Executor SQL Generator XAT SQL Tuples RDBMS Updating XML Views of Relational Data

  12. What Changes Do I Need To Make ? • Extend : • XQuery language to support XML Updates • XQuery Parser (Kweelt) to parse updates • “XAT Generator” to generate update nodes in XAT • Add Functionality: • “View Analyzer” to extract knowledge of underlying tables and relationships among them. • “Update Decomposer” to decompose given XML update into relational updates • “Update Translator" to make correct SQL translation using semantic information about relational tables. Updating XML Views of Relational Data

  13. Mapping Query Default Schema Update Manager within Rainbow User Query User Update User Query Results in XML Update Parser Parsed Tree Kweelt XQuery Parser XAT Generator Mapping Query XAT View Analyzer XAT View Composer XML View Manager Update Decomposer Table Relationships XAT XAT XAT Rewrite Single Table Updates Update Translator SI XAT XAT Executor SQL Node Generation XAT SQL Tuples Multiple SQL updates RDBMS Updating XML Views of Relational Data

  14. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  15. Relational View Update Scenario AuthorView Author Book • Root Table • Ownership or Subset Relationships • Reference Relationships Updating XML Views of Relational Data

  16. Work appeared in Literature • On the updatability of relational views • Dayal and Bernstein – IEEE transaction 1978 • A Relational Database View Update Translation Mechanism • Yoshifumi Masunaga – VLDB 1984 • Algorithms for translating view updates to database updates for view involving selections, projections, and joins. • A. M. Keller ACM SIGACT-SIGMOD 1985 • Updating Relational Databases through Object-Based Views • A. M. Keller, Barsalou, Siambela and Wiederhold – SIGMOD 1991 Updating XML Views of Relational Data

  17. Term Definitions (Keller – SIGMOD 1991) • Root Relation • A relational table under the view • Key of the view elements is same as the key of this relation <authorview> <author> <first>Michael</first> <last>Savitch</last> <title>Data Structures in C++</title> <year>2000</year> </author> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authorview> Root Author (Key : (First,Last)) Book (Key : Bookid) Updating XML Views of Relational Data

  18. Author (Key : (First,Last)) Book (Key : Bookid) First Last BookId BookId Title Year Michael Savitch 1 1 Data Structures in C++ 2000 Peter Naughton 2 2 JAVA 2 Reference 1998 Term Definitions (Contd.) • Ownership Connection (R2 is owned by R1) • Foreign key (also part of key) of R2, not unique, referring to key of R1 (1 : n) • Subset Connection (R2 is subset of R1) • Foreign key (also key) of R2, unique, referring to key of R1 (1:1) • Reference Connection (R2 References R1) • Foreign key of R2, null allowed, not unique, referring to key of R1. Updating XML Views of Relational Data

  19. Term Definitions (Contd.) • Dependency island of view • Maximal sub-tree of the tree of projections such that • Root of sub-tree is root relation • All directed paths beginning at root relation contain exclusively ownership and subset connections • Referencing Peninsula • Is a relation • directly connected to any relation of dependency island • Via reference connection Updating XML Views of Relational Data

  20. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  21. Restrictions on views • View should be in SPJ form • Only select, project and joins are allowed in view definition • View has at least one root relation • Key of table is also key of XML elements in view • No Aggregation in view definition • No aggregate columns such as max( ), count( ) etc • No explicit external dependencies • No element value computed from values of other elements Updating XML Views of Relational Data

  22. Assumptions for type of updates • Only data updates are performed • Only complete valid updates are issued FOR $root IN document(“authorview.xml”) $author IN $root/author[first = “Michael”][last = “Savitch”] UPDATE $root{ DELETE $author } <authorview> <author> <first>Michael</first> <last>Savitch</last> <title>Data Structures in C++</title> <year>2000</year> </author> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authorview> FOR $root IN document(“authorview.xml”) UPDATE $root{ INSERT <author> <first>Joe</first> <last>Smith</last> <title>FirstBook</title> <year>2002</year> </author> } Updating XML Views of Relational Data

  23. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  24. XQuery Update Grammar • A FLWU Expression FOR$binding1INXpath-expr,….. LET$binding := Xpath-expr,… WHEREpredicate1,….. updateOp,…… Where updateOp is defined as : UPDATE$binding {subOp{, subOp}* } and subOp is : DELETE$child | RENAME$childTonew_name | INSERT ( $bind [BEFORE | AFTER$child] | new_attribute(name, value) | new_ref(name, value) | content [BEFORE | AFTER$child] ) | REPLACE$childWITH ( new_attribute(name, value) | new_ref(name, value) | content ) | FOR$sub_bindingINXpath-subexpr,….. WHEREpredicate1,………. updateOp. Updating XML Views of Relational Data

  25. Running Example Mapping Query <authorview> FOR $authortuple IN document(“Default.xml”)/author/row $booktuple IN document(“Default.xml”)/book/row WHERE $authortuple/bookid = $booktuple/bookid RETURN <author> $authortuple/first $authortuple/last $booktuple/title $booktuple/year </author> </authorview> User Update FOR $root IN document(“authorview.xml”) $author IN $root/author[first = “Michael”][last = “Savitch”] UPDATE $root{ DELETE $author } Expected Effect <authorview> <author> <first>Michael</first> <last>Savitch</last> <title>Data Structures in C++</title> <year>2000</year> </author> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authorview> Mapping View <authorview> <author> <first>Peter</first> <last>Naughton</last> <title>JAVA 2 Reference</title> <year>1998</year> </author> </authorview> Updating XML Views of Relational Data

  26. My Approach • Analyze mapping query XAT to find • underlying relations • root relation for the view • relationship of other relations with root relation • Generate XAT for user update on mapping view • Massage composed tree to decompose update into updates against individual relations • Use semantic information for correct translation of updates • Generate SQL updates executed in the relational engine. Updating XML Views of Relational Data

  27. Database Catalog Dependency Island : Author Referencing Peninsulas : None Step 1 : Analysis of mapping query XAT T(<authorview>[col7]</authorview>):col8 <DB> <Author> <row> ……… </row> ……. </Author> <Book> <row> …… </row> …….. </Book> </DB> <authorview> FOR $authortuple IN document(“Default.xml”)/author/row $booktuple IN document(“Default.xml”)/book/row WHERE $authortuple/bookid = $booktuple/bookid RETURN <author> $authortuple/first $authortuple/last $booktuple/title $booktuple/year </author> </authorview> Agg() T (<author> [$col3], [$col4], [$col5], [$col6]</author>):col7 ($booktuple, title):$col5 ($booktuple, year):$col6 ($authortuple, last):$col4 ($authortuple, first):$col3 Relations : Author, Book ($col1=$col2) Author : First, Last Book : Bookid  Root Relation : Author ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 (S1, /author/row):$authortuple (S2, /book/row):$booktuple S(“Default.xml”):S1 S(“Default.xml”):S1 Updating XML Views of Relational Data

  28. Step 2 : Generation of XAT for user update Delete($root, $author) ($col2=“ Savitch”):$author ($col1=“ Michael”) FOR $root IN document(“authorview.xml”) $author IN $root/author[first = “Michael”][last = “Savitch”] UPDATE $root{ DELETE $author } ($author, last):$col2 ($author, first):$col1 ($root, author):$author (S1, ):$root S(“authorview.xml”):S1 Updating XML Views of Relational Data

  29. Composing two XATs T(<authorview>[col7]</authorview>):col8 Agg() Delete($root, $author) T (<author> [$col3], [$col4], [$col5], [$col6]</author>):col7 ($col2=“ Savitch”):$author ($booktuple, title):$col5 ($col1=“ Michael”) ($booktuple, year):$col6 ($authortuple, last):$col4 ($author, last):$col2 ($authortuple, first):$col3 ($author, first):$col1 ($col1=$col2) ($root, author):$author  (S1, ):$root ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 S(“authorview.xml”):S1 (S1, /author/row):$authortuple (S2, /book/row):$booktuple S(“Default.xml”):S1 S(“Default.xml”):S2 Updating XML Views of Relational Data

  30. Composed Algebra Tree Delete($root, $author) ($col4=“ Savitch”):$author ($col3=“ Michael”) ($author, last):$col4 ($author, first):$col3 ($col1=$col2):$root  ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 (S1, /author/row):$authortuple (S2, /book/row):$booktuple S(“Default.xml”):S1 S(“Default.xml”):S2 Updating XML Views of Relational Data

  31. Step 3 : Decomposing the Update Delete($root, $author) ($col4=“ Savitch”):$author ($col3=“ Michael”) ($author, last):$col4 ($author, first):$col3 ($col1=$col2):$root  ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 (S1, /author/row):$authortuple (S2, /book/row):$booktuple S(“Default.xml”):S1 S(“Default.xml”):S2 Updating XML Views of Relational Data

  32. Delete($root, $author)  ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 Delete($root, $author) (S2, /book/row):$booktuple (S1, /author/row):$authortuple S(“Default.xml”):S2 S(“Default.xml”):S1  ($authortuple, bookid):$col1 ($bookuple, bookid):$col2 (S2, /book/row):$booktuple (S1, /author/row):$authortuple S(“Default.xml”):S2 S(“Default.xml”):S1 Decomposing the Update (Contd.) Delete(book, Bookid = author.Bookid author.first = “Michael” author.last = “Savitch”) Delete(author, first = “Michael”, last = “Savitch”, Bookid = book.Bookid) Updating XML Views of Relational Data

  33. Delete(book, Bookid = author.Bookid author.first = “Michael” author.last = “Savitch”) Root Relation : Author Dependency Island : Author Delete(author, first = “Michael”, last = “Savitch”, Bookid = book.Bookid) Referencing Peninsulas : None Step 4 :Correct Translation of Update • Delete Algorithm (A. M. Keller, SIGMOD 1991) • Isolate Dependency island • For each projection in dependency island, delete all matching tuples from underlying relation • Identify referencing peninsulas • For each peninsula, perform a replacement on the foreign key of each matching tuple Updating XML Views of Relational Data

  34. Step 5 : Generation of SQL Update DELETE FROM author WHERE first = ‘Michael’ AND last = ‘Savitch’ AND bookid IN (SELECT bookid FROM book) Delete(author, first = “Michael”, last = “Savitch”, Bookid = book.Bookid) Updating XML Views of Relational Data

  35. Outline • Motivation • Background Material • Rainbow System • My Extension to Rainbow System • Work in Literature • Assumptions and Restrictions • Approach • Status • Evaluation • Related Work Updating XML Views of Relational Data

  36. Status • XQuery to support updates on XML • XQuery Parser (Kweelt) to parser updates • “XAT Generator” to generate update nodes in XAT • View Analyzer • Update Decomposer • Update Translator • Implementation : Ongoing • Evaluation : not done yet Updating XML Views of Relational Data

  37. Evaluation • Correct propagation of the updates. • Manual check on view reconstructed from tables after update. • Works irrespective of the mapping chosen to map XML documents into RDB. • Experiment with different mapping approaches. • Time taken to propagate the update • using different views having different no. of underlying tables. Updating XML Views of Relational Data

  38. Expected Contributions • XQuery support for XML updates • Work done with MQP group. • Framework for correct propagation of XML updates to underlying relations. • Application of object based view updating strategy to XML views • First solution for updating XML views • Implementation of the system as a proof of concept & incorporate into full working system Rainbow • Experimental evaluation. Updating XML Views of Relational Data

  39. Related Work • Querying XML views of Relational Data • J. Shanmugasundaram, Jerry Kierman, Eugene Shekita, Catalina Fan and John Funderburk – VLDB 2001 • Updating XML • Tatarinov, Ives, Alon Halevy and Daniel Weld SIGMOD 2001 • Updating Relational Databases through Object-Based Views • A. M. Keller, Barsalou, Siambela and Wiederhold – SIGMOD 1991 • Algorithms for translating view updates to database updates for view involving selections, projections, and joins. • A. M. Keller ACM SIGACT-SIGMOD 1985 • A Relational Database View Update Translation Mechanism • Yoshifumi Masunaga – VLDB 1984 • On the updatability of relational views • Dayal and Bernstein – IEEE transaction 1978 Updating XML Views of Relational Data

More Related