- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Fri, 07 Oct 2011 08:58:35 +0100
- To: public-rdf-dawg-comments@w3.org
On 17/09/11 02:43, David Mizell wrote:
> Hi –
> I'm starting to look at property paths in SPARQL 1.1, and the spec
> doesn't make it clear how/whether reversal “distributes” over other
> operators. Suppose you have the triples
> y a o1
> o1 b x
> y b o2
> o2 a x
> in the database. Would { x ^(a/b) y } match with the first pair, or with
> the second pair of triples in the database?
> Thanks
> David Mizell
> Cray Inc., Seattle
David - section "9.1 Property Path Syntax" has list giving the
precedence rules of the property path syntax forms. Groups using () has
higher precedence than unary ^ which in turn is higher precedence than
binary operator /
{ x ^(a/b) y } is the reverse path of a/b so "(reverse (seq :a :b))" so
it matches the first case, reversing the whole of a/b. i.e. b then a
---- data
@prefix : <http://www.example.org/> .
:y1 :a :o1 .
:o1 :b :x1 .
:y2 :b :o2 .
:o2 :a :x2 .
---- query
PREFIX : <http://www.example.org/>
SELECT *
{ ?x ^(:a/:b) ?y }
---- results
-------------
| x | y |
=============
| :x1 | :y1 |
-------------
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)
Received on Friday, 7 October 2011 07:59:22 UTC