use of org.apache.jena.sparql.expr.ExprList in project jena by apache.
the class ProcedureEval method exec.
@Override
public QueryIterator exec(Binding binding, Node name, ExprList args, ExecutionContext execCxt) {
// Eval if possible.
ExprList evalArgs = new ExprList();
for (Expr e : args) {
if (e.isVariable()) {
Var v = e.getExprVar().asVar();
// Special case - allow unevaluated variables.
if (binding.contains(v))
evalArgs.add(e.eval(binding, execCxt));
else
evalArgs.add(e);
} else {
NodeValue x = e.eval(binding, execCxt);
evalArgs.add(x);
}
}
return execEval(binding, evalArgs, execCxt);
}
use of org.apache.jena.sparql.expr.ExprList in project jena by apache.
the class SolutionModifierHandler method setVars.
@Override
public void setVars(Map<Var, Node> values) {
if (values.isEmpty()) {
return;
}
ExprRewriter exprRewriter = new ExprRewriter(values);
ExprList having = exprRewriter.rewrite(new ExprList(query.getHavingExprs()));
List<SortCondition> orderBy = exprRewriter.rewriteSortConditionList(query.getOrderBy());
VarExprList groupBy = exprRewriter.rewrite(query.getGroupBy());
query.getHavingExprs().clear();
query.getHavingExprs().addAll(having.getList());
if (orderBy != null) {
if (query.getOrderBy() == null) {
for (SortCondition sc : orderBy) {
query.addOrderBy(sc);
}
} else {
query.getOrderBy().clear();
query.getOrderBy().addAll(orderBy);
}
}
query.getGroupBy().clear();
query.getGroupBy().addAll(groupBy);
}
Aggregations