- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Mon, 28 Feb 2011 16:18:52 +0000
- To: SPARQL Working Group <public-rdf-dawg@w3.org>
Trying to catch up on the DELETE/bNodes discussions, I tried to pull a summary together for myself: == Intent The original resolution was that explicit bnodes (ones specified in the query string, not via substitution) act as variables for the DELETE template. c.f. DELETE WHERE. Examples: DELETE { ?x foaf:name [] } WHERE { ?x a foaf:Person } DELETE { ?x foaf:name _:a ; foaf:mbox _:a . } WHERE { ?x a foaf:Person } DELETE { [] foaf:name ?name ; foaf:mbox [] . } WHERE { ?x foaf:name ?name . FILTER(?name = "" ) } These explicit bnodes (a different kind of variable from substitution variables) are not general - they can't appear in the predicate or graph of a triple/quad by syntax. == Process 1 write [X] for a sequence of X's ACC = set of triples/quads to be removed. Using the "all terms" method: Step 1.1: Solve WHERE pattern to get bindings [B] Step 1.2: Turn bNodes in template into variables Remember which are the introduced variables - GV This is template T' Step 1.3: Let [X] be the sequence of solutions for all GV, for all terms in the graph store. X solves: SELECT DISTINCT ?Var_B # DISTINCT unnecessary { { ?Var_B ?Var_B1 ?Var_B2 } UNION { ?Var_B1 ?Var_B ?Var_B2 } UNION { ?Var_B1 ?Var_B2 ?Var_B } UNION { GRAPH ?Var_Bg {?Var_B ?Var_B1 ?Var_B2 } } UNION { GRAPH ?Var_Bg {?Var_B1 ?Var_B ?Var_B2 } } UNION { GRAPH ?Var_Bg {?Var_B1 ?Var_B2 ?Var_B } } } } The fact that "GRAPH ?Var_B" does not occur is a feature of the fact that "GRAPH []" isn't legal. { ?Var_B1 ?Var_B ?Var_B2 } x2 looks unnnecessary because bNodes can't be in the predicate position. Step 1.4: for each binding B in [B] for each binding X in [X] Form solution sequence B' = B union X This is a join on variable-disjoint solutions. Substitute for variables in T' for values using B' Eliminate illegal triples or quads(*2) Accumlate things to be deleted into ACC Step 1.5 Remove anything in ACC from the graph store. == Another way is: Observation: This means that DELETE is really a process of forming a sequence of templates and then doing a DELETE WHERE with each template, except that would mix bNodes explicitly in the template with bNodes from substitution. This makes the DELETE process: Step 2.1: Solve WHERE pattern to get bindings [B] Step 2.2: Turn bNodes in template into variables Remember which are the introduced variables - GV This is template T' This is making explicit bNodes into variables for the DELETE WHERE but done so as not to mix up bNodes from substitution. Step 2.3: for each binding B in [B] Substitute in T' for variables for values using B This can not involve a variable from GV by uniqueness. Eliminate illegal triples/quads except where a GV variable is unbound (*1) This gives template instance TI, where TI is ground terms or variables from GV. ## Do a DELETE WHERE using TI ## no explicit bNodes as variables by now. Solve TI, to give solution sequence [B2] Assumes its the whole pattern that matters, not individual triples (*3) for each binding B2 in [B2] Substitute in TI for variables for values using B2 Eliminate illegal triples (literals as subjects) (*2) to get triples and quads set DelS Accumlate things to be deleted into ACC Step 2.4 Remove anything in ACC from the graph store. (*1) Not sure this is the right order (*2) Unnecessary because we are going to diff (*3) This has not been discussed in email - I've seen indirect mention of both styles.
Received on Monday, 28 February 2011 16:19:28 UTC