Author: rwesten
Date: Fri Feb 3 11:08:37 2012
New Revision: 1240079
URL: http://svn.apache.org/viewvc?rev=1240079&view=rev
Log:
Applied the MGraphTests (as defined by the Clerezza test framework)
Fixed a GraphListener related Bug with Iterators
Modified:
incubator/stanbol/trunk/commons/indexedgraph/pom.xml
incubator/stanbol/trunk/commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/IndexedTripleCollection.java
incubator/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
Modified: incubator/stanbol/trunk/commons/indexedgraph/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/indexedgraph/pom.xml?rev=1240079&r1=1240078&r2=1240079&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/indexedgraph/pom.xml (original)
+++ incubator/stanbol/trunk/commons/indexedgraph/pom.xml Fri Feb 3 11:08:37
2012
@@ -84,6 +84,12 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.core.test</artifactId>
+ <version>0.13-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>rdf.ontologies</artifactId>
<scope>test</scope>
</dependency>
Modified:
incubator/stanbol/trunk/commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/IndexedTripleCollection.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/IndexedTripleCollection.java?rev=1240079&r1=1240078&r2=1240079&view=diff
==============================================================================
---
incubator/stanbol/trunk/commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/IndexedTripleCollection.java
(original)
+++
incubator/stanbol/trunk/commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/IndexedTripleCollection.java
Fri Feb 3 11:08:37 2012
@@ -79,7 +79,7 @@ class IndexedTripleCollection extends Ab
@Override
protected Iterator<Triple> performFilter(final NonLiteral subject, final
UriRef predicate, final Resource object) {
if(subject == null && predicate == null && object == null){ //[n,n,n]
- return iterator();
+ return createIterator(spo, spo.iterator());
}
final Triple low = new TripleImpl(
subject == null ? MIN : subject,
@@ -123,10 +123,10 @@ class IndexedTripleCollection extends Ab
public int size() {
return spo.size();
}
- @Override
- public Iterator<Triple> iterator() {
- return createIterator(spo, spo.iterator());
- }
+// @Override
+// public Iterator<Triple> iterator() {
+// return createIterator(spo, spo.iterator());
+// }
/**
* Returns an Iterator that ensures that calls to {@link Iterator#remove()}
@@ -162,9 +162,6 @@ class IndexedTripleCollection extends Ab
if(!(index == osp)){
osp.remove(current);
}
- //this bye-passes the parent remove methods
- //because of that we need to manually dispatch remove
events
- dispatchEvent(new
RemoveEvent(IndexedTripleCollection.this, current));
}
}
};
Modified:
incubator/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java?rev=1240079&r1=1240078&r2=1240079&view=diff
==============================================================================
---
incubator/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
(original)
+++
incubator/stanbol/trunk/commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/IndexedGraphTest.java
Fri Feb 3 11:08:37 2012
@@ -25,6 +25,7 @@ import org.apache.clerezza.rdf.core.UriR
import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.core.test.MGraphTest;
import org.apache.clerezza.rdf.ontologies.FOAF;
import org.apache.clerezza.rdf.ontologies.RDF;
import org.apache.clerezza.rdf.ontologies.RDFS;
@@ -32,9 +33,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.w3c.dom.NodeList;
-public class IndexedGraphTest {
+public class IndexedGraphTest extends MGraphTest {
protected static final Logger log =
LoggerFactory.getLogger(IndexedGraphTest.class);
@@ -46,7 +46,11 @@ public class IndexedGraphTest {
private Triple triple3 = new TripleImpl(uriRef3, uriRef1, uriRef3);
private Triple triple4 = new TripleImpl(uriRef1, uriRef3, uriRef2);
private Triple triple5 = new TripleImpl(uriRef2, uriRef3, uriRef2);
-
+
+ @Override
+ protected MGraph getEmptyMGraph() {
+ return new IndexedMGraph();
+ }
@Test
public void iteratorRemove() {
TripleCollection itc = new IndexedTripleCollection();