- From: Andy Seaborne <andy@apache.org>
- Date: Thu, 29 Sep 2016 00:44:56 +0100
- To: public-sparql-exists@w3.org
A number of examples of the deep injection proposal - while written in SPARQL syntax (and bnodes) this happens in the algebra. Example 6 (GRAPH) and 7 (UNION) show difference from proposal 1 :: Example 1 Binding for ?o <x> { ?s ?p ?o } => { ?s ?p ?o . VALUES ?o {<x>} } :: Example 2 FILTER using outer variable. Binding for ?o <x> { ?s ?p ?z FILTER(?o = <x> } => { ?s ?p ?z . VALUES ?o {<x>} FILTER(?o = <x> }} :: Example 3 # Empty BGP { FILTER (?o = <z>) } => { VALUES ?o {<x>} FILTER (?o = <z>) } :: Example 4 Binding for ?o <x> The ?o in the SELECT is not in-scope so V is empty. { ?s ?p ?o . { SELECT ?p { ?x ?p ?o } } } => { ?s ?p ?o . VALUES ?o {<x>} { SELECT ?p { ?x ?p ?o } } } :: Example 5 Binding for ?o <x> Binding for ?z <z> With scoping. The ?o in the SELECT is in-scope. ?z is not in-scope. { ?s ?p ?o . { SELECT ?o { ?x ?p ?o } GROUP BY ?o } } => { ?s ?p ?o . VALUES ?o ?z {<x> <z> } {SELECT ?o { ?x ?p ?o VALUES ?o {<x>} } GROUP BY ?o } } :: Example 6 GRAPH - inject the restriction at the point of the BGP { GRAPH <g> { ?s ?p ?o } } => { GRAPH <g> { VALUES ?o {<x>} ?s ?p ?o } } :: Example 7 { { ?s :p ?z . FILTER(?o = <x> } UNION { ?s :q ?z . FILTER(?o != <x> } } => { { VALUES ?o {<x>} ?s :p ?z . FILTER(?o = <x> } UNION { VALUES ?o {<x>} ?s :q ?z . FILTER(?o != <x> } } :: Example 8 # Inner pattern: from: SELECT * { BIND (1 as ?x) FILTER EXISTS { FILTER EXISTS { FILTER (?x = 1) } } } The transformation is: { FILTER EXISTS { FILTER (?x = 1) } } => { VALUES ?x { 1 } FILTER EXISTS { VALUES ?x { 1 } FILTER (?x = 1) } }
Received on Wednesday, 28 September 2016 23:45:25 UTC