use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.
the class OpRewriter method visit.
@Override
public void visit(OpTable opTable) {
Table tbl = opTable.getTable();
boolean process = false;
for (Var v : tbl.getVars()) {
process = process | values.keySet().contains(v);
}
if (!process) {
push(opTable);
} else {
TableN retTbl = new TableN(tbl.getVars());
Iterator<Binding> iter = tbl.rows();
while (iter.hasNext()) {
retTbl.addBinding(rewrite(iter.next()));
}
push(OpTable.create(retTbl));
}
}
use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.
the class EvaluatorSimple method project.
@Override
public Table project(Table table, List<Var> projectVars) {
QueryIterator qIter = table.iterator(getExecContext());
qIter = new QueryIterProject(qIter, projectVars, getExecContext());
return new TableN(qIter);
}
use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.
the class EvaluatorSimple method assign.
@Override
public Table assign(Table table, VarExprList exprs) {
QueryIterator qIter = table.iterator(getExecContext());
qIter = new QueryIterAssign(qIter, exprs, getExecContext(), false);
return new TableN(qIter);
}
use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.
the class EvaluatorSimple method groupBy.
@Override
public Table groupBy(Table table, VarExprList groupVars, List<ExprAggregator> aggregators) {
QueryIterator qIter = table.iterator(getExecContext());
qIter = new QueryIterGroup(qIter, groupVars, aggregators, getExecContext());
return new TableN(qIter);
}
use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.
the class EvaluatorSimple method filter.
@Override
public Table filter(ExprList expressions, Table table) {
if (debug) {
System.out.println("Restriction");
System.out.println(expressions);
dump(table);
}
QueryIterator iter = table.iterator(execCxt);
List<Binding> output = new ArrayList<>();
for (; iter.hasNext(); ) {
Binding b = iter.nextBinding();
if (expressions.isSatisfied(b, execCxt))
output.add(b);
}
return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt));
}
Aggregations