use of org.apache.jena.sparql.algebra.table.TableUnit 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);
}
Aggregations