use of org.apache.jena.sparql.engine.optimizer.reorder.ReorderProc in project jena by apache.
the class StageGeneratorGeneric method execute.
protected QueryIterator execute(BasicPattern pattern, ReorderTransformation reorder, StageGenerator execution, QueryIterator input, ExecutionContext execCxt) {
Explain.explain(pattern, execCxt.getContext());
if (!input.hasNext())
return input;
if (reorder != null && pattern.size() >= 2) {
// If pattern size is 0 or 1, nothing to do.
BasicPattern bgp2 = pattern;
// Try to ground the pattern
if (!input.isJoinIdentity()) {
QueryIterPeek peek = QueryIterPeek.create(input, execCxt);
// And now use this one
input = peek;
Binding b = peek.peek();
bgp2 = Substitute.substitute(pattern, b);
ReorderProc reorderProc = reorder.reorderIndexes(bgp2);
pattern = reorderProc.reorder(pattern);
}
}
Explain.explain("Reorder/generic", pattern, execCxt.getContext());
return QueryIterBlockTriples.create(input, pattern, execCxt);
}
use of org.apache.jena.sparql.engine.optimizer.reorder.ReorderProc in project jena by apache.
the class OpExecutorTDB1 method reorder.
private static BasicPattern reorder(BasicPattern pattern, QueryIterPeek peek, ReorderTransformation transform) {
if (transform != null) {
if (!peek.hasNext())
throw new ARQInternalErrorException("Peek iterator is already empty");
BasicPattern pattern2 = Substitute.substitute(pattern, peek.peek());
// Calculate the reordering based on the substituted pattern.
ReorderProc proc = transform.reorderIndexes(pattern2);
// Then reorder original patten
pattern = proc.reorder(pattern);
}
return pattern;
}
Aggregations