You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/11/25 17:53:55 UTC

svn commit: r1413371 - in /jena/branches/jena-core-simplified/src: main/java/com/hp/hpl/jena/assembler/assemblers/ main/java/com/hp/hpl/jena/graph/ main/java/com/hp/hpl/jena/graph/impl/ main/java/com/hp/hpl/jena/mem/ main/java/com/hp/hpl/jena/rdf/arp/ ...

Author: andy
Date: Sun Nov 25 16:53:52 2012
New Revision: 1413371

URL: http://svn.apache.org/viewvc?rev=1413371&view=rev
Log:
Add Graph.remove, Graph.removeAll
  Implement, including for BaseInfGraph
Replace all calls to BulkUpdateHandler operations with calls to GraphUtil
ARP now does Graph.add for each triple, and does not batch them.


Modified:
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/assembler/assemblers/ReasonerFactoryAssembler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/BulkUpdateHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/Graph.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphListener.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphUtil.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/FileGraphTransactionHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/GraphBase.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/SimpleBulkUpdateHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedBulkUpdateHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedGraph.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/mem/GraphMemBulkUpdateHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaHandler.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaReader.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/SAX2Model.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/model/impl/ModelCom.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/BaseInfGraph.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/BasicForwardRuleInfGraph.java
    jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/FBRuleInfGraph.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestGraph.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestReifier.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraph.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraphMaker.java
    jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/mem/test/TestGraphMem.java

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/assembler/assemblers/ReasonerFactoryAssembler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/assembler/assemblers/ReasonerFactoryAssembler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/assembler/assemblers/ReasonerFactoryAssembler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/assembler/assemblers/ReasonerFactoryAssembler.java Sun Nov 25 16:53:52 2012
@@ -89,7 +89,7 @@ public class ReasonerFactoryAssembler ex
     private void loadSchema( Graph result, Assembler a, Resource root )
         {
         Model m = a.openModel( root );
-        result.getBulkUpdateHandler().add( m.getGraph() );
+        GraphUtil.addInto(result, m.getGraph()) ;
         }
 
     private ReasonerFactory addRules( Resource root, Assembler a, final ReasonerFactory r )

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/BulkUpdateHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/BulkUpdateHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/BulkUpdateHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/BulkUpdateHandler.java Sun Nov 25 16:53:52 2012
@@ -28,13 +28,13 @@ import java.util.*;
     However, if a bulk update does not fail (ie throw an exception) then the
     addition or removal of triples must have been successfully completed
     in accordance with the operation of the owning graph.    
-    
  */
 public interface BulkUpdateHandler
     {
     /**
         Add all the triples into the graph this is handler for.
         @param triples an array of triples to add
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void add( Triple [] triples );
@@ -43,6 +43,7 @@ public interface BulkUpdateHandler
         Add all the triples in the list into the graph this is handler for.
         Each element of the List must be a Triple.
         @param triples a list of Triple objects to add
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void add( List<Triple> triples );
@@ -53,6 +54,7 @@ public interface BulkUpdateHandler
         have to expand the iterator into a data structure containing all the component
         elements; hence long iterators may be expensive on store. 
         @param it an Iterator delivering Triples
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void add( Iterator<Triple> it );
@@ -62,6 +64,7 @@ public interface BulkUpdateHandler
         Optionally add g's reified triples.
         @param g a Graph whose triples are to be added
         @param withReifications if true, the reified triples of g are added as well
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void add( Graph g, boolean withReifications );
@@ -70,66 +73,70 @@ public interface BulkUpdateHandler
         Add all the triples of the given graph into the graph this is handler for.
         Leave this graph's reifications unchanged.
         @param g a Graph whose triples are to be added
+        @deprecated See GraphUtil for helper functions for migration.
     */
-    // @Deprecated
-    // Will move to Graph.add(Graph)
+    @Deprecated
     void add( Graph g );
     
     /**
-        Remove all the triples from the graph this is handler for.
-        @param triples an array of triples to remove
+        Delete all the triples from the graph this is handler for.
+        @param triples an array of triples to delete
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void delete( Triple [] triples );
     
     /**
-        Remove all the triples in the list from the graph this is handler for.
+        Delete all the triples in the list from the graph this is handler for.
         Each element of the List must be a Triple.
-        @param triples a list of triples to remove
+        @param triples a list of triples to delete
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void delete( List<Triple> triples );
     
     /**
-        Remove all the triples in the iterator from the graph this is handler for.
+        Delete all the triples in the iterator from the graph this is handler for.
         Each element from the iterator must be a Triple. WARNING. An implementation may
         have to expand the iterator into a data structure containing all the component
         elements; hence long iterators may be expensive on store. 
         
         @param it an iterator over Triple
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void delete( Iterator<Triple> it );
     
     /**
-        Remove all the triples of the given graph from the graph this is handler for.
+        Delete all the triples of the given graph from the graph this is handler for.
         Do not change the reifications.
-        @param g a graph whose triples are to be removed
+        @param g a graph whose triples are to be deleted
+        @deprecated See GraphUtil for helper functions for migration.
     */
-    // @Deprecated
-    // Will move to Graph.delete(Graph)
+    @Deprecated
     void delete( Graph g );
     
     /**
-        Remove all the triples of the given graph from the graph this is handler for.
-        Reified triples may optionally be removed.
-        @param g a graph whose triples are to be removed
-        @param withReifications if true, remove g's reifications from this graph
+        Delete all the triples of the given graph from the graph this is handler for.
+        Reified triples may optionally be deleted.
+        @param g a graph whose triples are to be deleted
+        @param withReifications if true, delete g's reifications from this graph
+        @deprecated See GraphUtil for helper functions for migration.
     */
     @Deprecated
     void delete( Graph g, boolean withReifications );
 
     /**
     	Remove all the statements from a graph.
+    	@deprecated  Use Graph.removeAll()
     */
-    // @Deprecated
-    // Will move to Graph.removeAll() or .clear()
+    @Deprecated
     void removeAll();
     
     /**
        Remove all triples that would be delivered by find(s, p, o)
+       @deprecated  Use Graph.remove( Node s, Node p, Node o )
     */
-    // @Deprecated
-    // Will move to Graph.remove(s,p,o)
+    @Deprecated
     void remove( Node s, Node p, Node o );
     }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/Graph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/Graph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/Graph.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/Graph.java Sun Nov 25 16:53:52 2012
