Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner

Download Report

Transcript Ling Wang, Mukesh Mulchandani Advisor: Elke A. Rundensteiner

Updating XQuery Views over
Relational Data
Ling Wang, Mukesh Mulchandani
Advisor: Elke A. Rundensteiner
Rainbow Research group, DSRG, WPI
Motivation
• 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 using relational technology
- Publishing XML over relational database:
SilkRoute (AT&T), XPERANTO (IBM), RAINBOW(WPI)
- Storing XML into RDBs
LegoDB (BellLab), RAINBOW (WPI)
• Support Update features is important next step for those system
• Our Work will focus on Content updates using XQuery language
Problem Definition
• Sub-Problem 1: Expressing updates in
XQuery
We need to:
XQuery Update
- Extension to XQuery
- Extension to XML query Parser to support
Update features
XML View
• Sub-Problem 2: Translate XQuery update on
Virtual View into SQL update on RDB
View Query
SQL Update
We need to:
- Mapping from XML with Relational data
model ---- detecting View Updatability
- Mapping XQuery update on virtual view into
SQL update on Relational table ---- update translation
RDBMS
Solution for sub-problem1: Query 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.
Solution for sub-problem2: Update Translation
Four aspect have to be explored:
•
•
•
•
Correct Update Translatability Definition
General Classification of XML View Update(XVUP)
View Updatability Detecting
Valid Update Translation
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
Information
Language
Instance
Integrity Constraints
(Key, FK)
Aggregation
1NF
Local Constraints
(Not Null, domain)
Recursion
Hierarchy Consistency
2NF
RDB Schema
Correlation predicates attributes exposition
3NF
Underlying Relation
Non Correlation predicates attribute exposition
BCNF
Virtual View Definition
Key Exposition
Duplicates
Deletion
Insertion
Replacement
Rename Move
Set of each
Modification
Group Update
Schema Change
General Classification of XQuery View Update Problem Space
View Updatability
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
Case study for View Updatability
• 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
XQuery
Valid Update
Translation
View
Parser
View Analyser
Translatability Checker
Valid Update Checker
Update Decomposer
Update Propagation
Translator
SQL Update
DB
Trigger
Execution Engine