1 ling wang advisor: elke a. rundensteiner co-advisor: kathi fisler updating xquery views published...

51
1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

Upload: phillip-goodson

Post on 16-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

1

Ling WangAdvisor: Elke A. Rundensteiner

Co-Advisor: Kathi Fisler

Updating XQuery Views Published over Relational Data

Page 2: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

2

Outline Motivation

• Related Work

• Background:

XML, XML Views, XQuery Update Extension

• Problem Definition: - Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

• Update Strategy for PUP

• Rainfall System

• Experimental Study

• Contributions

• Conclusion

Page 3: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

3

• XML is a standard for exchanging data between web applications

• But RDBMS is mature data management technology:- Reliable persistent storage technique- Mature query optimization technique

• XML Management Systems using Relational technology- SilkRoute (AT&T), XPERANTO (IBM), RAINBOW (WPI)- Features:

# provide reliable persistent storage# support XML view mechanism for XML data publishing# support queries over XML views

• Systems must support update to become viable system

Motivation

Page 4: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

4

• View update problem in Relational databases is hard

- What is a correct translation?- How to eliminate ambiguity in translation?

• XML view update offers new challenges

- Mappings:

Data model mapping: XML vs. RelationalQuery language mapping: XQuery vs. SQL

- Consistency :

Constraints in different schemas such asXML schema, Relational schema, XML view schema

XML View Update

RDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

eg: Schema reducing (IDREF), Schema increasing (Duplicate)

Page 5: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

5

Related Work

1. Umeshwar Dayal, Philip A. Bernstein, On the Updatability of Relational Views, IEEE 1978.First work, describe criteria of correct update translation.

2. F Bancilhon and N. Spyratos, Update Semantics of Relational Views, ACM Transactions on Database Systems, 1984Complementary theory to eliminate ambiguous in update translation.

3. A. M. Keller, Barsalou, Siambela and Wiederhold, Updating Relational Databases through Object-Based Views, SIGMOD 1991View update problem in Object-base views.

4. Tatarinov Ives, Alon Halevy and Daniel Weld, Updating XML, SIGMOD 2001XQuery update extension, XML view update performance

Page 6: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

6

Where we are MotivationRelated Work Background:

XML Views, XQuery Update Extension

• Problem Definition: - Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

• Update Strategy for PUP

• Rainfall System

• Experimental Study

• Contributions

• Conclusion

Page 7: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

7

XML Schema

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema“ elementFormDefault="qualified"><xs:elementname="bib">

<xs:complexType><xs:sequence>

<xs:elementname="book" maxOccurs="unbounded"><xs:complexType>

<xs:sequence><xs:elementname="bookid" type="xs:string" nillable="false"/><xs:elementname="title" type="xs:string" nillable="false"/><xs:elementname="author">

<xs:complexType><xs:sequence>

<xs:elementname="aname" type="xs:string" maxOccurs="unbounded"/></xs:sequence>

</xs:complexType></xs:element>

</xs:sequence>……

</xs:complexType></xs:element>

</xs:schema>

Page 8: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

8

XML documentBib.xml

<publisher><pname>Addison-Wesley</pname><location>Boston</location>

</publisher><review>

A clear and detailed discussion of UNIX programming.</review>

</book><book year="2000">

<bookid>98003</bookid><title>Data on the Web</title><author>

<aname>Serge Abiteboul</aname><aname>Peter Buneman</aname><aname>Dan Suciu</aname>

</author><publisher>

<pname>Morgan Kaufmann Publishers</pname><location>New York</location>

</publisher><review>

A very good discussion of semi-structured database systems and XML.

</review></book>

</bib>

<bib><book year="1994">

<bookid>98001</bookid><title>TCP/IP Illustrated</title><author>

<aname>W. Stevens</aname></author><publisher>

<pname>Addison-Wesley</pname><location>San Francisco</location>

</publisher><review>

One of the best books on TCP/IP.</review>

</book><book year="1992">

<bookid>98002</bookid><title>Programming in Unix</title><author>

<aname>Bram Stoker</aname></author>

Page 9: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

9

Example Database ( Inlining)

IID PID aname

1.0 11.0 W.Stevens

2.0 21.0 Bram Stoker

1.0 31.0 Serge Abiteboul

2.0 31.0 Peter Buneman

3.0 31.0 Dan Suciu

IID PID bookid title author_IID year

1.0 0.0 98001 TCP/IP Illustrated 11.0 1994

2.0 0.0 98002 Programming in Unix

