Translate Graphical XML Query Language to SQLX - PowerPoint PPT Presentation

About This Presentation
Title:

Translate Graphical XML Query Language to SQLX

Description:

Translate Graphical XML Query Language to SQLX Wei Ni Tok Wang Ling Department of Computer Science University of Singapore {niwei, lingtw}_at_comp.nus.edu.sg – PowerPoint PPT presentation

Number of Views:165
Avg rating:3.0/5.0
Slides: 23
Provided by: soc128
Category:

less

Transcript and Presenter's Notes

Title: Translate Graphical XML Query Language to SQLX


1
Translate Graphical XML Query Language to SQLX
  • Wei Ni Tok Wang Ling
  • Department of Computer Science
  • University of Singapore
  • niwei, lingtw_at_comp.nus.edu.sg

2
Roadmap
  • ORA-SS and overview of our project
  • GLASS query
  • Translation from GLASS to SQLX
  • What is SQLX
  • Preprocessing
  • Translation
  • Conclusion and future works

3
1. ORA-SS
  • ORA-SS 6 (Object-Relational-Attribute model for
    Semi-Structured data ) is a rich semantic model
    for semi-structured data
  • Represents both the tree-like data structure and
    the relationship types contained in the data set
  • Distinguishes relationship attributes from object
    attributes
  • Uses Object ID indicating different object
    instances rather than element instances.
  • It is different from ER diagram in that ORA-SS
    represent the hierarchical structure of the
    semi-structured data.
  1. G. Dobbie, X. Y. Wu, T. W. Ling, M. L. Lee.
    ORA-SS An Object-Relationship-Attribute Model
    for Semistructured Data. TR21/00, Technical
    Report, Department of Computer Science, National
    University of Singapore, December 2000.

4
An XML example
lt!ELEMENT project (Jname?, member)gt
lt!ATTLIST project project_id ID REQUIREDgt
lt!ELEMENT Jname PCDATAgt lt!ELEMENT member
(Mname, age, job_title, publication,
qualification)gt lt!ATTLIST member
member_id CDATA IMPLIED gt lt!ELEMENT
Mname PCDATAgt lt!ELEMENT age PCDATAgt
lt!ELEMENT job_title PCDATAgt
lt!ELEMENT qualification PCDATAgt
lt!ATTLIST qualification degree CDATA IMPLIED

university CDATA IMPLIED
year
CDATA IMPLIEDgt lt!ELEMENT publication
(review)gt lt!ATTLIST publication
pub_id CDATA IMPLIED
title CDATA IMPLIEDgt
lt!ELEMENT review PCDATAgt
The DTD of the example dataset
Object Relations project (J, Jname)
member (M, Mname, age
qualification(degree,
university,
year)) publication (P, title,
(review)) Relationship Relations jm (J,
M, job_title) jmp (J, M, P)
An example ORA-SS schema
The ORDB storage schema of the example XML data
set
5
Overview of our project
  • In our project, the XML data is stored in ORDB
    (e.g. Oracle 9i), where
  • Relationship types and object classes are
    separately stored
  • Relationship type attributes and object
    attributes are differentiated
  • Multi-valued attributes and composite attributes
    are stored as nested tables.
  • We choose SQLX in our translation rather than
    XQuery because SQLX supports SQL-in-XML-out in
    ORDB (e.g. Oracle 9i). Meanwhile, we also have
    translation to XQuery.

6
2. GLASS query
  • GLASS 12 (Graphical query LAnguage for
    Semi-Structured data) is a high expressive
    graphical query language for semi-structured
    data, which is designed on the base of ORA-SS.
  • Separates the complex query logic from the query
    graph (the query graph is the graphical part of a
    GLASS query).
  • Considers relationship types in querying XML
    data.
  1. W. Ni, T. W. Ling. GLASS A Graphical Query
    Language for Semi-Structured Data. DASFAA 2003.

7
2. GLASS query (Cont.)
  • A typical GLASS query consists of four parts
  • (1) Left Hand Side Graph (LHS graph) denotes
    the basic conditions of a query (which can be
    different from the structure of source schema,
    where we shall do view validation first 3)
  • (2) Right Hand Side Graph (RHS graph) defines
    the output structure of the query result
  • (3) Link Set specifies the bindings between the
    RHS graph and LHS graph. When two graph entities
    are linked, they are visually connected by a
    line, which means the data type and value of the
    entity in the RHS graph are from the
    corresponding linked entity in the LHS graph.
  • (4) Condition Logic Window (CLW) It is an
    optional part where users write conditions and
    constructions that are difficult to draw, which
    includes Logic expressions, Mathematic
    expressions, Comparison expressions and IF-THEN
    statements.

