Re: SPARQL Query Results XML Format

Dave Beckett wrote:
> I've updated the XML results format editor's draft
> 
>   $Revision: 1.24 $ of $Date: 2005/04/25 16:11:26 $
>   http://www.w3.org/2001/sw/DataAccess/rf1/
> 
> to reflect issues brought up and after earlier discussion.

Nice job, I think it's a big improvement. I still have a few remarks 
though :)

> The changes are primarily as follows:
> 
> 1. Switched to a form where the variable name is not used as an
>    element name. It is now of the form <binding name="var">
 >
> 2. Added a boolean result form for ASK.
> 
> 3. Added sub-elements of binding for the RDF Term types:
>    <bnode>, <uri>, <literal>

Regarding points 1 and 3: I wonder why the <binding> element is 
necessary. An alternative would be to eliminate it and have the 
<bnode>, <uri> and <literal> elements directly as subelements of 
<result>, with the var attribute, like so:

     <result>
       <bnode var="x">r2</bnode>
       <uri var="hpage">http://work.example.org/bob/</uri>
       <literal var="name" xml:lang="en">Bob</literal>
       <uri var="mbox">mailto:bob@work.example.org</uri>
       <literal var="age" xsi:type="xs:integer" 
datatype="http://www.w3.org/2001/XMLSchema#integer">30</literal>
       <unbound var="blurb"/>
       <bnode var="friend">r1</bnode>
     </result>

I guess it comes down to taste as much as anything, but this would be 
more compact and arguably just as easy to parse/validate.

As for point 2, the boolean results format: my colleague Arjohn came 
up with the following alternatives:

Alternative 1:

<?xml version="1.0"?>
<sparql-ask xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result2">
   <true/>
</sparql-ask>

Alternative 2:

<?xml version="1.0"?>
<sparql-ask xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result2">
   <literal xsi:type="xs:boolean"
      datatype="http://www.w3.org/2001/XMLSchema#boolean>true</literal>
</sparql-ask>

Using a different root element makes it immediately clear that this is 
a fundamentally different kind of result - after all, it is not a 
variable binding result so it seems a bit awkward to try and fit it in 
the same Schema. A separate XML Schema for boolean results could be 
trivially simple.

Regarding the use of an index attribute for denoting order: I was a 
bit surprised to see that since I thought the idea was to just add a 
'ordered="true"' attribute to the header somewhere and leave ordering 
up to XML element order. This automatically makes it clear that the 
ordered result can be processed in a streaming fashion as well.

My (and Arjohn's) 2 cents,

Jeen
-- 
Jeen Broekstra          Aduna BV
Knowledge Engineer      Julianaplein 14b, 3817 CS Amersfoort
http://aduna.biz        The Netherlands
tel. +31 33 46599877

Received on Thursday, 28 April 2005 17:21:19 UTC