21.0 1992

3.0 0.0 98003 Data on the Web 31.0 2000

author

book

IID pname location

1.0 Addison-Wesley San Francisco

2.0 Addison-Wesley Boston

3.0 Morgan Kaufman publishers

New York

publisher

IID PID review

1.0 1.0 One of the best books on TCP/IP.

2.0 2.0 A clear and detailed discussion of UNIX programming.

3.0 3.0 A very good discussion of semi-structured database systems and XML.

review

Legend:

Primary Key

Unique Key

Non Key

RDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

Page 10: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

10

Default View

<DB><book>

<row><IID>1.0</IID><PID>0.0</PID><bookid>98001</bookid><title>TCP/IP Illustrated</title><author_IID>11.0</author_IID><year>1994</year>

</row>...</book><author>

<row><IID>1.0</IID><PID>11.0</PID><aname>W. Stevens</aname>

</row>...</author>

<publisher></row>

<IID>1.0</IID><PID>1.0</PID><pname>Addison-Wesley</pname><location> SanFrancisco</location>

<row>...</publisher><review>

<row><IID>1.0</IID><PID>1.0</PID><review>

One of the best books on TCP/IP.</review>

</row>...</review>

</DB>

- Bridging the gap between Relational database and XML data models - Show database structure, 1:1 mapping

RDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

Page 11: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

11

XML View

<bib>FOR $book in document("default.xml")/book/rowRETURN{

<book year=$book/year/text() bookid= $book/bookid/text()> <title>$book/title/text()</title>, <author>

FOR $aname in document("default.xml")/author/rowWHERE $book/author_IID = $aname/PIDRETURN{

<aname>$aname/aname/text()</aname>} </author></book>

}</bib>

- Information hiding- User specific data wrapping <bib>

<book year="1994“ bookid=“98001”><title>TCP/IP Illustrated</title><author>

<aname>W. Stevens</aname></author>

</book><book year="1992“ bookid=“98002”>

<title>Programming in Unix</title><author>

<aname>Bram Stoker</aname></author>

</book><book year="2000“ bookid=“98003”>

<title>Data on the Web</title><author>

<aname>Serge Abiteboul</aname><aname>Peter Buneman</aname><aname>Dan Suciu</aname>

</author></book>

</bib>

View Query

Virtual XML ViewRDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

Page 12: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

12

XQuery Update Grammar

  FOR $binding1 IN Xpath-expr,…..LET $binding := Xpath-expr,…WHERE predicate1,…..updateOp,……

  Where updateOp is defined as :   UPDATE $binding {subOp {, subOp}* } and subOp is : 

DELETE $child |INSERT ( $bind [BEFORE | AFTER $child]

| new_attribute(name, value) | new_ref(name, value) | content [BEFORE | AFTER $child] ) |

REPLACE $child WITH ( new_attribute(name, value)| new_ref(name, value)| content ) |

FOR $sub_binding IN Xpath-subexpr,…..WHERE predicate1,……….updateOp.

- XQuery does not support update operations- Update extension for XQuery language proposed in [SIGMOD2001]- FLWU Expression

RDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

Page 13: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

13

FOR $book IN document(“bib.xml")/bookLET $author:=$book/authorWHERE $book/title = “TCP/IP Illustrated”UPDATE $author{ INSERT

<aname>"Peter Naughton "</aname>}

Insert update

Update XQuery example

Updated view

<bib><book year="1994“ bookid=“98001”>

<title>TCP/IP Illustrated</title><author>

<aname>W. Stevens</aname><aname>"Peter Naughton "</aname>

</author></book><book year="1992“ bookid=“98002”>

<title>Programming in Unix</title><author>

<aname>Bram Stoker</aname></author>

</book><book year="2000“ bookid=“98003”>

<title>Data on the Web</title><author>

<aname>Serge Abiteboul</aname><aname>Peter Buneman</aname><aname>Dan Suciu</aname>

</author></book>

</bib>

RDBMS

View Query

XML View

XQuery update

SQL Update

RDBMS

Default View

Page 14: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

14

Where we are MotivationRelated Work Background:

XML Views, XQuery Update Extension

Problem Definition: - Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

• Update Strategy for PUP

• Rainfall System

• Experimental Study

• Contributions

• Conclusion

Page 15: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

15

General Characterization of XVUP

Information

Modification

Instance

Language

View QueryRDB Content

RDB Schema

Integrity Constraints(Key, FK)

