Proposal : deep binding injection

** Intuition/Outline

Ensure that the variables from the row being filtered are available, not 
just their values as in the spec with substitution.

This is done by restricting the variable to the value of the row at the 
point where the variable is being bound.  This is in a BGP.   Use of AS 
?x for ?x in the current row is not allowed : ?x is considered to be 
already set.

** Proposal

Rewrite the pattern of the EXISTS filter; do this in a deep fashion, 
while respecting scoping rules.

Let V = in-scope variables at the point of the FILTER EXISTS.

For each BGP in the pattern:
        Build a VALUES with variables of V still in-scope at this BGP.
        This includes empty BGPs

Scoping applies.

** Relationship to Issues

* Problem 2: Substitution happens where definitions are only for
variables

Variables are retained so e.g. BOUND(?var) remains unchanged.

The row being tested has already defined ?VAR so by the rule of no 
reassignment, using VALUE ?VAR at the BGP makes these illegal if a BGP 
used ?VAR : this is true at present.  We can leave things as they are. 
?VAR gets bound and presumably joined at some point (or it's out of scope).

Separately, a rule to forbid these forms might be clearer to users and 
in the spirit of ?VAR being fixed.  Then we can rewrite BGPs to include 
all vars.

* Problem 3: Blank nodes substituted into BGPs act as variables

No blank nodes are introduced into BGPs by substitution.

Binding for ?o = _:b
{ ?s ?p ?o } => { ?s ?p ?o . VALUES ?o {_:b} }

(in the algebra where _:b is not going to be remapped by surface syntax 
parsing)

* Problem 4: Substitution can flip MINUS to its disjoint-domain case

The domain of MINUS retains the same variables.

Received on Wednesday, 28 September 2016 23:45:13 UTC