Search in sources :

Example 91 with QueryIterator

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

the class Table1 method iterator.

@Override
public QueryIterator iterator(ExecutionContext execCxt) {
    // Root binding?
    Binding binding = BindingFactory.binding(var, value);
    QueryIterator qIter = QueryIterSingleton.create(null, var, value, execCxt);
    return qIter;
}
Also used : Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 92 with QueryIterator

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

the class JSONInput method process.

// TODO Streaming version of JSON Result set processing
private SPARQLResult process(InputStream in, Model model) {
    parse(in);
    if (model == null)
        model = GraphFactory.makeJenaDefaultModel();
    if (rows != null) {
        QueryIterator qIter = new QueryIterPlainWrapper(rows.iterator());
        ResultSet rs = new ResultSetStream(Var.varNames(vars), model, qIter);
        super.set(rs);
    } else
        super.set(booleanResult);
    return this;
}
Also used : QueryIterPlainWrapper(org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) ResultSet(org.apache.jena.query.ResultSet) ResultSetStream(org.apache.jena.sparql.engine.ResultSetStream)

Example 93 with QueryIterator

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

the class container method execEvaluated.

@Override
public QueryIterator execEvaluated(Binding binding, Node containerNode, Node predicate, Node member, ExecutionContext execCxt) {
    QueryIterator qIter1 = execEvaluatedConcrete(binding, containerNode, predicate, member, execCxt);
    QueryIterator qIter2 = execEvaluatedCalc(binding, containerNode, predicate, member, execCxt);
    QueryIterConcat concat = new QueryIterConcat(execCxt);
    concat.add(qIter1);
    concat.add(qIter2);
    return concat;
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 94 with QueryIterator

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

the class BIOInput method fromBIO.

public static ResultSet fromBIO(InputStream input) {
    // Scan the stream for VARS and accumulate the total variables. 
    // Trade off of guessing first line is all the VARS and coping with
    // anything possible.  -> Cope with anything possible.
    BindingInputStream bin = new BindingInputStream(input);
    List<Binding> bindings = new ArrayList<>();
    List<Var> vars = new ArrayList<>();
    while (bin.hasNext()) {
        Binding b = bin.next();
        bindings.add(b);
        for (Var v : bin.vars()) {
            if (!vars.contains(v))
                vars.add(v);
        }
    }
    QueryIterator qIter = new QueryIterPlainWrapper(bindings.iterator());
    return new ResultSetStream(Var.varNames(vars), m, qIter);
}
Also used : BindingInputStream(org.apache.jena.sparql.engine.binding.BindingInputStream) Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterPlainWrapper(org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) Var(org.apache.jena.sparql.core.Var) ArrayList(java.util.ArrayList) ResultSetStream(org.apache.jena.sparql.engine.ResultSetStream)

Example 95 with QueryIterator

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

the class Join method debug.

/* Debug.
     * Print inputs and outputs.
     * This involves materializing the iterators.   
     */
private static QueryIterator debug(QueryIterator left, QueryIterator right, ExecutionContext execCxt, JoinOp action) {
    Table t1 = TableFactory.create(left);
    Table t2 = TableFactory.create(right);
    left = t1.iterator(execCxt);
    right = t2.iterator(execCxt);
    QueryIterator qIter = action.exec(left, right);
    Table t3 = TableFactory.create(qIter);
    System.out.println("** Left");
    System.out.println(t1);
    System.out.println("** Right");
    System.out.println(t2);
    System.out.println("** ");
    System.out.println(t3);
    //        System.out.println(t4) ;
    return t3.iterator(execCxt);
}
Also used : Table(org.apache.jena.sparql.algebra.Table) QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

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