Adds basic support of SPARQL comparison operators

pull/10/head
Tpt 6 years ago
parent 0783e0ecb0
commit 45cb74a43a
  1. 18
      lib/src/sparql/eval.rs

@ -191,6 +191,24 @@ impl<S: EncodedQuadsStore> SimpleEvaluator<S> {
_ => None, _ => None,
}, },
}, },
PlanExpression::Equal(a, b) => {
Some((self.eval_expression(a, tuple)? == self.eval_expression(b, tuple)?).into())
}
PlanExpression::NotEqual(a, b) => {
Some((self.eval_expression(a, tuple)? != self.eval_expression(b, tuple)?).into())
}
PlanExpression::Greater(a, b) => {
Some((self.eval_expression(a, tuple)? > self.eval_expression(b, tuple)?).into())
}
PlanExpression::GreaterOrEq(a, b) => {
Some((self.eval_expression(a, tuple)? >= self.eval_expression(b, tuple)?).into())
}
PlanExpression::Lower(a, b) => {
Some((self.eval_expression(a, tuple)? < self.eval_expression(b, tuple)?).into())
}
PlanExpression::LowerOrEq(a, b) => {
Some((self.eval_expression(a, tuple)? <= self.eval_expression(b, tuple)?).into())
}
PlanExpression::UnaryNot(e) => self PlanExpression::UnaryNot(e) => self
.to_bool(self.eval_expression(e, tuple)?) .to_bool(self.eval_expression(e, tuple)?)
.map(|v| (!v).into()), .map(|v| (!v).into()),

Loading…
Cancel
Save