- From: Simon Raboczi <raboczi@tucanatech.com>
- Date: Wed, 29 Sep 2004 14:54:42 +1000
- To: public-rdf-dawg@w3.org
On 29/09/2004, at 13:43, Simon Raboczi wrote:
> <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>
>
On further thought, if ordered results aren't required it seems safe to
dispense with the sparql:Query instance entirely. The structure is
then nearly identical to the XML version, with <rdf:RDF> in place of
<results> and <sparql:Solution> in place of <result>.
(And I added Alice's name back, which I missed the first time around.
Oops.)
<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:Solution>
<var:hpage rdf:resource="http://work.example.org/alice/"/>
<var:name>Alice</var:name>
<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>
</rdf:RDF>
Although SPARQL doesn't having sorting yet, I'd be reluctant to suggest
a result format that couldn't express an ordering for the solutions.
The idea of flipflopping between the sparql:Query-rooted form and the
one without a sparql:Query depending on whether the query asked for
sorted results would be unpleasant for consumption by XML tools. The
XML format didn't have this problem because XML elements like the
<result> children of <results> have an order, whereas in RDF/XML the
<sparql:Solution> children of <rdf:RDF> don't have an ordering in the
RDF graph. One alternative would be to add a propertty
sparql:position with domain sparql:Solution and range
xsd:positiveInteger that would only be present for ordered results. If
the preceding result was intended to be sorted by $name, it'd look like
this:
<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:Solution>
<sparql:position
rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</sparql:
solutionIndex>
<var:hpage rdf:resource="http://work.example.org/alice/"/>
<var:name>Alice</var:name>
<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>
<sparql:position
rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</sparql:
solutionIndex>
<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>
</rdf:RDF>
Received on Wednesday, 29 September 2004 09:47:22 UTC