You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by re...@apache.org on 2013/06/28 12:37:11 UTC

svn commit: r1497719 - in /stanbol/trunk/commons: indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java

Author: reto
Date: Fri Jun 28 10:37:10 2013
New Revision: 1497719

URL: http://svn.apache.org/r1497719
Log:
STANBOL-1130: Added (commented out) failing test for IndexedMGraph. Work around in RecipesGraphProvider.

Modified:
    stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
    stanbol/trunk/commons/web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java

Modified: stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java?rev=1497719&r1=1497718&r2=1497719&view=diff
==============================================================================
--- stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java (original)
+++ stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java Fri Jun 28 10:37:10 2013
@@ -66,6 +66,48 @@ public class IndexedGraphTest  extends M
     protected MGraph getEmptyMGraph() {
         return new IndexedMGraph();
     }
+    /* FAILING die to STANBOL-1130
+    @Test
+    public void bNodeConsitency() {
+        MGraph mGraph = getEmptyMGraph();
+        final BNode bNode = new BNode() {
+
+            @Override
+            public int hashCode() {
+                return -1;
+            }
+
+            @Override
+            public boolean equals(Object o) {
+                return o instanceof BNode;
+            }
+            
+        
+        };
+        
+        final BNode bNodeClone = new BNode() {
+
+            @Override
+            public int hashCode() {
+                return -1;
+            }
+
+            @Override
+            public boolean equals(Object o) {
+                return o instanceof BNode; 
+            }
+            
+        
+        };
+        mGraph.add(new TripleImpl(bNode, uriRef1, uriRef2));
+        mGraph.add(new TripleImpl(bNodeClone, uriRef2, uriRef3));
+        NonLiteral bNodeBack = mGraph.filter(null, uriRef1, uriRef2).next().getSubject();
+        Assert.assertEquals("The bnode we get back is not equals to the one we added", bNode, bNodeBack);
+        NonLiteral bNodeBack2 = mGraph.filter(null, uriRef2, uriRef3).next().getSubject();
+        Assert.assertEquals("The returnned bnodes are no longer equals", bNodeBack, bNodeBack2);
+        Assert.assertTrue("Not finding a triple when searching with equal bNode", mGraph.filter(bNodeBack, uriRef2, null).hasNext());
+    }
+    */
     @Test
     public void iteratorRemove() {
         TripleCollection itc = new IndexedTripleCollection();

Modified: stanbol/trunk/commons/web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java?rev=1497719&r1=1497718&r2=1497719&view=diff
==============================================================================
--- stanbol/trunk/commons/web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java (original)
+++ stanbol/trunk/commons/web/rdfviewable-writer/src/main/java/org/apache/stanbol/commons/web/rdfviewable/writer/RecipesGraphProvider.java Fri Jun 28 10:37:10 2013
@@ -20,6 +20,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.felix.scr.annotations.Activate;
@@ -55,7 +56,8 @@ public class RecipesGraphProvider implem
     
     @Activate
     protected void activate(BundleContext context) {
-        recipesGraph = new IndexedMGraph();
+        //Work around because of STANBOL-1130
+        recipesGraph = new SimpleMGraph();//new IndexedMGraph();
         context.addBundleListener(this);
         for (Bundle b : context.getBundles()) {
             if (b.getState() == Bundle.ACTIVE) {