- From: Andy Seaborne <aseaborne@topquadrant.com>
- Date: Mon, 28 Nov 2016 16:26:25 +0000
- To: public-sparql-exists@w3.org
On 26/11/16 21:39, Peter F. Patel-Schneider wrote: > I have added a new test and shown what I think the results for several > setups are are on some data. The "Expected" results are what I think should > be expected from the fixed definition of SPARQL that the group is supposed > to produce. (Revised to take into account the empty BGPs that are generated > and stick around.) > > Graph > :s :p :v . > :t :r :w . > > Example 1 > SELECT ?x WHERE { > ?x :p :v . > FILTER ( EXISTS { > FILTER ( ?x = :s ) ) > } ) > } Parse error. > > Specification { { (x,:s) } } > Proposal A { { (x,:s) } } > Proposal B { { (x,:s) } } > Expected { { (x,:s) } } Yes > Example 2 > SELECT ?x WHERE { > ?x :p :v . > FILTER ( EXISTS { > SELECT (?y as ?x) WHERE { > ?y :r :w . > } > } ) > } > > Specification error issue 2 > Proposal A { } > Proposal B { { (x,:s) } } << I think. No - syntax error by assignment rule. Assigning to an already assigned variable is an error in SPARQL and proposal B sets ?x inside the SELECT > Expected { } ? Why? Digression: Both proposals need to deal with EXISTS { BIND(... AS ?x) Proposal-B forbids it statically (see also grammar notes 12 and 13) > Example 3 > SELECT ?x WHERE { > ?x :p :v . > FILTER ( EXISTS { > ?x :p :v . MINUS { ?x :p :v . } > } ) > } > > Specification { { (x,:s) } } > Proposal A { } > Proposal B { } Yes > Expected { } Not sure what to expect for MINUS inside EXISTS, or whether it matters as much as other forms. It gets complicated especially the more common NOT EXISTS, as to what the user is trying to achieve. I don't see it in user queries. In terms of priorities, having it evaluate with out errors, then making sure the common constructs work well, is the most useful thing we can do IMO. > Example 4 > SELECT ?x WHERE { > ?x :p :v . > FILTER ( EXISTS { > :a :q :c . MINUS { :a :q :c . } > } ) > } > > Specification { { (x,:s) } } It's {} { :a :q :c . MINUS { :a :q :c . } } is empty because the left-hand BGP does not match. Maybe you meant: :s :p :v MINUS { :s :p :v } or :s :p :v MINUS { :t :r :v } > Proposal A { { (x,:s) } } How? > Proposal B { } Yes. > Expected* { { (x,:s) } } > * Expected only if the flipping nature of MINUS is considered to be > expected, otherwise the expected result would be { }. > > Example 5 > SELECT ?x WHERE { > ?x :p :v . > FILTER ( EXISTS { > ?x :p :v . MINUS { :a :q :c . } > } ) > } > > Specification { { (x,:s) } } > Proposal A { { (x,:s) } } > Proposal B { } { { (x,:s) } } > Expected { { (x,:s) } } > Andy
Received on Monday, 28 November 2016 16:27:01 UTC