Local Constraints(Not Null, domain)

BCNF / 3NF / 2NF

Acyclic Dependency / Cyclic Dependency

Duplicates

( Aggregation )( Recursion )

Hierarchy Consistency

Key ExpositionNon Correlation predicates attribute exposition

Correlation predicates attributes exposition

Nested queries

DeletionInsertion

Replacement

Rename

Order

Set of eachGroup Update

( Schema Change )

Assumption

Exploring space

Page 16: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

16

Schema Mapping in XVUP

Constraints in

Extracted XML View Schema

Cardinality

Hierarchy from view query

Duplication

Constraints in XML Schema/DTD

Domain of element/attributes

Key Constraints

Referential Integrity Constraints (Foreign

Key)

Optional element

Nillable attributes

Cardinality constrains

Hierarchy

Choice

Inclusion dependency (ID/IDREF)

Sequence

Constraints in Relational

Database schema

Domain Constraints of attribute in

relation

Primary key / unique key of table

Foreign key between tables

Attributes is Null / Not null

Table definition

Global Constraints

Constraints in Filtered XML View

Schema

Domain

Cardinality

Null/Not null

Hierarchy

?

?

XML View Schema

ESchemaFSchema

Loading

View Query

Problem Definition:

- Characterize the XVUP- Schema mapping in XVUP

- Classify subproblems: RUP, PUP

- Update operation

- Correct translatability

Page 17: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

17

Example of FSchema vs. ESchema

<bib>FOR $book in document("default.xml")/book/rowRETURN{

<book year=$book/year/text()><bookid>$book/bookid/text()</bookid>,

<title>$book/title/text()</title>, <author>

FOR $aname in document("default.xml")/author/rowWHERE $book/author_IID = $aname/PIDRETURN{

<aname>$aname/aname/text()</aname>} </author></book>}

</bib>

IID PID aname

1.0 11.0 W.Stevens

IID PID bookid title author_IID year

1.0 0.0 98001 TCP/IP Illustrated 11.0 1994

author

bookFschema:

bookid (Not Null)title (Varchar(256))

Eschema:Hierarchy: book = parent(bookid)Cardinality: (book:aname) = (1:n)

Relational database

View Query

Page 18: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

18

Partition for XVUP Problem Space

• Publishing-based Update Problem (PUP)- General problem ---- updating freely constructed XQuery view.

- Touching all features in Language dimension.

• Round-trip Update Problem (RUP)- Simplest special problem.

- View has same schema

as original XML

document

- No abnormal case exists.

RDBMS

View Query

XML View

RDBMS

XML Doc+Schema

12

RUP

PUP

Problem Definition:

- Characterize the XVUP- Schema mapping in XVUP

- Classify subproblems: RUP, PUP

- Update operation

- Correct translatability

Page 19: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

19

XML View Update Operation

• Complete vs. Partial update

- Complete ---- insert/delete/replace a fully specified view-element instance

- Partial ---- insert/delete/replace a component of view-element instance

• Valid vs. Invalid update- Valid ---- Never against any constraints in

ESchema, Fschema (domain+null).

Update translation.

- Invalid ---- Against Constraints.

Rejected.

<bib><book year="1994">

<bookid>98001</bookid><title>TCP/IP Illustrated</title><author>

<aname>W. Stevens</aname></author>

</book><book year="1992">

<bookid>98002</bookid><title>Programming in Unix</title><author>

<aname>Bram Stoker</aname></author>

</book><book year="2000">

<bookid>98003</bookid><title>Data on the Web</title><author>

<aname>Serge Abiteboul</aname><aname>Peter Buneman</aname><aname>Dan Suciu</aname>

</author></book>

</bib>

Complete

Partial

Problem Definition:

- Characterize the XVUP- Schema mapping in XVUP

- Classify subproblems: RUP, PUP

- Update operation

- Correct translatability

Page 20: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

20

Correct Update Translatability

• No side effectOnly desired update is performed on view.

• One step changes- Each database tuple affected by at most one step of update operation- Implications: No order between update operations

Could affect same table several times• Minimal changes

- No valid translation is subset of current translation- No extraneous updates

• Replacement cannot be simplified- Two replaces could get same result, pick simple one- Replace minimum attribute set / non-key replacement

• No insert-delete pairs- Replace is cheaper than Insert/Delete pair

Problem Definition:

- Characterize the XVUP- Schema mapping in XVUP

- Classify subproblems: RUP, PUP

- Update operation

- Correct translatability

