Search in sources :

Example 76 with Op

use of org.apache.jena.sparql.algebra.Op in project jena by apache.

the class QueryIterUnion method output.

@Override
public void output(IndentedWriter out, SerializationContext sCxt) {
    out.println(Lib.className(this));
    out.incIndent();
    for (Op op : subOps) op.output(out, sCxt);
    out.decIndent();
    out.ensureStartOfLine();
}
Also used : Op(org.apache.jena.sparql.algebra.Op)

Example 77 with Op

use of org.apache.jena.sparql.algebra.Op in project jena by apache.

the class QueryIterUnion method nextStage.

@Override
protected QueryIterator nextStage(Binding binding) {
    QueryIterConcat unionQIter = new QueryIterConcat(getExecContext());
    for (Op subOp : subOps) {
        subOp = QC.substitute(subOp, binding);
        QueryIterator parent = QueryIterSingleton.create(binding, getExecContext());
        QueryIterator qIter = QC.execute(subOp, parent, getExecContext());
        unionQIter.add(qIter);
    }
    return unionQIter;
}
Also used : QueryIterConcat(org.apache.jena.sparql.engine.iterator.QueryIterConcat) Op(org.apache.jena.sparql.algebra.Op) QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 78 with Op

use of org.apache.jena.sparql.algebra.Op in project jena by apache.

the class EvaluatorDispatch method visit.

@Override
public void visit(OpDisjunction opDisjunction) {
    // Evaluation is as a concatentation of alternatives 
    Table table = TableFactory.createEmpty();
    for (Iterator<Op> iter = opDisjunction.iterator(); iter.hasNext(); ) {
        Op op = iter.next();
        Table eltTable = eval(op);
        table = evaluator.union(table, eltTable);
    }
    push(table);
}
Also used : Op(org.apache.jena.sparql.algebra.Op) Table(org.apache.jena.sparql.algebra.Table)

Example 79 with Op

use of org.apache.jena.sparql.algebra.Op in project jena by apache.

the class BuilderOp method addOps.

// Add all the operations from the list to the OpN
private final void addOps(OpN op, ItemList list) {
    for (int i = 1; i < list.size(); i++) {
        Op sub = build(list, i);
        op.add(sub);
    }
}
Also used : Op(org.apache.jena.sparql.algebra.Op)

Example 80 with Op

use of org.apache.jena.sparql.algebra.Op in project jena by apache.

the class TestSpecialGraphs method union_dft_1.

private void union_dft_1(Mode mode) {
    Op op = op("(bgp (?s ?p ?o))", mode);
    List<Binding> results = exec(op);
    assertEquals(5, results.size());
    Op op2 = Algebra.unionDefaultGraph(op);
    List<Binding> results2 = exec(op2);
    assertEquals(4, results2.size());
}
Also used : Binding(org.apache.jena.sparql.engine.binding.Binding) Op(org.apache.jena.sparql.algebra.Op)

Aggregations

Op (org.apache.jena.sparql.algebra.Op)166 Var (org.apache.jena.sparql.core.Var)29 VarExprList (org.apache.jena.sparql.core.VarExprList)18 Query (org.apache.jena.query.Query)17 ExprList (org.apache.jena.sparql.expr.ExprList)17 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)15 Test (org.junit.Test)14 Triple (org.apache.jena.graph.Triple)13 Expr (org.apache.jena.sparql.expr.Expr)13 BasicPattern (org.apache.jena.sparql.core.BasicPattern)11 ArrayList (java.util.ArrayList)9 Node (org.apache.jena.graph.Node)8 OpBGP (org.apache.jena.sparql.algebra.op.OpBGP)7 NodeValueInteger (org.apache.jena.sparql.expr.nodevalue.NodeValueInteger)7 Binding (org.apache.jena.sparql.engine.binding.Binding)5 ExprVar (org.apache.jena.sparql.expr.ExprVar)5 BaseTest (org.apache.jena.atlas.junit.BaseTest)3 Pair (org.apache.jena.atlas.lib.Pair)3 Table (org.apache.jena.sparql.algebra.Table)3 TransformCopy (org.apache.jena.sparql.algebra.TransformCopy)3