- From: Gregory Williams <greg@evilfunhouse.com>
- Date: Tue, 23 Jan 2018 09:03:42 -0800
- To: Adrian <skubella@uni-koblenz.de>
- Cc: public-sparql-dev@w3.org
- Message-Id: <1EC12872-0F01-4D0D-AB0E-F632E10E10CE@evilfunhouse.com>
Hi Adrian,
The way you describe ZeroOrOnePath and ZeroOrMorePath aligns with my understanding of the SPARQL specification. If the paper you cite suggests different results, that sounds like a problem with their formalization.
Thanks,
Greg
On Jan 22, 2018, at 7:21 AM, Adrian <skubella@uni-koblenz.de> wrote:
>
> Hi everyone,
>
> I have a question about the semantics of ZeroOrOnePath and ZeroOrMorePath of property paths. What are the correct query results in the following two situations?
>
>
> 1) ZeroOrOnePath
>
> Let's consider the following graph G consisting of one triple:
> <foaf:alice foaf:knows foaf:bob>
>
> Now we want to answer the query Q1:
> SELECT * WHERE {<foaf:chris> <foaf:knows>? ?o}
>
> Based on the definition of ZeroOrOnePath with one variable in the W3C recommendation [1]
> eval(Path(X:term, ZeroOrOnePath(P), Y:var)) = { (Y, yn) | yn = X or {(Y, yn)} in eval(Path(X,P,Y)) }
> Q1 would return {(?o, <foaf:chris>)} since it is not checked whether <foaf:chris> is contained in G.
>
> In contrast to this papers like [2] ZeroOrOnePath are defined in such a way that Q1 would return an empty result set.
>
>
> 2) ZeroOrMorePath
>
> Let's assume the following query Q2 over the graph G shown above:
> SELECT * WHERE {<foaf:chris> <foaf:knows>* ?o}
>
> Based on the definition of ZeroOrMorePath with one variable in the W3C recommendation [1], the query Q2 would return {(?o, <foaf:chris>)} even though <foaf:chris> is not element of the graph. (The definitions and a more detailed explanation is at the end of this mail.) According to [2] this query would return an empty result set.
>
>
> Can someone please explain to me, whether a subject not occurring in the graph should be contained in the result sets of ZeroOrOnePath and ZeroOrMorePath or not?
>
> Thank you very much for your help.
>
> Best regards,
> Adrian
>
> [1]https://www.w3.org/TR/sparql11-query/#PropertyPathPatterns <https://www.w3.org/TR/sparql11-query/#PropertyPathPatterns>
> [2]https://users.dcc.uchile.cl/~mromero/papers/ppath.pdf <https://users.dcc.uchile.cl/%7Emromero/papers/ppath.pdf>
>
>
> In [1] ZeroOrMorePath with one variable is defined as
> eval(Path(X:term, ZeroOrMorePath(path), vy:var)) ={ { (vy, n) } | n in ALP(X, path) }
> and ALP is defined as:
>
> ALP(x:term, path) =
> Let V = empty multiset
> ALP(x:term, path, V)
> return is V
>
> # V is the set of nodes visited
>
> ALP(x:term, path, V:set of RDF terms) =
> if ( x in V ) return
> add x to V
> X = eval(x,path)
> For n:term in X
> ALP(n, path, V)
> End
>
> If I understand it correctly in the first iteration of ALP(x:term, path, V:set of RDF terms) x is added to V regardless of whether x is element of the graph or not. Thus, query Q2 would return {(?o, <foaf:chris>)} even though <foaf:chris> is not element of the graph.
Received on Tuesday, 23 January 2018 17:12:23 UTC