Exemplo n.º 1
0
 /* Count the triples for the graph.find */
 public static long countTriples(Graph graph, Node s, Node p, Node o) {
   ExtendedIterator<Triple> iter = graph.find(s, p, o);
   try {
     return Iter.count(iter);
   } finally {
     iter.close();
   }
 }
Exemplo n.º 2
0
 public static Map<Node, Graph> indexBySubject(Graph graph) {
   ExtendedIterator<Triple> it = graph.find(Node.ANY, Node.ANY, Node.ANY);
   Map<Node, Graph> result;
   try {
     result = indexBySubject(it);
   } finally {
     it.close();
   }
   return result;
 }
Exemplo n.º 3
0
 /** Get exactly one triple or null for none or more than one. */
 public static Triple triple1(Graph graph, Node s, Node p, Node o) {
   ExtendedIterator<Triple> iter = graph.find(s, p, o);
   try {
     if (!iter.hasNext()) return null;
     Triple t = iter.next();
     if (iter.hasNext()) return null;
     return t;
   } finally {
     iter.close();
   }
 }
Exemplo n.º 4
0
 @Override
 public ExtendedIterator<Triple> find(Node s, Node p, Node o) {
   return SimpleEventManager.notifyingRemove(this, base.find(s, p, o));
 }
Exemplo n.º 5
0
 @Override
 public ExtendedIterator<Triple> find(Triple m) {
   return SimpleEventManager.notifyingRemove(this, base.find(m));
 }
Exemplo n.º 6
0
 private static void addAll(Graph srcGraph, Graph dstGraph) {
   Iterator<Triple> triples = srcGraph.find(Node.ANY, Node.ANY, Node.ANY);
   triples.forEachRemaining(dstGraph::add);
 }
Exemplo n.º 7
0
 /** Collect all the matching triples */
 public static void accTriples(Collection<Triple> acc, Graph graph, Node s, Node p, Node o) {
   ExtendedIterator<Triple> iter = graph.find(s, p, o);
   for (; iter.hasNext(); ) acc.add(iter.next());
   iter.close();
 }