@@ -31,8 +31,6 @@ import com.hp.hpl.jena.util.iterator.*;
     and transaction handling.
 <p>
     For <code>add(Triple)</code> see GraphAdd.
-    
-    @author Jeremy Carroll, Chris Dollin
 */
 public interface Graph  extends GraphAdd
     {
@@ -89,9 +87,17 @@ public interface Graph  extends GraphAdd
     PrefixMapping getPrefixMapping();
 
     /** 
-        Remove the triple t (if possible) from the set belonging to this graph 
+        Add the triple t (if possible) to the set belonging to this graph 
+        @param t the triple to add to the graph
+        @throws AddDeniedException if the triple cannot be added 
+     */
+    @Override
+    void add( Triple t ) throws AddDeniedException;
+
+    /** 
+        Delete the triple t (if possible) from the set belonging to this graph 
     
-        @param  t the triple to add to the graph
+        @param  t the triple to delete to the graph
         @throws DeleteDeniedException if the triple cannot be removed  
     */   
 	void delete(Triple t) throws DeleteDeniedException;
@@ -132,6 +138,16 @@ public interface Graph  extends GraphAdd
     */
     boolean contains( Triple t );
     
+    /**
+        Remove all the statements from this graph.
+    */
+    void removeAll();
+    
+    /**
+       Remove all triples that match by find(s, p, o)
+    */
+    void remove( Node s, Node p, Node o );
+    
 	/** Free all resources, any further use of this Graph is an error.
 	 */
 	void close();

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphListener.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphListener.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphListener.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphListener.java Sun Nov 25 16:53:52 2012
@@ -51,10 +51,6 @@ import java.util.*;
     <p>To track all changes to a graph it is necessary to consider all the methods
     in this interface, including {@link #notifyEvent(Graph, Object)}.
     </p>
-    
-    
-    
-    @author Jeremy Carroll, extensions by kers
 */
 
 public interface GraphListener 

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphUtil.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphUtil.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphUtil.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/GraphUtil.java Sun Nov 25 16:53:52 2012
@@ -18,10 +18,15 @@
 
 package com.hp.hpl.jena.graph;
 
+import java.util.Iterator ;
+import java.util.List ;
+
+import com.hp.hpl.jena.graph.impl.GraphWithPerform ;
+import com.hp.hpl.jena.util.IteratorCollection ;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
 
 /**
-    An ad-hoc collection of useful code for graphs; starting with findAll.
+    An ad-hoc collection of useful code for graphs
  */
 public class GraphUtil
 {
@@ -31,6 +36,8 @@ public class GraphUtil
     private GraphUtil()
     {}
 
+    private static final boolean OldStyle = true ; 
+    
     /**
      * Answer an iterator covering all the triples in the specified graph.
      * 
@@ -42,4 +49,226 @@ public class GraphUtil
     {
         return g.find(Triple.ANY) ;
     }
+    
+    public static void add(Graph graph, Triple[] triples)
+    {
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : triples )
+                g.performAdd(t) ;
+            graph.getEventManager().notifyAddArray(graph, triples) ;
+        }
+        else
+        {
+            for (Triple t : triples )
+                graph.add(t) ; 
+        }
+    }
+        
+    public static void add(Graph graph, List<Triple> triples)
+    {
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : triples)
+                g.performAdd(t) ;
+            graph.getEventManager().notifyAddList(graph, triples) ;
+        } else
+        {
+            for (Triple t : triples)
+                graph.add(t) ;
+        }
+    }
+        
+    public static void add(Graph graph, Iterator<Triple> it)
+    {
+        // Materialize to avoid ConcurrentModificationException.
+        List<Triple> s = IteratorCollection.iteratorToList(it) ;
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : s)
+                g.performAdd(t) ;
+            graph.getEventManager().notifyAddIterator(graph, s) ;
+        } 
+        else
+        {
+            for (Triple t : s)
+                graph.add(t) ;
+        }
+    }
+    
+    /** Add triples into the destination (arg 1) from the source (arg 2)*/
+    public static void addInto(Graph dstGraph, Graph srcGraph )
+    {
+        addInto(dstGraph, srcGraph, false) ;
+    }
+    
+    /** Add triples into the destination (arg 1) from the source (arg 2)*/
+    public static void addInto(Graph dstGraph, Graph srcGraph, boolean withReifications )
+    { 
+        addIteratorWorker(dstGraph, GraphUtil.findAll( srcGraph ));  
+        if (withReifications) addReificationsInto(  dstGraph, srcGraph );
+        dstGraph.getEventManager().notifyAddGraph( dstGraph, srcGraph );
+    }
+    
+    private static void addIteratorWorker( Graph graph, Iterator<Triple> it )
+    { 
+        List<Triple> s = IteratorCollection.iteratorToList( it );
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : s )
+                g.performAdd(t) ;
+        }
+        else
+        {
+            for (Triple t : s )
+                graph.add(t) ;
+        }
+    }
+
+    private static void addReificationsInto( Graph dstGraph, Graph srcGraph )
+    {
+        Reifier r = srcGraph.getReifier();
+        Iterator<Node> it = r.allNodes();
+        while (it.hasNext())
+        {
+            Node node = it.next();
+            dstGraph.getReifier().reifyAs( node, r.getTriple( node ) );
+        }
+    }
+    
+    public static void delete(Graph graph, Triple[] triples)
+    {
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : triples )
+                g.performDelete(t) ;
+            graph.getEventManager().notifyDeleteArray(graph, triples) ;
+        }
+        else
+        {
+            for (Triple t : triples )
+                graph.delete(t) ; 
+        }
+    }
+    
+    public static void delete(Graph graph, List<Triple> triples)
+    {
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : triples )
+                g.performDelete(t) ;
+            graph.getEventManager().notifyDeleteList(graph, triples) ;
+        }
+        else
+        {
+            for (Triple t : triples )
+                graph.delete(t) ; 
+        }
+    }
+    
+    public static void delete(Graph graph, Iterator<Triple> it)
+    {
+        // Materialize to avoid ConcurrentModificationException.
+        List<Triple> s = IteratorCollection.iteratorToList(it) ;
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : s)
+                g.performDelete(t) ;
+            graph.getEventManager().notifyDeleteIterator(graph, s) ;
+        } 
+        else
+        {
+            for (Triple t : s)
+                graph.delete(t) ;
+        }
+    }
+    
+    /** Delete triples the destination (arg 1) as given in the source (arg 2) */
+    public static void deleteFrom(Graph dstGraph, Graph srcGraph)
+    {
+        deleteFrom(dstGraph, srcGraph, false) ;
+    }
+    
+    /** Delete triples the destination (arg 1) as given in the source (arg 2) */
+    public static void deleteFrom(Graph dstGraph, Graph srcGraph, boolean withReifications )
+    { 
+        deleteIteratorWorker(dstGraph, GraphUtil.findAll( srcGraph ));  
+        if (withReifications) deleteReificationsFrom(  dstGraph, srcGraph );
+        dstGraph.getEventManager().notifyDeleteGraph( dstGraph, srcGraph );
+    }
+    
+    private static void deleteIteratorWorker( Graph graph, Iterator<Triple> it )
+    { 
+        List<Triple> s = IteratorCollection.iteratorToList( it );
+        if ( OldStyle && graph instanceof GraphWithPerform )
+        {
+            GraphWithPerform g = (GraphWithPerform)graph ;
+            for (Triple t : s )
+                g.performDelete(t) ;
+        }
+        else
+        {
+            for (Triple t : s )
+                graph.delete(t) ;
+        }
+    }
+    
+    private static void deleteReificationsFrom( Graph dstGraph, Graph srcGraph )
+    {
+        Reifier r = srcGraph.getReifier();
+        Iterator<Node> it = r.allNodes();
+        while (it.hasNext())
+        {
+            Node node = it.next();
+            dstGraph.getReifier().remove( node, r.getTriple( node ) );
+        }
+    }
+    
+    private static final int sliceSize = 1000 ;
+    /** A safe and cautious remve() function.
+     *  To avoid any possible ConcurrentModificationExceptions,
+     *  it finds batches of triples, deletes them and tries again until
+     *  no change occurs. 
+     */
+    public static void remove(Graph g, Node s, Node p, Node o)
+    {
+        // Beware of ConcurrentModificationExceptions.
+        // Delete in batches.
+        // That way, there is no active iterator when a delete 
+        // from the indexes happens.
+        
+        Triple[] array = new Triple[sliceSize] ;
+        
+        while (true)
+        {
+            // Convert/cache s,p,o?
+            // The Node Cache will catch these so don't worry unduely. 
+            ExtendedIterator<Triple> iter = g.find(s,p,o) ;
+            
+            // Get a slice
+            int len = 0 ;
+            for ( ; len < sliceSize ; len++ )
+            {
+                if ( !iter.hasNext() ) break ;
+                array[len] = iter.next() ;
+            }
+            
+            // Delete them.
+            for ( int i = 0 ; i < len ; i++ )
+            {
+                g.delete(array[i]) ;
+                array[i] = null ;
+            }
+            // Finished?
+            if ( len < sliceSize )
+                break ;
+        }
+    }
 }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/FileGraphTransactionHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/FileGraphTransactionHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/FileGraphTransactionHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/FileGraphTransactionHandler.java Sun Nov 25 16:53:52 2012
