Search in sources :

Example 1 with TableN

use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.

the class OpRewriter method visit.

@Override
public void visit(OpTable opTable) {
    Table tbl = opTable.getTable();
    boolean process = false;
    for (Var v : tbl.getVars()) {
        process = process | values.keySet().contains(v);
    }
    if (!process) {
        push(opTable);
    } else {
        TableN retTbl = new TableN(tbl.getVars());
        Iterator<Binding> iter = tbl.rows();
        while (iter.hasNext()) {
            retTbl.addBinding(rewrite(iter.next()));
        }
        push(OpTable.create(retTbl));
    }
}
Also used : Binding(org.apache.jena.sparql.engine.binding.Binding) Table(org.apache.jena.sparql.algebra.Table) TableN(org.apache.jena.sparql.algebra.table.TableN)

Example 2 with TableN

use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.

the class EvaluatorSimple method project.

@Override
public Table project(Table table, List<Var> projectVars) {
    QueryIterator qIter = table.iterator(getExecContext());
    qIter = new QueryIterProject(qIter, projectVars, getExecContext());
    return new TableN(qIter);
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator) TableN(org.apache.jena.sparql.algebra.table.TableN)

Example 3 with TableN

use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.

the class EvaluatorSimple method assign.

@Override
public Table assign(Table table, VarExprList exprs) {
    QueryIterator qIter = table.iterator(getExecContext());
    qIter = new QueryIterAssign(qIter, exprs, getExecContext(), false);
    return new TableN(qIter);
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator) TableN(org.apache.jena.sparql.algebra.table.TableN)

Example 4 with TableN

use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.

the class EvaluatorSimple method groupBy.

@Override
public Table groupBy(Table table, VarExprList groupVars, List<ExprAggregator> aggregators) {
    QueryIterator qIter = table.iterator(getExecContext());
    qIter = new QueryIterGroup(qIter, groupVars, aggregators, getExecContext());
    return new TableN(qIter);
}
Also used : QueryIterator(org.apache.jena.sparql.engine.QueryIterator) TableN(org.apache.jena.sparql.algebra.table.TableN)

Example 5 with TableN

use of org.apache.jena.sparql.algebra.table.TableN in project jena by apache.

the class EvaluatorSimple method filter.

@Override
public Table filter(ExprList expressions, Table table) {
    if (debug) {
        System.out.println("Restriction");
        System.out.println(expressions);
        dump(table);
    }
    QueryIterator iter = table.iterator(execCxt);
    List<Binding> output = new ArrayList<>();
    for (; iter.hasNext(); ) {
        Binding b = iter.nextBinding();
        if (expressions.isSatisfied(b, execCxt))
            output.add(b);
    }
    return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt));
}
Also used : Binding(org.apache.jena.sparql.engine.binding.Binding) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) ArrayList(java.util.ArrayList) TableN(org.apache.jena.sparql.algebra.table.TableN)

Aggregations

TableN (org.apache.jena.sparql.algebra.table.TableN)14 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)13 Binding (org.apache.jena.sparql.engine.binding.Binding)4 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Table (org.apache.jena.sparql.algebra.Table)1 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)1