Title: On the Updatability of XQuery Views Published Over Relational Data
1On the Updatability of XQuery Views Published
Over Relational Data
Authors Ling Wang and Elke A.
Rundensteiner Database Systems Research
Group Worcester Polytechnic Institute Worcester,
MA 01609 Presented by Xin Zhou (UCLA)
ER2004
2Outline
- Motivation --- What is the problem?
- Deciding Factors --- Where does it appear?
- Graph-based Algorithm --- How to solve it?
- Clean-extended Source Theory --- Is it correct?
- Related Work
- Conclusion and Future Work
3Motivation
- Publishing XML Views over Relational Data
- XPERANTO (IBM), SilkRoute (ATT), Rainbow (WPI)
- Update XML Views
- Important but not well supported
User Update
XML View
- Sub-problems
- View Updatability --- A correct update mapping
exists?
- Update Translation --- If so, how to find it?
View Query
?
- Our Focus View Updatability
- What are the deciding factors for view
updatability? - How do they affect the view updatability?
SQL
RDBMS
RDBMS
4Outline
- Motivation --- What is the problem?
- Deciding Factors --- Where is the problem?
- Graph-based Algorithm --- How to solve it?
- Clean-extended Source Theory --- Correct?
- Related Work
- Conclusion and Future Work
5Deciding Factors
- Update Granularity
- Relational View Tuple-based update
Virtual Relational View
bookid title amount website
98001 TCP/IP Illustrated 63.70 www.amazon.com
- XML View Flexible update granularity
Virtual XML View
Complete Update
ltbibgt ltprice_infogt ltamountgt63.70lt/amountgt ltw
ebsitegt www.amazon.com lt/websitegt ltbook_infogt
ltbookidgt98001lt/bookidgt lttitlegtTCP/IP
Illustratedlt/titlegt lt/book_infogt lt/price_infogt
lt/bibgt
Partial Update
6Deciding Factors
- View Construction Consistency
- Relational Database Key ForeignKey
Relationships - XML View Nested Hierarchical Structure
Not always consistent!
Relational Database
book
View Side Effect
bookid title
98001 TCP/IP Illustrated
price
bookid amount website
98001 63.70 www.amazon.com
7Deciding Factors
- Duplication
- The relational data appears more than once in XML
view. - Reason cardinality in view does not follow
cardinality in base.
Virtual View
ltbibgt ltbook_infogt ltbookidgt98001lt/bookidgt lttit
legt TCP/IP Illustrated lt/titlegt ltprice_infogt
ltamountgt63.70lt/amountgt ltwebsitegt www.amazon
.com lt/websitegt lt/price_infogt ltprice_infogt
ltamountgt50.60lt/amountgt ltwebsitegt www.bookpo
ol.com lt/websitegt lt/price_infogt lt/book_infogt
ltbook_infogt ltbookidgt98003lt/bookidgt lttitlegt
Data on the Web lt/titlegt ltprice_infogt
ltamountgt63.70lt/amountgt ltwebsitegt www.amazon
.com lt/websitegt lt/price_infogt ltprice_infogt
ltamountgt50.60lt/amountgt ltwebsitegt www.bookpo
ol.com lt/websitegt lt/price_infogt lt/book_infogt lt
/bibgt
View Side Effect
View Query
ltbibgt FOR book IN document("default.xml")/book/ro
w, RETURN ltbook_infogt book/bookid,
book/title, FOR price IN document("default.x
ml")/price/row RETURN ltprice_infogt
price/amount, price/website
lt/price_infogt lt/book_infogt lt/bibgt
Relational Database
book
Data on the Web
98003
price
bookid
amount
website
www.amazon.com
63.70
98001
www.bookpool.com
50.60
98003
8Outline
- Motivation --- What is the problem?
- Deciding Factors --- Where does it appear?
- Graph-based Algorithm --- How to solve it?
- View Relationship Graph (VRG) vs. View Trace
Graph (VTG) - Mark Graph with Update Context vs. Update Point
- Update Translatability Deciding Algorithm
- Clean-extended Source Theory --- Is it correct?
- Related Work
- Conclusion and Future Work
9Approach Overview
View Query/Pre-defined View Schema
User Update Query
Error message
View Analyzer
Identify Updating Node
VRG VTG Generator
Untranslatable
Deciding Update Translatability
Compute Node Closure
Conditionally Translatable
Unconditionally Translatable
Mark VRG
VRG
Additional Condition Checking
Untranslatable
XML/RDB Schema
Update Checker
Translatable
Update Translation Engine
SQL Update Query
Relational Data Storage
Oracle
DB2
SQL-Server
Sybase
10View Analysis Step1 --- VRG
- View Relationship Graph
- Graph captures hierarchical and cardinality
constraints from view query. - Similar with view forest from SilkRoute.
ltbibgt FOR book IN document("default.xml")/book/ro
w RETURN ltbook_infogt book/bookid,
book/title, FOR price IN
document("default.xml")/price/row WHERE
book/bookid price/bookid RETURN
ltprice_infogt price/amount,
price/website lt/price_infogt lt/book_infogt
lt/bibgt
11View Analysis Step1 --- VTG
- View Trace Graph
- Graph models hierarchical and cardinality
constraints in the undelying relations.
VRG
VTG
12View Analysis Step2 --- Closure
- Use closure for update translatability study.
- Closure of node in VRG
- Leaf node n n
- Internal node leaf nodes in subtree
cardinality and condition mark.
VRG
n6 n6
n5 n6, n7
n2 n3,n4,(n6,n7)con where con
(book_info/bookid price_info/bookid)
13View Analysis Step2 --- Closure
- Closure of node in VTG
- Leaf node same with its parent node.
- Note Under Assumption of update policy as (i)
Same update type and (ii) delete cascading. - Internal node leaf nodes in subtree
cardinality and condition mark. (same with VRG)
VTG
n5 n4 n5,n6
n4 n5,n6
n1 n2,n3,(n5,n6)con where con
(book_info/bookid price_info/bookid)
14View Analysis Step2 --- Closure
- Mapping closure between VRG and VTG
- CR closure of node n in VRG
- CT CRs corresponding closure in VTG
VRG
For each node n ? Node(CR) find corresponding
node n in VTG Compute (n) in VTG CT ? (n)
?
VTG
- Closure comparison.
- (match) CR ? CT ? all the nodes in the closure
are the same. - (Equal) CR ? CT ? (i) C1 ? C2 and (ii) the
cardinality and condition mark of each node are
also the same.
15View Analysis Step3 --- Mark VRG
- Deciding factors appear in two places
- Inside the element being deleted/inserted ---
Update Point - Outside the element being deleted/inserted ----
Update Context - Each node will be marked by (update-point-type
update-context-type)
XML Virtual View
bib
Update Context
Price_info
Price_info
Update Point
amount
website
Book_info
amount
website
Book_info
title
www.amazon.com
bookid
63.70
title
www.amazon.com
bookid
50.60
98001
TCP/IP Illustrated
98003
Data on the Web
16View Analysis Step3 --- Mark VRG
- Update Point Type
- Marking nodes
- Inconsistent ? CR ? CT, Dirty ? CR ? CT, Clean ?
CR ? CT,
VRG
VTG
Clean node
VRG
dirty node
VTG
Inconsistent node
CR n5 n6, n7
CT (n2, n3) n2, n3, n5, n6con
CT (n2, n3,n5, n6) n2, n3,(n5, n6)con
CR n2 n3, n4 ,(n6, n7)con
CR n2 n3, n4 ,n6, n7
CT (n2, n3, n5, n6) n2, n3, n5, n6con
17View Analysis Step3 --- Mark VRG
- Update Context Type
- Add second type of Mark safe or unsafe.
- Node Safe ? No duplication of node itself exists
in VRG. - Rules are utilized to identify the safety using
closure (CR , CT) comparison WangRundenstTR04.
VRG1
VRG2
18Update Translatability Checking
- Run-time update analysis
- Given a user update over the view.
- Step1 Identify the node N being
deleted/inserted. - Step2 Translatability of update is determined
according to node Ns marks.
Only (clean safe) node is un-conditionally
translatable!
19Update Translatability Checking
Unconditionally translatable
ltbibgt FOR book IN document("default.xml")/book/ro
w RETURN ltbook_infogt book/bookid,
book/title, FOR price IN
document("default.xml")/price/row WHERE
book/bookid price/bookid RETURN
ltprice_infogt price/amount,
price/website lt/price_infogt lt/book_infogt
lt/bibgt
20Update Translatability Checking
Construction Consistency Example
ltbibgt FOR book IN document("default.xml")/book/ro
w, price IN document("default.xml")/price/row
WHERE book/bookid price/bookid RETURN
ltprice_infogt price/amount,
price/website, ltbook_infogt
book/bookid, book/title
lt/book_infogt lt/price_infogt lt/bibgt
untranslatable
21Update Translatability Checking
Duplication Example
bib
ltbibgt FOR book IN document("default.xml")/book/ro
w, RETURN ltbook_infogt book/bookid,
book/title, FOR price IN document("default.x
ml")/price/row RETURN ltprice_infogt
price/amount, price/website
lt/price_infogt lt/book_infogt lt/bibgt
1
Conditionally translatable
book_info (dirty safe)
2
?
?
3
4
price_info (clean unsafe)
5
book/row/title book.title
book/row/bookid book.bookid
?
?
8
7
price/row/website price.website
price/row/amount price.amount
22Outline
- Motivation --- What is the problem?
- Deciding Factors --- Where it appears?
- Graph-based Algorithm --- How to solve it?
- Clean-extended Source Theory --- Is it correct?
- Related Work
- Conclusions and Future Work
23Clean-extended Source Theory
- Clean-extended source theory
- Extended source
- The relational portion generating the view
element v. - Clean-extended source
- The extended source which is not referenced by
anyone else beside v itself. - Insert/Delete a clean-extended source is
unconditionally translatable. - Algorithm proven by clean-extended source.
- WangRundenstTR04.
24Related Work
- Our earlier work
- WMR03 L. Wang, M. Mulchandani, and E. A.
Rundensteiner. Updating XQuery Views
Published over Relational Data A Round-trip Case
Study. In XML Database Symposium (VLDB
Workshop), 2003. - WR04 L. Wang and E. A. Rundensteiner. Updating
XML Views Published Over Relational
Databases Towards the Existence of a Correct
Update Mapping. Technical Report
WPI-CS-TR-04-19, Computer Science Department,
WPI, 2004.
25Related Work
- Relational View Update Works
- DB82 U. Dayal and P. A. Bernstein. On the
Correct Translation of Update Operations on
Relational Views. In ACM Transactions on
Database Systems, volume 7(3), 1982. - A86 A. M. Keller. The Role of Semantics in
Translating View Updates. IEEE Transact
ions on Computers, 19(1)6373, 1986. - Other XML View Update Problems
- TIHW01 I. Tatarinov, Z. G. Ives, A. Y. Halevy,
and D. S. Weld. Updating XML. In SIGMOD,
2001. - BDH03 V. P. Braganholo, S. B. Davidson, and
C. A. Heuser. On the Updatability of XML
Views over Relational Databases. In
WEBDB,2003. - BDH04 V. P. Braganholo, S. B. Davidson, and C.
A. Heuser. From XML view updates to
relational view updates old solutions to
a new problem. In VLDB, 2004.
26Conclusion and Future Work
- Contributions of this Work
- Identify key factors affecting view updatability.
- Establish clean-extended source theory as
theoretical foundation for view updatability
study. - Propose graph-based algorithm for identifying
update translatability. - Prove correctness of this solution.
- Apply algorithm to several case studies
- Future Work
- Expand types of XQuery Views covered by the
algorithm. - Efficient update translation strategy.