Page 21: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

21

Where we are Motivation Related Work Background Problem Definition Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

• Rainfall System

• Experiment Study

• Contributions

• Conclusion

Page 22: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

22

Problem for PUP

Information

Modification

Instance

Language

Duplicates

( Aggregation )( Recursion )

Hierarchy Consistency

Key ExpositionNon Correlation predicates attribute exposition

Correlation predicates attributes exposition

Nested queries

Assumption

Exploring spaceExposition feature

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 23: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

23

Exposition Completeness• Key Exposition

- Primary key of underlying relation has to be exposed- except automatic generated key(implication: user has right to update it)

• Non Correlation predicates attribute exposition (select condition)- variable involved in predicates has to be exposedeg: $book/bookid = “98004”

bookid has to be exposed in view result • Correlation predicates attribute exposition (join condition)

- variable involved in predicates has to be exposedeg: $book/authorid = $author/id

then authorid in book table, id in author table have to be exposed

• Complete Exposition

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 24: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

24

Construction Consistency

IID PID bookid title author_IID year

1.0 0.0 98001 TCP/IP Illustrated 11.0 1994

2.0 0.0 98002 Advanced Programming in the Unix environment

21.0 1992

3.0 0.0 98003 Data on the Web 31.0 2000

book

IID pname location

1.0 Addison-Wesley

San Francisco

2.0 Addison-Wesley Boston

3.0 Morgan Kaufman publishers

New York

publisher

• Reason: freely construct the view query• Confliction between FSchema and ESchema• View structure could be inconsistent with RDB, causing side-effect in update translation.

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 25: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

25

<bib>FOR $book IN document("default.xml")/book/row,

$publisher IN document("default.xml")/publisher/rowWHERE $book/author_IID = $publisher/IID RETURN

<book> $book/bookid, $book/title,

<publisher_info> $publisher/pname </publisher_info></book>

</bib>

<bib><book>

<bookid>98001</bookid><title>TCP/IP Illustrated</title><publisher_info>

<pname> Addison-Wesley</pname></publisher_info>

</book>……

</bib>

Construction Consistency

<bib>FOR $book IN document("default.xml")/book/row, $publlisher IN document("default.xml")/publisher/rowWHERE $book/IID = $publisher/IID RETURN

<publisher_info> $publisher/pname, <book> $book/bookid, $book/title </book> </publisher_info>

</bib>

<bib><publisher_info>

<pname> Addison-Wesley </pname><book>

<bookid>98001</bookid><title>TCP/IP Illustrated</title>

</book></publisher_info>……

</bib>

View Query Example1 ---- Consistent

View Query Example2 ---- Inconsistent

Delete

Delete

Side Effect

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 26: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

26

How to find inconsistent construction?

• Implicit hierarchy in Relational context:

- Table vs. Attribute- Key vs. Foreign-Key

bookid title year pname location review

BOOK

bookid authorid name

AUTHOR

Then, book is parent of all its attributes, book is parent of author

• Hierarchy in View context

- Return clause in FLWR expression- Variable binding in FOR clause

View Schema Graph (VSG) to describe hierarchy in FSchema

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

View Relationship Graph (VRG) to describe hierarchy in ESchema

Page 27: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

27

bib

Publisher_info

book

book/row/bookid book/row/title

publisher/row/pname

book

book/row/bookid book/row/title publisher

Publisher/row/pname

Hierarchy in relational context:View Relationship Graph

Hierarchy in view context:View Schema Graph

Reducing Operator:- Rename- Add- Delete

bib

book

book/row/bookid book/row/title Publisher_info

Publisher/row/pname

Rename

Page 28: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

28

Duplicate

- Two vertexes in VSG are exposed from same relational attribute.- Partial updates touching duplicate elements are not translatable.

why? Cause ambiguous/inconsistent effect on underlying relation.

book

publisher author

book/row/title

update

book/row/title author/row/anamepublisher/row/pname

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 29: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

29

View Features Update Type

Exposition complete

Consistency No Duplication

Complete Update

Partial Update

Y Y Y Y Y

Y Y N Y Case 1

Y N Y Y Case 2

Y N N Y Case 3

N Y Y N N

N Y N N N

N N Y N N

N N N N N

View Updatability in PUP Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Well-formed View

Page 30: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

30

Case study in PUP

• Case 0: Well-formed View Complete Exposition + Consistent Construction + No Duplication

• Case 1: Complete Exposition + Consistent + DuplicationPartial update + touch one side of duplication is not translatable

