W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2004

RE: SQL to XQuery translation

From: Murali Mani <mani@CS.UCLA.EDU>
Date: Thu, 15 Jan 2004 12:26:27 -0800 (PST)
To: Michael Rys <mrys@microsoft.com>
Cc: David Song <davidzsong@yahoo.com>, www-ql@w3.org
Message-ID: <Pine.GSO.4.58.0401151219420.25619@panther.cs.ucla.edu>


Some questions regarding Query Language translations propped up recently.
This was one that we could not answer..

When you do XQuery -> SQL, how do you translate predicates?

a predicate in XPath such as

path [predicate]/ ...

we need existential semantics over a potential result set.. does this get
translated to a subquery in SQL???

best, murali.


Note: for SQL -> XQuery might be easier (if we consider simple queries)..

for example,
FROM <Arr2>
WHERE <Arr3>

can be translated to (the way we teach SQL semantics in DB I ..)

for <Arr2'>
where <Arr3'>
return <Arr1'>

i think it is not difficult to translate these Arr2 -> Arr2' etc..?? Are
there things that I am overlooking??

On Thu, 15 Jan 2004, Michael Rys wrote:

> Some reasons why there is not much done in this area:
> 1. SQL is not powerful enough alone to query true XML data where mixed
> content, order, changing structure really matters. You would have to
> extend SQL fundamentally to allow this. There is some work going on at
> the relational database companies and the ANSI/ISO standards level.
> However, the focus there is mainly to leverage XPath and XQuery in the
> context of SQL expressions. So mapping SQL to XQuery would also mean
> that you define  relational semantics over the XML data, which you
> cannot easily do for general XML documents (see the discussions of
> edge/node-tables to represent XML relationally for some of the
> complexity).
> 2. In order to query relational data marked up in XML, most commercial
> systems provide a mapping level into XML (annotated schemata in SQL
> Server 2000, XSD-based OR mapping in Oracle 9i, DADs in IBM DB2) and
> then just let you use SQL to query it. So no need to map it to XQuery
> since the primary implementation architecture is SQL.
> If it would have been easy, I guess we would not have invested into
> XQuery in the first place but just defined a relational semantics on XML
> and be done with it...
> Best regards
> Michael
> > -----Original Message-----
> > From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf
> Of
> > David Song
> > Sent: Wednesday, January 14, 2004 11:39 PM
> > To: www-ql@w3.org
> > Subject: SQL to XQuery translation
> >
> >
> > I am in need of researching, designing, and
> > implementing techniques to translate from SQL to
> > XQuery.  Most (if not all) research has been focused
> > on XQuery->SQL, now I need the reverse!  I believe is
> > challenge is how to map SQL predicates into XPath
> > expressions.  SQL joins is another challenge.
> >
> > The business usage case is that users need to be able
> > to construct AdHoc queries using SQL to query XML data
> > residing in native XML database.  I need help in
> > designing algorithms to map SQL to XQuery/XPath.  I
> > have not found any research in this area.
> >
> > I very much appreciate if anyone can point me in the
> > right direction.  I have some preliminary design
> > thoughts if anyone is interested in a more detailed
> > discussion with me.  Thanks!
> >
> > David Song
> > College of Engineering
> > San Jose State University
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> >
Received on Thursday, 15 January 2004 15:26:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:16 UTC