@@ -67,7 +67,7 @@ public class FileGraphTransactionHandler
     
     @Override
     public void abort()
-        { fileGraph.getBulkUpdateHandler().removeAll();
+        { fileGraph.removeAll();
         fileGraph.readModelFrom( fileGraph.model, true, checkPointFile );
         checkPointFile.delete();
         inTransaction = false; }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/GraphBase.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/GraphBase.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/GraphBase.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/GraphBase.java Sun Nov 25 16:53:52 2012
@@ -18,12 +18,13 @@
 
 package com.hp.hpl.jena.graph.impl;
 
-import com.hp.hpl.jena.graph.*;
-import com.hp.hpl.jena.graph.query.*;
-import com.hp.hpl.jena.util.iterator.*;
-
-import com.hp.hpl.jena.shared.*;
-import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;
+import com.hp.hpl.jena.graph.* ;
+import com.hp.hpl.jena.graph.query.QueryHandler ;
+import com.hp.hpl.jena.graph.query.SimpleQueryHandler ;
+import com.hp.hpl.jena.shared.* ;
+import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
+import com.hp.hpl.jena.util.iterator.ClosableIterator ;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
 
 /**
     GraphBase is an implementation of Graph that provides some convenient
@@ -155,7 +156,7 @@ public abstract class GraphBase implemen
     */
     public void notifyDelete( Triple t )
         { getEventManager().notifyDeleteTriple( this, t ); }
-        
+    
     /**
          Answer a transaction handler bound to this graph. The default is
          SimpleTransactionHandler, which handles <i>no</i> transactions.
@@ -254,6 +255,26 @@ public abstract class GraphBase implemen
     public void performDelete( Triple t ) 
         { throw new DeleteDeniedException( "GraphBase::delete" ); }
 
+    /**
+        Remove all the statements from this graph.
+     */
+	@Override
+    public void removeAll()
+	{
+	    GraphUtil.remove(this, Node.ANY, Node.ANY, Node.ANY) ;
+        getEventManager().notifyEvent(this, GraphEvents.removeAll ) ;	
+	}
+
+	/**
+       Remove all triples that match by find(s, p, o)
+	 */
+	@Override
+    public void remove( Node s, Node p, Node o )
+	{
+	    GraphUtil.remove(this, s, p, o) ;
+	    getEventManager().notifyEvent(this, GraphEvents.remove(s, p, o) ) ;
+	}
+	
 	/**
 	     Answer an (extended) iterator over all the triples in this Graph matching
          <code>m</code>. Subclasses cannot over-ride this, because it implements

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/SimpleBulkUpdateHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/SimpleBulkUpdateHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/SimpleBulkUpdateHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/SimpleBulkUpdateHandler.java Sun Nov 25 16:53:52 2012
@@ -77,6 +77,7 @@ public class SimpleBulkUpdateHandler imp
         }
         
     @Override
+    @Deprecated
     public void add( Graph g )
         { add( g, false ); }
         
@@ -151,6 +152,7 @@ public class SimpleBulkUpdateHandler imp
         }
             
     @Override
+    @Deprecated
     public void delete( Graph g )
         { delete( g, false ); }
         
@@ -167,6 +169,7 @@ public class SimpleBulkUpdateHandler imp
         }
     
     @Override
+    @Deprecated
     public void removeAll()
         { removeAll( graph ); 
         notifyRemoveAll(); }
@@ -175,6 +178,7 @@ public class SimpleBulkUpdateHandler imp
         { manager.notifyEvent( graph, GraphEvents.removeAll ); }
 
     @Override
+    @Deprecated
     public void remove( Node s, Node p, Node o )
         { removeAll( graph, s, p, o ); 
         manager.notifyEvent( graph, GraphEvents.remove( s, p, o ) ); }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedBulkUpdateHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedBulkUpdateHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedBulkUpdateHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedBulkUpdateHandler.java Sun Nov 25 16:53:52 2012
@@ -77,6 +77,7 @@ public class WrappedBulkUpdateHandler im
         }
     
     @Override
+    @Deprecated
     public void add( Graph g )
         {
 	    base.add( g );
@@ -109,6 +110,7 @@ public class WrappedBulkUpdateHandler im
         }
 
     @Override
+    @Deprecated
     public void delete( Graph g )
         {
         base.delete( g );
@@ -124,6 +126,7 @@ public class WrappedBulkUpdateHandler im
         }
 
     @Override
+    @Deprecated
     public void removeAll()
         {
         base.removeAll();
@@ -131,6 +134,7 @@ public class WrappedBulkUpdateHandler im
         }
 
     @Override
+    @Deprecated
     public void remove( Node s, Node p, Node o )
         {
         base.remove( s, p, o );

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedGraph.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/graph/impl/WrappedGraph.java Sun Nov 25 16:53:52 2012
@@ -90,6 +90,20 @@ public class WrappedGraph implements Gra
         getEventManager().notifyDeleteTriple( this, t ); }
 
     @Override
+    public void removeAll()
+    {
+        base.removeAll() ;
+        getEventManager().notifyEvent(this, GraphEvents.removeAll ) ;   
+    }
+
+    @Override
+    public void remove(Node s, Node p, Node o)
+    {
+        base.remove(s,p,o) ;
+        getEventManager().notifyEvent(this, GraphEvents.remove(s, p, o) ) ;
+    }
+
+    @Override
     public ExtendedIterator<Triple> find( TripleMatch m )
         { return SimpleEventManager.notifyingRemove( this, base.find( m ) ); }
 

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/mem/GraphMemBulkUpdateHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/mem/GraphMemBulkUpdateHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/mem/GraphMemBulkUpdateHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/mem/GraphMemBulkUpdateHandler.java Sun Nov 25 16:53:52 2012
@@ -32,6 +32,7 @@ public class GraphMemBulkUpdateHandler e
 	    { super( graph ); }
 	
 	@Override
+	@Deprecated
     public void removeAll()
 	    {
 	    clearComponents();

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaHandler.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaHandler.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaHandler.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaHandler.java Sun Nov 25 16:53:52 2012
@@ -18,28 +18,23 @@
 
 package com.hp.hpl.jena.rdf.arp;
 
-import java.util.Arrays;
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.RDFErrorHandler ;
+import com.hp.hpl.jena.shared.JenaException ;
+import com.hp.hpl.jena.shared.PrefixMapping ;
+import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
 
-import com.hp.hpl.jena.graph.*;
-import com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler;
-import com.hp.hpl.jena.rdf.model.*;
-import com.hp.hpl.jena.shared.JenaException;
-import com.hp.hpl.jena.shared.PrefixMapping;
-import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;
-
-final class JenaHandler extends ARPSaxErrorHandler implements StatementHandler,
-        NamespaceHandler
+final class JenaHandler extends ARPSaxErrorHandler implements StatementHandler, NamespaceHandler
     {
-    static private final int BULK_UPDATE_SIZE = 1000;
-
-    private final BulkUpdateHandler bulk;
-
     private final PrefixMapping prefixMapping;
 
-    protected final Triple triples[];
-
     protected int here = 0;
 
+    private final Graph graph ;
+
     public JenaHandler( Model m, RDFErrorHandler e )
         { this( m.getGraph(), e ); }
 
@@ -52,8 +47,7 @@ final class JenaHandler extends ARPSaxEr
     private JenaHandler( Graph graph, PrefixMapping prefixMapping, RDFErrorHandler errorHandler )
         {
         super( errorHandler );
-        this.bulk = graph.getBulkUpdateHandler();
-        this.triples = new Triple[BULK_UPDATE_SIZE];
+        this.graph = graph ;
         this.prefixMapping = prefixMapping; 
         }
     
@@ -73,37 +67,30 @@ final class JenaHandler extends ARPSaxEr
         }
 
     @Override
-    public void statement( AResource subj, AResource pred, AResource obj )
-        {
+    public void statement(AResource subj, AResource pred, AResource obj)
+    {
         try
-            { triples[here++] = JenaReader.convert( subj, pred, obj ); }
-        catch (JenaException e)
-            { errorHandler.error( e ); }
-        if (here == BULK_UPDATE_SIZE) bulkUpdate();
+        {
+            Triple t = JenaReader.convert(subj, pred, obj) ;
+            graph.add(t) ;
+        } catch (JenaException e)
+        {
+            errorHandler.error(e) ;
         }
+    }
 
     @Override
-    public void statement( AResource subj, AResource pred, ALiteral lit )
-        {
+    public void statement(AResource subj, AResource pred, ALiteral lit)
+    {
         try
-            { triples[here++] = JenaReader.convert( subj, pred, lit ); }
-        catch (JenaException e)
-            { errorHandler.error( e ); }
-        if (here == BULK_UPDATE_SIZE) bulkUpdate();
-        }
-
-    public void bulkUpdate()
         {
-        try
-            {
-            if (here == BULK_UPDATE_SIZE) bulk.add( triples );
-            else bulk.add( Arrays.asList( triples ).subList( 0, here ) );
-            }
-        catch (JenaException e)
-            { errorHandler.error( e ); }
-        finally
-            { here = 0; }
+            Triple t = JenaReader.convert(subj, pred, lit) ;
+            graph.add(t) ;
+        } catch (JenaException e)
+        {
+            errorHandler.error(e) ;
         }
+    }
 
     @Override
     public void startPrefixMapping( String prefix, String uri )

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaReader.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaReader.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaReader.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/JenaReader.java Sun Nov 25 16:53:52 2012
@@ -171,7 +171,6 @@ public class JenaReader implements RDFRe
             handler = new JenaHandler(g, m, errorHandler);
             handler.useWith(arpf.getHandlers());
             arpf.parse(inputS, xmlBase);
-            handler.bulkUpdate();
         } catch (IOException e) {
             throw new WrappedIOException(e);
         } catch (SAXException e) {

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/SAX2Model.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/SAX2Model.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/SAX2Model.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/arp/SAX2Model.java Sun Nov 25 16:53:52 2012
@@ -145,8 +145,6 @@ public class SAX2Model extends SAX2RDF {
         // System.err.println("closing;");
         if (!closed) {
             super.close();
-            if (handler != null)
-              handler.bulkUpdate();
             closed = true;
         }
     }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/model/impl/ModelCom.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/model/impl/ModelCom.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/model/impl/ModelCom.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/rdf/model/impl/ModelCom.java Sun Nov 25 16:53:52 2012
@@ -188,7 +188,7 @@ public class ModelCom extends EnhGraph
 
     @Override
     public Model add( StmtIterator iter )  {
-        try { getBulkUpdateHandler().add( asTriples( iter ) ); }
+        try { GraphUtil.add( getGraph(), asTriples( iter ) ); }
         finally { iter.close(); }
         return this;
     }
@@ -199,7 +199,7 @@ public class ModelCom extends EnhGraph
         
     @Override
     public Model add( Model m, boolean suppressReifications ) {
-        getBulkUpdateHandler().add( m.getGraph(), !suppressReifications );
+        GraphUtil.addInto( getGraph(), m.getGraph(), !suppressReifications );
         return this;
     }
     
@@ -351,7 +351,7 @@ public class ModelCom extends EnhGraph
     @Override
     public Model remove( StmtIterator iter ) 
         {
-        getBulkUpdateHandler().delete( asTriples( iter ) );
+        GraphUtil.delete( getGraph(), asTriples( iter ) );
         return this;
         }
     
@@ -362,21 +362,21 @@ public class ModelCom extends EnhGraph
     @Override
     public Model remove( Model m, boolean suppressReifications ) 
         {
-        getBulkUpdateHandler().delete( m.getGraph(), !suppressReifications );
+        GraphUtil.deleteFrom( getGraph(), m.getGraph(), !suppressReifications );
         return this;
         }
     
     @Override
     public Model removeAll()
         { 
-        getGraph().getBulkUpdateHandler().removeAll();
+        getGraph().removeAll();
         return this; 
         }
     
     @Override
     public Model removeAll( Resource s, Property p, RDFNode o )
         {
-        getGraph().getBulkUpdateHandler().remove( asNode( s ), asNode( p ), asNode( o ) );
+        getGraph().remove( asNode( s ), asNode( p ), asNode( o ) );
         return this;
         }
         
@@ -1028,13 +1028,10 @@ public class ModelCom extends EnhGraph
     @Override
     public Model add( Statement [] statements )
         {
-        getBulkUpdateHandler().add( StatementImpl.asTriples( statements ) );
+        GraphUtil.add(getGraph(), StatementImpl.asTriples( statements ) );
         return this;
         }
         
-    protected BulkUpdateHandler getBulkUpdateHandler()
-        { return getGraph().getBulkUpdateHandler(); }
-        
     /**
         Add all the statements to the model by converting the list to an array of
         Statement and removing that.
@@ -1042,7 +1039,7 @@ public class ModelCom extends EnhGraph
     @Override
     public Model add( List<Statement> statements )
         {
-        getBulkUpdateHandler().add( asTriples( statements ) );
+        GraphUtil.add(getGraph(), asTriples( statements ) );
         return this;
         }
         
@@ -1068,7 +1065,7 @@ public class ModelCom extends EnhGraph
     @Override
     public Model remove( Statement [] statements )
         {
-        getBulkUpdateHandler().delete( StatementImpl.asTriples( statements ) );        
+        GraphUtil.delete( getGraph(), StatementImpl.asTriples( statements ) );        
         return this;
         }
      
@@ -1079,7 +1076,7 @@ public class ModelCom extends EnhGraph
     @Override
     public Model remove( List<Statement> statements )
         {
-        getBulkUpdateHandler().delete( asTriples( statements ) );
+        GraphUtil.delete( getGraph(), asTriples( statements ) );
         return this;
         }
            

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/BaseInfGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/BaseInfGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/BaseInfGraph.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/BaseInfGraph.java Sun Nov 25 16:53:52 2012
@@ -139,8 +139,6 @@ public abstract class BaseInfGraph exten
     /**
         InfBulkUpdateHandler - a bulk update handler specialised for inference
         graphs by code for <code>removeAll()</code>.
-
-        @author kers
     */
     static class InfBulkUpdateHandler extends SimpleBulkUpdateHandler
     	{
@@ -148,6 +146,7 @@ public abstract class BaseInfGraph exten
             { super(graph); }
 
         @Override
+        @Deprecated
         public void remove( Node s, Node p, Node o )
             {
             BaseInfGraph g = (BaseInfGraph) graph;
@@ -158,6 +157,7 @@ public abstract class BaseInfGraph exten
             }
 
         @Override
+        @Deprecated
         public void removeAll()
             {
             BaseInfGraph g = (BaseInfGraph) graph;
@@ -167,7 +167,26 @@ public abstract class BaseInfGraph exten
             g.getEventManager().notifyEvent( g, GraphEvents.removeAll );
             }
     	}
+    
+    @Override
+    public void remove( Node s, Node p, Node o )
+    {
+        getRawGraph().remove( s, p, o );
+        discardState();
+        rebind();
+        getEventManager().notifyEvent( this, GraphEvents.remove( s, p, o ) );
+    }
+    
+    @Override
+    public void removeAll()
+    {
+        getRawGraph().removeAll() ;
+        discardState();
+        rebind();
+        getEventManager().notifyEvent( this, GraphEvents.removeAll );
+    }
 
+    
     @Override
     public TransactionHandler getTransactionHandler()
         { return new InfTransactionHandler( this ); }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/BasicForwardRuleInfGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/BasicForwardRuleInfGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/BasicForwardRuleInfGraph.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/BasicForwardRuleInfGraph.java Sun Nov 25 16:53:52 2012
@@ -417,7 +417,7 @@ public class BasicForwardRuleInfGraph ex
             Graph dg = fdeductions.getGraph();
             if (dg != null) {
                 // Reuse the old graph in order to preserve any listeners
-                safeDeductions.getBulkUpdateHandler().removeAll();
+                safeDeductions.removeAll();
                 return dg;
             }
         }

