clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [1/3] clerezza git commit: CLEREZZA-1026: Copy additional classes from rdf.core to api.impl and refactor api.impl
Date Wed, 14 Nov 2018 02:55:28 GMT
Repository: clerezza
Updated Branches:
  refs/heads/reunited f06386fcf -> 829e5fa56


http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/GraphTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/GraphTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/GraphTest.java
new file mode 100644
index 0000000..66ad861
--- /dev/null
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/GraphTest.java
@@ -0,0 +1,563 @@
+/*
+ * 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.api.impl.graph;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.literal.TypedLiteralImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.*;
+
+
+
+/**
+ * A generic abstract test class, implementations overwrite this class,
+ * providing an implementation of the getEmptyGraph method.
+ *
+ * @author reto, szalay, mir, hhn
+ */
+public abstract class GraphTest {
+
+    private final IRI uriRef1 =
+            new IRI("http://example.org/ontology#res1");
+    private final IRI uriRef2 =
+            new IRI("http://example.org/ontology#res2");
+    private final IRI uriRef3 =
+            new IRI("http://example.org/ontology#res3");
+    private final IRI uriRef4 =
+            new IRI("http://example.org/ontology#res4");
+    private final IRI xmlLiteralType =
+            new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
+    private Literal literal1 = new PlainLiteralImpl("literal1");
+    private Literal literal2 = new PlainLiteralImpl("literal2");
+    private BlankNode bnode1 = new BlankNode();
+    private BlankNode bnode2 = new BlankNode();
+    private Triple trpl1 = new TripleImpl(uriRef2, uriRef2, literal1);
+    private Triple trpl2 = new TripleImpl(uriRef1, uriRef2, uriRef1);
+    private Triple trpl3 = new TripleImpl(bnode2, uriRef3, literal2);
+    private Triple trpl4 = new TripleImpl(uriRef3, uriRef4, literal2);
+    
+    /**
+     * Subclasses implement this method to provide implementation instances of
+     * Graph. This method may be called an arbitrary amount of time,
+     * independently whether previously returned Graph are still in use or not.
+     *
+     * @return an empty Graph of the implementation to be tested
+     */
+    protected abstract Graph getEmptyGraph();
+    
+    @Test
+    public void testAddCountAndGetTriples() {
+        Graph graph = getEmptyGraph();
+        Assert.assertEquals(0, graph.size());
+        final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
+        graph.add(triple1);
+        Assert.assertEquals(1, graph.size());
+        Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, uriRef1);
+        Assert.assertTrue(tripleIter.hasNext());
+        Triple tripleGot = tripleIter.next();
+        Assert.assertEquals(triple1, tripleGot);
+        Assert.assertFalse(tripleIter.hasNext());
+        BlankNode bnode = new BlankNode() {};
+        graph.add(new TripleImpl(bnode, uriRef1, uriRef3));
+        graph.add(new TripleImpl(bnode, uriRef1, uriRef4));
+        tripleIter = graph.filter(null, uriRef1, null);
+        Set<BlankNodeOrIRI> subjectInMatchingTriples = new HashSet<BlankNodeOrIRI>();
+        Set<RDFTerm> objectsInMatchingTriples = new HashSet<RDFTerm>();
+        while (tripleIter.hasNext()) {
+            Triple triple = tripleIter.next();
+            subjectInMatchingTriples.add(triple.getSubject());
+            objectsInMatchingTriples.add(triple.getObject());
+        }
+        Assert.assertEquals(1, subjectInMatchingTriples.size());
+        Assert.assertEquals(2, objectsInMatchingTriples.size());
+        Set<RDFTerm> expectedObjects = new HashSet<RDFTerm>();
+        expectedObjects.add(uriRef3);
+        expectedObjects.add(uriRef4);
+        Assert.assertEquals(expectedObjects, objectsInMatchingTriples);
+        graph.add(new TripleImpl(bnode, uriRef4, bnode));
+        tripleIter = graph.filter(null, uriRef4, null);
+        Assert.assertTrue(tripleIter.hasNext());
+        Triple retrievedTriple = tripleIter.next();
+        Assert.assertFalse(tripleIter.hasNext());
+        Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
+        tripleIter = graph.filter(uriRef1, uriRef2, null);
+        Assert.assertTrue(tripleIter.hasNext());
+        retrievedTriple = tripleIter.next();
+        Assert.assertFalse(tripleIter.hasNext());
+        Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
+    }
+    
+    @Test
+    public void testRemoveAllTriples() {
+        Graph graph = getEmptyGraph();
+        Assert.assertEquals(0, graph.size());
+        graph.add(new TripleImpl(uriRef1, uriRef2, uriRef3));
+        graph.add(new TripleImpl(uriRef2, uriRef3, uriRef4));
+        Assert.assertEquals(2, graph.size());
+        graph.clear();
+        Assert.assertEquals(0, graph.size());
+    }
+
+    @Test
+    public void testUseTypedLiterals() {
+        Graph graph = getEmptyGraph();
+        Assert.assertEquals(0, graph.size());
+        Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType);
+        final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
+        graph.add(triple1);
+        Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
+        Assert.assertTrue(tripleIter.hasNext());
+        RDFTerm gotValue = tripleIter.next().getObject();
+        Assert.assertEquals(value, gotValue);
+    }
+
+    @Test
+    public void testUseLanguageLiterals() {
+        Graph graph = getEmptyGraph();
+        Assert.assertEquals(0, graph.size());
+        Language language = new Language("it");
+        Literal value = new PlainLiteralImpl("<elem>value</elem>",language);
+        final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
+        graph.add(triple1);
+        Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
+        Assert.assertTrue(tripleIter.hasNext());
+        RDFTerm gotValue = tripleIter.next().getObject();
+        Assert.assertEquals(value, gotValue);
+        Assert.assertEquals(language, ((Literal)gotValue).getLanguage());
+    }
+
+    @Test
+    public void testRemoveViaIterator() {
+        Graph graph = getEmptyGraph();
+        Assert.assertEquals(0, graph.size());
+        final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
+        graph.add(triple1);
+        final TripleImpl triple2 = new TripleImpl(uriRef1, uriRef2, uriRef4);
+        graph.add(triple2);
+        Assert.assertEquals(2, graph.size());
+        Iterator<Triple> iterator = graph.iterator();
+        while (iterator.hasNext()) {
+            iterator.next();
+            iterator.remove();
+        }
+        Assert.assertEquals(0, graph.size());
+    }
+
+    @Test
+    public void testGetSize() throws Exception {
+        Graph graph = getEmptyGraph();
+        // The test graph must always be empty after test fixture setup
+        Assert.assertEquals(0, graph.size());
+    }
+
+
+    @Test
+    public void testAddSingleTriple() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertEquals(0, graph.size());
+        Assert.assertTrue(graph.add(triple));
+        Assert.assertEquals(1, graph.size());
+    }
+
+
+    @Test
+    public void testAddSameTripleTwice() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertEquals(0, graph.size());
+        Assert.assertTrue(graph.add(triple));
+        Assert.assertFalse(graph.add(triple)); // ImmutableGraph does not change
+        Assert.assertEquals(1, graph.size());
+    }
+
+
+    @Test
+    public void testRemoveSingleTriple() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertTrue(graph.add(triple));
+        Assert.assertTrue(graph.remove(triple));
+        Assert.assertEquals(0, graph.size());
+    }
+
+    @Test
+    public void testRemoveSameTripleTwice() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple tripleAlice= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        final Triple tripleBob= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/bob");
+        Assert.assertTrue(graph.add(tripleAlice));
+        Assert.assertTrue(graph.add(tripleBob));
+        Assert.assertTrue(graph.remove(tripleAlice));
+        Assert.assertFalse(graph.remove(tripleAlice));
+        Assert.assertEquals(1, graph.size());
+    }
+
+    @Test
+    public void testGetSameBlankNode() throws Exception {
+        Graph graph = getEmptyGraph();
+        BlankNode bNode = new BlankNode();
+        final IRI HAS_NAME = new IRI("http://example.org/ontology/hasName");
+        final PlainLiteralImpl name = new PlainLiteralImpl("http://example.org/people/alice");
+        final PlainLiteralImpl name2 = new PlainLiteralImpl("http://example.org/people/bob");
+        final Triple tripleAlice = new TripleImpl(bNode, HAS_NAME, name);
+        final Triple tripleBob = new TripleImpl(bNode, HAS_NAME, name2);
+        Assert.assertTrue(graph.add(tripleAlice));
+        Assert.assertTrue(graph.add(tripleBob));
+        Iterator<Triple> result = graph.filter(null, HAS_NAME, name);
+        Assert.assertEquals(bNode, result.next().getSubject());
+    }
+
+    @Test
+    public void testContainsIfContained() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertTrue(graph.add(triple));
+        Assert.assertTrue(graph.contains(triple));
+    }
+
+
+    @Test
+    public void testContainsIfEmpty() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertFalse(graph.contains(triple));
+    }
+
+
+    @Test
+    public void testContainsIfNotContained() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple tripleAdd= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        final Triple tripleTest= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/bob");
+        Assert.assertTrue(graph.add(tripleAdd));
+        Assert.assertFalse(graph.contains(tripleTest));
+    }
+
+
+    @Test
+    public void testFilterEmptyGraph() throws Exception {
+        Graph graph = getEmptyGraph();
+        Iterator<Triple> i = graph.filter(null, null, null);
+        Assert.assertFalse(i.hasNext());
+    }
+
+
+    @Test
+    public void testFilterSingleEntry() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple triple= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        Assert.assertTrue(graph.add(triple));
+
+        Iterator<Triple> i = graph.filter(null, null, null);
+        Collection<Triple> resultSet= toCollection(i);
+        Assert.assertEquals(1, resultSet.size());
+        Assert.assertTrue(resultSet.contains(triple));
+    }
+
+
+    @Test
+    public void testFilterByObject() throws Exception {
+        Graph graph = getEmptyGraph();
+        final Triple tripleAlice= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/alice");
+        final Triple tripleBob= createTriple(
+                "http://example.org/ontology/Person",
+                "http://example.org/ontology/hasName",
+                "http://example.org/people/bob");
+        Assert.assertTrue(graph.add(tripleAlice));
+        Assert.assertTrue(graph.add(tripleBob));
+
+        Iterator<Triple> iterator;
+        Collection<Triple> resultSet;
+
+        // Find bob
+        iterator = graph.filter(null, null,
+                new IRI("http://example.org/people/bob"));
+        resultSet= toCollection(iterator);
+        Assert.assertEquals(1, resultSet.size());
+        Assert.assertTrue(resultSet.contains(tripleBob));
+
+        // Find alice
+        iterator = graph.filter(null, null,
+                new IRI("http://example.org/people/alice"));
+        resultSet= toCollection(iterator);
+        Assert.assertEquals(1, resultSet.size());
+        Assert.assertTrue(resultSet.contains(tripleAlice));
+
+        // Find both
+        iterator = graph.filter(null, null, null);
+        resultSet= toCollection(iterator);
+        Assert.assertEquals(2, resultSet.size());
+        Assert.assertTrue(resultSet.contains(tripleAlice));
+        Assert.assertTrue(resultSet.contains(tripleBob));
+    }
+/*
+    @Test
+    public void graphEventTestAddRemove() {
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null));
+        mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
+        mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));        
+        mGraph.add(trpl1);
+        Assert.assertNull(listener.getEvents());        
+        mGraph.add(trpl2);
+        Assert.assertEquals(1, listener.getEvents().size());
+        Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof  AddEvent);
+        listener.resetEvents();
+        mGraph.remove(trpl2);
+        Assert.assertEquals(1, listener.getEvents().size());
+        Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof RemoveEvent);
+        listener.resetEvents();        
+        mGraph.add(trpl3);
+        Assert.assertEquals(1, listener.getEvents().size());
+        Assert.assertEquals(trpl3, listener.getEvents().get(0).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+        listener.resetEvents();        
+        mGraph.remove(trpl4);
+        Assert.assertNull(listener.getEvents());
+    }
+    
+    @Test
+    public void graphEventTestAddAllRemoveAll() {
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null));
+        mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
+        mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));
+        Graph triples = new SimpleGraph();
+        triples.add(trpl1);
+        triples.add(trpl2);
+        triples.add(trpl3);
+        triples.add(trpl4);
+        mGraph.addAll(triples);
+        List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
+        Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
+        Assert.assertEquals(3, cumulatedEvents.size());
+        Assert.assertTrue(cumulatedEvents.get(0) instanceof AddEvent);
+        Assert.assertTrue(cumulatedTriples.contains(trpl2));
+        Assert.assertTrue(cumulatedTriples.contains(trpl3));
+        Assert.assertTrue(cumulatedTriples.contains(trpl4));
+        listener.resetCumulatedEvents();
+        mGraph.removeAll(triples);
+        cumulatedEvents = listener.getCumulatedEvents();
+        cumulatedTriples = getCumulatedTriples(cumulatedEvents);
+        Assert.assertEquals(3, cumulatedEvents.size());
+        Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+        Assert.assertTrue(cumulatedTriples.contains(trpl2));
+        Assert.assertTrue(cumulatedTriples.contains(trpl3));
+        Assert.assertTrue(cumulatedTriples.contains(trpl4));
+    }
+
+    @Test
+    public void graphEventTestFilterRemove() {
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null));
+        mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
+        mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));
+        mGraph.add(trpl1);
+        mGraph.add(trpl2);
+        mGraph.add(trpl3);
+        mGraph.add(trpl4);
+        listener.resetCumulatedEvents();
+        Iterator<Triple> result = mGraph.filter(null, uriRef2, null);
+        while (result.hasNext()) {
+            result.next();
+            result.remove();
+        }
+        List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
+        Assert.assertEquals(1, cumulatedEvents.size());
+        Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+        Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+    }
+
+    @Test
+    public void graphEventTestIteratorRemove() {
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null));
+        mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
+        mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));
+        mGraph.add(trpl1);
+        mGraph.add(trpl2);
+        mGraph.add(trpl3);
+        mGraph.add(trpl4);
+        listener.resetCumulatedEvents();
+        Iterator<Triple> result = mGraph.iterator();
+        while (result.hasNext()) {
+            result.next();
+            result.remove();
+        }
+        List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
+        Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
+        Assert.assertEquals(3, cumulatedEvents.size());
+        Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+        Assert.assertTrue(cumulatedTriples.contains(trpl2));
+        Assert.assertTrue(cumulatedTriples.contains(trpl3));
+        Assert.assertTrue(cumulatedTriples.contains(trpl4));
+    }
+
+    @Test
+    public void graphEventTestClear() {
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null));
+        mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
+        mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));
+        mGraph.add(trpl1);
+        mGraph.add(trpl2);
+        mGraph.add(trpl3);
+        mGraph.add(trpl4);
+        listener.resetCumulatedEvents();
+        mGraph.clear();
+        List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
+        Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
+        Assert.assertEquals(3, cumulatedEvents.size());
+        Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+        Assert.assertTrue(cumulatedTriples.contains(trpl2));
+        Assert.assertTrue(cumulatedTriples.contains(trpl3));
+        Assert.assertTrue(cumulatedTriples.contains(trpl4));
+    }
+
+    private Set<Triple> getCumulatedTriples(List<GraphEvent> cumulatedEvents) {
+        Set<Triple> triples = new HashSet<Triple>();
+        for(GraphEvent event: cumulatedEvents) {
+            triples.add(event.getTriple());
+        }
+        return triples;
+    }
+
+    @Test
+    public void graphEventTestWithDelay() throws Exception{
+        Graph mGraph = getEmptyGraph();
+        TestGraphListener listener = new TestGraphListener();
+        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null),
+                1000);
+
+        Triple triple0 = new TripleImpl(uriRef2, uriRef2, literal1);
+        Triple triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
+        Triple triple2 = new TripleImpl(uriRef1, uriRef2, literal1);
+        Triple triple3 = new TripleImpl(uriRef1, uriRef2, bnode1);
+        mGraph.add(triple0);
+        mGraph.add(triple1);
+        mGraph.add(triple2);
+        mGraph.add(triple3);
+        Thread.sleep(1500);
+        Assert.assertEquals(3, listener.getEvents().size());
+        Assert.assertEquals(triple1, listener.getEvents().get(0).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+        Assert.assertEquals(triple2, listener.getEvents().get(1).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+        Assert.assertEquals(triple3, listener.getEvents().get(2).getTriple());
+        Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+    }
+
+    private static class TestGraphListener implements GraphListener {
+        private List<GraphEvent> events = null;
+        private List<GraphEvent> cumulatedEvents = new ArrayList<GraphEvent>();
+
+        @Override
+        public void graphChanged(List<GraphEvent> events) {
+            this.events = events;
+            Iterator<GraphEvent> eventIter = events.iterator();
+            while (eventIter.hasNext()) {
+                GraphEvent graphEvent = eventIter.next();
+                this.cumulatedEvents.add(graphEvent);
+            }            
+        }
+
+        public List<GraphEvent> getEvents() {
+            return events;
+        }
+
+        public List<GraphEvent> getCumulatedEvents() {
+            return cumulatedEvents;
+        }
+
+        public void resetEvents() {
+            events = null;
+        }
+
+        public void resetCumulatedEvents() {
+            cumulatedEvents = new ArrayList<GraphEvent>();
+        }
+    }
+*/
+    private Collection<Triple> toCollection(Iterator<Triple> iterator) {
+        Collection<Triple> result = new ArrayList<Triple>();
+        while (iterator.hasNext()) {
+            result.add(iterator.next());
+        }
+        return result;
+    }
+
+    /**
+     * Creates a new <code>Triple</code>.
+     * @param subject  the subject.
+     * @param predicate  the predicate.
+     * @param object  the object.
+     * @throws IllegalArgumentException  If an attribute is <code>null</code>.
+     */
+    private Triple createTriple(String subject, String predicate,
+            String object) {
+        return new TripleImpl(new IRI(subject), new IRI(predicate),
+                new IRI(object));
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/SimpleGraphTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/SimpleGraphTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/SimpleGraphTest.java
new file mode 100644
index 0000000..cdfadab
--- /dev/null
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graph/SimpleGraphTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.api.impl.graph;
+
+import org.apache.clerezza.api.impl.TripleImpl;
+
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.IRI;
+
+/**
+ *
+ * @author mir
+ */
+public class SimpleGraphTest {
+
+    private IRI uriRef1 = new IRI("http://example.org/foo");
+    private IRI uriRef2 = new IRI("http://example.org/bar");
+    private IRI uriRef3 = new IRI("http://example.org/test");
+    private Triple triple1 = new TripleImpl(uriRef1, uriRef2, uriRef3);
+    private Triple triple2 = new TripleImpl(uriRef2, uriRef2, uriRef1);
+    private Triple triple3 = new TripleImpl(uriRef3, uriRef1, uriRef3);
+    private Triple triple4 = new TripleImpl(uriRef1, uriRef3, uriRef2);
+    private Triple triple5 = new TripleImpl(uriRef2, uriRef3, uriRef2);
+        
+    @Test
+    public void iteratorRemove() {
+        SimpleGraph stc = new SimpleGraph();
+        stc.add(triple1);
+        stc.add(triple2);
+        stc.add(triple3);
+        stc.add(triple4);
+        stc.add(triple5);
+        Iterator<Triple> iter = stc.iterator();
+        while (iter.hasNext()) {
+            Triple triple = iter.next();
+            iter.remove();
+        }
+        Assert.assertEquals(0, stc.size());
+    }
+
+    @Test
+    public void removeAll() {
+        SimpleGraph stc = new SimpleGraph();
+        stc.add(triple1);
+        stc.add(triple2);
+        stc.add(triple3);
+        stc.add(triple4);
+        stc.add(triple5);
+        SimpleGraph stc2 = new SimpleGraph();
+        stc2.add(triple1);
+        stc2.add(triple3);
+        stc2.add(triple5);
+        stc.removeAll(stc2);
+        Assert.assertEquals(2, stc.size());
+    }
+    
+    @Test
+    public void filterIteratorRemove() {
+        SimpleGraph stc = new SimpleGraph();
+        stc.add(triple1);
+        stc.add(triple2);
+        stc.add(triple3);
+        stc.add(triple4);
+        stc.add(triple5);        
+        Iterator<Triple> iter = stc.filter(uriRef1, null, null);
+        while (iter.hasNext()) {
+            Triple triple = iter.next();
+            iter.remove();
+        }
+        Assert.assertEquals(3, stc.size());
+    }
+
+    @Test(expected=ConcurrentModificationException.class)
+    public void remove() {
+        SimpleGraph stc = new SimpleGraph();
+        stc.setCheckConcurrency(true);
+        stc.add(triple1);
+        stc.add(triple2);
+        stc.add(triple3);
+        stc.add(triple4);
+        stc.add(triple5);
+        Iterator<Triple> iter = stc.filter(uriRef1, null, null);
+        while (iter.hasNext()) {
+            Triple triple = iter.next();
+            stc.remove(triple);
+        }
+        Assert.assertEquals(3, stc.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
index 00e02a2..4a39411 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
@@ -20,7 +20,7 @@ package org.apache.clerezza.api.impl.graphmatching;
 
 import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.simple.SimpleMGraph;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.apache.clerezza.api.impl.TripleImpl;
 
 import java.util.Map;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
index 85dbc20..9dc1a8f 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
@@ -22,7 +22,7 @@ package org.apache.clerezza.api.impl.graphmatching;
 import org.apache.clerezza.api.BlankNode;
 import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.simple.SimpleMGraph;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.apache.clerezza.api.impl.TripleImpl;
 import org.apache.clerezza.api.BlankNodeOrIRI;
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/PlainLiteralImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/PlainLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/PlainLiteralImplTest.java
new file mode 100644
index 0000000..ff55388
--- /dev/null
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/PlainLiteralImplTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.api.impl.literal;
+
+import org.junit.Test;
+
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
+import org.junit.Assert;
+
+/**
+ *
+ * @author reto
+ *
+ */
+
+public class PlainLiteralImplTest {
+
+    
+    @Test public void plainLiteralEquality() {
+        String stringValue = "some text";
+        Literal literal1 = new PlainLiteralImpl(stringValue);
+        Literal literal2 = new PlainLiteralImpl(stringValue);        
+        Assert.assertEquals(literal1, literal2);
+        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+        Literal literal3 = new PlainLiteralImpl("something else");
+        Assert.assertFalse(literal1.equals(literal3));
+    }
+    
+    @Test public void languageLiteralEquality() {
+        String stringValue = "some text";
+        Language lang = new Language("en-ca");
+        Literal literal1 = new PlainLiteralImpl(stringValue, lang);
+        Literal literal2 = new PlainLiteralImpl(stringValue, lang);        
+        Assert.assertEquals(literal1, literal2);
+        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+        Language lang2 = new Language("de");
+        Literal literal3 = new PlainLiteralImpl(stringValue, lang2);
+        Assert.assertFalse(literal1.equals(literal3));
+        Literal literal4 = new PlainLiteralImpl(stringValue, null);
+        Assert.assertFalse(literal3.equals(literal4));
+        Assert.assertFalse(literal4.equals(literal3));
+    }
+
+    /**
+     * hashCode of the lexical form plus the hashCode of the locale
+     */
+    @Test public void checkHashCode() {
+        String stringValue = "some text";
+        Language language = new Language("en");
+        Literal literal = new PlainLiteralImpl(stringValue, language);
+        Assert.assertEquals(literal.getDataType().hashCode() + stringValue.hashCode() + language.hashCode(), literal.hashCode());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TripleImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TripleImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TripleImplTest.java
new file mode 100644
index 0000000..99e59ce
--- /dev/null
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TripleImplTest.java
@@ -0,0 +1,57 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.clerezza.api.impl.simple;
+/*
+ *
+ * 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.
+ *
+*/
+
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.junit.Test;
+import junit.framework.Assert;
+
+/**
+ *
+ * @author reto
+ *
+ */
+
+public class TripleImplTest {
+    
+    
+    @Test public void tripleEquality() {
+        BlankNodeOrIRI subject = new IRI("http://example.org/");
+        IRI predicate = new IRI("http://example.org/property");
+        RDFTerm object = new PlainLiteralImpl("property value");
+        Triple triple1 = new TripleImpl(subject, predicate, object);
+        Triple triple2 = new TripleImpl(subject, predicate, object);
+        Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
+        Assert.assertEquals(triple1, triple2);    
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TypedLiteralImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TypedLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TypedLiteralImplTest.java
new file mode 100644
index 0000000..8589c4e
--- /dev/null
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TypedLiteralImplTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.api.impl.simple;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.literal.TypedLiteralImpl;
+import org.junit.Test;
+import junit.framework.Assert;
+
+import org.apache.clerezza.api.Literal;
+/**
+ *
+ * @author reto/**
+ *
+ * @author reto/**
+ *
+ * @author reto/**
+ *
+ * @author reto
+ *
+ */
+
+public class TypedLiteralImplTest {
+    
+    
+    @Test public void typedLiteralEquality() {
+        String stringValue = "some text";
+        IRI uriRef = new IRI("http://example.org/datatypes/magic");
+        Literal literal1 = new TypedLiteralImpl(stringValue, uriRef);
+        Literal literal2 = new TypedLiteralImpl(stringValue, uriRef);        
+        Assert.assertEquals(literal1, literal2);
+        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+        Literal literal3 = new TypedLiteralImpl("something else", uriRef);
+        Assert.assertFalse(literal1.equals(literal3));
+        IRI uriRef2 = new IRI("http://example.org/datatypes/other");
+        Literal literal4 = new TypedLiteralImpl(stringValue, uriRef2);
+        Assert.assertFalse(literal1.equals(literal4));
+    }
+
+
+    /**
+     * The hascode is equals to the hascode of the lexical form plus the hashcode of the dataTyp
+     */
+    @Test public void checkHashCode() {
+        String stringValue = "some text";
+        IRI uriRef = new IRI("http://example.org/datatypes/magic");
+        Literal literal =  new TypedLiteralImpl(stringValue, uriRef);
+        Assert.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
deleted file mode 100644
index ff6e678..0000000
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
+++ /dev/null
@@ -1,71 +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.api.impl.simple;
-
-import org.apache.clerezza.api.impl.PlainLiteralImpl;
-import org.junit.Test;
-
-import org.apache.clerezza.api.Language;
-import org.apache.clerezza.api.Literal;
-import org.junit.Assert;
-/**
- *
- * @author reto
- *
- */
-
-public class PlainLiteralImplTest {
-
-    
-    @Test public void plainLiteralEquality() {
-        String stringValue = "some text";
-        Literal literal1 = new PlainLiteralImpl(stringValue);
-        Literal literal2 = new PlainLiteralImpl(stringValue);        
-        Assert.assertEquals(literal1, literal2);
-        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
-        Literal literal3 = new PlainLiteralImpl("something else");
-        Assert.assertFalse(literal1.equals(literal3));
-    }
-    
-    @Test public void languageLiteralEquality() {
-        String stringValue = "some text";
-        Language lang = new Language("en-ca");
-        Literal literal1 = new PlainLiteralImpl(stringValue, lang);
-        Literal literal2 = new PlainLiteralImpl(stringValue, lang);        
-        Assert.assertEquals(literal1, literal2);
-        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
-        Language lang2 = new Language("de");
-        Literal literal3 = new PlainLiteralImpl(stringValue, lang2);
-        Assert.assertFalse(literal1.equals(literal3));
-        Literal literal4 = new PlainLiteralImpl(stringValue, null);
-        Assert.assertFalse(literal3.equals(literal4));
-        Assert.assertFalse(literal4.equals(literal3));
-    }
-
-    /**
-     * hashCode of the lexical form plus the hashCode of the locale
-     */
-    @Test public void checkHashCode() {
-        String stringValue = "some text";
-        Language language = new Language("en");
-        Literal literal = new PlainLiteralImpl(stringValue, language);
-        Assert.assertEquals(literal.getDataType().hashCode() + stringValue.hashCode() + language.hashCode(), literal.hashCode());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
deleted file mode 100644
index ff3280d..0000000
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
+++ /dev/null
@@ -1,109 +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.api.impl.simple;
-
-import org.apache.clerezza.api.impl.TripleImpl;
-
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.IRI;
-
-/**
- *
- * @author mir
- */
-public class SimpleGraphTest {
-
-    private IRI uriRef1 = new IRI("http://example.org/foo");
-    private IRI uriRef2 = new IRI("http://example.org/bar");
-    private IRI uriRef3 = new IRI("http://example.org/test");
-    private Triple triple1 = new TripleImpl(uriRef1, uriRef2, uriRef3);
-    private Triple triple2 = new TripleImpl(uriRef2, uriRef2, uriRef1);
-    private Triple triple3 = new TripleImpl(uriRef3, uriRef1, uriRef3);
-    private Triple triple4 = new TripleImpl(uriRef1, uriRef3, uriRef2);
-    private Triple triple5 = new TripleImpl(uriRef2, uriRef3, uriRef2);
-        
-    @Test
-    public void iteratorRemove() {
-        SimpleGraph stc = new SimpleGraph();
-        stc.add(triple1);
-        stc.add(triple2);
-        stc.add(triple3);
-        stc.add(triple4);
-        stc.add(triple5);
-        Iterator<Triple> iter = stc.iterator();
-        while (iter.hasNext()) {
-            Triple triple = iter.next();
-            iter.remove();
-        }
-        Assert.assertEquals(0, stc.size());
-    }
-
-    @Test
-    public void removeAll() {
-        SimpleGraph stc = new SimpleGraph();
-        stc.add(triple1);
-        stc.add(triple2);
-        stc.add(triple3);
-        stc.add(triple4);
-        stc.add(triple5);
-        SimpleGraph stc2 = new SimpleGraph();
-        stc2.add(triple1);
-        stc2.add(triple3);
-        stc2.add(triple5);
-        stc.removeAll(stc2);
-        Assert.assertEquals(2, stc.size());
-    }
-    
-    @Test
-    public void filterIteratorRemove() {
-        SimpleGraph stc = new SimpleGraph();
-        stc.add(triple1);
-        stc.add(triple2);
-        stc.add(triple3);
-        stc.add(triple4);
-        stc.add(triple5);        
-        Iterator<Triple> iter = stc.filter(uriRef1, null, null);
-        while (iter.hasNext()) {
-            Triple triple = iter.next();
-            iter.remove();
-        }
-        Assert.assertEquals(3, stc.size());
-    }
-
-    @Test(expected=ConcurrentModificationException.class)
-    public void remove() {
-        SimpleGraph stc = new SimpleGraph();
-        stc.setCheckConcurrency(true);
-        stc.add(triple1);
-        stc.add(triple2);
-        stc.add(triple3);
-        stc.add(triple4);
-        stc.add(triple5);
-        Iterator<Triple> iter = stc.filter(uriRef1, null, null);
-        while (iter.hasNext()) {
-            Triple triple = iter.next();
-            stc.remove(triple);
-        }
-        Assert.assertEquals(3, stc.size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
deleted file mode 100644
index 9b38af9..0000000
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.apache.clerezza.api.impl.simple;
-/*
- *
- * 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.
- *
-*/
-
-
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.impl.PlainLiteralImpl;
-import org.apache.clerezza.api.impl.TripleImpl;
-import org.junit.Test;
-import junit.framework.Assert;
-
-/**
- *
- * @author reto
- *
- */
-
-public class TripleImplTest {
-    
-    
-    @Test public void tripleEquality() {
-        BlankNodeOrIRI subject = new IRI("http://example.org/");
-        IRI predicate = new IRI("http://example.org/property");
-        RDFTerm object = new PlainLiteralImpl("property value");
-        Triple triple1 = new TripleImpl(subject, predicate, object);
-        Triple triple2 = new TripleImpl(subject, predicate, object);
-        Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
-        Assert.assertEquals(triple1, triple2);    
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/829e5fa5/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
----------------------------------------------------------------------
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
deleted file mode 100644
index dbde617..0000000
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
+++ /dev/null
@@ -1,67 +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.api.impl.simple;
-
-import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.TypedLiteralImpl;
-import org.junit.Test;
-import junit.framework.Assert;
-
-import org.apache.clerezza.api.Literal;
-/**
- *
- * @author reto/**
- *
- * @author reto/**
- *
- * @author reto/**
- *
- * @author reto
- *
- */
-
-public class TypedLiteralImplTest {
-    
-    
-    @Test public void typedLiteralEquality() {
-        String stringValue = "some text";
-        IRI uriRef = new IRI("http://example.org/datatypes/magic");
-        Literal literal1 = new TypedLiteralImpl(stringValue, uriRef);
-        Literal literal2 = new TypedLiteralImpl(stringValue, uriRef);        
-        Assert.assertEquals(literal1, literal2);
-        Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
-        Literal literal3 = new TypedLiteralImpl("something else", uriRef);
-        Assert.assertFalse(literal1.equals(literal3));
-        IRI uriRef2 = new IRI("http://example.org/datatypes/other");
-        Literal literal4 = new TypedLiteralImpl(stringValue, uriRef2);
-        Assert.assertFalse(literal1.equals(literal4));
-    }
-
-
-    /**
-     * The hascode is equals to the hascode of the lexical form plus the hashcode of the dataTyp
-     */
-    @Test public void checkHashCode() {
-        String stringValue = "some text";
-        IRI uriRef = new IRI("http://example.org/datatypes/magic");
-        Literal literal =  new TypedLiteralImpl(stringValue, uriRef);
-        Assert.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
-    }
-
-}


Mime
View raw message