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/12/17 13:35:11 UTC

svn commit: r1422902 - in /jena/trunk/jena-core/src: main/java/com/hp/hpl/jena/graph/compose/ test/java/com/hp/hpl/jena/graph/compose/test/

Author: andy
Date: Mon Dec 17 12:35:10 2012
New Revision: 1422902

URL: http://svn.apache.org/viewvc?rev=1422902&view=rev
Log:
Clearing up and handling JENA-59

Modified:
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Delta.java
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Difference.java
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestCaseBasic.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDelta.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDifference.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestPackage.java

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Delta.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Delta.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Delta.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Delta.java Mon Dec 17 12:35:10 2012
@@ -16,71 +16,86 @@
  * limitations under the License.
  */
 
-package com.hp.hpl.jena.graph.compose;
+package com.hp.hpl.jena.graph.compose ;
 
-import com.hp.hpl.jena.graph.*;
-import com.hp.hpl.jena.util.iterator.*;
+import com.hp.hpl.jena.graph.* ;
+import com.hp.hpl.jena.util.iterator.* ;
 
 /**
-    Graph operation for wrapping a base graph and leaving it unchanged while recording
-    all the attempted updates for later access.
-*/
-
-public class Delta extends Dyadic implements Graph 
-	{
-	private Graph base;
-	
-	public Delta( Graph base )
-		{
-		super( Factory.createGraphMem(), Factory.createGraphMem() );
-		this.base = base;
-		}
-		
+ * Graph operation for wrapping a base graph and leaving it unchanged while
+ * recording all the attempted updates for later access.
+ */
+
+@Deprecated
+public class Delta extends Dyadic implements Graph
+{
+    private Graph base ;
+
+    public Delta(Graph base)
+    {
+        super(Factory.createGraphMem(), Factory.createGraphMem()) ;
+        this.base = base ;
+    }
+
     /**
-        Answer the graph of all triples added
-    */
-	public Graph getAdditions()
-		{ return L; }
-		
+     * Answer the graph of all triples added
+     */
+    public Graph getAdditions()
+    {
+        return L ;
+    }
+
     /**
-        Answer the graph of all triples removed
-    */
-	public Graph getDeletions()
-		{ return R; }
-		
+     * Answer the graph of all triples removed
+     */
+    public Graph getDeletions()
+    {
+        return R ;
+    }
+
     /**
-        Add the triple to the graph, ie add it to the additions, remove it from the removals.
-    */
-	@Override public void performAdd( Triple t )
-		{
-		L.add( t );
-		R.delete( t );
-		}
+     * Add the triple to the graph, ie add it to the additions, remove it from
+     * the removals.
+     */
+    @Override
+    public void performAdd(Triple t)
+    {
+        if (!base.contains(t)) 
+            L.add(t) ;
+        R.delete(t) ;
+    }
 
     /**
-        Remove the triple, ie, remove it from the adds, add it to the removals.
-    */
-	@Override public void performDelete( Triple t )
-		{
-		L.delete( t );
-		R.add( t );
-		}
-		 
+     * Remove the triple, ie, remove it from the adds, add it to the removals.
+     */
+    @Override
+    public void performDelete(Triple t)
+    {
+        L.delete(t) ;
+        if (base.contains(t)) 
+            R.add(t) ;
+    }
+
     /**
-        Find all the base triples matching tm, exclude the ones that are deleted, add the ones
-        that  have been added.
-    */
-	@Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch tm ) 
-		{
-        return base.find( tm ) .filterDrop( ifIn( GraphUtil.findAll( R ) ) ) .andThen( L.find( tm ) );
-		}
-
-	@Override public void close() 
-		{
-		super.close();
-		base.close();
-		}
-
-	@Override public int graphBaseSize()
-		{ return base.size() + L.size() - R.size(); }
-	}
+     * Find all the base triples matching tm, exclude the ones that are deleted,
+     * add the ones that have been added.
+     */
+    @Override
+    public ExtendedIterator<Triple> graphBaseFind(TripleMatch tm)
+    {
+        return base.find(tm).filterDrop(ifIn(GraphUtil.findAll(R))).andThen(L.find(tm)) ;
+    }
+
+    @Override
+    public void close()
+    {
+        super.close() ;
+        base.close() ;
+    }
+
+    @Override
+    public int graphBaseSize()
+    {
+        return base.size() + L.size() - R.size() ;
+    }
+}

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Difference.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Difference.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Difference.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Difference.java Mon Dec 17 12:35:10 2012
@@ -25,7 +25,7 @@ import com.hp.hpl.jena.util.iterator.*;
     Class representing the dynamic set difference L - R of two graphs. This is updatable;
     the updates are written through to one or other of the base graphs.
 */