Modified: jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/FBRuleInfGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/FBRuleInfGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/FBRuleInfGraph.java (original)
+++ jena/branches/jena-core-simplified/src/main/java/com/hp/hpl/jena/reasoner/rulesys/FBRuleInfGraph.java Sun Nov 25 16:53:52 2012
@@ -407,7 +407,7 @@ public class FBRuleInfGraph  extends Bas
             // initilize the deductions graph
             if (fdeductions != null) {
                 Graph oldDeductions = (fdeductions).getGraph();
-                oldDeductions.getBulkUpdateHandler().removeAll();
+                oldDeductions.removeAll();
             } else {
                 fdeductions = new FGraph( createDeductionsGraph() );
             }

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java Sun Nov 25 16:53:52 2012
@@ -51,7 +51,7 @@ public class TestIntersection extends Gr
     	Graph L = graphWith( "a pings b; b pings c; c pings a" );
     	Graph R = graphWith( "c pings a; b pings c; x captures y" );
     	Graph join = new Intersection( L, R );
-        L.getBulkUpdateHandler().delete( join );
+    	GraphUtil.deleteFrom(L, R) ;
         assertIsomorphic( "R should not change", graphWith( "c pings a; b pings c; x captures y" ), R );
         assertIsomorphic( graphWith( "a pings b" ), L );
 		}

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestGraph.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestGraph.java Sun Nov 25 16:53:52 2012
@@ -35,8 +35,6 @@ import java.util.*;
     AbstractTestGraph provides a bunch of basic tests for something that
     purports to be a Graph. The abstract method getGraph must be overridden
     in subclasses to deliver a Graph of interest. 
