use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class sse_query method exec.
@Override
protected void exec() {
Op op = modAlgebra.getOp();
if (op == null) {
System.err.println("No query expression to execute");
throw new TerminationException(9);
}
Dataset dataset = modDataset.getDataset();
// Check there is a dataset.
if (dataset == null)
dataset = DatasetFactory.createGeneral();
modTime.startTimer();
DatasetGraph dsg = dataset.asDatasetGraph();
if (printOp || printPlan) {
if (printOp) {
divider();
IndentedWriter out = new IndentedWriter(System.out, true);
op.output(out);
out.flush();
}
if (printPlan) {
QueryIterator qIter = Algebra.exec(op, dsg);
Plan plan = new PlanOp(op, null, qIter);
divider();
IndentedWriter out = new IndentedWriter(System.out, false);
plan.output(out);
out.flush();
}
//return ;
}
// Do not optimize. Execute as-is.
QueryExecUtils.execute(op, dsg, modResults.getResultsFormat());
long time = modTime.endTimer();
if (modTime.timingEnabled())
System.out.println("Time: " + modTime.timeStr(time));
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class TestPath method eval.
private static List<Binding> eval(Graph graph, Node start, String pathStr, Node finish) {
Path path = SSE.parsePath(pathStr, pmap);
QueryIterator qIter = PathLib.execTriplePath(BindingFactory.root(), start, path, finish, new ExecutionContext(ARQ.getContext(), graph, null, null));
return Iter.toList(qIter);
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class TestResultSet method make.
private ResultSet make(String var1, Node val1, String var2, Node val2) {
BindingMap b = BindingFactory.create();
b.add(Var.alloc(var1), val1);
b.add(Var.alloc(var2), val2);
List<String> vars = new ArrayList<>();
vars.add(var1);
vars.add(var2);
QueryIterator qIter = QueryIterSingleton.create(b, null);
ResultSet rs = new ResultSetStream(vars, null, qIter);
return rs;
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class TestResultSet method make2.
private ResultSet make2(String var, Node val) {
BindingMap b1 = BindingFactory.create();
b1.add(Var.alloc(var), val);
BindingMap b2 = BindingFactory.create();
b2.add(Var.alloc(var), val);
List<String> vars = new ArrayList<>();
vars.add(var);
List<Binding> solutions = new ArrayList<>();
solutions.add(b1);
solutions.add(b2);
QueryIterator qIter = new QueryIterPlainWrapper(solutions.iterator(), null);
ResultSet rs = new ResultSetStream(vars, null, qIter);
return rs;
}
use of org.apache.jena.sparql.engine.QueryIterator in project jena by apache.
the class SpatialOperationPFBase method variableSubject.
private QueryIterator variableSubject(Binding binding, Node s, SpatialMatch match, ExecutionContext execCxt) {
Var v = Var.alloc(s);
List<Node> r = query(match);
// Make distinct. Note interaction with limit is imperfect
r = Iter.iter(r).distinct().toList();
QueryIterator qIter = new QueryIterExtendByVar(binding, v, r.iterator(), execCxt);
return qIter;
}
Aggregations