use of org.apache.rya.api.domain.RangeValue in project incubator-rya by apache.
the class FilterRangeVisitor method meet.
@Override
public void meet(final Filter node) throws Exception {
super.meet(node);
final ValueExpr arg = node.getCondition();
if (arg instanceof FunctionCall) {
final FunctionCall fc = (FunctionCall) arg;
if (RANGE.stringValue().equals(fc.getURI())) {
// range(?var, start, end)
final List<ValueExpr> valueExprs = fc.getArgs();
if (valueExprs.size() != 3) {
throw new QueryEvaluationException("org.apache:range must have 3 parameters: variable, start, end");
}
final Var var = (Var) valueExprs.get(0);
final ValueConstant startVc = (ValueConstant) valueExprs.get(1);
final ValueConstant endVc = (ValueConstant) valueExprs.get(2);
final Value start = startVc.getValue();
final Value end = endVc.getValue();
rangeValues.put(var, new RangeValue(start, end));
node.setCondition(new ValueConstant(BooleanLiteralImpl.TRUE));
}
}
}
use of org.apache.rya.api.domain.RangeValue in project incubator-rya by apache.
the class FilterRangeVisitor method meet.
@Override
public void meet(final StatementPattern node) throws Exception {
super.meet(node);
final Var subjectVar = node.getSubjectVar();
final RangeValue subjRange = rangeValues.get(subjectVar);
final Var predVar = node.getPredicateVar();
final RangeValue predRange = rangeValues.get(predVar);
final Var objVar = node.getObjectVar();
final RangeValue objRange = rangeValues.get(objVar);
if (subjRange != null) {
// Assumes no blank nodes can be ranges
subjectVar.setValue(new RangeURI(subjRange));
}
if (predRange != null) {
predVar.setValue(new RangeURI(predRange));
}
if (objRange != null) {
objVar.setValue(objRange);
}
}
Aggregations