jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1439124 - in /jena/trunk/jena-core/src: main/java/com/hp/hpl/jena/graph/compose/ test/java/com/hp/hpl/jena/graph/compose/test/
Date Sun, 27 Jan 2013 17:34:12 GMT
Author: andy
Date: Sun Jan 27 17:34:12 2013
New Revision: 1439124

URL: http://svn.apache.org/viewvc?rev=1439124&view=rev
Log:
JENA-381 Composed graphs

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/DisjointUnion.java
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Dyadic.java
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Intersection.java
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Union.java
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDyadic.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=1439124&r1=1439123&r2=1439124&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 Sun Jan 27
17:34:12 2013
@@ -81,7 +81,7 @@ public class Delta extends Dyadic implem
      * add the ones that have been added.
      */
     @Override
-    public ExtendedIterator<Triple> graphBaseFind(TripleMatch tm)
+    protected ExtendedIterator<Triple> _graphBaseFind(TripleMatch tm)
     {
         return base.find(tm).filterDrop(ifIn(GraphUtil.findAll(R))).andThen(L.find(tm)) ;
     }

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=1439124&r1=1439123&r2=1439124&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 Sun Jan
27 17:34:12 2013
@@ -51,6 +51,6 @@ public class Difference extends Dyadic i
 	@Override public void performDelete( Triple t )
 		{ L.delete( t ); }
 
-	@Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch t ) 
+	@Override public ExtendedIterator<Triple> _graphBaseFind( TripleMatch t ) 
 		{ return L.find( t ). filterDrop ( ifIn( R ) ); }
 	}

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/DisjointUnion.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/DisjointUnion.java?rev=1439124&r1=1439123&r2=1439124&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/DisjointUnion.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/DisjointUnion.java Sun
Jan 27 17:34:12 2013
@@ -35,7 +35,7 @@ public class DisjointUnion extends Dyadi
     public DisjointUnion( Graph L, Graph R )
         { super( L, R ); }
 
-    @Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch m )
+    @Override protected ExtendedIterator<Triple> _graphBaseFind( TripleMatch m )
         { return L.find( m ) .andThen( R.find( m ) ); }
     
     @Override public boolean graphBaseContains( Triple t )

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Dyadic.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Dyadic.java?rev=1439124&r1=1439123&r2=1439124&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Dyadic.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Dyadic.java Sun Jan 27
17:34:12 2013
@@ -19,6 +19,8 @@
 package com.hp.hpl.jena.graph.compose;
 
 import com.hp.hpl.jena.graph.*;
+import com.hp.hpl.jena.graph.impl.SimpleEventManager;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
 /**
     Base class for the two-operand composition operations; has two graphs L and R
@@ -44,6 +46,25 @@ public abstract class Dyadic extends Com
             ;
 		}
 
+	
+	/**
+	 * override graphBaseFind to return an iterator that will report when
+	 * a deletion occurs.
+	 */
+	@Override
+    protected final ExtendedIterator<Triple> graphBaseFind( TripleMatch m )
+    {
+		return SimpleEventManager.notifyingRemove( this, this._graphBaseFind( m ) );
+    }
+	
+	/**
+	 * The method that the overridden graphBaseFind( TripleMatch m ) calls to actually
+	 * do the work of finding.
+	 * @param m
+	 * @return
+	 */
+	protected abstract ExtendedIterator<Triple> _graphBaseFind( TripleMatch m );
+	
     @Override
     public void close()
     	{

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=1439124&r1=1439123&r2=1439124&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 Sun
Jan 27 17:34:12 2013
@@ -51,7 +51,7 @@ public class Intersection extends Dyadic
 		if (this.contains( t )) L.delete( t );
 		}
 		
-	@Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch s )
+	@Override protected ExtendedIterator<Triple> _graphBaseFind( TripleMatch s )
 		{
         return L.find( s ) .filterKeep(  ifIn( R ) );
 		}

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Union.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Union.java?rev=1439124&r1=1439123&r2=1439124&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Union.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/graph/compose/Union.java Sun Jan 27
17:34:12 2013
@@ -58,7 +58,7 @@ public class Union extends Dyadic implem
         duplicates. That last is a performance penalty, but I see no way to remove it
         unless we know the graphs do not overlap.
     */
-	@Override public ExtendedIterator<Triple> graphBaseFind( final TripleMatch t ) 
+	@Override protected ExtendedIterator<Triple> _graphBaseFind( final TripleMatch t )

 	    {
 	    Set<Triple> seen = CollectionFactory.createHashedSet();
         return recording( L.find( t ), seen ).andThen( rejecting( R.find( t ), seen ) );


Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDyadic.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDyadic.java?rev=1439124&r1=1439123&r2=1439124&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDyadic.java
(original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/compose/test/TestDyadic.java
Sun Jan 27 17:34:12 2013
@@ -36,12 +36,7 @@ public abstract class TestDyadic extends
 	public static TestSuite suite()
     	{ return new TestSuite( TestDyadic.class ); }
     
-	
-	// Override and don't execute.
-	@Override
-	public void testEventDeleteByFind() {}
-	
-	
+
 	static private ExtendedIterator<String> things( final String x ) 
 		{
 		return new NiceIterator<String>()
@@ -71,7 +66,7 @@ public abstract class TestDyadic extends
         Graph g = Factory.createGraphMem(), h = Factory.createGraphMem();
         Dyadic d = new Dyadic( g, h )
             {
-            @Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch m
) { return null; }
+            @Override protected ExtendedIterator<Triple> _graphBaseFind( TripleMatch
m ) { return null; }
             };
         assertSame( g, d.getL() );
         assertSame( h, d.getR() );



Mime
View raw message