Re: draft XML query results format spec

On Wed, Sep 29, 2004 at 01:43:34PM +1000, Simon Raboczi wrote:
> 
> On 29/09/2004, at 3:06, Dave Beckett wrote:
> 
> ><results xmlns="http://www.w3.org/sw/2001/DataAccess/result1#">
> >
> >  <result>
> >    <hpage href="http://work.example.org/alice/"/>
> >    <name>Alice</name>
> >    <mbox/>
> >    <blurb 
> >datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral">&lt;p 
> >xmlns="http://www.w3.org/1999/xhtml"&gt;My name is 
> >&lt;b&gt;alice&lt;/b&gt;&lt;/p&gt;</blurb>
> >  </result>
> >
> >  <result>
> >    <hpage href="http://work.example.org/bob/"/>
> >    <name xml:lang="en">Bob</name>
> >    <mbox href="mailto:bob@work"/>
> >    <age datatype="http://www.w3.org/2001/XMLSchema#integer">30</age>
> >  </result>
> >
> ></results>
> 
> I'm fairly sympathetic to Jos's preference[1] for variable bindings to 
> be expressed as RDF graphs, so here's my translation of the above 
> result into RDF/XML:

I too would rather pay a bit of payload price and enable people to use
both XML tools and RDF tools. I was going to chime in after I'd tried
expressing the results in RDF. Simon saved me.

1. Message
Our queriable world will be better when we eventually
convince/coerce everyone to provide their data in RDF. We'd send a
pretty lame message if we didn't follow that too.

2. Code Reuse
There's existing machinery for datatype expression, literal XML,
... Let's re-use it.

3. Consitency with DESCRIBE
It seems like that the results of DESCRIBE are RDF/XML. Using the same
language for tuples gives at least the appearance of more consistency.
It's possible that the DESCRIBE report machinery will also be useful
for returning usefull information about bNodes. For instance
  SELECT ?whom
  WHERE ?i foaf:mbox <mailto:alice@work.example>
        ?i foaf:know ?whom
would give back
  <sparql:Query>
    <sparql:solution rdf:parseType="Collection">
      <sparql:Solution>
        <foaf:Person>
         <foaf:mbox rdf:resource="mailto:bob@work.example" />
         <foaf:given>Bob</foaf:given>
       </foaf:Person>
      </sparql:Solution>
      <sparql:Solution>
        <foaf:Person>
         <foaf:mbox rdf:resource="mailto:eve@work.example" />
         <foaf:given>Eve</foaf:given>
       </foaf:Person>
...
which is parallel to what you'd get for
  DESCRIBE ?i
  WHERE ?i foaf:mbox <mailto:bob@work.example>

4. Extensibility
The extensibility mechanism for RDF is pretty clear. It'd be nioce
to lean on it, and it probably wouldn't take too much work to make
sure we weren't doing non-monotonic extensions.

5. Closure
Our query language works on it's own results. That's got to lead
to some cool composability payoff.

6. We think RDF is keen*
Well, we must, or we wouldn't be here.

* slang for "splendid"

> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>   xmlns:sparql="http://www.w3.org/sw/2001/DataAccess/sparql#"
>   xmlns:var="http://www.w3.org/sw/2001/DataAccess/variable#">
> 
> <sparql:Query>
>   <sparql:solution rdf:parseType="Collection">
> 
>     <sparql:Solution>
>       <var:hpage rdf:resource="http://work.example.org/alice/"/>
>       <var:blurb rdf:parseType="Literal" 
> xmlns="http://www.w3.org/1999/xhtml"><p>My name is 
> <b>alice</b></p></var:blurb>
>     </sparql:Solution>
> 
>     <sparql:Solution>
>       <var:hpage rdf:resource="http://work.example.org/bob/"/>
>       <var:name xml:lang="en">Bob</var:name>
>       <var:mbox rdf:resource="mailto:bob@work"/>
>       <var:age 
> rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">30</var:age>
>     </sparql:Solution>
> 
>   </sparql:solution>
> </sparql:Query>
> 
> </rdf:RDF>
> 
> It's inevitably a bit more verbose than the XML version, but not 
> comically so.  It's mostly the namespacing that seems to clutter it.  
> Variable properties are in their own namespace so that there's no 
> trouble with them clashing with the structural element names like 
> "Query" and "solution".  A bit of the namespace clutter could be 
> avoided if one was willing to declare a default namespace for the 
> document.
> 
> The use of parseType="Literal" as a special-cased representation of the 
> XMLLiteral datatype seems to be clearer than the alternatives.  I don't 
> think this could be extended to work for literals belonging to subtypes 
> of XMLLiteral, though, as there's nowhere to express the rdf:datatype.
> 
> [1] 
> http://lists.w3.org/Archives/Public/public-rdf-dawg/2004JulSep/0569.htm
> 



-- 
-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 Wednesday, 29 September 2004 10:14:00 UTC