Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XML Views over Relational Data.

Similar presentations


Presentation on theme: "Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XML Views over Relational Data."— Presentation transcript:

1 Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XML Views over Relational Data

2 Outline Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Round-Trip update problem ( RUP) Update Strategy for Publish-based update problem ( PUP) XVUP System Architecture Contribution Related Work

3 XML is a standard for information exchange over internet But RDBMS is mature - Mature query optimization techniques - High query performance Research Topic on dealing with XML with relational technology: - Publishing XML over relational database: SilkRoute (AT&T), XPERANTO (IBM), RAINBOW - Storing XML into RDBs LegoDB (BellLab), RAINBOW Support Update features Our Work will focus on Content updates using XQuery language Motivation

4 Step1: Expressing updates in XQuery - Extension to XQuery - Extension to XML query Parser to support Update features Step2: Update RD through XML View - Keep Consistency - Translate XML View Updates (XQuery) into Relation Table Updates (SQL) What should we do? RDBMS View Query XML View XML Update Query SQL Update RDBMS

5 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Round-Trip update problem ( RUP) Update Strategy for Publish-based update problem ( PUP) XVUP System Architecture Contribution Related Work

6 XML Schema Bib.xsd

7 XML document USD USD Addison-Wesley Boston A clear and detailed discussion of UNIX programming Data on the Web Serge Abiteboul Peter Buneman Dan Suciu DEM Morgan Kaufmann Publishers New York A very good discussion of semi-structured database systems and XML TCP/IP Illustrated W. Stevens USD Addison-Wesley San Francisco One of the best books on TCP/IP Advanced Programming in the Unix environment Bram Stoker Bib.xml

8 FOR $book IN document(“bib.xml”)/book LET $titles = $book/title WHERE <= 2000 RETURN $book/title, count($titles) TCP/IP Illustrated Advanced Programming in the Unix environment 2 Xquery: Query Result: XQuery Example

9 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 | RENAME $child To new_name | 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.

