Exemplo n.º 1
0
 public static void removeAll(Graph g, Node s, Node p, Node o) {
   ExtendedIterator<Triple> it = g.find(s, p, o);
   try {
     while (it.hasNext()) {
       Triple t = it.next();
       g.delete(t);
       it.remove();
     }
   } finally {
     it.close();
   }
 }
 @Override
 public void delete(Quad quad) {
   Graph graph;
   if (quad.isDefaultGraph()) {
     graph = getDefaultGraph();
   } else {
     graph = getGraph(quad.getGraph());
   }
   if (graph != null) {
     graph.delete(quad.asTriple());
   }
 }
 /** Removes the triple t (if possible) from the set belonging to this graph. */
 @Override
 public void performDelete(Triple t) {
   version++;
   if (fdata != null) {
     Graph data = fdata.getGraph();
     if (data != null) {
       data.delete(t);
     }
   }
   if (!this.isPrepared()) {
     fdeductions.getGraph().delete(t);
   }
 }
Exemplo n.º 4
0
  public static void removeAll(Graph g) {
    ExtendedIterator<Triple> it = GraphUtil.findAll(g);
    try {
      while (it.hasNext()) {
        Triple t = it.next();
        g.delete(t);
        it.remove();
      }
    } finally {
      it.close();
    }

    // get rid of remaining blank nodes using a SPARQL DELETE
    if (g instanceof SparqlGraph) {
      ((SparqlGraph) g).removeAll();
    }
  }