use of org.apache.jena.sparql.engine.QueryIterator 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.engine.QueryIterator 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));
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class EvaluatorSimple method minusWorker.
private Table minusWorker(Table tableLeft, Table tableRight) {
// Minus(Ω1, Ω2) = { μ | μ in Ω1 such that for all μ' in Ω2, either μ and μ' are not compatible or dom(μ) and dom(μ') are disjoint }
TableN results = new TableN();
QueryIterator iterLeft = tableLeft.iterator(execCxt);
for (; iterLeft.hasNext(); ) {
Binding bindingLeft = iterLeft.nextBinding();
boolean includeThisRow = true;
// Find a reason not to include the row.
// That's is not disjoint and not compatible.
QueryIterator iterRight = tableRight.iterator(execCxt);
for (; iterRight.hasNext(); ) {
Binding bindingRight = iterRight.nextBinding();
if (Algebra.disjoint(bindingLeft, bindingRight))
// Disjoint - not a reason to exclude
continue;
if (!Algebra.compatible(bindingLeft, bindingRight))
// Compatible - not a reason to exclude.
continue;
includeThisRow = false;
break;
}
iterRight.close();
if (includeThisRow)
results.addBinding(bindingLeft);
}
iterLeft.close();
return results;
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class OpExecutor method execute.
protected QueryIterator execute(OpGroup opGroup, QueryIterator input) {
QueryIterator qIter = exec(opGroup.getSubOp(), input);
qIter = new QueryIterGroup(qIter, opGroup.getGroupVars(), opGroup.getAggregators(), execCxt);
return qIter;
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class OpExecutor method execute.
protected QueryIterator execute(OpSlice opSlice, QueryIterator input) {
QueryIterator qIter = exec(opSlice.getSubOp(), input);
qIter = new QueryIterSlice(qIter, opSlice.getStart(), opSlice.getLength(), execCxt);
return qIter;
}
Aggregations