Search in sources :

Example 6 with Abortable

use of org.apache.jena.sparql.engine.iterator.Abortable in project jena by apache.

the class PatternMatchData method execute.

/**
 * Non-reordering execution of a triple pattern (basic graph pattern),
 * given an iterator of bindings as input.
 */
public static QueryIterator execute(Graph graph, BasicPattern pattern, QueryIterator input, Predicate<Triple> filter, ExecutionContext execCxt) {
    List<Triple> triples = pattern.getList();
    Iterator<Binding> chain = input;
    List<Abortable> killList = new ArrayList<>();
    for (Triple triple : triples) {
        // Plain, no RDF-star
        // chain = StageMatchTriple.accessTriple(chain, graph, triple, filter, execCxt);
        // [Match] Missing filter.
        chain = SolverRX3.rdfStarTriple(chain, triple, execCxt);
        chain = SolverLib.makeAbortable(chain, killList);
    }
    // "killList" will be aborted on timeout.
    return new QueryIterAbortable(chain, killList, input, execCxt);
}
Also used : Triple(org.apache.jena.graph.Triple) Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterAbortable(org.apache.jena.sparql.engine.iterator.QueryIterAbortable) QueryIterAbortable(org.apache.jena.sparql.engine.iterator.QueryIterAbortable) Abortable(org.apache.jena.sparql.engine.iterator.Abortable) ArrayList(java.util.ArrayList)

Aggregations

Binding (org.apache.jena.sparql.engine.binding.Binding)6 Abortable (org.apache.jena.sparql.engine.iterator.Abortable)6 QueryIterAbortable (org.apache.jena.sparql.engine.iterator.QueryIterAbortable)6 ArrayList (java.util.ArrayList)4 Node (org.apache.jena.graph.Node)4 Triple (org.apache.jena.graph.Triple)4 SolverLib.makeAbortable (org.apache.jena.sparql.engine.main.solver.SolverLib.makeAbortable)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)2 Var (org.apache.jena.sparql.core.Var)2 TDBException (org.apache.jena.tdb.TDBException)1 NodeId (org.apache.jena.tdb.store.NodeId)1 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)1 TDBException (org.apache.jena.tdb2.TDBException)1 NodeId (org.apache.jena.tdb2.store.NodeId)1 NodeTable (org.apache.jena.tdb2.store.nodetable.NodeTable)1