clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [6/7] clerezza-rdf-core git commit: CLEREZZA-982: moved files for new packages
Date Thu, 09 Apr 2015 12:34:09 GMT
CLEREZZA-982: moved files for new packages


Project: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/commit/816dc11f
Tree: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/tree/816dc11f
Diff: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/diff/816dc11f

Branch: refs/heads/master
Commit: 816dc11f23b3fc769467608035381db401ca0d05
Parents: 95dc837
Author: Reto Gmuer <reto@apache.org>
Authored: Thu Apr 9 12:24:53 2015 +0000
Committer: Reto Gmuer <reto@apache.org>
Committed: Thu Apr 9 12:24:53 2015 +0000

----------------------------------------------------------------------
 .../apache/clerezza/commons/rdf/BlankNode.java  |  41 ++
 .../clerezza/commons/rdf/BlankNodeOrIri.java    |  30 ++
 .../org/apache/clerezza/commons/rdf/Graph.java  |  88 ++++
 .../clerezza/commons/rdf/ImmutableGraph.java    |  55 ++
 .../org/apache/clerezza/commons/rdf/Iri.java    |  83 +++
 .../apache/clerezza/commons/rdf/Language.java   |  63 +++
 .../apache/clerezza/commons/rdf/Literal.java    |  93 ++++
 .../apache/clerezza/commons/rdf/RdfTerm.java    |  32 ++
 .../org/apache/clerezza/commons/rdf/Triple.java |  57 +++
 .../clerezza/commons/rdf/WatchableGraph.java    |  94 ++++
 .../clerezza/commons/rdf/event/AddEvent.java    |  37 ++
 .../commons/rdf/event/FilterTriple.java         |  86 ++++
 .../clerezza/commons/rdf/event/GraphEvent.java  |  59 +++
 .../commons/rdf/event/GraphListener.java        |  43 ++
 .../clerezza/commons/rdf/event/RemoveEvent.java |  37 ++
 .../clerezza/commons/rdf/package-info.java      |  21 +
 .../java/org/apache/commons/rdf/BlankNode.java  |  41 --
 .../org/apache/commons/rdf/BlankNodeOrIri.java  |  30 --
 .../main/java/org/apache/commons/rdf/Graph.java |  88 ----
 .../org/apache/commons/rdf/ImmutableGraph.java  |  55 --
 .../main/java/org/apache/commons/rdf/Iri.java   |  83 ---
 .../java/org/apache/commons/rdf/Language.java   |  63 ---
 .../java/org/apache/commons/rdf/Literal.java    |  93 ----
 .../java/org/apache/commons/rdf/RdfTerm.java    |  32 --
 .../java/org/apache/commons/rdf/Triple.java     |  57 ---
 .../org/apache/commons/rdf/WatchableGraph.java  |  94 ----
 .../org/apache/commons/rdf/event/AddEvent.java  |  37 --
 .../apache/commons/rdf/event/FilterTriple.java  |  86 ----
 .../apache/commons/rdf/event/GraphEvent.java    |  59 ---
 .../apache/commons/rdf/event/GraphListener.java |  43 --
 .../apache/commons/rdf/event/RemoveEvent.java   |  37 --
 .../org/apache/commons/rdf/package-info.java    |  21 -
 .../commons/rdf/impl/sparql/SparqlBNode.java    |  74 +++
 .../commons/rdf/impl/sparql/SparqlClient.java   | 224 ++++++++
 .../commons/rdf/impl/sparql/SparqlGraph.java    | 505 +++++++++++++++++++
 .../commons/rdf/impl/sparql/SparqlBNode.java    |  74 ---
 .../commons/rdf/impl/sparql/SparqlClient.java   | 224 --------
 .../commons/rdf/impl/sparql/SparqlGraph.java    | 505 -------------------
 .../rdf/impl/sparql/BNodeCircleTest.java        | 118 +++++
 .../commons/rdf/impl/sparql/BNodeTest.java      | 139 +++++
 .../commons/rdf/impl/sparql/SimilarBNodes.java  | 104 ++++
 .../rdf/impl/sparql/SparqlGraphTest.java        | 113 +++++
 .../rdf/impl/sparql/BNodeCircleTest.java        | 118 -----
 .../commons/rdf/impl/sparql/BNodeTest.java      | 139 -----
 .../commons/rdf/impl/sparql/SimilarBNodes.java  | 104 ----
 .../rdf/impl/sparql/SparqlGraphTest.java        | 113 -----
 .../commons/rdf/impl/sparql/bnode-circle.ttl    |   7 +
 .../commons/rdf/impl/sparql/grounded.ttl        |  16 +
 .../commons/rdf/impl/sparql/similar-bnodes.ttl  |   8 +
 .../commons/rdf/impl/sparql/simple-bnode.ttl    |   7 +
 .../commons/rdf/impl/sparql/bnode-circle.ttl    |   7 -
 .../apache/commons/rdf/impl/sparql/grounded.ttl |  16 -
 .../commons/rdf/impl/sparql/similar-bnodes.ttl  |   8 -
 .../commons/rdf/impl/sparql/simple-bnode.ttl    |   7 -
 .../commons/rdf/impl/utils/AbstractGraph.java   | 316 ++++++++++++
 .../rdf/impl/utils/AbstractImmutableGraph.java  | 112 ++++
 .../commons/rdf/impl/utils/AbstractLiteral.java |  61 +++
 .../rdf/impl/utils/DelayedNotificator.java      | 113 +++++
 .../commons/rdf/impl/utils/LiteralImpl.java     |  82 +++
 .../commons/rdf/impl/utils/LockingIterator.java |  73 +++
 .../rdf/impl/utils/PlainLiteralImpl.java        |  77 +++
 .../commons/rdf/impl/utils/TripleImpl.java      | 100 ++++
 .../rdf/impl/utils/TypedLiteralImpl.java        |  80 +++
 .../rdf/impl/utils/WatchableGraphWrapper.java   | 289 +++++++++++
 .../rdf/impl/utils/debug/ReadLockDebug.java     |  85 ++++
 .../debug/ReentrantReadWriteLockTracker.java    | 133 +++++
 .../rdf/impl/utils/debug/WriteLockDebug.java    |  89 ++++
 .../impl/utils/graphmatching/GraphMatcher.java  | 140 +++++
 .../GraphNotIsomorphicException.java            |  28 +
 .../graphmatching/GroupMappingIterator.java     | 102 ++++
 .../impl/utils/graphmatching/HashMatching.java  | 268 ++++++++++
 .../utils/graphmatching/MappingIterator.java    |  76 +++
 .../graphmatching/PermutationIterator.java      | 107 ++++
 .../rdf/impl/utils/graphmatching/Utils.java     |  82 +++
 .../graphmatching/collections/IntHashMap.java   | 377 ++++++++++++++
 .../graphmatching/collections/IntHashSet.java   |  62 +++
 .../graphmatching/collections/IntIterator.java  |  30 ++
 .../utils/graphmatching/collections/IntSet.java |  35 ++
 .../commons/rdf/impl/utils/package-info.java    |  21 +
 .../rdf/impl/utils/simple/SimpleGraph.java      | 218 ++++++++
 .../impl/utils/simple/SimpleImmutableGraph.java |  79 +++
 .../rdf/impl/utils/simple/SimpleMGraph.java     |  57 +++
 .../commons/rdf/impl/utils/AbstractGraph.java   | 316 ------------
 .../rdf/impl/utils/AbstractImmutableGraph.java  | 112 ----
 .../commons/rdf/impl/utils/AbstractLiteral.java |  61 ---
 .../rdf/impl/utils/DelayedNotificator.java      | 113 -----
 .../commons/rdf/impl/utils/LiteralImpl.java     |  82 ---
 .../commons/rdf/impl/utils/LockingIterator.java |  73 ---
 .../rdf/impl/utils/PlainLiteralImpl.java        |  77 ---
 .../commons/rdf/impl/utils/TripleImpl.java      | 100 ----
 .../rdf/impl/utils/TypedLiteralImpl.java        |  80 ---
 .../rdf/impl/utils/WatchableGraphWrapper.java   | 289 -----------
 .../rdf/impl/utils/debug/ReadLockDebug.java     |  85 ----
 .../debug/ReentrantReadWriteLockTracker.java    | 133 -----
 .../rdf/impl/utils/debug/WriteLockDebug.java    |  89 ----
 .../impl/utils/graphmatching/GraphMatcher.java  | 140 -----
 .../GraphNotIsomorphicException.java            |  28 -
 .../graphmatching/GroupMappingIterator.java     | 102 ----
 .../impl/utils/graphmatching/HashMatching.java  | 268 ----------
 .../utils/graphmatching/MappingIterator.java    |  76 ---
 .../graphmatching/PermutationIterator.java      | 107 ----
 .../rdf/impl/utils/graphmatching/Utils.java     |  82 ---
 .../graphmatching/collections/IntHashMap.java   | 377 --------------
 .../graphmatching/collections/IntHashSet.java   |  62 ---
 .../graphmatching/collections/IntIterator.java  |  30 --
 .../utils/graphmatching/collections/IntSet.java |  35 --
 .../commons/rdf/impl/utils/package-info.java    |  21 -
 .../rdf/impl/utils/simple/SimpleGraph.java      | 218 --------
 .../impl/utils/simple/SimpleImmutableGraph.java |  79 ---
 .../rdf/impl/utils/simple/SimpleMGraph.java     |  57 ---
 .../utils/graphmatching/GraphMatcherTest.java   | 211 ++++++++
 .../utils/graphmatching/HashMatchingTest.java   |  51 ++
 .../graphmatching/PermutationIteratorTest.java  |  78 +++
 .../impl/utils/graphmatching/Utils4Testing.java |  51 ++
 .../impl/utils/simple/PlainLiteralImplTest.java |  71 +++
 .../rdf/impl/utils/simple/SimpleGraphTest.java  | 109 ++++
 .../rdf/impl/utils/simple/TripleImplTest.java   |  57 +++
 .../impl/utils/simple/TypedLiteralImplTest.java |  67 +++
 .../utils/graphmatching/GraphMatcherTest.java   | 211 --------
 .../utils/graphmatching/HashMatchingTest.java   |  51 --
 .../graphmatching/PermutationIteratorTest.java  |  78 ---
 .../impl/utils/graphmatching/Utils4Testing.java |  51 --
 .../impl/utils/simple/PlainLiteralImplTest.java |  71 ---
 .../rdf/impl/utils/simple/SimpleGraphTest.java  | 109 ----
 .../rdf/impl/utils/simple/TripleImplTest.java   |  57 ---
 .../impl/utils/simple/TypedLiteralImplTest.java |  67 ---
 126 files changed, 6221 insertions(+), 6221 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
