RE: Further comments on SPARQL 1.1 (property paths)

Hi Andy

Consider the following trivial dataset:

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix : <http://example.org/> .

:a foaf:knows :b .
:a foaf:knows :c .
:b foaf:knows :d .
:c foaf:knows :d .

Given this dataset executing either of the following queries results in a
result set containing two results where the results are duplicates.

Explicit 2 Step Query

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?x ?y WHERE { ?x foaf:knows ?z . ?z foaf:knows ?y }

?x = http://example.org/a , ?y = http://example.org/d
?x = http://example.org/a , ?y = http://example.org/d

Equivalent Query using Property Paths

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?x ?y WHERE {?x foaf:knows{2} ?y}

?x = http://example.org/a , ?y = http://example.org/d
?x = http://example.org/a , ?y = http://example.org/d

The results are duplicates but seeing as there are two valid ways to bind
this solution is this not a correct result set?  This is what I was trying
to get at when I asked whether duplicates can occur when you transform a
simple path.

Rob Vesse

-----Original Message-----
From: public-rdf-dawg-comments-request@w3.org
[mailto:public-rdf-dawg-comments-request@w3.org] On Behalf Of Andy Seaborne
Sent: 26 February 2010 14:29
To: Rob Vesse
Cc: public-rdf-dawg-comments@w3.org
Subject: Re: Further comments on SPARQL 1.1 (property paths)



On 25/02/2010 3:24 PM, Rob Vesse wrote:
> With regards to my previous comments and the Working Group's response
> [1] I would like to make some further comments.
>
...
> Property Paths - Having asked Steve Harris for clarification of this
> off-list I'd like to make the following comment about simple property
> paths. The draft states that simple paths can be transformed to algebra
> expressions and executed as such (I've implemented this in my
> implementation) but the specification also states that property paths
> should eliminate duplicates. In the case where paths can be transformed
> to a BGP is it still necessary to eliminate duplicates?

A simple path is one that is equivalent to writing out in full in triples.

For example:
?x :p/:q ?y

is equivalent to:

?x :p ?_Z
?_Z :q ?y

for some variable generated ?_Z

A BGP does not generate duplicates nor does a simple path.

So if the transformation has been done to a BGP, no more work is needed 
other than to evaluate the BGP.

	Andy

>
> Rob Vesse
>
> PhD Student
>
> IAM Group
>
> Bay 20, Room 4027, Building 32
>
> Electronics & Computer Science
>
> University of Southampton
>
> SO17 1BJ
>
> [1] http://www.w3.org/2009/sparql/wiki/CommentResponse:RV-2
>

Received on Friday, 26 February 2010 15:24:34 UTC