You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/19 22:34:37 UTC
[3/6] clerezza git commit: CLEREZZA-964: using rdf-commons from
clerezza-rdf-core repository
http://git-wip-us.apache.org/repos/asf/clerezza/blob/4bc320a8/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java b/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
index 34fc25c..b839c37 100644
--- a/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
+++ b/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
@@ -23,19 +23,18 @@ import java.util.Iterator;
import java.util.Set;
import org.junit.Test;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
import static org.junit.Assert.*;
/**
@@ -44,22 +43,22 @@ import static org.junit.Assert.*;
*/
public abstract class TcProviderTest {
- protected final UriRef uriRefA = generateUri("a");
- protected final UriRef uriRefA1 = generateUri("a1");
- protected final UriRef uriRefB = generateUri("b");
- protected final UriRef uriRefB1 = generateUri("b1");
- protected final UriRef uriRefC = generateUri("c");
+ protected final Iri uriRefA = generateUri("a");
+ protected final Iri uriRefA1 = generateUri("a1");
+ protected final Iri uriRefB = generateUri("b");
+ protected final Iri uriRefB1 = generateUri("b1");
+ protected final Iri uriRefC = generateUri("c");
- protected final UriRef graphUriRef = generateUri("myGraph");
- protected final UriRef otherGraphUriRef = new UriRef(graphUriRef.getUnicodeString());
+ protected final Iri graphIri = generateUri("myGraph");
+ protected final Iri otherGraphIri = new Iri(graphIri.getUnicodeString());
@Test
- public void testCreateGraph() {
+ public void testCreateImmutableGraph() {
TcProvider simpleTcmProvider = getInstance();
- MGraph mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- Graph createdGraph = simpleTcmProvider.createGraph(uriRefA, mGraph);
+ ImmutableGraph createdGraph = simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
Iterator<Triple> iteratorInput = mGraph.iterator();
Iterator<Triple> iteratorCreated = createdGraph.iterator();
@@ -67,80 +66,80 @@ public abstract class TcProviderTest {
assertFalse(iteratorCreated.hasNext());
try {
- simpleTcmProvider.createGraph(uriRefA, mGraph);
+ simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
assertTrue(false);
} catch (EntityAlreadyExistsException e) {
assertTrue(true);
}
- simpleTcmProvider.deleteTripleCollection(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA);
}
@Test
- public void testCreateMGraph() {
+ public void testCreateGraph() {
TcProvider simpleTcmProvider = getInstance();
- MGraph mGraph = simpleTcmProvider.createMGraph(uriRefA);
+ Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
assertTrue(mGraph.isEmpty());
try {
- simpleTcmProvider.createMGraph(uriRefA);
+ simpleTcmProvider.createGraph(uriRefA);
assertTrue(false);
} catch (EntityAlreadyExistsException e) {
assertTrue(true);
}
- simpleTcmProvider.deleteTripleCollection(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA);
}
@Test
- public void testGetGraph() {
+ public void testGetImmutableGraph() {
TcProvider simpleTcmProvider = getInstance();
// add Graphs
- MGraph mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- simpleTcmProvider.createGraph(uriRefA, mGraph);
- mGraph = new SimpleMGraph();
+ simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+ mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
- simpleTcmProvider.createGraph(uriRefA1, mGraph);
- mGraph = new SimpleMGraph();
+ simpleTcmProvider.createImmutableGraph(uriRefA1, mGraph);
+ mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
- simpleTcmProvider.createGraph(uriRefB, mGraph);
- mGraph = new SimpleMGraph();
+ simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+ mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
- simpleTcmProvider.createGraph(uriRefB1, mGraph);
+ simpleTcmProvider.createImmutableGraph(uriRefB1, mGraph);
- Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
+ ImmutableGraph bGraph = simpleTcmProvider.getImmutableGraph(uriRefB);
Iterator<Triple> iterator = bGraph.iterator();
assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
assertFalse(iterator.hasNext());
- simpleTcmProvider.deleteTripleCollection(uriRefA);
- simpleTcmProvider.deleteTripleCollection(uriRefA1);
- simpleTcmProvider.deleteTripleCollection(uriRefB);
- simpleTcmProvider.deleteTripleCollection(uriRefB1);
+ simpleTcmProvider.deleteGraph(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA1);
+ simpleTcmProvider.deleteGraph(uriRefB);
+ simpleTcmProvider.deleteGraph(uriRefB1);
}
@Test
- public void testGetMGraph() {
+ public void testGetGraph() {
TcProvider simpleTcmProvider = getInstance();
- // add MGraphs
- MGraph mGraph = simpleTcmProvider.createMGraph(uriRefA);
+ // add Graphs
+ Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- mGraph = simpleTcmProvider.createMGraph(uriRefA1);
+ mGraph = simpleTcmProvider.createGraph(uriRefA1);
mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
- mGraph = simpleTcmProvider.createMGraph(uriRefB);
+ mGraph = simpleTcmProvider.createGraph(uriRefB);
mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
assertEquals(1, mGraph.size());
- mGraph = simpleTcmProvider.createMGraph(uriRefB1);
+ mGraph = simpleTcmProvider.createGraph(uriRefB1);
mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
- MGraph bGraph = simpleTcmProvider.getMGraph(uriRefB);
+ Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
Iterator<Triple> iterator = bGraph.iterator();
assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
assertFalse(iterator.hasNext());
- simpleTcmProvider.deleteTripleCollection(uriRefA);
- simpleTcmProvider.deleteTripleCollection(uriRefA1);
- simpleTcmProvider.deleteTripleCollection(uriRefB);
- simpleTcmProvider.deleteTripleCollection(uriRefB1);
+ simpleTcmProvider.deleteGraph(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA1);
+ simpleTcmProvider.deleteGraph(uriRefB);
+ simpleTcmProvider.deleteGraph(uriRefB1);
}
@@ -148,22 +147,22 @@ public abstract class TcProviderTest {
public void testGetTriples() {
TcProvider simpleTcmProvider = getInstance();
// add Graphs
- MGraph mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- simpleTcmProvider.createGraph(uriRefA, mGraph);
- mGraph = new SimpleMGraph();
+ simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+ mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
- simpleTcmProvider.createGraph(uriRefB, mGraph);
- // add MGraphs
- mGraph = simpleTcmProvider.createMGraph(uriRefA1);
+ simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+ // add Graphs
+ mGraph = simpleTcmProvider.createGraph(uriRefA1);
mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
- mGraph = simpleTcmProvider.createMGraph(uriRefB1);
+ mGraph = simpleTcmProvider.createGraph(uriRefB1);
mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+ // get a ImmutableGraph
+ Graph tripleCollection = simpleTcmProvider.getGraph(uriRefA);
// get a Graph
- TripleCollection tripleCollection = simpleTcmProvider.getTriples(uriRefA);
- // get a MGraph
- TripleCollection tripleCollection2 = simpleTcmProvider.getTriples(uriRefB1);
+ Graph tripleCollection2 = simpleTcmProvider.getGraph(uriRefB1);
Iterator<Triple> iterator = tripleCollection.iterator();
assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
@@ -172,22 +171,22 @@ public abstract class TcProviderTest {
iterator = tripleCollection2.iterator();
assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
assertFalse(iterator.hasNext());
- simpleTcmProvider.deleteTripleCollection(uriRefA);
- simpleTcmProvider.deleteTripleCollection(uriRefA1);
- simpleTcmProvider.deleteTripleCollection(uriRefB);
- simpleTcmProvider.deleteTripleCollection(uriRefB1);
+ simpleTcmProvider.deleteGraph(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA1);
+ simpleTcmProvider.deleteGraph(uriRefB);
+ simpleTcmProvider.deleteGraph(uriRefB1);
}
@Test
public void testDeleteEntity() {
TcProvider simpleTcmProvider = getInstance();
- MGraph mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- Graph graph = mGraph.getGraph();
- simpleTcmProvider.createGraph(uriRefA, graph);
- simpleTcmProvider.createGraph(uriRefC, graph);
+ ImmutableGraph graph = mGraph.getImmutableGraph();
+ simpleTcmProvider.createImmutableGraph(uriRefA, graph);
+ simpleTcmProvider.createImmutableGraph(uriRefC, graph);
- simpleTcmProvider.deleteTripleCollection(uriRefA);
+ simpleTcmProvider.deleteGraph(uriRefA);
try {
simpleTcmProvider.getGraph(uriRefA);
assertTrue(false);
@@ -196,9 +195,9 @@ public abstract class TcProviderTest {
}
// Check that graph is still available under uriRefC
- Graph cGraph = simpleTcmProvider.getGraph(uriRefC);
+ ImmutableGraph cGraph = simpleTcmProvider.getImmutableGraph(uriRefC);
assertNotNull(cGraph);
- simpleTcmProvider.deleteTripleCollection(uriRefC);
+ simpleTcmProvider.deleteGraph(uriRefC);
}
/**
@@ -214,17 +213,17 @@ public abstract class TcProviderTest {
// @Test
// public void testGetNames() {
-// MGraph mGraph = new SimpleMGraph();
+// Graph mGraph = new SimpleGraph();
// mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
// simpleTcmProvider.createGraph(uriRefB, mGraph.getGraph());
//
-// mGraph = new SimpleMGraph();
+// mGraph = new SimpleGraph();
// mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-// Graph graph = mGraph.getGraph();
+// ImmutableGraph graph = mGraph.getGraph();
// simpleTcmProvider.createGraph(uriRefA, graph);
// simpleTcmProvider.createGraph(uriRefC, graph);
//
-// Set<UriRef> names = simpleTcmProvider.getNames(graph);
+// Set<Iri> names = simpleTcmProvider.getNames(graph);
//
// assertTrue(names.contains(uriRefA));
// assertTrue(names.contains(uriRefC));
@@ -234,83 +233,83 @@ public abstract class TcProviderTest {
// }
@Test
- public void testCreateMGraphExtended() throws Exception {
+ public void testCreateGraphExtended() throws Exception {
TcProvider provider = getInstance();
- MGraph graph = provider.createMGraph(graphUriRef);
+ Graph graph = provider.createGraph(graphIri);
assertNotNull(graph);
//get a new provider and check that graph is there
provider = getInstance();
- graph = provider.getMGraph(graphUriRef);
+ graph = provider.getGraph(graphIri);
assertNotNull(graph);
//check that there is no such graph, but only the mgraph
boolean expThrown = false;
try {
- Graph g = provider.getGraph(graphUriRef);
+ ImmutableGraph g = provider.getImmutableGraph(graphIri);
} catch(NoSuchEntityException e) {
expThrown = true;
}
assertTrue(expThrown);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
@Test
- public void testCreateGraphExtended() throws Exception {
+ public void testCreateImmutableGraphExtended() throws Exception {
TcProvider provider = getInstance();
- Graph graph = provider.createGraph(graphUriRef, null);
+ ImmutableGraph graph = provider.createImmutableGraph(graphIri, null);
assertNotNull(graph);
//get a new provider and check that graph is there
provider = getInstance();
- graph = provider.getGraph(graphUriRef);
+ graph = provider.getImmutableGraph(graphIri);
assertNotNull(graph);
//check that there is no such mgraph, but only the graph
boolean expThrown = false;
try {
- MGraph g = provider.getMGraph(graphUriRef);
+ Graph g = provider.getGraph(graphIri);
} catch(NoSuchEntityException e) {
expThrown = true;
}
assertTrue(expThrown);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
@Test
public void testCreateGraphNoDuplicateNames() throws Exception {
TcProvider provider = getInstance();
- Graph graph = provider.createGraph(graphUriRef, null);
+ ImmutableGraph graph = provider.createImmutableGraph(graphIri, null);
assertNotNull(graph);
boolean expThrown = false;
try {
- Graph other = provider.createGraph(otherGraphUriRef, null);
+ ImmutableGraph other = provider.createImmutableGraph(otherGraphIri, null);
} catch(EntityAlreadyExistsException eaee) {
expThrown = true;
}
assertTrue(expThrown);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
@Test
- public void testCreateMGraphNoDuplicateNames() throws Exception {
+ public void testCreateGraphNoDuplicateNames2() throws Exception {
TcProvider provider = getInstance();
- MGraph graph = provider.createMGraph(graphUriRef);
+ Graph graph = provider.createGraph(graphIri);
assertNotNull(graph);
boolean expThrown = false;
try {
- MGraph other = provider.createMGraph(otherGraphUriRef);
+ Graph other = provider.createGraph(otherGraphIri);
} catch(EntityAlreadyExistsException eaee) {
expThrown = true;
}
assertTrue(expThrown);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
@Test
@@ -320,11 +319,11 @@ public abstract class TcProviderTest {
TcProvider provider = getInstance();
- Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));
+ ImmutableGraph graph = provider.createImmutableGraph(graphIri, createTestTripleCollection(t1));
assertEquals(1, graph.size());
assertTrue(graph.contains(t1));
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
@Test
@@ -336,7 +335,7 @@ public abstract class TcProviderTest {
TcProvider provider = getInstance();
- Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));
+ ImmutableGraph graph = provider.createImmutableGraph(graphIri, createTestTripleCollection(t1));
boolean expThrown = false;
@@ -385,7 +384,7 @@ public abstract class TcProviderTest {
}
assertTrue(expThrown);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
// This tests can not pass, because equals in AbstractGraph is not implemented
@@ -395,27 +394,27 @@ public abstract class TcProviderTest {
//
// TcProvider provider = getInstance();
//
-// TripleCollection triples = createTestTripleCollection(createTestTriple());
-// Graph graph = provider.createGraph(graphUriRef, triples);
+// Graph triples = createTestTripleCollection(createTestTriple());
+// ImmutableGraph graph = provider.createGraph(graphIri, triples);
//
// provider = getInstance();
-// Set<UriRef> names = provider.getNames(graph);
-// assertTrue(names.contains(graphUriRef));
+// Set<Iri> names = provider.getNames(graph);
+// assertTrue(names.contains(graphIri));
// }
//
// @Test
// public void testCreateSameGraphWithDifferentNames() throws Exception {
//
-// TripleCollection triples = createTestTripleCollection(createTestTriple());
+// Graph triples = createTestTripleCollection(createTestTriple());
//
// TcProvider provider = getInstance();
-// UriRef name1 = new UriRef("http://myGraph1");
-// Graph graph = provider.createGraph(name1, triples);
+// Iri name1 = new Iri("http://myGraph1");
+// ImmutableGraph graph = provider.createGraph(name1, triples);
//
-// UriRef name2 = new UriRef("http://myGraph2");
-// Graph secondGraph = provider.createGraph(name2, triples);
+// Iri name2 = new Iri("http://myGraph2");
+// ImmutableGraph secondGraph = provider.createGraph(name2, triples);
//
-// Set<UriRef> names = provider.getNames(graph);
+// Set<Iri> names = provider.getNames(graph);
// assertNotNull(names);
// assertEquals(2, names.size());
// }
@@ -423,72 +422,63 @@ public abstract class TcProviderTest {
@Test
public void testGraphDeletion() throws Exception {
- TripleCollection triples = createTestTripleCollection(createTestTriple());
+ Graph triples = createTestTripleCollection(createTestTriple());
TcProvider provider = getInstance();
- UriRef name1 = new UriRef("http://myGraph1");
- Graph graph = provider.createGraph(name1, triples);
+ Iri name1 = new Iri("http://myGraph1");
+ ImmutableGraph graph = provider.createImmutableGraph(name1, triples);
- UriRef name2 = new UriRef("http://myGraph2");
- Graph secondGraph = provider.createGraph(name2, triples);
+ Iri name2 = new Iri("http://myGraph2");
+ ImmutableGraph secondGraph = provider.createImmutableGraph(name2, triples);
//if we delete graph with name1, the second graph should still be there
- provider.deleteTripleCollection(name1);
+ provider.deleteGraph(name1);
provider = getInstance();
- Graph firstGraph = provider.getGraph(name2);
+ ImmutableGraph firstGraph = provider.getImmutableGraph(name2);
assertNotNull(firstGraph);
//check second name is not there
boolean expThrown = false;
try {
- Graph g = provider.getGraph(name1);
+ ImmutableGraph g = provider.getImmutableGraph(name1);
} catch(NoSuchEntityException nses) {
expThrown = true;
}
assertTrue(expThrown);
- provider.deleteTripleCollection(name2);
+ provider.deleteGraph(name2);
}
- @Test
- public void testGetTriplesGraph() throws Exception {
- TcProvider provider = getInstance();
- Graph graph = provider.createGraph(graphUriRef,
- createTestTripleCollection(createTestTriple()));
- TripleCollection tc = provider.getTriples(graphUriRef);
- assertNotNull(tc);
- provider.deleteTripleCollection(graphUriRef);
- }
@Test
- public void testGetTriplesMGraph() throws Exception {
+ public void testGetTriplesGraph() throws Exception {
TcProvider provider = getInstance();
- MGraph graph = provider.createMGraph(graphUriRef);
+ Graph graph = provider.createGraph(graphIri);
- TripleCollection tc = provider.getTriples(graphUriRef);
+ Graph tc = provider.getGraph(graphIri);
assertNotNull(tc);
- provider.deleteTripleCollection(graphUriRef);
+ provider.deleteGraph(graphIri);
}
private Triple createTestTriple() {
- NonLiteral subject = new BNode() {};
- UriRef predicate = new UriRef("http://test.com/");
- NonLiteral object = new UriRef("http://test.com/myObject");
+ BlankNodeOrIri subject = new BlankNode() {};
+ Iri predicate = new Iri("http://test.com/");
+ BlankNodeOrIri object = new Iri("http://test.com/myObject");
return new TripleImpl(subject, predicate, object);
}
- private TripleCollection createTestTripleCollection(Triple t) {
+ private Graph createTestTripleCollection(Triple t) {
Set<Triple> ts = new HashSet<Triple>();
ts.add(t);
- return new SimpleMGraph(ts);
+ return new SimpleGraph(ts);
}
- protected UriRef generateUri(String name) {
- return new UriRef("http://example.org/" + name);
+ protected Iri generateUri(String name) {
+ return new Iri("http://example.org/" + name);
}
}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/4bc320a8/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TripleCollectionWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TripleCollectionWrapper.java b/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TripleCollectionWrapper.java
deleted file mode 100644
index 0cceae7..0000000
--- a/rdf.core.test/src/main/java/org/apache/clerezza/rdf/core/test/TripleCollectionWrapper.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
-
-/**
- *
- * @author mir
- */
-class TripleCollectionWrapper implements TripleCollection {
-
- protected TripleCollection wrapped;
-
- public TripleCollectionWrapper(TripleCollection tc) {
- this.wrapped = tc;
- }
-
- @Override
- public Iterator<Triple> filter(NonLiteral subject, UriRef predicate, Resource object) {
- return wrapped.filter(subject, predicate, object);
- }
-
- @Override
- public void addGraphListener(GraphListener listener, FilterTriple filter, long delay) {
- wrapped.addGraphListener(listener, filter, delay);
- }
-
- @Override
- public void addGraphListener(GraphListener listener, FilterTriple filter) {
- wrapped.addGraphListener(listener, filter);
- }
-
- @Override
- public void removeGraphListener(GraphListener listener) {
- wrapped.removeGraphListener(listener);
- }
-
- @Override
- public int size() {
- return wrapped.size();
- }
-
- @Override
- public boolean isEmpty() {
- return wrapped.isEmpty();
- }
-
- @Override
- public boolean contains(Object o) {
- return wrapped.contains(o);
- }
-
- @Override
- public Iterator<Triple> iterator() {
- return wrapped.iterator();
- }
-
- @Override
- public Object[] toArray() {
- return wrapped.toArray();
- }
-
- @Override
- public <T> T[] toArray(T[] a) {
- return wrapped.toArray(a);
- }
-
- @Override
- public boolean add(Triple e) {
- return wrapped.add(e);
- }
-
- @Override
- public boolean remove(Object o) {
- return wrapped.remove(o);
- }
-
- @Override
- public boolean containsAll(Collection<?> c) {
- return wrapped.containsAll(c);
- }
-
- @Override
- public boolean addAll(Collection<? extends Triple> c) {
- return wrapped.addAll(c);
- }
-
- @Override
- public boolean removeAll(Collection<?> c) {
- return wrapped.removeAll(c);
- }
-
- @Override
- public boolean retainAll(Collection<?> c) {
- return wrapped.retainAll(c);
- }
-
- @Override
- public void clear() {
- wrapped.clear();
- }
-
-}