|
|
@ -136,18 +136,10 @@ impl PlanNode { |
|
|
|
object, |
|
|
|
object, |
|
|
|
graph_name, |
|
|
|
graph_name, |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
if let PatternValue::Variable(var) = subject { |
|
|
|
subject.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
predicate.lookup_variables(callback); |
|
|
|
} |
|
|
|
object.lookup_variables(callback); |
|
|
|
if let PatternValue::Variable(var) = predicate { |
|
|
|
graph_name.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = object { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = graph_name { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Self::PathPattern { |
|
|
|
Self::PathPattern { |
|
|
|
subject, |
|
|
|
subject, |
|
|
@ -155,15 +147,9 @@ impl PlanNode { |
|
|
|
graph_name, |
|
|
|
graph_name, |
|
|
|
.. |
|
|
|
.. |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
if let PatternValue::Variable(var) = subject { |
|
|
|
subject.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
object.lookup_variables(callback); |
|
|
|
} |
|
|
|
graph_name.lookup_variables(callback); |
|
|
|
if let PatternValue::Variable(var) = object { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = graph_name { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Self::Filter { child, expression } => { |
|
|
|
Self::Filter { child, expression } => { |
|
|
|
expression.lookup_used_variables(callback); |
|
|
|
expression.lookup_used_variables(callback); |
|
|
@ -209,9 +195,7 @@ impl PlanNode { |
|
|
|
service_name, |
|
|
|
service_name, |
|
|
|
.. |
|
|
|
.. |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
if let PatternValue::Variable(v) = service_name { |
|
|
|
service_name.lookup_variables(callback); |
|
|
|
callback(v.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
child.lookup_used_variables(callback); |
|
|
|
child.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
Self::Project { mapping, child } => { |
|
|
|
Self::Project { mapping, child } => { |
|
|
@ -279,18 +263,10 @@ impl PlanNode { |
|
|
|
object, |
|
|
|
object, |
|
|
|
graph_name, |
|
|
|
graph_name, |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
if let PatternValue::Variable(var) = subject { |
|
|
|
subject.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
predicate.lookup_variables(callback); |
|
|
|
} |
|
|
|
object.lookup_variables(callback); |
|
|
|
if let PatternValue::Variable(var) = predicate { |
|
|
|
graph_name.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = object { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = graph_name { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Self::PathPattern { |
|
|
|
Self::PathPattern { |
|
|
|
subject, |
|
|
|
subject, |
|
|
@ -298,15 +274,9 @@ impl PlanNode { |
|
|
|
graph_name, |
|
|
|
graph_name, |
|
|
|
.. |
|
|
|
.. |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
if let PatternValue::Variable(var) = subject { |
|
|
|
subject.lookup_variables(callback); |
|
|
|
callback(var.encoded); |
|
|
|
object.lookup_variables(callback); |
|
|
|
} |
|
|
|
graph_name.lookup_variables(callback); |
|
|
|
if let PatternValue::Variable(var) = object { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if let PatternValue::Variable(var) = graph_name { |
|
|
|
|
|
|
|
callback(var.encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Self::Filter { child, .. } => { |
|
|
|
Self::Filter { child, .. } => { |
|
|
|
//TODO: have a look at the expression to know if it filters out unbound variables
|
|
|
|
//TODO: have a look at the expression to know if it filters out unbound variables
|
|
|
@ -402,6 +372,18 @@ pub enum PatternValue { |
|
|
|
TriplePattern(Box<TriplePatternValue>), |
|
|
|
TriplePattern(Box<TriplePatternValue>), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl PatternValue { |
|
|
|
|
|
|
|
pub fn lookup_variables(&self, callback: &mut impl FnMut(usize)) { |
|
|
|
|
|
|
|
if let Self::Variable(v) = self { |
|
|
|
|
|
|
|
callback(v.encoded) |
|
|
|
|
|
|
|
} else if let Self::TriplePattern(p) = self { |
|
|
|
|
|
|
|
p.subject.lookup_variables(callback); |
|
|
|
|
|
|
|
p.predicate.lookup_variables(callback); |
|
|
|
|
|
|
|
p.object.lookup_variables(callback); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for PatternValue { |
|
|
|
impl fmt::Display for PatternValue { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|