a case tool for designing xml views
DESCRIPTION
A CASE Tool for Designing XML Views. Yabing Chen, Tok Wang Ling, Mong Li Lee May, 2002. Contents. Introduction Preliminaries Architecture of the CASE tool An illustrating example Related work Conclusion Q & A. Part 1. Introduction. Introduction. XML – eXtensible Markup Language - PowerPoint PPT PresentationTRANSCRIPT
A CASE Tool for Designing XML Views
Yabing Chen, Tok Wang Ling, Mong Li Lee
May, 2002
Contents
1. Introduction2. Preliminaries3. Architecture of the CASE tool4. An illustrating example5. Related work6. Conclusion7. Q & A
Part 1. Introduction
Introduction XML – eXtensible Markup Language XML Views An introduction to the CASE tool –
XVS
XML – eXtensible Markup Language
XML – originally a document markup language.
XML – now standard for publishing and exchanging data on the web.
XML – enforces explicit structuring. XML – suitable for express more
structured data.
Introduction
XML Views XML views are analogous to Relational
views. They provide logical data independence that
masks changes in the conceptual schemas. They also increase the flexibility of a database
that allows multiple users to see the data in different ways.
XML Views are implemented as an mediator on top of the database. Rlational database, such as Oracle 9i, SQL Sever. Native XML database, such Software AG Tamino.
Introduction
An introduction to the CASE tool - XVS
XVS – XML Views System. a novel case tool for designing XML
views. Provides for a graphical views
design facility. Validates all designed views. Stores XML data in an object-
relational database.
Introduction
Part 2. Preliminaries
Preliminaries ORA-SS data model View Definition Language
ORA-SS data model ORA-SS – Object-Relationship-Attribute Semi
Structured data model. Three basic concepts: object classes,
relationship types and attributes. Object class – an entity type in ER diagram or
an element in XML. Relationship type – indicate existing semantic
relationships among object classes. Attributes – properties, may belong to object
classes or relationship types.
Preliminaries
ORA-SS data model (cont.) An object class – a labeled rectangle. A relationship type – (name, n, p, c) An attribute – a labeled circle.
Preliminaries
s u p p lier
s n o p ar t
p n op r ic e
p r o jec t
jn o
p s ,2 ,1 :n ,1 :n
s p ,2 ,1 :n ,1 :n
s p
p r o jec t
jn o :j0 0 1
s u p p lier s u p p lier
s n o :s 0 0 1
p ar t
p r ic e :9 0
p ar t
p n o :p 0 0 2
p r ic e :1 2 0
p ar t
s n o :s 0 0 1
p n o :p 0 0 3
p r ic e :11 0
F i g ur e 1 : O R A-SS Sc he m a D i ag r am
F i g ur e 2 : O R A-SS Ins tanc e D i ag r am
p n o :p 0 0 1
ORA-SS data model (cont.) ORA-SS – A semantically rich data model.
Reflects nested structure of semistructured data.
Distinguishes between object classes, relationship types and attributes.
Distinguishes between attributes of relationship types and attributes of object classes.
Such semantics is essential for designing valid XML views and efficient storage.
However, existing data model cannot support such semantics.
Preliminaries
View Definition Language W3C standard – XQuery. We adopt FLWR expression to
define views. FLWR expression – For, Let, Where
and Return clauses. We also adopt XQuery as the query
language to query views.
Preliminaries
Part 3. Architecture of the CASE tool
Architecture of the CASE tool
O R D B M S
X V S
W e b
A pplic a tio n
U s e r Q u e r y( X Q u ery )
A n s we r to Q u e ry( XM L )
D e s i g n G r a p h i c a lV i e w S c h e m a
X M L D o cu m e n t
Tr a n s fo r m /En r i c h(O R A - S S )
Q u e r y R e w r i t e(S Q L )
Ge n e r ate X M LR esu lt
G e n e r a te V i e wD e f i n i t i o n ( X V L )
M ate r ial i z e V ie w
Figure 3. The Architecture of the CASE tool
Modules of our system Transform/Enrich ORA-SS.
This module takes an XML document and generates the corresponding ORA-SS graphical schema diagram.
It also allows users to enrich the ORA-SS schema diagram to add necessary semantic information for XML views design.
Design graphical view schema. This module allows users to graphically design views
over source schema. Generate view definition.
This module generates a view definition in FLWR expression from the graphical view schema.
Architecture of the CASE tool
Modules of our system (cont.) Query Rewrite
This module rewrite a XQuery over the view into SQL query over the source database.
Generate XML result This module tags the resulting table returned
by SQL query. Then it generates the resulting XML document.
Materialize view This module executes the XQuery expression
in the view definition and generates the view documents.
Architecture of the CASE tool
Part 4. An illustrating example
An illustrating example
1. Mapping XML document to ORA-SS schema diagram
2. Defining views3. Rewriting XQuery
1. Mapping XML document to ORA-SS schema diagram
Transform an XML document to ORA-SS
An illustrating example
s u p p lie r
s n o p ar t
p n op r ic e
p r o jec t
jn o
<db> <project jno=”j001”> <supplier sno=“s001”> <part pno=“p001”> <price> 100</price> </part> </supplier> <supplier sno=“s002”> <part pno=“p001”> <price> 100</price> </part> </supplier> </project></db>
Figure 4. An XML document on project, supplier and part
Figure 5. The ORA-SS schema diagram of the XML
document
1. Mapping XML document to ORA-SS schema diagram
Enrich the ORA-SS schema with semantics.
An illustrating example
s u p p lie r
s n o p ar t
p n op r ic e
p r o jec t
jn o
Figure 5. The ORA-SS schema diagram of the XML
document
s u p p lie r
s n o p ar t
p n op r ic e
p r o jec t
jn o
js ,2 ,1 :n ,1 :n
s p ,2 ,1 :n ,1 :ns p j,3 ,1 :n ,1 :n
s p
Figure 6. The ORA-SS schema diagram enriched with
semantics
2. Defining views Designing a view by selecting, dropping or restructuring
on the ORA-SS schema.
An illustrating example
p ar t
p n o s u p p lie r
s n o
p r ic e
p r o jec t
jn op ar t
p n o s u p p lie r
s n o
p s
p r ic e
p r o jec t
jn o
F i g ur e 8 : i nval i d vi e w w hi c hs w aps s uppl i e r and par t
F i g ur e 9 : val i d vi e w w hi c hs w aps s uppl i e r and par t
p s ,2 ,1 :n ,1 :np s ,2 ,1 :n ,1 :n
s u p p lie r
s n o p ar t
p n op r ic e
p r o jec t
jn o
js ,2 ,1 :n ,1 :n
s p ,2 ,1 :n ,1 :ns p j,3 ,1 :n ,1 :n
s p
Fig u re 7 . Th e O R A -S S s ch e m ae n rich e d with s e m a n t ics
2. Defining views (cont.) Mapping the view schema to a view definition in XQuery
expression.
An illustrating example
Create View As swap-supplier-partFor $j In document("spj.xml")//projectReturn <project jno={$j/@jno}> { for $pn In distinct($j//part/@pno) Return <part pno={$pn}> { For $s In $j/supplier[part/@pno=$pn] Return <supplier sno={$s/@sno}> { For $p In $s/part[@pno=$pn] Return <price> {$p/price/text()} </price> } </supplier> } </part> } </project>
The mapping process may be divided into two steps:
• Mapping the view schema to an intermediary view definition, which is generated according to the operation on the view schema.
• Mapping the intermediary definition to the view definition in XQuery expression.
Figure 10. The View definition in XQuery expression
3. Rewriting XQuery Users may issue an XQuery on the views. The following query retrieves all suppliers that
supply part “p001” in project “j001”
An illustrating example
For $s In
view(“swap-supplier-part”)//project[@jno=”j001”]/part[@pno=”p001”]/supplier
Return
<supplier sno={$s/@sno}>
{$s/price}
</supplier>
Select supplier.sno supplier_part.price
From supplier, supplier_part , spj
Where spj.jno=’j001’ and spj.pno=’p001’
and supplier.sno=spj.sno and supplier_part.sno=supplier.sno
and supplier_part.pno=’p001’Figure 11. An XQuery on the
viewFigure 12. The rewritten SQL
query
3. Rewriting XQuery (cont.) We will first get the resulting table shown in figure 12. After tagging, we will get the XML document shown in figure 13.
An illustrating example
<result> <supplier sno="s001"> <price>100</price> </supplier> <supplier sno="s002"> <price>100</price> </supplier></result>
Sno price
S001 100
S002 100
Figure 12. The result in table form
Figure 13. The result in XML form
tagging
Part 5. Related Work
ActiveViews system & MIX system
ActiveViews system. Adopt XML as the data model to define view. Every view is presented as an object. A view includes not only data, but also method.
MIX system. It provides a virtual view of underlying
heterogeneous sources. It adopts XML DTD as the data model.
Most other works export relational data as XML views, such as XPERANTO, etc,.
Related Work
Comparison
Related Work
ActiveViews system [AAC+99]
MIX system [BGL+99]XVS
(our system)
Data model XML XML DTD ORA-SS
Storage O2 system N/A ORDBMS
View definition language
OQL-style language XMAS language XQuery language
Query language
Lorel language XMAS language XQuery language
Validation of views
No No Yes
Support projection,
join and restructuring
of views
No No Yes
Support graphical
views designNo No Yes
Part 6. Conclusion
Conclusion A CASE tool for XML views – XVS Preliminaries
ORA-SS as the data model. XQuery as the view language.
Novel features More flexible XML views. More operation such as
projection, join and restructuring. Validating XML views.
Future work Query optimization View update
Q & A