10 FOR $book IN document(“bib.xml")/book LET$author:=$book/author WHERE $book/title = “TCP/IP Illustrated” UPDATE $author{ INSERT "Peter Naughton " } Insert Update Update query example TCP/IP Illustrated W. Stevens "Peter Naughton " USD Addison-Wesley San Francisco One of the best books on TCP/IP. ……

11 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Update Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, SUP Update Strategy for Round-Trip update problem ( RUP) Update Strategy for Publish-based update problem ( SUP) XVUP System Architecture Contribution Related Work

12 Correct Update Translatability No side effect One Step changes - Each database tuple is affected by at most one step of update operation - Implications: No order between update operation Could affect same table several times Minimal changes - No valid translation is subset of current translation - No extraneous updates Replacement can not be simplified - Two replace could get same result, pick simple one - Replace the minimum attribute set No insert-delete pairs - Replace is cheaper than Insert/Delete pair

13 General Classification of XML View Update(XVUP) Four dimensions for XVUP be studied: Information Dimension: - The amount of information available for XVUP eg: Constraints, Keys, Virtual View Definition, Underlying Relation Modification Dimension: - What modifications the XVUP can handle? eg: Content ( Insert/Delete/Replace/Move/Rename…), Schema Language Dimension: - View form eg: Algebra, XML Query language, SPJ, duplicate, Recursion, Aggregation Instance Dimension: - Requirement for DB eg: BCNF, 3NF, others?

14 Virtual View Definition Underlying Relation RDB Schema Integrity Constraints (Key, FK) Deletion Insertion Replacement Rename Move Set of each Group Update Schema Change Duplicates Aggregation Recursion Hierarchy Consistency Key Exposition Non Correlation predicates attribute exposition Correlation predicates attributes exposition BCNF 3NF Information Modification Instance Language Local Constraints (Not Null, domain) 2NF 1NF General Classification of XVUP

15 Information dimension - Why Local Constraints ? ---- Valid Update An Update to an XML view is Valid Update iff the update never inviolate any XML semantic constraints. - Why Integrity Constraints ? Update Propagation Knowledge of dependency of RDB, keep global integrity Instance dimension - BCNF ---- preserving of data dependency Modification dimension - Content update ( insertion/deletion/replacement ) Only think about language dimension! Why?

16 bib book bookidtitle author prices aname source currency year (0,n) (1,n) (1,1) (0,1) (0,n)(1:1) value publisher pnamelocation (0,1) review (0,1) XML Schema Graph (XSG) -Remember hierarchical information of XML view or XML document 1 (1,1) 1 111

17 Duplicate Duplicate: - two vertex in XSG are exposed from same relational attribute. - Partial updates touching duplicate elements are not translatable. why? Cause ambiguous/inconsistent for underlying relation. book publisher author titleanamepnametitle Book/title update

18 Exposition Features 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 exposed eg: $book/bookid = “98004” bookid has to be exposed in view result Correlation predicates attributes exposition (join condition) - variable involved in predicates has to be exposed eg: $book/authorid = $author/id then authorid in book table, id in author table have to be exposed Complete Exposition

19 Why? Flexibility in constructing view, could against RDB. Hierarchy in Relational Semantic: - Table vs. Attribute - Key vs. Foreign-Key bookidtitleyearpnamelocationreview BOOK bookidauthoridname AUTHOR Then, book is parent of all its attributes, book is ancester of author - ID pairs. ( Recursive table like edge) ??? sourcepositionnametarget 1.0 book bookid98003 Hierarchy Consistency Note: Same implication with default XML view generation

20 Hierarchy Consistency -Transitivity holds: Ai ancestor Aj ancestor Ak ancestor Ai PKUKNK R

21 Consistent edge in XSG: edge has same ancestor-descendant with underlying relation Hierarchy Consistency BIB AUTHOR ANAMEBOOK BOOKIDTITLE David Sklansky TCP/IP Illustrated …… Inconsistent edge Author/aname Book/bookid Book/title FOR $book IN document("default.xml")/books/Row, $author IN document("default.xml")/author/Row WHERE $book/Author_IID = $author/PID RETURN $author/aname, $book/bookid, $book/title Un-updatable

22 Consistent edge construction View is consistent construction iff all edges in XSG are consistent edge. Inconsistent Construction View is inconsistent construction if exist an inconsistent edge. Translatability All update worked on sub-tree rooted in inconsistent edge are not translatable. Hierarchy Consistency

23 Assumption & Case Study General Assumption - RDB has no cyclic dependencies - No order issue Typical View update problem - Round-Trip Update problem (RUP) - Semi-structured Update problem (SUP) RDBMS View Query XML View RDBMS XML Doc+Schema 1 RUP: View = Schema SUP: View  Schema 2

24 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Update Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Publish-based update problem ( SUP) Update Strategy for Round-Trip update problem ( RUP) XVUP System Architecture Contribution Related Work

25 Semi-structured Update Problem (SUP) Update Translatability Exposition complete ConsistencyDuplicationComplete Update Partial Update YYYYCase 1 YYNYY YNYYCase 2 YNNYCase 3 NYYNN NYNNN NNYNN NNNNN

26 Semi-structured Update Problem (SUP) Case 1: Complete Exposition + Consistent + Duplication Partial update + touch duplication is not translatable Case 2: Complete Exposition + In-Consistent + No-Duplication sub-tree rooted at inconsistent edge is not updatable Case 3: Complete Exposition + In-Consistent + Duplication - case2  case 3, same as case 2 for inconsistent part - partial update touch duplication is not translatable

27 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Update Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Publish-based update problem ( SUP) Update Strategy for Round-Trip update problem ( RUP) XVUP System Architecture Contribution Related Work

28 Round-Trip Update Problem Loading Features Structure Preserving ( hierarchy information of XML) Complete Structure Loading ---- each edge e(v1,v2) in XSG is mapped to a hierachical relationship defined in relational semantic. Lossless Structure Loading ---- could re-construct XML view with same structure information as original XML document. Complete Structure Loading  Lossless Structure Loading

29 IIDPIDBOOK IIDPIDBOOKIDTITLEAUTHOR_IIDPUBLISHER_IIDYEAR IIDPIDANAME IIDPIDSOURCECURRENCYVALUE BIB BOOK AUTHOR PRICE IIDPIDPNAMELOCATION Complete Structure Loading for example XML schema (Basic Inline)

30 IIDPIDBOOK IIDPIDBOOKIDTITLEAUTHOR_IIDPNAMELOCATIONYEAR IIDPIDANAME IIDPIDSOURCECURRENCYVALUE BIB BOOK AUTHOR PRICE Lossless Structure Loading for example XML schema ( Shared Inline)

31 Round-Trip Update Problem Semantic Preserving ( Constraints information of XML) - Five kinds of constraints: Domain Constraints, Not null constraints, Key Constraints, Cardinality Constraints (0,1) at most ---- NULL + UNIQUE (0,n) any ---- eg: Separate Table/ overflow table (1,1) only ---- NOT NULL + UNIQUE (1,n) at least ---- Not Null Inclusion Dependency ( IDREF) Keep as duplicate Separate table with K-FK connection Complete Semantic Loading --- keep all semantic constraints in RDB schema

32 Round-Trip Update Problem loading strategy feature for RUP Lossless Structure loading + Complete Semantic Loading Update Translatability any valid update are translatable in RUP

33 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Update Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Publish-based update problem ( SUP) Update Strategy for Round-Trip update problem ( RUP) XVUP System Architecture Update Strategy Contribution Related Work

34 Parser View Analyser Valid Update Checker Translatability Checker Update Decomposer Translator Update Propagation Execution Engine View DB Trigger SQL Update XQuery System Architecture

35 Where we are Motivation (Why?) Background: XML View, Update Extension for XQuery Problem Definition: - Correct Update Translatability - General Classification of XML View Update(XVUP) - Typical Case Study: RUP, PUP Update Strategy for Publish-based update problem ( SUP) Update Strategy for Round-Trip update problem ( RUP) XVUP System Architecture Update Strategy Contribution Related Work

36 Fundmental ---- connection Ownership connection Subset connectionReferencing connection X1 & X2 X1=NK/PK(R1), X2  PK(R2) X1=NK/PK(R1), X2=PK(R2) X1=NK/PK(R1), X2  NK/UK(R2), Cardinality 1: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

37 R1 is the owner of R2 if: (a) every tuple in R2 must be connected to an owning tuple in R1 (b) Deletion of an owning tuple in R1 requires deletion of all tuples connected to that tuple in R2 (c) Modification of X1 in an owning tuple of R1 - propagation of the modification to the matching attributes X2 of all owned tuples in R2 or - deletion of those tuples. Fundmental ---- Ownership Connection

38 Fundmental ---- Reference Connection R1 is referencing to R2 if: (a) Every tuple in R2 must either be connected to a referenced tuple in R1 or have null value for X1 ( the latter is allowed only when X1  NK(R1). (b) Deletion of a tuple in R1 requires - deletion of its referencing tuples in R2 - assignment of null values to attributes X2 of all the referencing tuples in R2. (c) Modification of X1 in a referenced tuple of R1 - propagation of the modification to attributes X2 of all referencing tuples in R2 - assignment of null values to attributes X2 of all referencing tuples in R2 (unique + NULL) - deletion of those tuples. (unique + Not NULL)

39 Fundmental ---- Subset Connection R1 and R2 is subset connection if: (a) Every tuple in R2 must be connected to one tuple in R1. (b) Deletion of a tuple in R1 requires deletion of the connected tuple in R2 ( if the latter exists) (c) Modification of X1 in a tuple of R1 requires - propagation of the modification to attributes X2 of its connected tuple in R2 - deletion of the R1 tuple. ( reject update)

40 XML View Mapping Graph (VMG) Graph G(V,E) is represented as follows: Nodes: - Core Relation : Relations underlying View - Extended Relation: Relations connected with Core Relation by FK. - Involved Relation: Relations connected with Extended Relation or other involved relation by FK Edges: connections between two relation node.

41 From DAG to Set-Tree Observation: - DAG: No recursion in View - Set of trees: replicating subtrees rooted at vertices having multiple incoming edges. XML View Mapping Graph (VMG)

42 IIDPIDBOOK IIDPIDBOOKIDTITLEAUTHOR_IIDPUBLISHER_IIDYEAR IIDPIDANAME IIDPIDSOURCECURRENCYVALUE BIB BOOK AUTHOR PRICE IIDPIDPNAMELOCATION VMG for Basic Inline Loading Strategy PUBLISHER

43 Pivot Relations (PR) - Core Relation - key is exposed in the view - not included in other tree rooted in pivot relation - out-going ownership/subset connections to other Core Relations = 0 Implication: - Start point of sub-tree of VMG Fundmental ---- Pivot Relation

44 Book PricePublisherAuthor Bib Book PricePublisherAuthor Bib Book PricePublisherAuthor Bib Pivot Relation Example for PR

45 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 R k via Reference connection Rk Rj Dependency Island /Reference Peninsula

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

47 analysisVMG(){ new VMG(V,E) for each underlying relation Ri put Ri into V as a node of VMG for each relation Rj  DB if ( Foreign key from Rj->Ri) then { identifyConnectionType(Ri,Rj) put edge e(Rj->Ri) with connection type(o/s/r) into E } else if ( Foreign key from Ri->Rj) then { identifyConnectionType(Ri,Rj) put edge e(Ri->Rj) with connection type(o/s/r) into E } else{} return VMG } Step1: View Analyser

48 updateTranslatabilityChecking( XAT_tree, update, VMG){ if ( expositionCompletenessChecking(VMG)) if ( completeUpdate(update) ) return true; else{ if ( duplicationChecking(VMG, update) ) if ( expositionConsistencyChecking(VMG)) return true; return false; } Step2: Update Translatability Checking

49 Step3: Update Decomposition updateDecomposition(XAT_tree) { XATleave = get all leave node of XAT_tree resultUpdate = array of RelationalUpdate for all XAT_leave do{ node = ith XAT_leave update = ith resultUpdate set updateType by looking at the root of XAT_tree while node != null { update = opUpdateDecomp( node, update) node = parent node } distinctResultUpdate(); } Tagger Source Join Nav Source

50 opUpdateDecomp( XAT_node, update){ if XAT_node is a Navigate node update.tableName = get table name from node if it has one elseif XAT_node is a Select node or a Join node add the condition into whereClause of update break any complex binary conditions into simple binary conditions and store the conditions to be referred while extending tuples in case of insert and replace updates elseif XAT_node is a Tagger node if type of update is delete extract names of attributes from tagger pattern fill in the updateColumn vector of update if type of update is Insert if the DOM pattern of element represented by the tagger matches DOM pattern of the element to be inserted extract names of attributes from tagger pattern extract values of attributes from pattern of element to be inserted fill in the updateColumn vector of update if type of update is Replace if the DOM pattern of element represented by the tagger matches DOM pattern of the replacing element extract names of attributes from tagger pattern extract old values by querying the relational database extract new values from pattern of the replacing element fill in the updateColumn vector of update else do nothing return update }

51 Step4: Delete Propagation Delete tuple t from relation R Algorithm (Step1-3): - Isolate the Dependency Island (DI) of R - Delete Matching t from R - Identify Referencing Peninsulas(RP) - Replacement on foreign key of matching tuple in each Peninsula elsedelete corresponding tuple Global Integrity Maintenance (Step4): - Relation involved in deletions Delete propagation in its DI, Repeatedly, if necessary Foreign Key Replacement in its RP

52 IIDPIDBOOK IIDPIDBOOKIDTITLEAUTHOR_IIDPUBLISHER_IIDYEAR IIDPIDANAME IIDPIDSOURCECURRENCYVALUE BIB BOOK AUTHOR PRICE IIDPIDPNAMELOCATION VMG for Basic Inline Loading Strategy PUBLISHER delete Delete/ Replace

53 Step4: Insertion Propagation Insert tuple t into the relation R Algorithm - Extend the view tuple with values for the attributes that have been exposed out in the view definition - If new tuple is already present in the instance, reject the update - Otherwise, perform an insertion in the underlying database relation. Global Integrity Maintenance: - Insertion-check for RC, if there, do nothing else rollback, reject insertion

54 updateTranslation(resultUpdate ){ update = first of resultUpdate while update != null{ updateType (update) formatWhereConditions formatOtherConditions } updateType (update){ if update-type is replace do nothing elseif delete or insertion if update-columns include all attributes of table do nothing else update-type = replace } Step5: Update Translation

55 Virtual View Definition Underlying Relation RDB Schema Integrity Constraints (Key, FK) Deletion Insertion Replacement Rename Move Set of each Group Update Schema Change Duplicates Aggregation Recursion Hierarchy Consistency Key Exposition Non Correlation predicates attribute exposition Correlation predicates attributes exposition BCNF 3NF Information Modification Instance Language Local Constraints (Not Null, domain) 2NF 3NF General Classification of XVUP


Download ppt "Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner Co-Advisor: Kathi Fisler Updating XML Views over Relational Data."

Similar presentations


Ads by Google