|
|
@ -461,112 +461,110 @@ pub enum PlanExpression { |
|
|
|
impl PlanExpression { |
|
|
|
impl PlanExpression { |
|
|
|
pub fn lookup_used_variables(&self, callback: &mut impl FnMut(usize)) { |
|
|
|
pub fn lookup_used_variables(&self, callback: &mut impl FnMut(usize)) { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
PlanExpression::Variable(v) | PlanExpression::Bound(v) => { |
|
|
|
Self::Variable(v) | Self::Bound(v) => { |
|
|
|
callback(*v); |
|
|
|
callback(*v); |
|
|
|
} |
|
|
|
} |
|
|
|
PlanExpression::Constant(_) |
|
|
|
Self::Constant(_) |
|
|
|
| PlanExpression::Rand |
|
|
|
| Self::Rand |
|
|
|
| PlanExpression::Now |
|
|
|
| Self::Now |
|
|
|
| PlanExpression::Uuid |
|
|
|
| Self::Uuid |
|
|
|
| PlanExpression::StrUuid |
|
|
|
| Self::StrUuid |
|
|
|
| PlanExpression::BNode(None) => (), |
|
|
|
| Self::BNode(None) => (), |
|
|
|
PlanExpression::UnaryPlus(e) |
|
|
|
Self::UnaryPlus(e) |
|
|
|
| PlanExpression::UnaryMinus(e) |
|
|
|
| Self::UnaryMinus(e) |
|
|
|
| PlanExpression::Not(e) |
|
|
|
| Self::Not(e) |
|
|
|
| PlanExpression::BNode(Some(e)) |
|
|
|
| Self::BNode(Some(e)) |
|
|
|
| PlanExpression::Str(e) |
|
|
|
| Self::Str(e) |
|
|
|
| PlanExpression::Lang(e) |
|
|
|
| Self::Lang(e) |
|
|
|
| PlanExpression::Datatype(e) |
|
|
|
| Self::Datatype(e) |
|
|
|
| PlanExpression::Iri(e) |
|
|
|
| Self::Iri(e) |
|
|
|
| PlanExpression::Abs(e) |
|
|
|
| Self::Abs(e) |
|
|
|
| PlanExpression::Ceil(e) |
|
|
|
| Self::Ceil(e) |
|
|
|
| PlanExpression::Floor(e) |
|
|
|
| Self::Floor(e) |
|
|
|
| PlanExpression::Round(e) |
|
|
|
| Self::Round(e) |
|
|
|
| PlanExpression::UCase(e) |
|
|
|
| Self::UCase(e) |
|
|
|
| PlanExpression::LCase(e) |
|
|
|
| Self::LCase(e) |
|
|
|
| PlanExpression::StrLen(e) |
|
|
|
| Self::StrLen(e) |
|
|
|
| PlanExpression::EncodeForUri(e) |
|
|
|
| Self::EncodeForUri(e) |
|
|
|
| PlanExpression::Year(e) |
|
|
|
| Self::Year(e) |
|
|
|
| PlanExpression::Month(e) |
|
|
|
| Self::Month(e) |
|
|
|
| PlanExpression::Day(e) |
|
|
|
| Self::Day(e) |
|
|
|
| PlanExpression::Hours(e) |
|
|
|
| Self::Hours(e) |
|
|
|
| PlanExpression::Minutes(e) |
|
|
|
| Self::Minutes(e) |
|
|
|
| PlanExpression::Seconds(e) |
|
|
|
| Self::Seconds(e) |
|
|
|
| PlanExpression::Timezone(e) |
|
|
|
| Self::Timezone(e) |
|
|
|
| PlanExpression::Tz(e) |
|
|
|
| Self::Tz(e) |
|
|
|
| PlanExpression::Md5(e) |
|
|
|
| Self::Md5(e) |
|
|
|
| PlanExpression::Sha1(e) |
|
|
|
| Self::Sha1(e) |
|
|
|
| PlanExpression::Sha256(e) |
|
|
|
| Self::Sha256(e) |
|
|
|
| PlanExpression::Sha384(e) |
|
|
|
| Self::Sha384(e) |
|
|
|
| PlanExpression::Sha512(e) |
|
|
|
| Self::Sha512(e) |
|
|
|
| PlanExpression::IsIri(e) |
|
|
|
| Self::IsIri(e) |
|
|
|
| PlanExpression::IsBlank(e) |
|
|
|
| Self::IsBlank(e) |
|
|
|
| PlanExpression::IsLiteral(e) |
|
|
|
| Self::IsLiteral(e) |
|
|
|
| PlanExpression::IsNumeric(e) |
|
|
|
| Self::IsNumeric(e) |
|
|
|
| PlanExpression::IsTriple(e) |
|
|
|
| Self::IsTriple(e) |
|
|
|
| PlanExpression::Subject(e) |
|
|
|
| Self::Subject(e) |
|
|
|
| PlanExpression::Predicate(e) |
|
|
|
| Self::Predicate(e) |
|
|
|
| PlanExpression::Object(e) |
|
|
|
| Self::Object(e) |
|
|
|
| PlanExpression::BooleanCast(e) |
|
|
|
| Self::BooleanCast(e) |
|
|
|
| PlanExpression::DoubleCast(e) |
|
|
|
| Self::DoubleCast(e) |
|
|
|
| PlanExpression::FloatCast(e) |
|
|
|
| Self::FloatCast(e) |
|
|
|
| PlanExpression::DecimalCast(e) |
|
|
|
| Self::DecimalCast(e) |
|
|
|
| PlanExpression::IntegerCast(e) |
|
|
|
| Self::IntegerCast(e) |
|
|
|
| PlanExpression::DateCast(e) |
|
|
|
| Self::DateCast(e) |
|
|
|
| PlanExpression::TimeCast(e) |
|
|
|
| Self::TimeCast(e) |
|
|
|
| PlanExpression::DateTimeCast(e) |
|
|
|
| Self::DateTimeCast(e) |
|
|
|
| PlanExpression::DurationCast(e) |
|
|
|
| Self::DurationCast(e) |
|
|
|
| PlanExpression::YearMonthDurationCast(e) |
|
|
|
| Self::YearMonthDurationCast(e) |
|
|
|
| PlanExpression::DayTimeDurationCast(e) |
|
|
|
| Self::DayTimeDurationCast(e) |
|
|
|
| PlanExpression::StringCast(e) => e.lookup_used_variables(callback), |
|
|
|
| Self::StringCast(e) => e.lookup_used_variables(callback), |
|
|
|
PlanExpression::Or(a, b) |
|
|
|
Self::Or(a, b) |
|
|
|
| PlanExpression::And(a, b) |
|
|
|
| Self::And(a, b) |
|
|
|
| PlanExpression::Equal(a, b) |
|
|
|
| Self::Equal(a, b) |
|
|
|
| PlanExpression::Greater(a, b) |
|
|
|
| Self::Greater(a, b) |
|
|
|
| PlanExpression::GreaterOrEqual(a, b) |
|
|
|
| Self::GreaterOrEqual(a, b) |
|
|
|
| PlanExpression::Less(a, b) |
|
|
|
| Self::Less(a, b) |
|
|
|
| PlanExpression::LessOrEqual(a, b) |
|
|
|
| Self::LessOrEqual(a, b) |
|
|
|
| PlanExpression::Add(a, b) |
|
|
|
| Self::Add(a, b) |
|
|
|
| PlanExpression::Subtract(a, b) |
|
|
|
| Self::Subtract(a, b) |
|
|
|
| PlanExpression::Multiply(a, b) |
|
|
|
| Self::Multiply(a, b) |
|
|
|
| PlanExpression::Divide(a, b) |
|
|
|
| Self::Divide(a, b) |
|
|
|
| PlanExpression::LangMatches(a, b) |
|
|
|
| Self::LangMatches(a, b) |
|
|
|
| PlanExpression::Contains(a, b) |
|
|
|
| Self::Contains(a, b) |
|
|
|
| PlanExpression::StrStarts(a, b) |
|
|
|
| Self::StrStarts(a, b) |
|
|
|
| PlanExpression::StrEnds(a, b) |
|
|
|
| Self::StrEnds(a, b) |
|
|
|
| PlanExpression::StrBefore(a, b) |
|
|
|
| Self::StrBefore(a, b) |
|
|
|
| PlanExpression::StrAfter(a, b) |
|
|
|
| Self::StrAfter(a, b) |
|
|
|
| PlanExpression::StrLang(a, b) |
|
|
|
| Self::StrLang(a, b) |
|
|
|
| PlanExpression::StrDt(a, b) |
|
|
|
| Self::StrDt(a, b) |
|
|
|
| PlanExpression::SameTerm(a, b) |
|
|
|
| Self::SameTerm(a, b) |
|
|
|
| PlanExpression::SubStr(a, b, None) |
|
|
|
| Self::SubStr(a, b, None) |
|
|
|
| PlanExpression::Regex(a, b, None) => { |
|
|
|
| Self::Regex(a, b, None) => { |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
PlanExpression::If(a, b, c) |
|
|
|
Self::If(a, b, c) |
|
|
|
| PlanExpression::SubStr(a, b, Some(c)) |
|
|
|
| Self::SubStr(a, b, Some(c)) |
|
|
|
| PlanExpression::Regex(a, b, Some(c)) |
|
|
|
| Self::Regex(a, b, Some(c)) |
|
|
|
| PlanExpression::Replace(a, b, c, None) |
|
|
|
| Self::Replace(a, b, c, None) |
|
|
|
| PlanExpression::Triple(a, b, c) => { |
|
|
|
| Self::Triple(a, b, c) => { |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
c.lookup_used_variables(callback); |
|
|
|
c.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
PlanExpression::Replace(a, b, c, Some(d)) => { |
|
|
|
Self::Replace(a, b, c, Some(d)) => { |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
a.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
b.lookup_used_variables(callback); |
|
|
|
c.lookup_used_variables(callback); |
|
|
|
c.lookup_used_variables(callback); |
|
|
|
d.lookup_used_variables(callback); |
|
|
|
d.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
PlanExpression::Concat(es) |
|
|
|
Self::Concat(es) | Self::Coalesce(es) | Self::CustomFunction(_, es) => { |
|
|
|
| PlanExpression::Coalesce(es) |
|
|
|
|
|
|
|
| PlanExpression::CustomFunction(_, es) => { |
|
|
|
|
|
|
|
for e in es { |
|
|
|
for e in es { |
|
|
|
e.lookup_used_variables(callback); |
|
|
|
e.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PlanExpression::Exists(e) => { |
|
|
|
Self::Exists(e) => { |
|
|
|
e.lookup_used_variables(callback); |
|
|
|
e.lookup_used_variables(callback); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|