- From: Andy Seaborne <andy@apache.org>
- Date: Thu, 14 Dec 2017 21:21:18 +0000
- To: public-sparql-dev@w3.org
On 14/12/17 15:06, Adrian wrote:
> Hello,
>
> I have a question about the semantics of ZeroOrOnePath of property paths.
> In [1] ZeroOrOnePath with two variables is defined as:
>
> eval(Path(X:var, ZeroOrOnePath(P), Y:var)) =
> { (X, xn) (Y, yn) | either (yn in nodes(G) and xn = yn) or {(X,xn), (Y,yn)} in eval(Path(X,P,Y)) }
>
> Let's consider the following example graph G consisting of the following two triples:
> <foaf:alice foaf:knows foaf:bob>
> <foaf:bob foaf:knows foaf:bob>
>
> Now we want to answer the following query:
> SELECT * WHERE {?s <foaf:knows>? ?o}
>
> Based on the former definition, this query would produce the following results:
> 1) {(?s, foaf:alice), (?o, foaf:alice)}, since foaf:alice is in nodes(G)
> 2) {(?s, foaf:alice), (?o, foaf:bob)}, since <foaf:alice foaf:knows foaf:bob> is in G
> But {(?s, foaf:bob), (?o, foaf:bob)} is*no* result, since foaf:bob is in nodes(G)*and* <foaf:bob foaf:knows foaf:bob> is in G. This means the XOR condition in the definition of ZeroOrOnePath will be evaluate to false.
Adrian,
It's OR, not XOR.
Andy
>
> Based on my intuition of the semantics of ZeroOrOnePath I would have expected that {(?s, foaf:bob), (?o, foaf:bob)} is part of the result. Also in papers like [2] ZeroOrOnePath are defined in a way so that {(?s, foaf:bob), (?o, foaf:bob)} would be part of the result.
>
> I would assume that there is a reason why the definition in [1] excludes {(?s, foaf:bob), (?o, foaf:bob)} from the result set. Could someone please explain me the reason, why {(?s, foaf:bob), (?o, foaf:bob)} was excluded?
>
> Thank you very much for your help.
>
> Best regards,
> Adrian
>
> [1]https://www.w3.org/TR/sparql11-query/#PropertyPathPatterns
> [2]https://users.dcc.uchile.cl/~mromero/papers/ppath.pdf
>
Received on Thursday, 14 December 2017 21:21:43 UTC