• Case 2: Complete Exposition + In-Consistent + No-Duplicationsub-tree rooted at inconsistent edge is not updatable

• Case 3: Complete Exposition + In-Consistent + Duplicationcase 1 case 2

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 31: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

31

Round-Trip Update Problem (RUP)

- View is the same structure and semantics as the original XML document.- RUP falls into Well-formed View.- Any Valid Updates on it are always Translatable.

<bib><book year="1994">

<bookid>98001</bookid><title>TCP/IP Illustrated</title><author>

<aname>W. Stevens</aname></author><publisher>

<pname>Addison-Wesley</pname><location>San Francisco</location>

</publisher><review>

One of the best books on TCP/IP.</review>

</book>… …

<bib>

IID PID bookid title author_IID year

book

IID PID review

reviewIID PID aname

author

IID pname location

publisher

Complete exposition? YESConstruction consistency? YESNO Duplication? YES

Update Strategy for PUP

Exposition completeness

Construction consistency

Duplicate

View updatability in PUP

Page 32: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

32

Where we are Motivation Related Work Background Problem Definition

- Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

Update Strategy for PUP Rainfall System

• Experiment Study

• Contributions

• Conslusion

Page 33: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

33

XAT Rewriter

View Composer

DB2

View Query

Parsed Tree

Multiple SQL updates

SQL Generator

User Query

SQL

XAT Executor

XAT

XAT

XAT Generator

XQuery Parser

View Query

Oracle

XQuery ViewManager

SQL-ServerSybase

RDBMS

XAT XAT

Information Collecter

View Analyzer

Valid Update Checker

Update Decomposer

Update Translator

Update Propagator

Meta -Data

XAT

XATView Query XAT

Materialized data

Process Step

Process Flow

Data Flow

RDBMS

Legend

Rainfall

RainbowQueryEngine

Result XML

Page 34: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

34

Function updateDecomposition (XAT t)begin

XATleaves get all leave node of XAT tresultUpdate new array of RelationalUpdatefor ( all node n in XATleaves )

up new RelationalUpdateup.updateType same type as root node type of XAT twhile ( n is not null )

opUpdateDecomp(node, up)n parent of node n

decideUpdateType (up)put up into resultUpdate

distinctResultUpdate(resultUpdate)EndFunction decideUpdateType (RelationalUpdate up)begin if ( up.updateType is insert or replace )

do nothing else

if ( up.updateType is delete )if ( up.updateColumns include all attributes of relation up.tableName )

up.updateType deleteelse

up.updateType replace end

Rainfall Update System

Fundamental concept

Update decomposition

Update propagationUpdate Decomposition Algorithm

Page 35: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

35

Update DecompositionTagger

Source

Join

NavNav

Source

Function opUpdateDecomp( XATNode n, RelationalUpdate up)Begin

if ( n is a Navigate node )up.tableName get table name from n if it has one

elseif ( n is a Select node or a Join node )

up.whereClause condition in predicate of node nelse

if ( n is a Tagger node )if ( up.updateType is delete )

if ( n.DOMpattern matches DOM pattern of the element node to be inserted )up.updateColum.columnName extract names of attributes from Tagger pattern

if ( up.updateType is insert ) if ( n.DOMpattern matches DOM pattern of the element node to be inserted )

up.updateColumn.columnName extract names of attributes from Tagger patternup.updateColumn.columnValue extract attribute values from pattern of inserted element

if ( up.updateType is replace) if ( n.DOM pattern matches DOM pattern of the element node to replacing )

up.updateColum.columnName extract names of attributes from Tagger pattern up.updateColumn.oldColumnValue extract old values from relational database up.updateColumn.columnValue extract values from pattern of the replacing element

else do nothing return upend

Page 36: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

36

Fundamental ---- connection

Ownership

connection

Subset connection Referencing connection

X1 X2X1=UK/PK(R1),

X2PK(R2)X1=UK/PK(R1),

X2=PK(R2)X1=UK/PK(R1),

X2 NK/UK(R2),

Cardinality1:n 1:[0,1] 1:n

Representation R1 R2 R1 R2 R1 R2

R

We divide Foreign key as three types:

Inner-going Outer-going

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

FK

Page 37: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

37

Book

Author

Review State

PublisherPrices

PhoneBook

1. Delete

2. Delete 3. Delete

4. Delete

5. Replace

Example for delete propagation

-Dependency Island

- Referencing peninsula

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

Page 38: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

38

