use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class QueryValidator method outputAlgebra.
private void outputAlgebra(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException {
outStream.println("<p>Algebra structure:</p>");
// No optimization
final Op op = Algebra.compile(query);
output(outStream, query, op, lineNumbers);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class sdbprint method compilePrint.
private void compilePrint(Store store, Query query) {
SDB.getContext().setIfUndef(SDB.annotateGeneratedSQL, true);
if (!printQuery && !printOp && !printSqlNode && !printSQL && !printPlan)
printSQL = true;
if (isVerbose()) {
//printQuery = true ;
printOp = true;
//printSqlNode = true ;
printSQL = true;
}
if (printQuery) {
divider();
query.serialize(System.out, Syntax.syntaxARQ);
}
QueryEngineSDB qe = new QueryEngineSDB(store, query);
Op op = qe.getOp();
if (printOp) {
divider();
PrintSDB.print(op);
// No newline.
}
if (printSqlNode) {
divider();
PrintSDB.printSqlNodes(op);
}
if (printSQL) {
divider();
PrintSDB.printSQL(op);
}
if (printPlan) {
divider();
System.out.print(qe.getPlan());
}
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestSolverTDB method exec.
private static ResultSet exec(String pattern, Graph graph) {
Op op = SSE.parseOp(pattern, pmap);
List<Var> vars = new ArrayList<>();
vars.addAll(OpVars.visibleVars(op));
QueryIterator qIter = Algebra.exec(op, graph);
return ResultSetFactory.create(qIter, Var.varNames(vars));
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class ApplyTransformVisitor method visit.
@Override
public void visit(OpLeftJoin op) {
Op left = null;
Op right = null;
// Must do right-left because the pushes onto the stack were left-right.
if (op.getRight() != null)
right = pop(opStack);
if (op.getLeft() != null)
left = pop(opStack);
ExprList exprs = op.getExprs();
ExprList exprs2 = collect(exprs);
OpLeftJoin x = op;
if (exprs != exprs2)
x = OpLeftJoin.createLeftJoin(left, right, exprs2);
Op opX = x.apply(opTransform, left, right);
push(opStack, opX);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class ApplyTransformVisitor method visitN.
@Override
public void visitN(OpN op) {
List<Op> x = new ArrayList<>(op.size());
for (Iterator<Op> iter = op.iterator(); iter.hasNext(); ) {
Op sub = iter.next();
Op r = pop(opStack);
// Skip nulls.
if (r != null)
// Add in reverse.
x.add(0, r);
}
Op opX = op.apply(opTransform, x);
push(opStack, opX);
}
Aggregations