Download ppt file

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

SQL wikipedia , lookup

Database wikipedia , lookup

Functional Database Model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

Versant Object Database wikipedia , lookup

Database model wikipedia , lookup

Transcript
A CASE Tool for Designing XML
Views
Yabing Chen, Tok Wang Ling, Mong Li Lee
May, 2002
Contents
1.
2.
3.
4.
5.
6.
7.
Introduction
Preliminaries
Architecture of the CASE tool
An illustrating example
Related work
Conclusion
Q&A
Part 1. Introduction
Introduction



XML – eXtensible Markup Language
XML Views
An introduction to the CASE tool – XVS
Introduction
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.
Part 2. Preliminaries
Preliminaries


ORA-SS data model
View Definition Language
Preliminaries
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.
project
project
jno:
j001
ps,2,1:n,1:n
jno
supplier
supplier
supplier
sp,2,1:n,1:n
sno
sno:
s001
sno:
s001
part
part
sp
part
part
pno
price
Figure 1: ORA-SS Schema Diagram
pno:
p001
price:
90
pno:
p002
price:
120
pno:
p003
Figure 2: ORA-SS Instance Diagram
price:
110
Preliminaries
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.
Part 3. Architecture of the CASE
tool
Architecture of the CASE tool
Application
Use r Q u e ry
( XQ uery)
Answer to Query
(XML)
Web
XML Document
Tran sform /En ri ch
(O RA- SS)
De si gn Graph i cal
Vi e w S ch e m a
Ge n e rate Vi e w
De fi n i ti on ( XVL)
Materialize View
Generate
XML
Result
Q u e ry Re wri te
(S Q L)
ORDBMS
Figure 3. The Architecture of the CASE tool
XVS
Architecture of the CASE tool
Modules of our system

Transform/Enrich ORA-SS.



Design graphical view schema.


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.
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


Generate XML result



This module rewrite a XQuery over the view into
SQL query over the source database.
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.
Part 4. An illustrating example
An illustrating example
1.
2.
3.
Mapping XML document to ORA-SS
schema diagram
Defining views
Rewriting XQuery
An illustrating example
1. Mapping XML document to ORA-SS schema diagram

Transform an XML document to ORA-SS
<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
project
jno
sno
supplier
part
pno
price
Figure 5. The ORA-SS schema
diagram of the XML document
An illustrating example
1. Mapping XML document to ORA-SS schema diagram

Enrich the ORA-SS schema with semantics.
project
project
js,2,1:n,1:n
jno
supplier
jno
supplier
sp,2,1:n,1:n
spj,3,1:n,1:n
sno
part
sno
part
sp
pno
price
pno
Figure 5. The ORA-SS schema
diagram of the XML document
price
Figure 6. The ORA-SS schema
diagram enriched with
semantics
An illustrating example
2. Defining views

Designing a view by selecting, dropping or restructuring on the
ORA-SS schema.
project
project
project
js,2,1:n,1:n
jno
supplier
jno
sp,2,1:n,1:n
spj,3,1:n,1:n
sno
part
part
jno
ps,2,1:n,1:n
pno price supplier
ps,2,1:n,1:n
pno
sp
pno
price
Figure 7. The ORA-SS schema
enriched with semantics
part
supplier
ps
sno
Figure 8: invalid view which
swaps supplier and part
sno
price
Figure 9: valid view which
swaps supplier and part
An illustrating example
2. Defining views (cont.)

Mapping the view schema to a view definition in XQuery expression.
Create View As swap-supplier-part
For $j In document("spj.xml")//project
Return
<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>
Figure 10. The View definition in XQuery expression
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.
An illustrating example
3. Rewriting XQuery


Users may issue an XQuery on the views.
The following query retrieves all suppliers that supply
part “p001” in project “j001”
For $s In
view(“swap-supplierpart”)//project[@jno=”j001”]/part[@pn
o=”p001”]/supplier
Return
<supplier sno={$s/@sno}>
{$s/price}
</supplier>
Figure 11. An XQuery on the view
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 12. The rewritten SQL query
An illustrating example
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.
Sno
price
S001
100
S002
100
tagging
<result>
<supplier sno="s001">
<price>100</price>
</supplier>
<supplier sno="s002">
<price>100</price>
</supplier>
</result>
Figure 12. The result in table form
Figure 13. The result in XML form
Part 5. Related Work
Related Work
ActiveViews system & MIX system

ActiveViews system.




MIX 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.
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
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
No
No
Yes
No
No
Yes
No
No
Yes
Validation of
views
Support
projection,
join and
restructuring
of views
Support
graphical
views design
Part 6. Conclusion
Conclusion


A CASE tool for XML views – XVS
Preliminaries



Novel features



ORA-SS as the data model.
XQuery as the view language.
More flexible XML views. More operation such as projection,
join and restructuring.
Validating XML views.
Future work


Query optimization
View update
Q&A