W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2004

Re: draft XML query results format spec

From: Simon Raboczi <raboczi@tucanatech.com>
Date: Wed, 29 Sep 2004 13:43:34 +1000
Message-Id: <BD78416E-11C9-11D9-BE4C-000A95C5686E@tucanatech.com>
To: public-rdf-dawg@w3.org

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:

<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




Received on Wednesday, 29 September 2004 03:44:12 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:20 GMT