8
2. GLASS query example
Original Schema
Example 1. Find the member whose age is less
than 35, and he either has taken part in less
than 5 projects or written more than 6
publications in some of the projects he attended
display the member id and name.
The hierarchical position of member and project
is swapped in this query.
The GLASS query of Example 1.
9
2. GLASS query example
Original Schema
Example 1. Find the member whose age is less
than 35, and he either has taken part in less
than 5 projects or written more than 6
publications in some of the projects he attended
display the member id and name.
The GLASS query of Example 1.
10
3. Translation from GLASS to SQLX
  • What is SQLX 7
  • SQLX (aka. SQL/XML) is an XML-related
    specification expanded on SQL.
  • SQLX combines the features in both XML document
    processing and the traditional SQL
  • Three fundamental SQLX functions
  • XMLELEMENT
  • XMLATTRIBUTES
  • XMLAGG
  • Why SQLX
  • An extended standard on SQL, which is supported
    by Oracle, IBM, Microsoft, etc.
  • It can be processed by ORDB systems.
  1. Information technology -- Database languages --
    SQL -- Part 14 XML-Related Specifications.
    ISO/IEC 9075-142003

11
3. Translation from GLASS to SQLX Preprocessing
  • Expansion of the simple projection
  • Expansion of the abbreviated RHS graph
  • Construction of the condition tree from LHS graph
    and CLW.
  • In comparison with the condition tree in TQL
    13, our condition tree
  • Contains the information of relationship types
  • Can represent aggregation and restructuring (such
    as swap)
  • Expresses logic in CLW.
  1. Y. Papakonstantinou, M. Petropoulos and
    V.Vassalos. QURSED Querying and Reporting
    Semistructured Data. ACM SIGMOD 2002, Jun 4-6,
    Madison, Wisconsin, USA.

12
3. Translation from GLASS to SQLX
(Preprocessing) The Generation of
condition tree
Original Schema
Step 1. Initializing the condition tree.
The condition tree is initially a copy of the LHS
graph from the original GLASS query.
The CLW remains unchanged in this step.
The original GLASS query
The condition tree after Step 1.
13
3. Translation from GLASS to SQLX
(Preprocessing) The Generation of
condition tree
Step 2. Decomposing the LHS graph (making
duplicate nodes as necessary).
Link to the member in the RHS graph
The condition tree after Step 1.
The condition tree after Step 2.
14
3. Translation from GLASS to SQLX
(Preprocessing) The Generation of
condition tree
Step 3. Adding the logic expressions (in CLW)
into the condition tree.
If there are any existential and universal
quantifiers in CLW, they will be added also in
this step.
The condition tree after Step 3.
The AND node here is necessary to differentiate
the following two different query logic - A AND
B OR C - A AND (B OR C)
The condition tree after Step 2.
15
3. Translation from GLASS to SQLX
(Preprocessing) The Generation of
condition tree
Step 4. Eliminating universal quantifiers in the
condition tree. (not applied in this
example)
  • Comments
  • The condition tree is a combination of LHS
    graph and CLW, where we generate the WHERE
    clauses in the SQLX expressions directly by
    traversing the condition tree instead of the
    original LHS graph and/or CLW.

The final condition tree.
16
3. Translation from GLASS to SQLX Translate
Condition Tree and RHS graph into SQLX
  • Traverse the expanded RHS graph in depth-first
    order and generate the select statements of the
    SQLX.
  • Generate where clauses
  • Render join for parent-child/ancestor-descendant
    relations (such relations on a XPath are
    performed by joining a series of tables in ORDB)
  • Specify conditions for linked nodes by traversing
    the condition tree.

17
3. Translation from GLASS to SQLX Translate
Condition Tree and RHS graph into SQLX
Traverse the (expanded) RHS graph and obtain the
query block below
Preprocessed GLASS query for translation
The SQLX query expressions
SELECT XMLELEMENT(NAME member,
XMLATTRIBUTES (M1.M AS member_id)
XMLELEMENT (NAME Mname, M1.Mname) ) FROM
member M1 WHERE
For Each Node N in DF-Traversing the expanded
RHS graph CASE (N is the root of RHS) THEN
generate a block of SELECT XMLELEMENT
SELECT XMLELEMENT (NAME N ) FROM WHERE CASE
(N is an attribute in XML) THEN generate a block
of SELECT XMLATTRIBUTES SELECT
XMLATTRIBUTES ( AS N ) FROM WHERE CASE
(other kind of N) THEN generate a block of
SELECT XMLAGG(XMLELEMENT) //i.e. N is an element
but not the root SELECT XMLAGG
(XMLELEMENT (NAME N ) FROM WHERE)
18
3. Translation from GLASS to SQLX Translate
Condition Tree and RHS graph into SQLX
Traverse the (expanded) RHS graph and obtain the
query block below
The SQLX query expressions
SELECT XMLELEMENT(NAME member,
XMLATTRIBUTES (M1.M AS member_id)
XMLELEMENT (NAME Mname, M1.Mname) ) FROM
member M1 WHERE
M1.age lt35 AND ( M1.M IN (SELECT M FROM member
WHERE
(SELECT COUNT(J) FROM jm
WHERE M
jm.M)lt5) OR M1.M IN (SELECT M
FROM member
WHERE (SELECT J FROM project
WHERE(SELECT
COUNT(P) FROM jmp
WHERE jmp.J
project.J
AND jmp.M
member.M)gt6)) )
19
4. Conclusion future works
  • We present the translation from GLASS to SQLX.
  • GLASS supports SWAPPING and GROUPING on the base
    of the semantic information in ORA-SS.
  • By translating into SQLX, GLASS can be processed
    on ORDB systems such as Oracle 9i.
  • The translation method is simple. Compared with
    other XML-to-SQL translation works,
  • The ORDB data storage preserves the semantic
    information in ORA-SS differentiates
    relationship type attributes from object
    attributes.
  • GLASS query considers the relationship
    information in ORA-SS which are important to
    define the query semantic clearly.
  • Our translation is simpler in comparison with the
    literature review in 8 and supports SWAPPING,
    GROUPING (also Quantifiers) in GLASS.
  1. R. Krishnamurthy, R. Kaushik, and J. F. Naughton
    XML-to-SQL Query Translation Literature The
    State of the Art and Open Problems. University of
    Wisconsin-Madison

