W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > March 2011

Re: Comments about property paths

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Fri, 25 Mar 2011 13:07:49 +0000
Message-ID: <4D8C93A5.8030202@epimorphics.com>
To: Sebastián Conca <sconca87@gmail.com>
CC: public-rdf-dawg-comments@w3.org

The details of the property path expressions is something the WG has 
been working on recently and there are changes in the specification 
since the last published working draft in response to comments from the 
community and from discussions with the working group. You can see the 
changes in the editors' draft at 

The path evaluation has changed recently to make it in-line with the 
decisions of the SPARQL-WG as the WG works through the exact 
specification of property paths.

For both queries:

SELECT * WHERE { :a (:p+) ?x }
SELECT * WHERE { :a :p/(:p*) ?x }

the results would be:

| x  |
| :b |
| :c |
| :a |

The expression (:p+)+ is not equivalent in terms of cardinality of the 
elements although it should return the same elements. SELECT DISTINCT 
may be useful.

We would be grateful if you would acknowledge that your comment has been 
answered by sending a reply to this mailing list.

Andy, on behalf of the SPARQL-WG

On 18/03/11 20:04, Sebastián Conca wrote:
> Dear All,
> I have been trying some examples of SPARQL 1.1 property paths, and I
> have gotten some results that seem to be counterintuitive. For
> instance, consider a graph G:
> :a :p :b
> :b :p :c
> :c :p :a
> and the following query Q1:
> SELECT * WHERE { :a (:p+) ?x }
> According to the semantics proposed in the Working Draft document, the
> result of the query Q1 over G is:
> ?x = :b, :c, :a
> Now, consider a query Q2:
> SELECT * WHERE { :a :p/(:p*) ?x }
> According to the semantics proposed in the Working Draft document, the
> result of the query Q2 over G is:
> ?x = :b, :c, :a, :b
> I tested both queries in ARQ, getting the same results shown above.
> The paths used in the queries are equivalent regular expressions (the
> regular languages represented by (:p+) and :p/(:p*) are the same), so
> the results of these queries over G should be the same. Am I missing
> something?
> I also executed in ARQ a third query Q3 containing a regular
> expression that is equivalent to (:p+) and :p/(:p*):
> SELECT * WHERE { :a (:p+)+ ?x }
> But this time I got the result:
> ?x = :b, :c, :a, :b, :c, :a, :b, :c, :a, :b, :c, :a, :b, :c, :a
> What should be the interpretation of this result? I would really
> appreciate it if you could let me know whether I am missing something.
> Thank you very much.
> With best regards,
> Sebastián Conca
Received on Friday, 25 March 2011 13:08:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:11 UTC