use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class EvaluatorSimple method diffWorker.
// @@ Abstract compatibility
private Table diffWorker(Table tableLeft, Table tableRight) {
QueryIterator left = tableLeft.iterator(execCxt);
TableN r = new TableN();
for (; left.hasNext(); ) {
Binding b = left.nextBinding();
if (tableRight.contains(b))
r.addBinding(b);
}
tableLeft.close();
tableRight.close();
return r;
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class EvaluatorSimple method joinWorker.
private Table joinWorker(Table tableLeft, Table tableRight, boolean leftJoin, ExprList conditions) {
QueryIterator left = tableLeft.iterator(execCxt);
JoinType joinType = (leftJoin ? JoinType.LEFT : JoinType.INNER);
QueryIterator qIter = TableJoin.joinWorker(left, tableRight, joinType, conditions, execCxt);
tableLeft.close();
tableRight.close();
// qIter and left should be properly closed by use or called code.
return new TableN(qIter);
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class EvaluatorSimple method procedure.
@Override
public Table procedure(Table table, Node procId, ExprList args) {
Procedure proc = ProcEval.build(procId, args, execCxt);
QueryIterator qIter = ProcEval.eval(table.iterator(execCxt), proc, execCxt);
return TableFactory.create(qIter);
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class BuilderResultSet method build.
public static ResultSet build(Item item) {
BuilderLib.checkTagged(item, Tags.tagResultSet, "Not a (resultset ...)");
ItemList list = item.getList();
List<Var> vars = BuilderNode.buildVarList(list.get(1));
// skip tag, skip vars.
int start = 2;
List<Binding> bindings = new ArrayList<>();
for (int i = start; i < list.size(); i++) {
Item itemRow = list.get(i);
Binding b = BuilderBinding.build(itemRow);
bindings.add(b);
}
QueryIterator qIter = new QueryIterPlainWrapper(bindings.listIterator());
return new ResultSetStream(Var.varNames(vars), null, qIter);
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class WriterTable method outputPlain.
public static void outputPlain(IndentedWriter out, Table table, SerializationContext sCxt) {
QueryIterator qIter = table.iterator(null);
for (; qIter.hasNext(); ) {
Binding b = qIter.nextBinding();
output(out, b, sCxt);
out.println();
}
qIter.close();
}
Aggregations