new file mode 100644
index 0000000..2fcf23b
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
@@ -0,0 +1,41 @@
+/*
+ * 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.commons.rdf;
+
+/**
+ * A Blank Node represents a resource, 
+ * but does not indicate a URI for the resource. Blank nodes act like 
+ * existentially qualified variables in first order logic. 
+ *
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node" >RDF-1.1
+ * Blank Node</a>, as defined by <a href=
+ * "http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes" >RDF-1.1 Concepts
+ * and Abstract Syntax</a>, a W3C Recommendation published on 25 February 2014.<br>
+ *
+ * Note that: Blank nodes are disjoint from IRIs and literals. Otherwise,
+ * the set of possible blank nodes is arbitrary. RDF makes no reference to any
+ * internal structure of blank nodes.
+ *
+ *
+ * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
+ * Blank Node</a>
+ */
+public class BlankNode implements BlankNodeOrIri {
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIri.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIri.java b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIri.java
new file mode 100644
index 0000000..0a292d8
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIri.java
@@ -0,0 +1,30 @@
+/*
+ * 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.commons.rdf;
+
+/**
+ * Represents a <code>Resource</code> that is not a <code>Literal</code>. 
+ * This is a marker interface implemented by <code>UriRef</code> 
+ * and <code>BNode</code>.
+ *
+ * @author reto
+ */
+public interface BlankNodeOrIri extends RdfTerm {
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
new file mode 100644
index 0000000..5a188ff
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
@@ -0,0 +1,88 @@
+/*
+ * 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.commons.rdf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphListener;
+
+
+/**
+ * A set of triples (as it doesn't allow duplicates), it does however
+ * not extend {@link java.util.Set} as it doesn't inherit its
+ * specification for <code>hashCode()</code> and <code>equals</code>.
+ * It is possible to add <code>GraphListener</code> to listen for modifications
+ * in the triples.
+ *
+ * @author reto
+ */
+public interface Graph extends Collection<Triple> {
+    
+    /**
+     * Filters triples given a pattern. 
+     * filter(null, null, null) returns the same as iterator()
+     * 
+     * @param subject
+     * @param predicate
+     * @param object
+     * @return <code>Iterator</code>
+     */
+    public Iterator<Triple> filter(BlankNodeOrIri subject, Iri predicate, 
+            RdfTerm object);
+
+    /**
+     * Returns true if <code>other</code> describes the same graph and will 
+     * always describe the same graph as this instance, false otherwise. 
+     * It returns true if this == other or if it
+     * is otherwise guaranteed that changes to one of the instances are
+     * immediately reflected in the other or if both graphs are immutable.
+     *
+     * @param other
+     * @return true if other == this
+     */
+    @Override
+    public boolean equals(Object other);
+
+    /**
+     * Returns an ImutableGraph describing the graph at the current point in 
+     * time. if <code>this</code> is an instance of ImmutableGraph this can 
+     * safely return <code>this</code>.
+     *
+     * @return the current time slice of the possibly mutable graph represented by the instance.
+     */
+    public ImmutableGraph getImmutableGraph();
+    
+    /**
+     * The lock provided by this methods allows to create read- and write-locks
+     * that span multiple method calls. Having a read locks prevents other
+     * threads from writing to this Graph, having a write-lock prevents other
+     * threads from reading and writing. Implementations would typically
+     * return a <code>java.util.concurrent.locks.ReentrantReadWriteLock</code>.
+     * Immutable instances (such as instances of <code>ImmutableGraph</code>)
+     * or instances used in transaction where concurrent acces of the same 
+     * instance is not an issue may return a no-op ReadWriteLock (i.e. one
+     * which returned ReadLock and WriteLock instances of which the methods do 
+     * not do anything)
+     *
+     * @return the lock of this Graph
+     */
+    ReadWriteLock getLock();
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
new file mode 100644
index 0000000..a3b0211
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
@@ -0,0 +1,55 @@
+ /*
+ * 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.commons.rdf;
+
+/**
+ * A graph, modeled as a set of triples.
+ * This interface does not extend java.util.Set because of the different 
+ * identity constraints, i.e. two <code>Graph</code>s may be equal (isomorphic) 
+ * even if the set of triples are not.
+ * 
+ * Implementations MUST be immutable and throw respective exceptions, when 
+ * add/remove-methods are called.
+ * 
+ * @see org.apache.clerezza.rdf.core.impl.AbstractGraph
+ * @author reto
+ *
+ */
+public interface ImmutableGraph extends Graph {
+
+    /** 
+     * Returns true if two graphs are isomorphic
+     * 
+     * @return true if two graphs are isomorphic
+     */
+    @Override
+    public boolean equals(Object obj);
+
+    /** 
+     * Return the sum of the blank-nodes independent hashes of the triples. 
+     * More precisely the hash of the triple is calculated as follows:
+     * (hash(subject) >> 1) ^  hash(hashCode) ^ (hash(hashCode) << 1)
+     * Where the hash-fucntion return the hashCode of the argument 
+     * for grounded arguments and 0 otherwise. 
+     * 
+     * @return hash code
+     */
+    @Override
+    public int hashCode();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/Iri.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Iri.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Iri.java
new file mode 100644
index 0000000..e1ef0f7
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/Iri.java
@@ -0,0 +1,83 @@
+/*
+ * 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.commons.rdf;
+
+import java.io.Serializable;
+
+/**
+ * Represents an RDF URI Reference
+ * 
+ * RDF URI References are defined in section 6.4 RDF URI References of
+ * http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-Graph-URIref
+ * 
+ * Note that an RDF URI Reference is not the same as defined by RFC3986, 
+ * RDF URI References support most unicode characters 
+ * 
+ * @author reto
+ */
+public class Iri implements BlankNodeOrIri, Serializable {
+
+    private String unicodeString;
+
+    public Iri(String unicodeString) {
+        this.unicodeString = unicodeString;
+    }
+
+    /** 
+     * @return the unicode string that produces the URI
+     */
+    public String getUnicodeString() {
+        return unicodeString;
+    }
+
+    /**
+     * Returns true iff <code>obj</code> == <code>UriRef</code>
+     * 
+     * @param obj
+     * @return true if obj is an instanceof UriRef with 
+     * the same unicode-string, false otherwise
+     */
+    @Override
+    public boolean equals(Object obj) {
+
+        if (!(obj instanceof Iri)) {
+            return false;
+        }
+
+        return unicodeString.equals(((Iri) obj).getUnicodeString());
+    }
+
+    /**
+     * @return 5 + the hashcode of the string
+     */
+    @Override
+    public int hashCode() {
+        int hash = 5 + unicodeString.hashCode();
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buffer = new StringBuilder();
+        buffer.append('<');
+        buffer.append(unicodeString);
+        buffer.append('>');
+        return buffer.toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
new file mode 100644
index 0000000..e76e16d
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
@@ -0,0 +1,63 @@
+/*
+ * 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.commons.rdf;
+
+/**
+ * Represents a language as expressed by the RDF 4646 language tag
+ *
+ * @author reto
+ */
+public class Language {
+
+    private String id;
+
+    /**
+     * Constructs the language tag defined by RDF 4646, normalized to lowercase.
+     *
+     * @param the id as defined by RDF 4646, normalized to lowercase.
+     */
+    public Language(String id) {
+        if ((id == null) || (id.equals(""))) {
+            throw new IllegalArgumentException("A language id may not be null or empty");
+        }
+        this.id = id.toLowerCase();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (other instanceof Language) {
+            return id.equals(((Language) other).id);
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return id.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
new file mode 100644
index 0000000..cf5e1ee
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
@@ -0,0 +1,93 @@
+/*
+ * 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.commons.rdf;
+
+
+/**
+ * Represents a literal value that can be a node in an RDF Graph. 
+ * Literals are used to identify values such as numbers and dates by 
+ * means of a lexical representation. There are two types of literals 
+ * represented by the subinterfaces {@link PlainLiteral} 
+ * and {@link TypedLiteral} 
+ *
+ * @author reto
+ */
+public interface Literal extends RdfTerm {
+    
+    /**
+     * The lexical form of this literal, represented by a <a
+     * href="http://www.unicode.org/versions/latest/">Unicode string</a>.
+     *
+     * @return The lexical form of this literal.
+     * @see <a
+     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
+     * Literal lexical form</a>
+     */
+    String getLexicalForm();
+
+    /**
+     * The IRI identifying the datatype that determines how the lexical form
+     * maps to a literal value.
+     *
+     * @return The datatype IRI for this literal.
+     * @see <a
+     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
+     * Literal datatype IRI</a>
+     */
+    Iri getDataType();
+    
+    /**
+     * If and only if the datatype IRI is <a
+     * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+     * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language
+     * tag for this Literal is a language tag as defined by <a
+     * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
+     * If the datatype IRI is not <a
+     * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+     * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
+     * must null.
+     *
+     * @return The language tag of the literal or null if no language tag is defined
+     * @see <a
+     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
+     * Literal language tag</a>
+     */
+    public Language getLanguage();
+    
+    /** 
+     * Returns true if <code>obj</code> is an instance of 
+     * <code>literal</code> that is term-equal with this, false otherwise
+     * 
+     * Two literals are term-equal (the same RDF literal) if and only if the 
+     * two lexical forms, the two datatype IRIs, and the two language tags (if 
+     * any) compare equal, character by character.
+     * 
+     * @return true if obj equals this, false otherwise.
+     */
+    public boolean equals(Object obj);
+    
+    /**
+     * Returns the hash code of the lexical form plus the hash code of the 
+     * datatype plus if the literal has a language the hash code of the 
+     * language. 
+     * 
+     * @return hash code
+     */
+    public int hashCode();
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/RdfTerm.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/RdfTerm.java b/api/src/main/java/org/apache/clerezza/commons/rdf/RdfTerm.java
new file mode 100644
index 0000000..8f0fb40
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/RdfTerm.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.rdf;
+
+/**
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>, as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/"
+ * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation published on
+ * 25 February 2014.<br>
+ *
+ * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>
+ */
+public interface RdfTerm {
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
new file mode 100644
index 0000000..2a1569e
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
@@ -0,0 +1,57 @@
+/*
+ * 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.commons.rdf;
+
+/**
+ * A structure containing a subject, a predicate, and an object. 
+ * Also known as a statement.
+ *
+ * @author reto
+ */
+public interface Triple {
+
+    BlankNodeOrIri getSubject();
+
+    Iri getPredicate();
+
+    RdfTerm getObject();
+
+    /**
+     * 
+     * @param obj
+     * @return true iff subject, predicate, and object of both triples are equal
+     */
+    @Override
+    boolean equals(Object obj);
+
+    /**
+     * The hash code is computed as follow
+     * (subject.hashCode() >> 1) ^  predicate.hashCode() ^ object.hashCode() << 1)
+     * 
+     * Note that the hash returned is computed including the hash of BNodes, so 
+     * it is not blank-node blind as in Graph.
+     * 
+     * This would have to change if triple should extend Graph
+     * 
+     * @return hash code
+     */
+    @Override
+    int hashCode();
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
new file mode 100644
index 0000000..6367333
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
@@ -0,0 +1,94 @@
+/*
+ * 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.commons.rdf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphListener;
+
+
+/**
+ * An extension to the Graph interface that allows to add throws events
+ * on modifications.
+ *
+ * @author reto
+ */
+public interface WatchableGraph extends Graph {
+   
+
+    /**
+     * Adds the specified <code>GraphListener</code> to the graph. This listener
+     * will be notified, when the graph is modified and the <code>Triple</code>
+     * that was part of the modifiaction matched the specified
+     * <code>FilterTriple</code>. The notification will be passed to the
+     * listener after the specified delay time (in milli-seconds) has passed.
+     * If more matching events occur during the delay period, then they are
+     * passed all together at the end of the delay period. If the the listener
+     * unregisters or the platform is stopped within the period then the already
+     * occurred events may not be delivered.
+     *
+     * All implementations support this method, immutable implementations will
+     * typically provide an empty implementation, they shall not throw an
+     * exception.
+     *
+     * Implementation of which the triples change over time without add- and
+     * remove-methods being called (e.g. implementation dynamically generating
+     * their triples on invocation of the filer-method) may choose not to, or
+     * only partially propagate their changes to the listener. They should
+     * describe the behavior in the documentation of the class.
+     *
+     * Implementations should keep weak references the listeners, so that the
+     * listener can be garbage collected if its no longer referenced by another
+     * object.
+     *
+     * If delay is 0 notification will happen synchroneously.
+     *
+     * @param listener The listener that will be notified
+     * @param filter The triple filter with which triples are tested,
+     *        that were part of the modification.
+     * @param delay The time period afer which the listener will be notified in milliseconds.
+     */
+    public void addGraphListener(GraphListener listener, FilterTriple filter,
+            long delay);
+
+    /**
+     * Adds the specified <code>GraphListener</code> to the graph. This listener
+     * will be notified, when the graph is modified and the <code>Triple</code>
+     * that was part of the modifiaction matched the specified
+     * <code>FilterTriple</code>. The notification will be passed without delay.
+     *
+     * Same as <code>addGraphListener(listener, filter, 0).
+     *
+     * @param listener The listener that will be notified
+     * @param filter The triple filter with which triples are tested,
+     *        that were part of the modification.
+     */
+    public void addGraphListener(GraphListener listener, FilterTriple filter);
+
+    /**
+     * Removes the specified <code>GraphListener</code> from the graph. This
+     * listener will no longer be notified, when the graph is modified.
+     *
+     * @param listener The listener to be removed.
+     */
+    public void removeGraphListener(GraphListener listener);
+  
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
new file mode 100644
index 0000000..1d4a835
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.commons.rdf.event;
+
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+
+/**
+ * This class represent a addition event that occured on a
+ * <code>TripleCollection</code>.
+ *
+ * @author rbn
+ */
+public class AddEvent extends GraphEvent {
+
+
+    public AddEvent(Graph graph,  Triple triple) {
+        super(graph, triple);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
new file mode 100644
index 0000000..3480c13
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
@@ -0,0 +1,86 @@
+/*
+ * 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.commons.rdf.event;
+
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+
+/**
+ * The <code>FilterTriple</code> class provides a match()-method that tests
+ * if a <code>Triple</code> match a certain triple pattern.
+ *
+ * @author mir
+ */
+public class FilterTriple {
+
+    private BlankNodeOrIri subject;
+    private Iri predicate;
+    private RdfTerm object;
+    
+    /**
+     * Creates a new <code>FilterTriple</code>. The specified subject,
+     * predicate and object are used to test a given <code>Triple</code>. Any
+     * of these values can be null, which acts as wildcard in the test.
+     *
+     * @param subject  the subject.
+     * @param predicate  the predicate.
+     * @param object  the object.
+     */
+    public FilterTriple (BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
+        this.subject = subject;
+        this.predicate = predicate;
+        this.object = object;
+    }
+
+    /**
+     * Returns true if the subject, predicate and object of the specified
+     * <code>Triple</code> match the subject, predicate and object of this
+     * <code>FilterTriple</code>. Null values in the <code>FilterTriple</code>
+     * act as wildcards.
+     * @param triple
+     * @return
+     */
+    public boolean match(Triple triple) {
+        boolean subjectMatch, predicateMatch, objectMatch;
+        if (this.subject == null) {
+            subjectMatch = true;            
+        } else {
+            subjectMatch = this.subject.equals(triple.getSubject());
+        }
+        if (this.predicate == null) {
+            predicateMatch = true;
+        } else {
+            predicateMatch = this.predicate.equals(triple.getPredicate());
+        }
+        if (this.object == null) {
+            objectMatch = true;
+        } else {
+            objectMatch = this.object.equals(triple.getObject());
+        }
+        return subjectMatch && predicateMatch && objectMatch;
+    }
+
+    @Override
+    public String toString() {
+        return "FilterTriples: "+subject+" "+predicate+" "+object;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
new file mode 100644
index 0000000..d055088
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.commons.rdf.event;
+
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+
+/**
+ * This class represent a modification event that occured on a
+ * <code>TripleCollection</code>. A <code>GraphEvent</code> object keeps
+ * information about this event. These information are: The <code>Triple</code>
+ * that was part of the modification, the type of modification (addition or
+ * removal) and the <code>TripleCollection</code> that was modified.
+ *
+ * @author mir
+ */
+public class GraphEvent {
+
+    private Graph graph;
+    private Triple triple;
+
+    protected GraphEvent(Graph graph, Triple triple) {
+        this.graph = graph;
+        this.triple = triple;
+    }
+
+    /**
+     * Returns the <code>TripleCollection</code> that was modified in the event.
+     * @return the graph
+     */
+    public Graph getGraph() {
+        return graph;
+    }
+
+
+    /**
+     * Return the <code>Triple</code> that was part of the modification.
+     * @return the triple
+     */
+    public Triple getTriple() {
+        return triple;
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
new file mode 100644
index 0000000..8d0b257
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
@@ -0,0 +1,43 @@
+/*
+ * 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.commons.rdf.event;
+
+import java.util.List;
+
+/**
+ * A class that is interested in graph events implements this interface and
+ * is then added as listener to a <code>ListenableTripleCollection</code> or
+ * one of its subclasses. When the <code>ListenableTripleCollection</code> is
+ * modified, then the <code>GraphListener</code> is notified.
+ *
+ * @author mir
+ */
+public interface GraphListener {
+
+    /**
+     * This method is called when a <code>ListenableTripleCollection</code> was
+     * modified, to which this <code>GraphListener</code> was added. A
+     * <code>List</code> containing <code>GraphEvent</code>s are passed as
+     * argument. The list contains all events in which a triple was part of
+     * the modification that matched the <code>FilterTriple</code> which was passed
+     * as argument when the listener was added.
+     * @param events
+     */
+    public void graphChanged(List<GraphEvent> events);
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
new file mode 100644
index 0000000..60150d6
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.commons.rdf.event;
+
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+
+/**
+ * This class represent a removal event that occured on a
+ * <code>TripleCollection</code>.
+ *
+ * @author rbn
+ */
+public class RemoveEvent extends GraphEvent {
+
+
+    public RemoveEvent(Graph graph,  Triple triple) {
+        super(graph, triple);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java b/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
new file mode 100644
index 0000000..da34f2d
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Common RDF API
+ */
+package org.apache.commons.rdf;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/BlankNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/BlankNode.java b/api/src/main/java/org/apache/commons/rdf/BlankNode.java
deleted file mode 100644
index 2fcf23b..0000000
--- a/api/src/main/java/org/apache/commons/rdf/BlankNode.java
+++ /dev/null
@@ -1,41 +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.commons.rdf;
-
-/**
- * A Blank Node represents a resource, 
- * but does not indicate a URI for the resource. Blank nodes act like 
- * existentially qualified variables in first order logic. 
- *
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node" >RDF-1.1
- * Blank Node</a>, as defined by <a href=
- * "http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes" >RDF-1.1 Concepts
- * and Abstract Syntax</a>, a W3C Recommendation published on 25 February 2014.<br>
- *
- * Note that: Blank nodes are disjoint from IRIs and literals. Otherwise,
- * the set of possible blank nodes is arbitrary. RDF makes no reference to any
- * internal structure of blank nodes.
- *
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
- * Blank Node</a>
- */
-public class BlankNode implements BlankNodeOrIri {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/BlankNodeOrIri.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/BlankNodeOrIri.java b/api/src/main/java/org/apache/commons/rdf/BlankNodeOrIri.java
deleted file mode 100644
index 0a292d8..0000000
--- a/api/src/main/java/org/apache/commons/rdf/BlankNodeOrIri.java
+++ /dev/null
@@ -1,30 +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.commons.rdf;
-
-/**
- * Represents a <code>Resource</code> that is not a <code>Literal</code>. 
- * This is a marker interface implemented by <code>UriRef</code> 
- * and <code>BNode</code>.
- *
- * @author reto
- */
-public interface BlankNodeOrIri extends RdfTerm {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/Graph.java b/api/src/main/java/org/apache/commons/rdf/Graph.java
deleted file mode 100644
index 5a188ff..0000000
--- a/api/src/main/java/org/apache/commons/rdf/Graph.java
+++ /dev/null
@@ -1,88 +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.commons.rdf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.commons.rdf.event.FilterTriple;
-import org.apache.commons.rdf.event.GraphListener;
-
-
-/**
- * A set of triples (as it doesn't allow duplicates), it does however
- * not extend {@link java.util.Set} as it doesn't inherit its
- * specification for <code>hashCode()</code> and <code>equals</code>.
- * It is possible to add <code>GraphListener</code> to listen for modifications
- * in the triples.
- *
- * @author reto
- */
-public interface Graph extends Collection<Triple> {
-    
-    /**
-     * Filters triples given a pattern. 
-     * filter(null, null, null) returns the same as iterator()
-     * 
-     * @param subject
-     * @param predicate
-     * @param object
-     * @return <code>Iterator</code>
-     */
-    public Iterator<Triple> filter(BlankNodeOrIri subject, Iri predicate, 
-            RdfTerm object);
-
-    /**
-     * Returns true if <code>other</code> describes the same graph and will 
-     * always describe the same graph as this instance, false otherwise. 
-     * It returns true if this == other or if it
-     * is otherwise guaranteed that changes to one of the instances are
-     * immediately reflected in the other or if both graphs are immutable.
-     *
-     * @param other
-     * @return true if other == this
-     */
-    @Override
-    public boolean equals(Object other);
-
-    /**
-     * Returns an ImutableGraph describing the graph at the current point in 
-     * time. if <code>this</code> is an instance of ImmutableGraph this can 
-     * safely return <code>this</code>.
-     *
-     * @return the current time slice of the possibly mutable graph represented by the instance.
-     */
-    public ImmutableGraph getImmutableGraph();
-    
-    /**
-     * The lock provided by this methods allows to create read- and write-locks
-     * that span multiple method calls. Having a read locks prevents other
-     * threads from writing to this Graph, having a write-lock prevents other
-     * threads from reading and writing. Implementations would typically
-     * return a <code>java.util.concurrent.locks.ReentrantReadWriteLock</code>.
-     * Immutable instances (such as instances of <code>ImmutableGraph</code>)
-     * or instances used in transaction where concurrent acces of the same 
-     * instance is not an issue may return a no-op ReadWriteLock (i.e. one
-     * which returned ReadLock and WriteLock instances of which the methods do 
-     * not do anything)
-     *
-     * @return the lock of this Graph
-     */
-    ReadWriteLock getLock();
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/ImmutableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/ImmutableGraph.java b/api/src/main/java/org/apache/commons/rdf/ImmutableGraph.java
deleted file mode 100644
index a3b0211..0000000
--- a/api/src/main/java/org/apache/commons/rdf/ImmutableGraph.java
+++ /dev/null
@@ -1,55 +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.commons.rdf;
-
-/**
- * A graph, modeled as a set of triples.
- * This interface does not extend java.util.Set because of the different 
- * identity constraints, i.e. two <code>Graph</code>s may be equal (isomorphic) 
- * even if the set of triples are not.
- * 
- * Implementations MUST be immutable and throw respective exceptions, when 
- * add/remove-methods are called.
- * 
- * @see org.apache.clerezza.rdf.core.impl.AbstractGraph
- * @author reto
- *
- */
-public interface ImmutableGraph extends Graph {
-
-    /** 
-     * Returns true if two graphs are isomorphic
-     * 
-     * @return true if two graphs are isomorphic
-     */
-    @Override
-    public boolean equals(Object obj);
-
-    /** 
-     * Return the sum of the blank-nodes independent hashes of the triples. 
-     * More precisely the hash of the triple is calculated as follows:
-     * (hash(subject) >> 1) ^  hash(hashCode) ^ (hash(hashCode) << 1)
-     * Where the hash-fucntion return the hashCode of the argument 
-     * for grounded arguments and 0 otherwise. 
-     * 
-     * @return hash code
-     */
-    @Override
-    public int hashCode();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/Iri.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/Iri.java b/api/src/main/java/org/apache/commons/rdf/Iri.java
deleted file mode 100644
index e1ef0f7..0000000
--- a/api/src/main/java/org/apache/commons/rdf/Iri.java
+++ /dev/null
@@ -1,83 +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.commons.rdf;
-
-import java.io.Serializable;
-
-/**
- * Represents an RDF URI Reference
- * 
- * RDF URI References are defined in section 6.4 RDF URI References of
- * http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-Graph-URIref
- * 
- * Note that an RDF URI Reference is not the same as defined by RFC3986, 
- * RDF URI References support most unicode characters 
- * 
- * @author reto
- */
-public class Iri implements BlankNodeOrIri, Serializable {
-
-    private String unicodeString;
-
-    public Iri(String unicodeString) {
-        this.unicodeString = unicodeString;
-    }
-
-    /** 
-     * @return the unicode string that produces the URI
-     */
-    public String getUnicodeString() {
-        return unicodeString;
-    }
-
-    /**
-     * Returns true iff <code>obj</code> == <code>UriRef</code>
-     * 
-     * @param obj
-     * @return true if obj is an instanceof UriRef with 
-     * the same unicode-string, false otherwise
-     */
-    @Override
-    public boolean equals(Object obj) {
-
-        if (!(obj instanceof Iri)) {
-            return false;
-        }
-
-        return unicodeString.equals(((Iri) obj).getUnicodeString());
-    }
-
-    /**
-     * @return 5 + the hashcode of the string
-     */
-    @Override
-    public int hashCode() {
-        int hash = 5 + unicodeString.hashCode();
-        return hash;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append('<');
-        buffer.append(unicodeString);
-        buffer.append('>');
-        return buffer.toString();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/Language.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/Language.java b/api/src/main/java/org/apache/commons/rdf/Language.java
deleted file mode 100644
index e76e16d..0000000
--- a/api/src/main/java/org/apache/commons/rdf/Language.java
+++ /dev/null
@@ -1,63 +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.commons.rdf;
-
-/**
- * Represents a language as expressed by the RDF 4646 language tag
- *
- * @author reto
- */
-public class Language {
-
-    private String id;
-
-    /**
-     * Constructs the language tag defined by RDF 4646, normalized to lowercase.
-     *
-     * @param the id as defined by RDF 4646, normalized to lowercase.
-     */
-    public Language(String id) {
-        if ((id == null) || (id.equals(""))) {
-            throw new IllegalArgumentException("A language id may not be null or empty");
-        }
-        this.id = id.toLowerCase();
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (other == null) {
-            return false;
-        }
-        if (other instanceof Language) {
-            return id.equals(((Language) other).id);
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        return id.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/Literal.java b/api/src/main/java/org/apache/commons/rdf/Literal.java
deleted file mode 100644
index cf5e1ee..0000000
--- a/api/src/main/java/org/apache/commons/rdf/Literal.java
+++ /dev/null
@@ -1,93 +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.commons.rdf;
-
-
-/**
- * Represents a literal value that can be a node in an RDF Graph. 
- * Literals are used to identify values such as numbers and dates by 
- * means of a lexical representation. There are two types of literals 
- * represented by the subinterfaces {@link PlainLiteral} 
- * and {@link TypedLiteral} 
- *
- * @author reto
- */
-public interface Literal extends RdfTerm {
-    
-    /**
-     * The lexical form of this literal, represented by a <a
-     * href="http://www.unicode.org/versions/latest/">Unicode string</a>.
-     *
-     * @return The lexical form of this literal.
-     * @see <a
-     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
-     * Literal lexical form</a>
-     */
-    String getLexicalForm();
-
-    /**
-     * The IRI identifying the datatype that determines how the lexical form
-     * maps to a literal value.
-     *
-     * @return The datatype IRI for this literal.
-     * @see <a
-     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
-     * Literal datatype IRI</a>
-     */
-    Iri getDataType();
-    
-    /**
-     * If and only if the datatype IRI is <a
-     * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
-     * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language
-     * tag for this Literal is a language tag as defined by <a
-     * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
-     * If the datatype IRI is not <a
-     * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
-     * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
-     * must null.
-     *
-     * @return The language tag of the literal or null if no language tag is defined
-     * @see <a
-     * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
-     * Literal language tag</a>
-     */
-    public Language getLanguage();
-    
-    /** 
-     * Returns true if <code>obj</code> is an instance of 
-     * <code>literal</code> that is term-equal with this, false otherwise
-     * 
-     * Two literals are term-equal (the same RDF literal) if and only if the 
-     * two lexical forms, the two datatype IRIs, and the two language tags (if 
-     * any) compare equal, character by character.
-     * 
-     * @return true if obj equals this, false otherwise.
-     */
-    public boolean equals(Object obj);
-    
-    /**
-     * Returns the hash code of the lexical form plus the hash code of the 
-     * datatype plus if the literal has a language the hash code of the 
-     * language. 
-     * 
-     * @return hash code
-     */
-    public int hashCode();
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/RdfTerm.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/RdfTerm.java b/api/src/main/java/org/apache/commons/rdf/RdfTerm.java
deleted file mode 100644
index 8f0fb40..0000000
--- a/api/src/main/java/org/apache/commons/rdf/RdfTerm.java
+++ /dev/null
@@ -1,32 +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.commons.rdf;
-
-/**
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>, as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/"
- * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation published on
- * 25 February 2014.<br>
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>
- */
-public interface RdfTerm {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/Triple.java b/api/src/main/java/org/apache/commons/rdf/Triple.java
deleted file mode 100644
index 2a1569e..0000000
--- a/api/src/main/java/org/apache/commons/rdf/Triple.java
+++ /dev/null
@@ -1,57 +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.commons.rdf;
-
-/**
- * A structure containing a subject, a predicate, and an object. 
- * Also known as a statement.
- *
- * @author reto
- */
-public interface Triple {
-
-    BlankNodeOrIri getSubject();
-
-    Iri getPredicate();
-
-    RdfTerm getObject();
-
-    /**
-     * 
-     * @param obj
-     * @return true iff subject, predicate, and object of both triples are equal
-     */
-    @Override
-    boolean equals(Object obj);
-
-    /**
-     * The hash code is computed as follow
-     * (subject.hashCode() >> 1) ^  predicate.hashCode() ^ object.hashCode() << 1)
-     * 
-     * Note that the hash returned is computed including the hash of BNodes, so 
-     * it is not blank-node blind as in Graph.
-     * 
-     * This would have to change if triple should extend Graph
-     * 
-     * @return hash code
-     */
-    @Override
-    int hashCode();
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/WatchableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/WatchableGraph.java b/api/src/main/java/org/apache/commons/rdf/WatchableGraph.java
deleted file mode 100644
index 6367333..0000000
--- a/api/src/main/java/org/apache/commons/rdf/WatchableGraph.java
+++ /dev/null
@@ -1,94 +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.commons.rdf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.commons.rdf.event.FilterTriple;
-import org.apache.commons.rdf.event.GraphListener;
-
-
-/**
- * An extension to the Graph interface that allows to add throws events
- * on modifications.
- *
- * @author reto
- */
-public interface WatchableGraph extends Graph {
-   
-
-    /**
-     * Adds the specified <code>GraphListener</code> to the graph. This listener
-     * will be notified, when the graph is modified and the <code>Triple</code>
-     * that was part of the modifiaction matched the specified
-     * <code>FilterTriple</code>. The notification will be passed to the
-     * listener after the specified delay time (in milli-seconds) has passed.
-     * If more matching events occur during the delay period, then they are
-     * passed all together at the end of the delay period. If the the listener
-     * unregisters or the platform is stopped within the period then the already
-     * occurred events may not be delivered.
-     *
-     * All implementations support this method, immutable implementations will
-     * typically provide an empty implementation, they shall not throw an
-     * exception.
-     *
-     * Implementation of which the triples change over time without add- and
-     * remove-methods being called (e.g. implementation dynamically generating
-     * their triples on invocation of the filer-method) may choose not to, or
-     * only partially propagate their changes to the listener. They should
-     * describe the behavior in the documentation of the class.
-     *
-     * Implementations should keep weak references the listeners, so that the
-     * listener can be garbage collected if its no longer referenced by another
-     * object.
-     *
-     * If delay is 0 notification will happen synchroneously.
-     *
-     * @param listener The listener that will be notified
-     * @param filter The triple filter with which triples are tested,
-     *        that were part of the modification.
-     * @param delay The time period afer which the listener will be notified in milliseconds.
-     */
-    public void addGraphListener(GraphListener listener, FilterTriple filter,
-            long delay);
-
-    /**
-     * Adds the specified <code>GraphListener</code> to the graph. This listener
-     * will be notified, when the graph is modified and the <code>Triple</code>
-     * that was part of the modifiaction matched the specified
-     * <code>FilterTriple</code>. The notification will be passed without delay.
-     *
-     * Same as <code>addGraphListener(listener, filter, 0).
-     *
-     * @param listener The listener that will be notified
-     * @param filter The triple filter with which triples are tested,
-     *        that were part of the modification.
-     */
-    public void addGraphListener(GraphListener listener, FilterTriple filter);
-
-    /**
-     * Removes the specified <code>GraphListener</code> from the graph. This
-     * listener will no longer be notified, when the graph is modified.
-     *
-     * @param listener The listener to be removed.
-     */
-    public void removeGraphListener(GraphListener listener);
-  
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/event/AddEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/event/AddEvent.java b/api/src/main/java/org/apache/commons/rdf/event/AddEvent.java
deleted file mode 100644
index 1d4a835..0000000
--- a/api/src/main/java/org/apache/commons/rdf/event/AddEvent.java
+++ /dev/null
@@ -1,37 +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.commons.rdf.event;
-
-import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.Graph;
-
-/**
- * This class represent a addition event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class AddEvent extends GraphEvent {
-
-
-    public AddEvent(Graph graph,  Triple triple) {
-        super(graph, triple);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/event/FilterTriple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/event/FilterTriple.java b/api/src/main/java/org/apache/commons/rdf/event/FilterTriple.java
deleted file mode 100644
index 3480c13..0000000
--- a/api/src/main/java/org/apache/commons/rdf/event/FilterTriple.java
+++ /dev/null
@@ -1,86 +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.commons.rdf.event;
-
-import org.apache.commons.rdf.BlankNodeOrIri;
-import org.apache.commons.rdf.RdfTerm;
-import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.Iri;
-
-/**
- * The <code>FilterTriple</code> class provides a match()-method that tests
- * if a <code>Triple</code> match a certain triple pattern.
- *
- * @author mir
- */
-public class FilterTriple {
-
-    private BlankNodeOrIri subject;
-    private Iri predicate;
-    private RdfTerm object;
-    
-    /**
-     * Creates a new <code>FilterTriple</code>. The specified subject,
-     * predicate and object are used to test a given <code>Triple</code>. Any
-     * of these values can be null, which acts as wildcard in the test.
-     *
-     * @param subject  the subject.
-     * @param predicate  the predicate.
-     * @param object  the object.
-     */
-    public FilterTriple (BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
-        this.subject = subject;
-        this.predicate = predicate;
-        this.object = object;
-    }
-
-    /**
-     * Returns true if the subject, predicate and object of the specified
-     * <code>Triple</code> match the subject, predicate and object of this
-     * <code>FilterTriple</code>. Null values in the <code>FilterTriple</code>
-     * act as wildcards.
-     * @param triple
-     * @return
-     */
-    public boolean match(Triple triple) {
-        boolean subjectMatch, predicateMatch, objectMatch;
-        if (this.subject == null) {
-            subjectMatch = true;            
-        } else {
-            subjectMatch = this.subject.equals(triple.getSubject());
-        }
-        if (this.predicate == null) {
-            predicateMatch = true;
-        } else {
-            predicateMatch = this.predicate.equals(triple.getPredicate());
-        }
-        if (this.object == null) {
-            objectMatch = true;
-        } else {
-            objectMatch = this.object.equals(triple.getObject());
-        }
-        return subjectMatch && predicateMatch && objectMatch;
-    }
-
-    @Override
-    public String toString() {
-        return "FilterTriples: "+subject+" "+predicate+" "+object;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/event/GraphEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/event/GraphEvent.java b/api/src/main/java/org/apache/commons/rdf/event/GraphEvent.java
deleted file mode 100644
index d055088..0000000
--- a/api/src/main/java/org/apache/commons/rdf/event/GraphEvent.java
+++ /dev/null
@@ -1,59 +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.commons.rdf.event;
-
-import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.Graph;
-
-/**
- * This class represent a modification event that occured on a
- * <code>TripleCollection</code>. A <code>GraphEvent</code> object keeps
- * information about this event. These information are: The <code>Triple</code>
- * that was part of the modification, the type of modification (addition or
- * removal) and the <code>TripleCollection</code> that was modified.
- *
- * @author mir
- */
-public class GraphEvent {
-
-    private Graph graph;
-    private Triple triple;
-
-    protected GraphEvent(Graph graph, Triple triple) {
-        this.graph = graph;
-        this.triple = triple;
-    }
-
-    /**
-     * Returns the <code>TripleCollection</code> that was modified in the event.
-     * @return the graph
-     */
-    public Graph getGraph() {
-        return graph;
-    }
-
-
-    /**
-     * Return the <code>Triple</code> that was part of the modification.
-     * @return the triple
-     */
-    public Triple getTriple() {
-        return triple;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/event/GraphListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/event/GraphListener.java b/api/src/main/java/org/apache/commons/rdf/event/GraphListener.java
deleted file mode 100644
index 8d0b257..0000000
--- a/api/src/main/java/org/apache/commons/rdf/event/GraphListener.java
+++ /dev/null
@@ -1,43 +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.commons.rdf.event;
-
-import java.util.List;
-
-/**
- * A class that is interested in graph events implements this interface and
- * is then added as listener to a <code>ListenableTripleCollection</code> or
- * one of its subclasses. When the <code>ListenableTripleCollection</code> is
- * modified, then the <code>GraphListener</code> is notified.
- *
- * @author mir
- */
-public interface GraphListener {
-
-    /**
-     * This method is called when a <code>ListenableTripleCollection</code> was
-     * modified, to which this <code>GraphListener</code> was added. A
-     * <code>List</code> containing <code>GraphEvent</code>s are passed as
-     * argument. The list contains all events in which a triple was part of
-     * the modification that matched the <code>FilterTriple</code> which was passed
-     * as argument when the listener was added.
-     * @param events
-     */
-    public void graphChanged(List<GraphEvent> events);
-}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/816dc11f/api/src/main/java/org/apache/commons/rdf/event/RemoveEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/event/RemoveEvent.java b/api/src/main/java/org/apache/commons/rdf/event/RemoveEvent.java
deleted file mode 100644
index 60150d6..0000000
--- a/api/src/main/java/org/apache/commons/rdf/event/RemoveEvent.java
+++ /dev/null
@@ -1,37 +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.commons.rdf.event;
-
-import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.Graph;
-
-/**
- * This class represent a removal event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class RemoveEvent extends GraphEvent {
-
-
-    public RemoveEvent(Graph graph,  Triple triple) {
-        super(graph, triple);
-    }
-
-}


Mime
View raw message