use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class QueryValidatorJSON method algebraOptQuads.
private static void algebraOptQuads(JsonBuilder obj, Query query) {
Op op = Algebra.compile(query);
op = Algebra.toQuadForm(op);
op = Algebra.optimize(op);
obj.key(jAlgebraOptQuads).value(string(query, op));
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class QueryValidatorJSON method algebra.
private static void algebra(JsonBuilder obj, Query query) {
Op op = Algebra.compile(query);
obj.key(jAlgebra).value(string(query, op));
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class QueryEngineBase method createPlan.
protected Plan createPlan() {
// Decide the algebra to actually execute.
Op op = queryOp;
if (!startBinding.isEmpty()) {
op = Substitute.substitute(op, startBinding);
context.put(ARQConstants.sysCurrentAlgebra, op);
// Don't reset the startBinding because it also is
// needed in the output.
}
op = modifyOp(op);
QueryIterator queryIterator = null;
if (dataset != null)
// Null means setting up but not executing a query.
queryIterator = evaluate(op, dataset, startBinding, context);
else
// Bypass management interface
queryIterator = evaluateNoMgt(op, dataset, startBinding, context);
// This could be an automagic iterator to catch close.
return new PlanOp(getOp(), this, queryIterator);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class OpExecutor method execute.
protected QueryIterator execute(OpMinus opMinus, QueryIterator input) {
Op lhsOp = opMinus.getLeft();
Op rhsOp = opMinus.getRight();
QueryIterator left = exec(lhsOp, input);
QueryIterator right = exec(rhsOp, root());
Set<Var> commonVars = OpVars.visibleVars(lhsOp);
commonVars.retainAll(OpVars.visibleVars(rhsOp));
return QueryIterMinus.create(left, right, commonVars, execCxt);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class PathLib method pathToTriples.
/** Convert any paths of exactly one predicate to a triple pattern */
public static Op pathToTriples(PathBlock pattern) {
BasicPattern bp = null;
Op op = null;
for (TriplePath tp : pattern) {
if (tp.isTriple()) {
if (bp == null)
bp = new BasicPattern();
bp.add(tp.asTriple());
continue;
}
// Path form.
op = flush(bp, op);
bp = null;
OpPath opPath2 = new OpPath(tp);
op = OpSequence.create(op, opPath2);
continue;
}
// End. Finish off any outstanding BGP.
op = flush(bp, op);
return op;
}
Aggregations