Пример #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();
   }
 }
Пример #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;
 }
Пример #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();
   }
 }
Пример #4
0
 @Override
 public ExtendedIterator<Triple> find(Node s, Node p, Node o) {
   return SimpleEventManager.notifyingRemove(this, base.find(s, p, o));
 }
Пример #5
0
 @Override
 public ExtendedIterator<Triple> find(Triple m) {
   return SimpleEventManager.notifyingRemove(this, base.find(m));
 }
Пример #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);
 }
Пример #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();
 }