XML-to-RDB Mapping Analysis Tools
Download
Report
Transcript XML-to-RDB Mapping Analysis Tools
Display and Analysis Tools for
Updating XML Views
David Krolick and Alex Perry
Advisor: Professor Elke A. Rundensteiner
MQP Presentation
April 19, 2005
1
Motivation
XML Views are important
– Hide unimportant information
– Organize data to meet user needs
– Wrap heterogeneous data sources:
XML
Relational databases
Must support operations over Views:
– Querying
– Updating
2
Updating Database Through Views
User Update
XQuery
XML View
XQuery
View Query
SQL
Relational
Database
XQuery
XML Database
3
Valid Update Example
Relational Database
Legend
Primary Key
Non Key
publisher
pubid
pubname
A01
McGraw-Hill
A02
Simon & Schuster Inc.
book
bookid
title
pubid
price
9801
TCP/IP
A01
37.00
9802
Unix
A02
45.00
View Query (PublisherView.xml)
Update Query
<PublisherView>
FOR $publisher
IN document(“default.xml”)/publisher/row
RETURN
<publisher>
$publisher/pubid, $publisher/pubname
FOR $book
IN document(“default.xml”)/publisher/row
WHERE ($publisher/pubid = $book/pubid)
AND ($book/price > 0.00)
RETURN {
<book>
$book/bookid, $book/pubid
</book>
</publisher> }
</PublisherView>
FOR $root
IN document(“PublisherView.xml”)
UPDATE $root {
INSERT
<publisher>
<pubid>A03</pubid>
<pubname>ACME</pubname>
<book>
<bookid>”9802”</bookid>
<title>”Windows”</title>
<pubid>A03</pubid>
<price>25.00</price>
</book>
</publisher>
}
4
Invalid Update Example
Relational Database
Legend
Primary Key
Non Key
publisher
pubid
pubname
A01
McGraw-Hill
A02
Simon & Schuster Inc.
book
bookid
title
pubid
price
9801
TCP/IP
A01
37.00
9802
Unix
A02
45.00
View Query (PublisherView.xml)
Update Query
<PublisherView>
FOR $publisher
IN document(“default.xml”)/publisher/row
RETURN
<publisher>
$publisher/pubid, $publisher/pubname
FOR $book
IN document(“default.xml”)/publisher/row
WHERE ($publisher/pubid = $book/pubid)
AND ($book/price > 0.00)
RETURN {
<book>
$book/bookid, $book/pubid
</book>
</publisher> }
</PublisherView>
FOR $root
IN document(“PublisherView.xml”)
UPDATE $root {
INSERT
<publisher>
<pubid>A03</pubid>
<pubname>ACME</pubname>
<book>
<bookid>”9802”</bookid>
<title>”Windows”</title>
<pubid></pubid>
<price></price>
</book>
</publisher>
}
5
U-Filter
“A lightweight XML View Update Checker” *
Purpose: Analyze updatability of XML views
– Constraint validation
– Side-effect checking
Process:
– Use data structures (Annotated Schema Graphs) to:
Analyze constraints of base data and extraction query
Mark data structures to indicate translatability of updates
* Wang, L., Rundensteiner, E., and Mani, Murali.
“U-Filter: A Lightweight XML View Update Checker.” VLDB2005, April. 2005, Submitted.
6
U-Filter Overview
GUI
View Query / Pre-defined View Schema
User Update Query
ASG
Invalid
Update Validation
Annotated
Schema Graph
Generator
ASG
Valid
Schema-driven translatability Reasoning
U-Filter
Unconditionally Translatable
Conditionally Translatable
Condition Analysis
XML/RDB
Schema
Untranslatable
Unsatisfied
Satisfied
Data-driven Translatability Checking
Translatable Update Query
Data Conflicts
Error Message
Update Translation Engine
Data Storage
SQL Update Query
XML
Oracle
DB2
Error Message
SQL Server
Sybase
7
Purpose of our Project
Implement and generate ASGs for U-Filter
– viewASG for structure and constraints of XML Views
– baseASG for structure and constraints of databases
Create GUI to visually analyze constraints and
updates
– Displays: Queries, Graphs, Update Results
8
ASG Generator
RAINBOW
XAT
View ASG tableNames
Generator
Database
Schema
Extractor
relTables
relTables
viewASG
View ASG
Extender
leafNodes
Base ASG
Generator
viewASG baseASG
viewASG
ASG
Marker
baseASG
markedASG
GUI
9
XAT
• Tagger – Contains hierarchy
• Combine – Specifies edge
cardinality of *
• For – Contains data
constraints in inner tree
• Select – Contains data
constraints
• NavUnnest – Contains data
label information
• Xin Zhang and Elke A. Rundensteiner. “XAT: XML Algebra for the
Rainbow System”, Computer Science Department, WPI, Technical
Report, WPI-CS-TR-02-24, July, 2002
10
View ASG Captures View
Constraints
N1
N1.1
ASGNodeAnnots
ID
Name
N1
BookView
N1.1
book
N1.1.1
title
N1.1.1.1 book.title
Type
Properties
string
Not Null
Type
Conditions
book.pubid = “A1”
N1.1.1
ASGEdgeAnnots
BID
EID
N1.1.1.1
N1
N1.1
*
N1.1
N1.1.1
1
N1.1.1
N1.1.1.1
1
11
Base ASG Captures Base
Constraints
N1
ASGNodeAnnots
ID
Name
N1
BookView
N1.1
book.title
Type
Properties
Conditions
N1.1
ASGEdgeAnnots
BID
EID
Type
N1
N1.1
1
12
Updatability Marking
Marks
– Update Context: Updatability with respect to all nodes
Safe
Unsafe
– Update Point: Updatability with respect to descendant
nodes
Clean
Dirty
Marks are analyzed to determine translatability
– Unconditionally Translatable: Safe and Clean
– Conditionally Translatable: Safe but Dirty
– Untranslatable: Unsafe
Implemented By Ming and Francisco for CS525 Class Project
13
U-Filter Display
Goals
– Accurately display graphs and queries
– Provide a visual demonstration for better
understanding of the system
– Provide detailed output to aid in
troubleshooting
14
U-Filter Display Architecture
Grappa Creator
Graph Updator
Graph and Query
Display Window
ASG Parser
View Query Dialog
Update Query Dialog
ASG Generator
http://www.research.att.com/~john/Grappa/
Update Display
Window
Updatability Testing
15
U-Filter Display: Select Query
16
U-Filter Display: View Query
17
U-Filter Display: View ASG
18
U-Filter Display: Base ASG
19
U-Filter Display: Update Query
20
U-Filter Display: Marked ASG
21
U-Filter Display Evaluation
HCI Considerations
– Grappa
– Organized Layout
– Intuitive Design
– Color Coding
Evaluation
– Iterative feedback from Ling Wang
– Feedback from DSRG
22
Project Evaluation
Test Cases
– 9 View Queries
– Represent Different Nested Relationships
– Utilize Xquery Core functions except: if / then / else
Updatability Tests
– Modified Marking Conditions
Still in Progress…
23
Conclusion
We generate two ASGs to hold hierarchy and constraints
– View ASG is constructed from an XAT representing a
Query View
– Base ASG is constructed by querying an underlying
database and the leaf nodes of the View ASG
We created a GUI to facilitate
– the creation, observation and marking of our ASGs
– the checking and categorization of update queries
24
Project Challenges
Reading and analyzing technical research papers
Integrating code with a larger system (RAINBOW) and
concurrent implementation with another group
Working with legacy code that was partially broken and
poorly documented
A team member who didn’t contribute and dropped out near
end of project
Iterative development with specifications that were unclear
to us, and final requirements
25
Technical Challenges
Working with XQuery Views
Using the Visitor and Strategy Patterns
Interacting with Oracle through JDBC
Finding and utilizing a good XML parser for
parsing an XML schema document
Designing and implementing GUI with the Grappa
package
26
Acknowledgements
We would like to thank:
Elke Rundensteiner
Ling Wang
Song Wang
DSRG Team
For their help in our project
27
References
Akif, Mohammad et al. Java XML Programmer's Reference. Apress,
2003.
Birbeck, Mark et al. Professional XML. Second Edition. Apress, 2004.
Dillon, Sean et al. Beginning Oracle Programming. Apress, 2003.
Harold, Elliotte Rusty. XML 1.1 Bible. 3rd Edition. John Wiley & Sons,
2004.
Hólm, Bjarki et al. Oracle 9i Java Programming: Solutions for
Developers using Java and PL/SQL. Apress, 2001.
Navarro, Ann, and White, Chuck. Mastering XML. Sybex, 2000.
Wang, L., Rundensteiner, E., and Mani, Murali. “U-Filter: A Lightweight
XML View Update Checker.” VLDB2005, April. 2005
http://www.w3.org/XML/
http://davis.wpi.edu/dsrg/rainbow/objective.htm
http://davis.wpi.edu/dsrg/rainbow/xupdate/index.html#objective
http://www.research.att.com/~john/Grappa/
28