-    
- 	@author kers
 */
 public/* abstract */class AbstractTestGraph extends GraphTestBase
     {
@@ -304,48 +302,47 @@ public/* abstract */class AbstractTestGr
     public void testBulkUpdate()
         {
         Graph g = getGraph();
-        BulkUpdateHandler bu = g.getBulkUpdateHandler();
         Graph items = graphWith( "pigs might fly; dead can dance" );
         int initialSize = g.size();
     /* */
-        bu.add( tripleArray );
+        GraphUtil.add( g,  tripleArray );
         testContains( g, tripleArray );
         testOmits( g, tripleList );
     /* */
-        bu.add( tripleList );
+        GraphUtil.add( g,  tripleList );
         testContains( g, tripleList );
         testContains( g, tripleArray );
     /* */
-        bu.add( tripleSet.iterator() );
+        GraphUtil.add( g, tripleSet.iterator() );
         testContains( g, tripleSet.iterator() );
         testContains( g, tripleList );
         testContains( g, tripleArray );
     /* */
-        bu.add( items );
+        GraphUtil.addInto( g, items );
         testContains( g, items );
         testContains( g, tripleSet.iterator() );
         testContains( g, tripleArray );
         testContains( g, tripleList );
     /* */
-        bu.delete( tripleArray );
+        GraphUtil.delete( g, tripleArray );
         testOmits( g, tripleArray );
         testContains( g, tripleList );
         testContains( g, tripleSet.iterator() );
         testContains( g, items );
     /* */
-        bu.delete( tripleSet.iterator() );
+        GraphUtil.delete( g, tripleSet.iterator() );
         testOmits( g, tripleSet.iterator() );
         testOmits( g, tripleArray );
         testContains( g, tripleList );
         testContains( g, items );
     /* */
-        bu.delete( items );
+        GraphUtil.deleteFrom( g, items );
         testOmits( g, tripleSet.iterator() );
         testOmits( g, tripleArray );
         testContains( g, tripleList );
         testOmits( g, items ); 
     /* */
-        bu.delete( tripleList );
+        GraphUtil.delete( g, tripleList );
         assertEquals( "graph has original size", initialSize, g.size() );
         }
         
@@ -365,12 +362,11 @@ public/* abstract */class AbstractTestGr
     public void testBulkAddWithReification( boolean withReifications )
         {
         Graph graphToUpdate = getGraph();
-        BulkUpdateHandler bu = graphToUpdate.getBulkUpdateHandler();
         Graph graphToAdd = graphWith( "pigs might fly; dead can dance" );
         Reifier updatedReifier = graphToUpdate.getReifier();
         Reifier addedReifier = graphToAdd.getReifier();
         xSPOyXYZ( addedReifier );
-        bu.add( graphToAdd, withReifications );
+        GraphUtil.addInto( graphToUpdate, graphToAdd, withReifications );
         assertIsomorphic
             ( 
             withReifications ? getReificationTriples( addedReifier ) : graphWith( "" ), 
@@ -430,12 +426,11 @@ public/* abstract */class AbstractTestGr
     public void testBulkUpdateRemoveWithReification( boolean withReifications )
         {
         Graph g = getGraph();
-        BulkUpdateHandler bu = g.getBulkUpdateHandler();
         Graph items = graphWith( "pigs might fly; dead can dance" );
         Reifier gr = g.getReifier(), ir = items.getReifier();
         xSPOyXYZ( ir );
         xSPO( gr ); aABC( gr ); 
-        bu.delete( items, withReifications );
+        GraphUtil.deleteFrom( g, items, withReifications );
         Graph answer = graphWith( "" );
         Reifier ar = answer.getReifier();
         if (withReifications)
@@ -628,7 +623,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         Triple [] triples = tripleArray( "x R y; a P b" );
-        g.getBulkUpdateHandler().add( triples );
+        GraphUtil.add(g, triples );
         L.assertHas( new Object[] {"add[]", g, triples} );
         }
       
@@ -636,7 +631,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         List<Triple> elems = Arrays.asList( tripleArray( "bells ring loudly; pigs might fly" ) );
-        g.getBulkUpdateHandler().add( elems );
+        GraphUtil.add(g, elems) ;
         L.assertHas( new Object[] {"addList", g, elems} );
         }
     
@@ -644,7 +639,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         Triple [] triples = tripleArray( "x R y; a P b" );
-        g.getBulkUpdateHandler().delete( triples );
+        GraphUtil.delete( g, triples );
         L.assertHas( new Object[] {"delete[]", g, triples} );
         }
         
@@ -652,7 +647,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         List<Triple> elems = Arrays.asList( tripleArray( "bells ring loudly; pigs might fly" ) );
-        g.getBulkUpdateHandler().delete( elems );
+        GraphUtil.delete( g, elems );
         L.assertHas( new Object[] {"deleteList", g, elems} );
         }
         
