Re: Comments about property paths

Sebastián,

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 
http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml.

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