- From: Andy Seaborne <andy@apache.org>
- Date: Tue, 30 May 2017 22:04:10 +0100
- To: public-sparql-dev@w3.org
On 30/05/17 20:56, Toni Schindler wrote: > Hi. > > Given the data > > :x1 :p "s1" > :x2 :p "s2" > > I expect query 1 > > { > ?x1 :p ?s1. > ?x2 :p ?s2. > } > > to return two solutions, > > ?x1 ?s1 ?x2 ?s2 > :x1 "s1" :x2 "s2" > :x2 "s2" :x1 "s1" It has 4 solutions. ?x1 :p ?s1. can match ?x1=:x1, ?s1=:s1 and also ?x1=:x2 ?s1=:s2 and then ?x2 :p ?s2. can match ?x2=:x1, ?s2=:s1 and also ?x2=:x2 ?s2=:s2 There is no connection between the two parts so you get 2 x 2 = 4 solution - every combination. There is no reason ?x1=:x1, ?s1=:s1, ?x2=:x1, ?s2=:s1 isn't a solution. Just because ?x1 is matched to :x1 does not stop ?x2 being matched the same way. Andy > > while query 2 > > { > { ?x1 :p ?s1. } > { ?x2 :p ?s2. } > } > > should have four solutions: > > ?x1 ?s1 ?x2 ?s2 > :x1 "s1" :x2 "s2" > :x2 "s2" :x1 "s1" > :x1 "s1" :x1 "s1" > :x2 "s2" :x2 "s2" > > This is because in the first case, there is one length-2 basic graph > pattern, matching a length-2 subgraph (the whole graph) with two > different ways to bind the variables to the matched graph. > In the second case, there is a group graph pattern of two length-1 basic > graph patterns, each matching two subgraphs, and in each case there is > one way to bind variables; both length-2 solutions are joined, giving a > total of four solutions. > > Can someone confirm that this is the correct interpretation? > This is a reduced example of my question about a test case I asked here: > https://lists.w3.org/Archives/Public/public-rdf-tests/2017May/0000.html > > Toni > >
Received on Tuesday, 30 May 2017 21:04:45 UTC