@@ -660,7 +655,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L ); 
         Triple [] triples = tripleArray( "I wrote this; you read that; I wrote this" );
-        g.getBulkUpdateHandler().add( asIterator( triples ) );
+        GraphUtil.add(g, asIterator( triples ) );
         L.assertHas( new Object[] {"addIterator", g, Arrays.asList( triples )} );
         }
         
@@ -668,7 +663,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         Triple [] triples = tripleArray( "I wrote this; you read that; I wrote this" );
-        g.getBulkUpdateHandler().delete( asIterator( triples ) );
+        GraphUtil.delete( g, asIterator( triples ) );
         L.assertHas( new Object[] {"deleteIterator", g, Arrays.asList( triples )} );
         }
         
@@ -679,7 +674,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         Graph triples = graphWith( "this type graph; I type slowly" );
-        g.getBulkUpdateHandler().add( triples );
+        GraphUtil.addInto( g, triples );
         L.assertHas( new Object[] {"addGraph", g, triples} );
         }
         
@@ -687,7 +682,7 @@ public/* abstract */class AbstractTestGr
         {        
         Graph g = getAndRegister( L );
         Graph triples = graphWith( "this type graph; I type slowly" );
-        g.getBulkUpdateHandler().delete( triples );
+        GraphUtil.deleteFrom( g, triples );
         L.assertHas( new Object[] {"deleteGraph", g, triples} );
         }
     
