use of org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper in project jena by apache.
the class Eval method evalDS.
static Table evalDS(OpDatasetNames opDSN, Evaluator evaluator) {
Node graphNode = opDSN.getGraphNode();
if (graphNode.isURI()) {
if (evaluator.getExecContext().getDataset().containsGraph(graphNode)) {
return new TableUnit();
} else // WRONG
{
return new TableEmpty();
}
}
if (!Var.isVar(graphNode))
throw new ARQInternalErrorException("OpDatasetNames: Not a URI or variable: " + graphNode);
DatasetGraph dsg = evaluator.getExecContext().getDataset();
Iterator<Node> iter = dsg.listGraphNodes();
List<Binding> list = new ArrayList<>((int) dsg.size());
for (; iter.hasNext(); ) {
Node gn = iter.next();
Binding b = BindingFactory.binding(Var.alloc(graphNode), gn);
list.add(b);
}
QueryIterator qIter = new QueryIterPlainWrapper(list.iterator(), evaluator.getExecContext());
return TableFactory.create(qIter);
}
use of org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper 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;
}
use of org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper 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);
}
Aggregations