20
4. Conclusion future works
  • Future works
  • Query optimization on the base of ORA-SS
  • Decrease the cost of join
  • Cost model and optimized query plan
  • Improving our case tool (so far partially
    developed)

21
References
  1. S. Ceri, S.Comai, E. Damiani, P.Fraternali, S.
    Paraboschi, and L.Tanca. XML-GL a graphical
    language of querying and restructuring XML
    documents. In Proc. WWW8, Toronto, Canada, May
    1999.
  2. S. Ceri, S. Comai, E. Damiani, P. Fraternali, and
    L. Tanca. Complex Queries in XML-GL. SAC(2)
    2000888-893.
  3. Y. B. Chen, T. W. Ling, M. L. Lee. Designing
    Valid XML Views. 21st International Conference on
    Conceptual Modeling (ER'2002), pp 463-477,
    October 7-11, 2002, Tampere, Finland.
  4. S. Cohen, Y. Kanza, Y. Kogan, W. Nutt, Y. Sagiv
    and A. Serebrenik. Equix Easy Querying in XML
    Databases. In proceedings of Webdb98 The Web
    and Database Workshop, 1998.
  5. S. Comai, E. Damiani, P. Fraternali. Computing
    Graphical Queries over XML Data. ACM Transactions
    on Information Systems, Vol. 19, No. 4, October
    2001, Pages 371-430.
  6. G. Dobbie, X. Y. Wu, T. W. Ling, M. L. Lee.
    ORA-SS An Object-Relationship-Attribute Model
    for Semistructured Data. TR21/00, Technical
    Report, Department of Computer Science, National
    University of Singapore, December 2000.
  7. Information technology -- Database languages --
    SQL -- Part 14 XML-Related Specifications.
    ISO/IEC 9075-142003
  8. R. Krishnamurthy, R. Kaushik, and J. F. Naughton
    XML-to-SQL Query Translation Literature The
    State of the Art and Open Problems. University of
    Wisconsin-Madison
  9. B. Ludaescher, Y. Papakonstantinou, and P.
    Velikhov. Navigation-driven evaluation of virtual
    mediated views. In Proceedings of the sixth
    International Conference on Extending Database
    Technology (EDBT)(Konstanz, Germany, March),
    Lecture Notes in Computer Science, vol. 1777,
    Springer-Verlage, New York, 2000.
  10. L. Mark, etc. XMLApe. College of Computing,
    Georgia Institue of Technology.
    http//www.cc.gatech.edu/projects/XMLApe/
  11. K. D. Munroe, B. Ludaescher and Y.
    Papakonstantinou. Blended Browsing and Querying
    of XML in Lazy Mediator System. Konstanz,
    Germany, March 2000.
  12. W. Ni, T. W. Ling. GLASS A Graphical Query
    Language for Semi-Structured Data. DASFAA 2003.
  13. Y. Papakonstantinou, M. Petropoulos and
    V.Vassalos. QURSED Querying and Reporting
    Semistructured Data. ACM SIGMOD 2002, Jun 4-6,
    Madison, Wisconsin, USA.
  14. XQuery 1.0 An XML Query Language. W3C Working
    Draft 22 August 2003 http//www.w3.org/TR/xquery/
  15. XML Path Language (XPath) 2.0. W3C Working Draft
    22 August 2003 http//www.w3.org/TR/xpath20/
  16. XML Schema. http//www.w3.org/XML/Schema

22
The End
  • Thank you very much
  • wish you have wonderful time in Beijing.
Write a Comment
User Comments (0)
About PowerShow.com