@@ -702,7 +697,7 @@ public/* abstract */class AbstractTestGr
     public void testRemoveAllEvent()
         {
         Graph g = getAndRegister( L );
-        g.getBulkUpdateHandler().removeAll();
+        g.removeAll();
         L.assertHas( new Object[] { "someEvent", g, GraphEvents.removeAll } );        
         }
     
@@ -710,7 +705,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getAndRegister( L );
         Node S = node( "S" ), P = node( "??" ), O = node( "??" );
-        g.getBulkUpdateHandler().remove( S, P, O );
+        g.remove( S, P, O );
         Object event = GraphEvents.remove( S, P, O );
         L.assertHas( new Object[] { "someEvent", g, event } );        
         }
@@ -837,7 +832,7 @@ public/* abstract */class AbstractTestGr
         {
         Graph g = getGraph();
         graphAdd( g, triples );
-        g.getBulkUpdateHandler().removeAll();
+        g.removeAll();
         assertTrue( g.isEmpty() );
         }
     
@@ -902,7 +897,7 @@ public/* abstract */class AbstractTestGr
                 graphAdd( content, cases[i][0] );
                 Triple remove = triple( cases[i][1] );
                 Graph expected = graphWith( cases[i][2] );
-                content.getBulkUpdateHandler().remove( remove.getSubject(), remove.getPredicate(), remove.getObject() );
+                content.remove( remove.getSubject(), remove.getPredicate(), remove.getObject() );
                 Graph finalContent = remove( copy( content ), baseContent );
                 assertIsomorphic( cases[i][1], expected, finalContent );
                 }
@@ -957,12 +952,12 @@ public/* abstract */class AbstractTestGr
 
 	protected void add( Graph toUpdate, Graph toAdd )
         {
-        toUpdate.getBulkUpdateHandler().add( toAdd );
+	    GraphUtil.addInto( toUpdate, toAdd) ;
         }
     
     protected Graph remove( Graph toUpdate, Graph toRemove )
         {
-        toUpdate.getBulkUpdateHandler().delete( toRemove );
+        GraphUtil.deleteFrom(toUpdate, toRemove) ;
         return toUpdate;
         }
     