-
+@Deprecated
 public class Difference extends Dyadic implements Graph 
 	{
     /**

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java Mon Dec 17 12:35:10 2012
@@ -32,6 +32,7 @@ import com.hp.hpl.jena.util.iterator.*;
     an implementation of a dynamic intersection of two models.
 */
 
+@Deprecated
 public class Intersection extends Dyadic implements Graph
 	{
 	public Intersection( Graph L, Graph R )

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestCaseBasic.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestCaseBasic.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestCaseBasic.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestCaseBasic.java Mon Dec 17 12:35:10 2012
@@ -23,9 +23,6 @@ import java.lang.reflect.*;
 import com.hp.hpl.jena.graph.*;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 
-/**
-     @author  bwm, kers
-*/
 public class TestCaseBasic extends com.hp.hpl.jena.regression.TestCaseBasic 
 	{
     private Class<? extends Graph> graphClass;

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDelta.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDelta.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDelta.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDelta.java Mon Dec 17 12:35:10 2012
@@ -18,15 +18,13 @@
 
 package com.hp.hpl.jena.graph.compose.test;
 
-import com.hp.hpl.jena.graph.*;
-import com.hp.hpl.jena.graph.compose.Delta;
-import com.hp.hpl.jena.graph.test.*;
+import junit.framework.TestSuite ;
 
-import junit.framework.*;
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.compose.Delta ;
+import com.hp.hpl.jena.graph.test.GraphTestBase ;
 
-/**
-	@author kers
-*/
+@SuppressWarnings("deprecation")
 public class TestDelta extends GraphTestBase 
 	{
 		
@@ -45,7 +43,7 @@ public class TestDelta extends GraphTest
 	/* */	
 		Graph base = graphWith( "x R y; p S q; I like cheese; pins pop balloons" );
 		Graph save = graphWith( "x R y; p S q; I like cheese; pins pop balloons" );
-		Delta delta = new Delta( base );
+        Delta delta = new Delta( base );
 		assertContainsAll( "Delta", delta, "x R y; p S q; I like cheese; pins pop balloons" );
 		assertContainsAll( "Delta", base, "x R y; p S q; I like cheese; pins pop balloons" );
 	/* */

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDifference.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDifference.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDifference.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDifference.java Mon Dec 17 12:35:10 2012
@@ -24,9 +24,7 @@ import com.hp.hpl.jena.graph.test.*;
 
 import junit.framework.*;
 
-/**
-	@author kers
-*/
+@SuppressWarnings("deprecation")
 public class TestDifference extends GraphTestBase 
 	{
 	public TestDifference( String name )

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestIntersection.java Mon Dec 17 12:35:10 2012
@@ -23,6 +23,7 @@ import com.hp.hpl.jena.graph.compose.Int
 import com.hp.hpl.jena.graph.test.*;
 import junit.framework.*;
 
+@SuppressWarnings("deprecation")
 public class TestIntersection extends GraphTestBase 
 	{
 	public TestIntersection( String name )

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestPackage.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestPackage.java?rev=1422902&r1=1422901&r2=1422902&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestPackage.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestPackage.java Mon Dec 17 12:35:10 2012
@@ -18,9 +18,6 @@
 
 package com.hp.hpl.jena.graph.compose.test;
 
-/**
-	@author kers
-*/
 
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.compose.*;
@@ -28,13 +25,9 @@ import com.hp.hpl.jena.mem.test.TestSuit
 
 import junit.framework.*;
 
-/**
- *
- * @author  bwm
- * @version $Name: not supported by cvs2svn $ $Revision: 1.1 $ $Date: 2009-06-29 08:55:42 $
- */
 public class TestPackage extends TestCase {
     
+    @SuppressWarnings("deprecation")
     public static TestSuite suite() {
     	TestSuite result = new TestSuite();
         suite( result, Intersection.class );