Re: Supplemental XQuery reading list

On Fri, Apr 16, 2004 at 07:54:06AM -0700, Howard Katz wrote:
> 
> 
> > I can't speak to Andy's agenda, but one point that's been kicking
> > around in the XQuery/RDF Query arena for a while is that XQuery can be
> > used to express SQL queries so it must be able to express RDF
> > queries.
> 
> It can, if you're able to work out a mapping from the RDF data model into
> the XQuery data model, which is basically the XML Infoset + XML Schema
> support + support for multiple documents.
> 
> I'm finding myself quite interested in the inverse problem: would it be
> possible and useful to be able to map from the XQuery surface language into
> an underlying RDF graph-based data model, so that XQuery syntax can be used
> to interrogate an RDF data store more or less directly? In other words, can
> we swap out XQuery's underlying XML-based data model and slide in an
> RDF-based one in its place so that we don't have to do the mapping to XML?
> I'll be talking about this after Amsterdam.
> 
> > I've seen a couple approaches that I believe workable [1]
> > [2], but would like to see how people solve the problem for SQL.
> 
> I've given a few pointers in my response to Andy's email re SQL-to-XML
> mappings for XQuery.
> 
> > I suspect that in standardizing an RDF query language we are going
> > beyond where existing SQL mappings to XQuery have gone in that we want
> > *one* mapping to XQuery that operates on XQuery+whatever
> > implementations from different vendors. Does such a "standard" mapping
> > to SQL exist?
> 
> I'm not sure what you mean by the last, Eric. Can you explain a bit more?

Sure. One objection to using XQuery for querying RDF is that the data
models are different. In my view, this doesn't preclude its utility
but may force an awkward interface. One can invent conventions/
libraries to access the parts of the SQL or RDF model with queries
that parse syntactically as XQuery (though this may be like mixing a
martini with a spatula).

To prove the point, I was looking for a published or coded "standard"
that would enable some idiom of XQuery to access to any relational
database. Suppose I need to use up some asparagus and I use this
mythical "standard" XQuery mapping for relational databases
    LET $r := document("odbc://localhost/db")
    FOR $recipe in $r[table="recipies"],
        $supplies in $r[table="supplies"]
    WHERE $supplies/primaryKey=$recipe/ingredients
      and $supplies/name="asparagus"
    RETURN $recipe/name
to access a data base of two (poorly normalized) tables:
  recipies:
     name          ingredient  optional
    cold cereal    3
    cold cereal    7           1
steamed asparagus  14
steamed asparagus  33

  supplies:
primaryKey     name
3           dry cereal
7                 milk
14           asparagus
33               steam

That was just to frame what I meant by a convention or standard for
accessing relational databases. If we want to use that for DAWGQL,
we could construct queries like
    LET $t := document("odbc://localhost/db")
    FOR $whoArc in $t[table="triples"],
        $emailArc in $t[table="triples"]
    WHERE $whoArc/predicate="<http://xmlns.com/foaf/0.1/name>"
      and $whoArc/object="'Bob Smith'"
      and $emailArc/subject=$whoArc/subject
      and $emailArc/predicate="<http://xmlns.com/foaf/0.1/mbox>"
    RETURN $emailArc/object
to execute a typical graph query (John Smith's email addr) on a
table of RDF triples called triples.

Then the DAWG could define a the XQuery mapping of the DAWGQL in
terms of
  1 Use the Foo SQL-XQuery mapping spec.
  2 All triples are in a table called "triples" which has
    the fields "predicate", "subject", "object".
We probably wouldn't want to, but it would be worth looking at.

BTW: I refer to DAWGQL *because* it's such an ugly name that it
would never be used for anything but a placeholder.

> > [1] http://www.w3.org/2001/11/13-RDF-Query-Rules/#XQueryFA
> > [2] http://www.w3.org/2001/11/13-RDF-Query-Rules/#TreeHugger
> > --
> > -eric
> >
> > office: +81.466.49.1170 W3C, Keio Research Institute at SFC,
> >                         Shonan Fujisawa Campus, Keio University,
> >                         5322 Endo, Fujisawa, Kanagawa 252-8520
> >                         JAPAN
> >         +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
> > cell:   +1.857.222.5741 (does not work in Asia)
> >
> > (eric@w3.org)
> > Feel free to forward this message to any list for any purpose other than
> > email address distribution.
> >

-- 
-eric

office: +81.466.49.1170 W3C, Keio Research Institute at SFC,
                        Shonan Fujisawa Campus, Keio University,
                        5322 Endo, Fujisawa, Kanagawa 252-8520
                        JAPAN
        +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
cell:   +1.857.222.5741 (does not work in Asia)

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Received on Friday, 16 April 2004 14:40:16 UTC