use of org.apache.jena.graph.Node in project jena by apache.
the class listIndex method findIndexMember.
private static QueryIterator findIndexMember(Graph graph, Binding binding, Node listNode, Var varIndex, Var varMember, ExecutionContext execCxt) {
// Iterate over list
List<Node> members = GraphList.members(new GNode(graph, listNode));
List<Binding> bindings = new ArrayList<>();
for (int i = 0; i < members.size(); i++) {
Node idx = NodeFactoryExtra.intToNode(i);
Node member = members.get(i);
BindingMap b = BindingFactory.create(binding);
b.add(varIndex, idx);
b.add(varMember, member);
bindings.add(b);
}
return new QueryIterPlainWrapper(bindings.iterator(), execCxt);
}
use of org.apache.jena.graph.Node in project jena by apache.
the class PathEngine1 method doMultiLengthPath.
@Override
protected void doMultiLengthPath(Path pathStep, Node node, long min1, long max1, Collection<Node> output) {
if (min1 == P_Mod.UNSET)
// {,N}
min1 = 0;
// do 0-min1 steps, not collecting.
Collection<Node> collectStartPoints = collector();
if (min1 > 0)
doFixedLengthPath(pathStep, node, min1, collectStartPoints);
else
collectStartPoints.add(node);
// System.out.println("Start points: "+collectStartPoints) ;
// {N,M} = {N} then {0,M-N}
int length = (int) (max1 - min1);
Collection<Node> visited = collector();
for (Node n : collectStartPoints) doMultiLengthPath(pathStep, n, length, visited, output);
}
use of org.apache.jena.graph.Node in project jena by apache.
the class PathEngineN method ALP.
// This is the worker function for path*
private void ALP(Node node, Path path, Set<Node> visited, Collection<Node> output) {
if (visited.contains(node))
return;
// "visited" is nodes on this path (see the matching .remove).
if (!output.add(node))
return;
visited.add(node);
Iterator<Node> iter1 = eval(path, node);
// For each step, add to results and recurse.
for (; iter1.hasNext(); ) {
Node n1 = iter1.next();
ALP(n1, path, visited, output);
}
visited.remove(node);
}
use of org.apache.jena.graph.Node in project jena by apache.
the class TestNodeAllocator method allocOneScope3.
@Test
public void allocOneScope3() {
LabelToNode alloc = SyntaxLabels.createLabelToNode();
Node b1 = alloc.get(gragh1, "xyz");
Node b2 = alloc.get(gragh2, "xyz");
// SAME
assertEquals(b1, b2);
}
use of org.apache.jena.graph.Node in project jena by apache.
the class TestNodeAllocator method allocOneScope4.
@Test
public void allocOneScope4() {
LabelToNode alloc = SyntaxLabels.createLabelToNode();
Node b1 = alloc.get(null, "xyz");
Node b2 = alloc.get(gragh2, "xyz");
// SAME
assertEquals(b1, b2);
}
Aggregations