Example for insert propagation

Book

Author

Review State

PublisherPrices

PhoneBook

1. Extend2. (C1) Insert(C2) Reject

(C3) Replace

3. Checking

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

Page 39: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

39

Where we are

Motivation Related Work Background Problem Definition

- Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

Update Strategy for PUP Rainfall System Experiment Study

• Contributions

• Conclusion

Page 40: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

40

0

100000

200000

300000

400000

500000

600000

700000

800000

900000

1000000

200 400 600 800 1000 1200

File Size(elements/file)

Time(ms)

Inline Loading Delete

Updating vs. Re-loading

Note: (1) Loading strategy: shared inlining. (2) View is same complexity with document (RUP)

Page 41: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

41

0

5000

10000

15000

20000

25000

30000

35000

200 400 600 800 1000 1200File S ize

(elements/file)

Time(ms)

Delete Insert Replace

Translation for different update types

Note: (1) Same View between update types (2) Update is same granularity

Page 42: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

42

Performance among different translation steps

Note: (1) Database size: number of books= 800. (2) Same view between different update types (3) Update is translatable (4) Update has same granularity

0

2500

5000

7500

10000

12500

15000

17500

20000

Delete Insert Replace Update Type

Time(ms)

ViewQuery

UserQuery

XAT Optimization

View Analysis

Update Decompososition

Update Translation & Propagation

Execution

Page 43: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

43

Where we are

Motivation Related Work Background Problem Definition

- Characterize the XML View Update Problem (XVUP)

- Correct Translatability

- Classify subproblems: RUP, PUP

Update Strategy for PUP Rainfall System Experiment Study Contributions

• Conclusion

Page 44: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

44

Contributions

• Characterize and propose a classification of the XML view update problem, and describe the updatability of each class.

• Present a decomposition-based update translation algorithm that correctly translates XQuery updates on views into a set of SQL-level updates.

• Implement Update System Framework (Rainfall) to implement the proposed strategy.

• Provide experimental results studying the performance of update strategies.

Page 45: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

45

Conclusion

• We study the view update problem in XML context and provide solution for solving this problem

• Future work.- Order sensitive view update- Batch update processing- Performance in update translation

- Choose trigger for query plan optimization- Use index speeding up path expression evaluation- Use materialized view XAT to improve performance- re-write and optimize XAT

- How to deal with schema changes

Page 46: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

46

Thanks

• Advisor: Prof. Elke A. Rundensteiner.

• Co-advisor: Prof. Kathi Fisler.

• Group member: Mukesh Mulchandani in Rainfall system implementation.

• Xin Zhang and Rainbow group members in base system supporting.

Page 47: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

47

Appendix

Algorithm used in our Update Strategy

Page 48: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

48

• Dependency Island (DI) of root relation R- Rooted at R.- Maximal sub-tree.- All inner-going ownership and subset connections of R.

• Referencing Peninsula (RP) of root relation R- A relation Rj- Directly connected to any relation of dependency island Rk via

Reference connection Rk Rj

• Referenced Continent( RC) of root relation R- Rooted at R. - Maximal sub-tree.- All outer-going ownership / subset / reference connections of R.

Dependency Island /Reference Peninsula

RDI

RPRC

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

Page 49: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

49

View Mapping Graph (VMG) for running example

book

author publisher review

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

Page 50: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

50

Delete Propagation

Assuming update is to delete a tuple t from relation R.

(1)Isolate the dependency island DI of r.

(2)For each relation in DI of r, delete all tuples dependent on t.

(3)For each reference peninsula attached to DI of r, perform a replacement on the foreign key of each matching tuple.

(4) For relations in DI of r that has dependency island, deletion is propagated( repeatedly, if necessary) to their DI.

(5) For those relations involved in deletion, replacement is executed on their RP.

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation

Page 51: 1 Ling Wang Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XQuery Views Published over Relational Data

51

Insertion Propagation

Assuming update is to insert a tuple t into relation R.

(1)Extend the view tuple t as t' with values for the attributes that have been exposed out in the view definition.

(2) Case 1: An identical tuple exists in R, reject the update.

(3) Case 2: If t' does not match any key of underlying database relation, perform an insertion in R. Further, for RC of R, a check-insertion operation is done.

(4)Case 3: If t' matches the key of an existing tuple, but some values for non-key attributes differ. If R has dependency island, reject the update, otherwise, performe replacement of t with t'.

Rainfall Update System

Fundamental concept

Update decomposition

Update propagation