// Before: SELECT * WHERE { { ?s ?p ?o . BIND(<ex://a> AS ?x) } { ?a ?b ?c } } // After: SELECT * WHERE { ?s ?p ?o . ?a ?b ?c . BIND(<ex://a> AS ?x) }
Example
// Before: SELECT ?y WHERE { ?y <ex://p> ?o . BIND(<ex://a> AS ?x) } // After (nothing projects ?x, so the bind is deleted): // SELECT ?y WHERE { ?y <ex://p> ?o }
Floats every
BINDinopas high as the plan allows and deletes the ones nothing above reads.Works on a subtree as happily as on a whole query, the invariant being anchored per swap.