Search in sources :

Example 31 with QueryIterator

use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.

the class ExecutionDispatch method visit.

@Override
public void visit(OpSlice opSlice) {
    QueryIterator input = pop();
    QueryIterator qIter = opExecutor.execute(opSlice, input);
    push(qIter);
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 32 with QueryIterator

use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.

the class ExecutionDispatch method visit.

@Override
public void visit(OpDiff opDiff) {
    QueryIterator input = pop();
    QueryIterator qIter = opExecutor.execute(opDiff, input);
    push(qIter);
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 33 with QueryIterator

use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.

the class ListBase method allLists.

protected QueryIterator allLists(Binding binding, Collection<Node> x, Var listVar, Node predicate, PropFuncArg argObject, ExecutionContext execCxt) {
    // BFI: Find all lists; work hard.
    QueryIterConcat qIter = new QueryIterConcat(execCxt);
    for (Node n : x) {
        Binding b = BindingFactory.binding(binding, listVar, n);
        QueryIterator q = execOneList(b, n, predicate, argObject, execCxt);
        qIter.add(q);
    }
    return qIter;
}
Also used : QueryIterConcat(org.apache.jena.sparql.engine.iterator.QueryIterConcat) Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) Node(org.apache.jena.graph.Node)

Example 34 with QueryIterator

use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.

the class container method execEvaluatedConcrete.

// Ask directly.
private QueryIterator execEvaluatedConcrete(Binding binding, Node containerNode, Node predicate, Node member, ExecutionContext execCxt) {
    QueryIterator input = QueryIterSingleton.create(binding, execCxt);
    Graph graph = execCxt.getActiveGraph();
    QueryIterator qIter = new QueryIterTriplePattern(input, new Triple(containerNode, predicate, member), execCxt);
    return qIter;
}
Also used : Triple(org.apache.jena.graph.Triple) Graph(org.apache.jena.graph.Graph) QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 35 with QueryIterator

use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.

the class QueryTest method unique.

private static ResultSetRewindable unique(ResultSetRewindable results) {
    // VERY crude.  Utilises the fact that bindings have value equality.
    List<Binding> x = new ArrayList<>();
    Set<Binding> seen = new HashSet<>();
    for (; results.hasNext(); ) {
        Binding b = results.nextBinding();
        if (seen.contains(b))
            continue;
        seen.add(b);
        x.add(b);
    }
    QueryIterator qIter = new QueryIterPlainWrapper(x.iterator());
    ResultSet rs = new ResultSetStream(results.getResultVars(), ModelFactory.createDefaultModel(), qIter);
    return ResultSetFactory.makeRewindable(rs);
}
Also used : Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterPlainWrapper(org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) ArrayList(java.util.ArrayList) ResultSet(org.apache.jena.query.ResultSet) ResultSetStream(org.apache.jena.sparql.engine.ResultSetStream) HashSet(java.util.HashSet)

Aggregations

QueryIterator (org.apache.jena.sparql.engine.QueryIterator)126 Binding (org.apache.jena.sparql.engine.binding.Binding)27 Op (org.apache.jena.sparql.algebra.Op)15 Node (org.apache.jena.graph.Node)13 TableN (org.apache.jena.sparql.algebra.table.TableN)13 ArrayList (java.util.ArrayList)12 ResultSetStream (org.apache.jena.sparql.engine.ResultSetStream)10 Var (org.apache.jena.sparql.core.Var)9 ResultSet (org.apache.jena.query.ResultSet)8 QueryIterPlainWrapper (org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper)8 Triple (org.apache.jena.graph.Triple)6 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)6 BasicPattern (org.apache.jena.sparql.core.BasicPattern)5 QueryIterConcat (org.apache.jena.sparql.engine.iterator.QueryIterConcat)5 Table (org.apache.jena.sparql.algebra.Table)4 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)4 HashSet (java.util.HashSet)3 Plan (org.apache.jena.sparql.engine.Plan)3 BindingMap (org.apache.jena.sparql.engine.binding.BindingMap)3 Procedure (org.apache.jena.sparql.procedure.Procedure)3