@@ -970,7 +965,7 @@ public/* abstract */class AbstractTestGr
     protected Graph copy( Graph g )
         {
         Graph result = Factory.createDefaultGraph();
-        result.getBulkUpdateHandler().add( g );
+        GraphUtil.addInto(result, g) ;
         return result;
         }
     

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestReifier.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestReifier.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestReifier.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/AbstractTestReifier.java Sun Nov 25 16:53:52 2012
@@ -509,14 +509,14 @@ public abstract class AbstractTestReifie
     public void testBulkClearReificationTriples()
         {
         Graph g = getGraphWith( "x rdf:subject S" );
-        g.getBulkUpdateHandler().removeAll();
+        g.removeAll();
         assertEquals( "oops: " + g.getClass(), Collections.EMPTY_SET, g.find( Node.ANY, Node.ANY, Node.ANY ).toSet() );        
         }
     
     public void testBulkClearReificationTriples2()
         {
         Graph g = getGraphWith( "x rdf:subject S; x rdf:predicate P; x rdf:object O; x rdf:type rdf:Statement" );
-        g.getBulkUpdateHandler().removeAll();
+        g.removeAll();
         assertEquals( Collections.EMPTY_SET, g.find( Node.ANY, Node.ANY, Node.ANY ).toSet() );        
         }
     

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraph.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraph.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraph.java Sun Nov 25 16:53:52 2012
@@ -32,8 +32,6 @@ import junit.framework.*;
 /**
     Test FileGraph by seeing if we can make some file graphs and then read
     them back.
-
- 	@author hedgehog
 */
 
 public class TestFileGraph extends GraphTestBase
@@ -91,13 +89,13 @@ public class TestFileGraph extends Graph
         File foo = FileUtils.tempFileName( "fileGraph", ".nt" );
         
         Graph g = new FileGraph( foo, true, true );
-        g.getBulkUpdateHandler().add( initial );
+        GraphUtil.addInto( g, initial );
         g.getTransactionHandler().begin();
-        g.getBulkUpdateHandler().add( extra );
+        GraphUtil.addInto( g, extra );
         g.getTransactionHandler().commit();
         Graph union = graphWith( "" );
-        union.getBulkUpdateHandler().add( initial );
-        union.getBulkUpdateHandler().add( extra );
+        GraphUtil.addInto(union, initial );
+        GraphUtil.addInto(union, extra );
         assertIsomorphic( union, g );
         Model inFile = ModelFactory.createDefaultModel();
         inFile.read( "file:///" + foo, "N-TRIPLES" );
@@ -110,9 +108,9 @@ public class TestFileGraph extends Graph
         Graph extra = graphWith( "extra hasValue 17; also hasURI world" );
         File foo = FileUtils.tempFileName( "fileGraph", ".n3" );
         Graph g = new FileGraph( foo, true, true );
-        g.getBulkUpdateHandler().add( initial );
+        GraphUtil.addInto( g, initial );
         g.getTransactionHandler().begin();
-        g.getBulkUpdateHandler().add( extra );
+        GraphUtil.addInto( g, extra );
         g.getTransactionHandler().abort();
         assertIsomorphic( initial, g );
         }
@@ -124,10 +122,10 @@ public class TestFileGraph extends Graph
         File foo = FileUtils.tempFileName( "fileGraph", ".nt" );
         Graph g = new FileGraph( foo, true, true );
         g.getTransactionHandler().begin();
-        g.getBulkUpdateHandler().add( initial );
+        GraphUtil.addInto( g, initial );
         g.getTransactionHandler().commit();
         g.getTransactionHandler().begin();
-        g.getBulkUpdateHandler().add( extra );
+        GraphUtil.addInto( g, extra );
         g.getTransactionHandler().abort();
         assertIsomorphic( initial, g );
         Model inFile = ModelFactory.createDefaultModel();
@@ -184,7 +182,7 @@ public class TestFileGraph extends Graph
             File foo = FileUtils.tempFileName( prefix, suffix );
             Graph original = graphWith( content );
             Graph g = new FileGraph( foo, true, true );
-            g.getBulkUpdateHandler().add( original );
+            GraphUtil.addInto( g, original );
             g.close();
             Graph g2 = new FileGraph( foo, false, true );
             assertIsomorphic( original, g2 );

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraphMaker.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraphMaker.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraphMaker.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/graph/test/TestFileGraphMaker.java Sun Nov 25 16:53:52 2012
@@ -70,7 +70,7 @@ public class TestFileGraphMaker extends 
         FileGraphMaker A = new FileGraphMaker( scratch.getPath(), ReificationStyle.Minimal, true );
         FileGraphMaker B = new FileGraphMaker( scratch.getPath(), ReificationStyle.Minimal, true );
         FileGraph gA = (FileGraph) A.createGraph( "already", true );
-        gA.getBulkUpdateHandler().add( content );
+        GraphUtil.addInto( gA, content );
         gA.close();
         FileGraph gB = (FileGraph) B.openGraph( "already", false );
         assertIsomorphic( content, gB );

Modified: jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/mem/test/TestGraphMem.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/mem/test/TestGraphMem.java?rev=1413371&r1=1413370&r2=1413371&view=diff
==============================================================================
--- jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/mem/test/TestGraphMem.java (original)
+++ jena/branches/jena-core-simplified/src/test/java/com/hp/hpl/jena/mem/test/TestGraphMem.java Sun Nov 25 16:53:52 2012
@@ -36,14 +36,15 @@ public class TestGraphMem extends Abstra
     
     @Override public Graph getGraph()
         { return new GraphMem(); }   
-    
-    public void testRemoveAllDoesntUseFind()
-        {
-        Graph g = new GraphMemWithoutFind();
-        graphAdd( g, "x P y; a Q b" );
-        g.getBulkUpdateHandler().removeAll();
-        assertEquals( 0, g.size() );
-        }
+
+    // g.removalAll may use find (carefully)
+//    public void testRemoveAllDoesntUseFind()
+//        {
+//        Graph g = new GraphMemWithoutFind();
+//        graphAdd( g, "x P y; a Q b" );
+//        g.removeAll();
+//        assertEquals( 0, g.size() );
+//        }
     
     public void testSizeAfterRemove() 
         {