You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by ha...@apache.org on 2019/05/11 19:39:22 UTC

[clerezza] branch reunited updated (8004a43 -> cf3d51f)

This is an automated email from the ASF dual-hosted git repository.

hasan pushed a change to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git.


 discard 8004a43  CLEREZZA-1040: Update versions
    omit eb52739  supportingnon-DS parser/serializer as discussed on list
    omit ef8e17a  Falling back to Serializer.getInstance() instead of null
    omit 2970ea1  CLEREZZA-1036: Refactor jaxrs.rdf.providers to use api and api.impl module
    omit 069c0ae  CLEREZZA-1039: Remove doap_rdf.rdf
    omit 71f88c1  CLEREZZA-1039: Reformat site.xml
    omit 47eeb9c  CLEREZZA-1039: Remove unnecessary or obsolete files, update README.md and NOTICE
    omit 6bf49b9  CLEREZZA-1039: Remove obsolete file DISCLAIMER
    omit a5e7f30  CLEREZZA-1039: Remove website bundle
    omit 30d4d8c  CLEREZZA-1033: Delete rdf module
    omit f6e2a2a  CLEREZZA-1026: Reformat codes in api.impl
    omit 799b2d1  CLEREZZA-1038: Move scala.utils from rdf module into api.utils module
    omit 0add015  CLEREZZA-1032: Update ontologies pom.xml to export package and add ontology classes DCTERMS, PLATFORM, SKOS04, SKOS08
    omit e855395  CLEREZZA-1026: Update api pom.xml to export package and reformat codes
    omit 2959bcf  CLEREZZA-1032: Add ontology class XSD to ontologies module
    omit 3d1b3db  CLEREZZA-1037: Add api.utils module to reactor's pom.xml
    omit 54c21fe  CLEREZZA-1037: Move utils from rdf module to api.utils module
    omit 59ff83d  CLEREZZA-1032: Add ontologies module to reactor's pom.xml
    omit 502b36a  CLEREZZA-1032: Add ontology classes FOAF, OWL, RDF, and RDFS to ontologies module
    omit f4c8ad5  CLEREZZA-1025: Use api and api.impl module in representation module
    omit e5ca19a  CLEREZZA-1026: Remove module rdf from reactor's pom.xml and update api and api.impl module names
    omit cfc3226  CLEREZZA-1031: Move TcProviderTest from test.utils to dataset
    omit f509da8  CLEREZZA-1035: Remove TcProviderTest from test.utils to avoid cyclic dependency with dataset
    omit 6781b44  CLEREZZA-1031: Copy PermissionParser used by TcAccessController from legacy bundle org.apache.clerezza.utils
    omit 685c12b  CLEREZZA-1034: Merge rdf simple storage into dataset module
    omit 0656586  CLEREZZA-1035: Add module test.utils in reactor pom.xml
    omit 11799ce  CLEREZZA-1035: Copy rdf.core.test from rdf module to test.utils
    omit 036ce3f  CLEREZZA-1031: Add representation and dataset module to reactor pom.xml
    omit 938e440  CLEREZZA-1025: Update pom.xml in representation module
    omit 50211e4  CLEREZZA-1031: Move rdf.core access to a new module called dataset
    omit ec0265f  CLEREZZA-1026: Update version in sparql module
    omit 01dc25b  CLEREZZA-1026: Move some tests from rdf.core to api.impl
    omit f5d9dd8  CLEREZZA-1026: Clean up rdf.core
    omit 8a9026b  CLEREZZA-1026: Remove sparql parser generator in rdf.core
    omit f8dd915  CLEREZZA-1026: Add module sparql in reactor pom.xml
    omit eec0ac7  CLEREZZA-1026: Introduce GraphStore to remove dependency to TcProvider and refactor sparql
    omit 829e5fa  CLEREZZA-1026: Copy additional classes from rdf.core to api.impl and refactor api.impl
    omit f06386f  CLEREZZA-1026: Bump maven-surefire-plugin in parent pom to 2.22.1 and set useSystemClassLoader to false
    omit a6bb00b  Revert "CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml"
    omit 53ffa57  CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml
    omit 1576c56  CLEREZZA-1026: Fix reactor's pom.xml
    omit d1ee24c  CLEREZZA-1026: Rename impl.utils to api.impl; rename packages within api and api.impl
    omit e64bd26  CLEREZZA-1025: Copy serializedform in core to a new module called representation
    omit 2109cae  Merged in clerezza-rdf-core
     add ab278b6  Removed unnecessary boxing.
     new 954f291  Merged in clerezza-rdf-core
     new 9647fd3  CLEREZZA-1025: Copy serializedform in core to a new module called representation
     new 9364e6d  CLEREZZA-1026: Rename impl.utils to api.impl; rename packages within api and api.impl
     new 44fd93c  CLEREZZA-1026: Fix reactor's pom.xml
     new 566be34  CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml
     new 1ac8b3a  Revert "CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml"
     new e153faa  CLEREZZA-1026: Bump maven-surefire-plugin in parent pom to 2.22.1 and set useSystemClassLoader to false
     new 0ff3e25  CLEREZZA-1026: Copy additional classes from rdf.core to api.impl and refactor api.impl
     new ca80018  CLEREZZA-1026: Introduce GraphStore to remove dependency to TcProvider and refactor sparql
     new fc1bbb0  CLEREZZA-1026: Add module sparql in reactor pom.xml
     new 5bffbb5  CLEREZZA-1026: Remove sparql parser generator in rdf.core
     new 1b65ea2  CLEREZZA-1026: Clean up rdf.core
     new 57f001c  CLEREZZA-1026: Move some tests from rdf.core to api.impl
     new 55c58cd  CLEREZZA-1026: Update version in sparql module
     new 1a52443  CLEREZZA-1031: Move rdf.core access to a new module called dataset
     new fa9a8ba  CLEREZZA-1025: Update pom.xml in representation module
     new 3fd7cbe  CLEREZZA-1031: Add representation and dataset module to reactor pom.xml
     new 209ee57  CLEREZZA-1035: Copy rdf.core.test from rdf module to test.utils
     new 2cd406b  CLEREZZA-1035: Add module test.utils in reactor pom.xml
     new b314faa  CLEREZZA-1034: Merge rdf simple storage into dataset module
     new 0369377  CLEREZZA-1031: Copy PermissionParser used by TcAccessController from legacy bundle org.apache.clerezza.utils
     new 624edf0  CLEREZZA-1035: Remove TcProviderTest from test.utils to avoid cyclic dependency with dataset
     new c2efd15  CLEREZZA-1031: Move TcProviderTest from test.utils to dataset
     new dba24d1  CLEREZZA-1026: Remove module rdf from reactor's pom.xml and update api and api.impl module names
     new 447fd00  CLEREZZA-1025: Use api and api.impl module in representation module
     new e41e0bc  CLEREZZA-1032: Add ontology classes FOAF, OWL, RDF, and RDFS to ontologies module
     new e9a3fe5  CLEREZZA-1032: Add ontologies module to reactor's pom.xml
     new 334c046  CLEREZZA-1037: Move utils from rdf module to api.utils module
     new 1921aca  CLEREZZA-1037: Add api.utils module to reactor's pom.xml
     new bff642b  CLEREZZA-1032: Add ontology class XSD to ontologies module
     new 820de2c  CLEREZZA-1026: Update api pom.xml to export package and reformat codes
     new f0f27c9  CLEREZZA-1032: Update ontologies pom.xml to export package and add ontology classes DCTERMS, PLATFORM, SKOS04, SKOS08
     new 80ad0d3  CLEREZZA-1038: Move scala.utils from rdf module into api.utils module
     new 7a08040  CLEREZZA-1026: Reformat codes in api.impl
     new 2980b6b  CLEREZZA-1033: Delete rdf module
     new 54e79ae  CLEREZZA-1039: Remove website bundle
     new 00379c4  CLEREZZA-1039: Remove obsolete file DISCLAIMER
     new 1e2ae5f  CLEREZZA-1039: Remove unnecessary or obsolete files, update README.md and NOTICE
     new 471770a  CLEREZZA-1039: Reformat site.xml
     new 31f8658  CLEREZZA-1039: Remove doap_rdf.rdf
     new b10c9a1  CLEREZZA-1036: Refactor jaxrs.rdf.providers to use api and api.impl module
     new cc057c7  Falling back to Serializer.getInstance() instead of null
     new c65d7a6  supportingnon-DS parser/serializer as discussed on list
     new 6d149e9  CLEREZZA-1040: Update versions
     new cf3d51f  Reapply commit ab278b609cfe1fee9704abb563679ae952bcc47f

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8004a43)
            \
             N -- N -- N   refs/heads/reunited (cf3d51f)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 45 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/clerezza/test/utils/RandomGraph.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[clerezza] 08/45: CLEREZZA-1026: Copy additional classes from rdf.core to api.impl and refactor api.impl

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 0ff3e25afdd2117e6c635d2b8a343f6cc2453459
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 03:54:16 2018 +0100

    CLEREZZA-1026: Copy additional classes from rdf.core to api.impl and refactor api.impl
---
 .../api/impl/{ => graph}/AbstractGraph.java        |   3 +-
 .../impl/{ => graph}/AbstractImmutableGraph.java   |   2 +-
 .../api/impl/{ => graph}/DelayedNotificator.java   |   2 +-
 .../api/impl/{ => graph}/LockingIterator.java      |   2 +-
 .../api/impl/graph/PrivilegedGraphWrapper.java     | 254 ++++++++++
 .../PrivilegedImmuatbleGraphWrapper.java}          |  42 +-
 .../ReadOnlyException.java}                        |  46 +-
 .../api/impl/{simple => graph}/SimpleGraph.java    |  19 +-
 .../{simple => graph}/SimpleImmutableGraph.java    |   4 +-
 .../api/impl/{simple => graph}/SimpleMGraph.java   |   2 +-
 .../impl/{ => graph}/WatchableGraphWrapper.java    |  24 +-
 .../clerezza/api/impl/graph/WriteBlockedGraph.java | 113 +++++
 .../api/impl/graphmatching/GraphMatcher.java       |   2 +-
 .../api/impl/{ => literal}/AbstractLiteral.java    |   2 +-
 .../InvalidLiteralTypeException.java}              |  40 +-
 .../clerezza/api/impl/literal/LiteralFactory.java  |  83 +++
 .../api/impl/{ => literal}/LiteralImpl.java        |   2 +-
 .../NoConvertorException.java}                     |  39 +-
 .../api/impl/{ => literal}/PlainLiteralImpl.java   |   2 +-
 .../api/impl/literal/SimpleLiteralFactory.java     | 305 +++++++++++
 .../api/impl/{ => literal}/TypedLiteralImpl.java   |   2 +-
 .../org/apache/clerezza/api/impl/package-info.java |   3 -
 .../org/apache/clerezza/api/impl/util/Base64.java  | 120 +++++
 .../clerezza/api/impl/util/W3CDateFormat.java      | 196 +++++++
 .../apache/clerezza/api/impl/graph/GraphTest.java  | 563 +++++++++++++++++++++
 .../impl/{simple => graph}/SimpleGraphTest.java    |   3 +-
 .../api/impl/graphmatching/GraphMatcherTest.java   |   2 +-
 .../api/impl/graphmatching/Utils4Testing.java      |   2 +-
 .../{simple => literal}/PlainLiteralImplTest.java  |   4 +-
 .../impl/{simple => literal}/TripleImplTest.java   |   2 +-
 .../{simple => literal}/TypedLiteralImplTest.java  |   2 +-
 31 files changed, 1716 insertions(+), 171 deletions(-)

diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
similarity index 98%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
index ab236b6..b4e996e 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.graph;
 
 import java.util.AbstractCollection;
 import java.util.Collection;
@@ -32,7 +32,6 @@ import org.apache.clerezza.api.BlankNodeOrIRI;
 import org.apache.clerezza.api.RDFTerm;
 import org.apache.clerezza.api.Triple;
 import org.apache.clerezza.api.ImmutableGraph;
-import org.apache.clerezza.api.impl.simple.SimpleImmutableGraph;
 import org.apache.clerezza.api.impl.debug.ReentrantReadWriteLockTracker;
 
 /**
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
similarity index 98%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
index c46f0fc..a9c35b6 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.graph;
 
 import java.util.Collection;
 import java.util.Iterator;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
similarity index 98%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
index 39d52f5..a3512e2 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.graph;
 
 import java.lang.ref.WeakReference;
 import java.util.*;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
similarity index 97%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
index 84b73de..4db0d85 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.graph;
 
 import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java
new file mode 100644
index 0000000..ce682b0
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java
@@ -0,0 +1,254 @@
+/*
+ * 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 java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ * Calls the methods of the wrapped <code>Graph</code> as privileged
+ * code, because they may need permissions like writing to disk or accessing       
+ * network.
+ *
+ * @author mir
+ */
+public class PrivilegedGraphWrapper implements Graph {
+
+    private Graph graph;
+
+    public PrivilegedGraphWrapper(Graph Graph) {
+        this.graph = Graph;
+    }
+
+    @Override
+    public Iterator<Triple> filter(final BlankNodeOrIRI subject, final IRI predicate,
+            final RDFTerm object) {
+        return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
+
+            @Override
+            public Iterator<Triple> run() {
+                return graph.filter(subject, predicate, object);
+            }
+        });
+    }
+
+    @Override
+    public int size() {
+        return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
+
+            @Override
+            public Integer run() {
+                return graph.size();
+            }
+        });
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.isEmpty();
+            }
+        });
+    }
+
+    @Override
+    public boolean contains(final Object o) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.contains(o);
+            }
+        });
+    }
+
+    @Override
+    public Iterator<Triple> iterator() {
+        return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
+
+            @Override
+            public Iterator<Triple> run() {
+                return graph.iterator();
+            }
+        });
+    }
+
+    @Override
+    public Object[] toArray() {
+        return AccessController.doPrivileged(new PrivilegedAction<Object[]>() {
+
+            @Override
+            public Object[] run() {
+                return graph.toArray();
+            }
+        });
+    }
+
+    @Override
+    public <T> T[] toArray(final T[] a) {
+        return AccessController.doPrivileged(new PrivilegedAction<T[]>() {
+
+            @Override
+            public T[] run() {
+                return graph.toArray(a);
+            }
+        });
+    }
+
+    @Override
+    public boolean add(final Triple triple) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.add(triple);
+            }
+        });
+    }
+
+    @Override
+    public boolean remove(final Object o) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.remove(o);
+            }
+        });
+    }
+
+    @Override
+    public boolean containsAll(final Collection<?> c) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.containsAll(c);
+            }
+        });
+    }
+
+    @Override
+    public boolean addAll(final Collection<? extends Triple> c) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.addAll(c);
+            }
+        });
+    }
+
+    @Override
+    public boolean removeAll(final Collection<?> c) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.removeAll(c);
+            }
+        });
+    }
+
+    @Override
+    public boolean retainAll(final Collection<?> c) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+            @Override
+            public Boolean run() {
+                return graph.retainAll(c);
+            }
+        });
+    }
+
+    @Override
+    public void clear() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+
+            @Override
+            public Object run() {
+                graph.clear();
+                return null;
+            }
+        });
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return graph.getLock();
+    }
+
+    private static class PriviledgedTripleIterator implements Iterator<Triple> {
+
+        private final Iterator<Triple> wrappedIterator;
+
+        public PriviledgedTripleIterator(Iterator<Triple> wrappedIterator) {
+            this.wrappedIterator = wrappedIterator;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+                @Override
+                public Boolean run() {
+                    return wrappedIterator.hasNext();
+                }
+            });
+        }
+
+        @Override
+        public Triple next() {
+            return AccessController.doPrivileged(new PrivilegedAction<Triple>() {
+
+                @Override
+                public Triple run() {
+                    return wrappedIterator.next();
+                }
+            });
+        }
+
+        @Override
+        public void remove() {
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+
+                @Override
+                public Object run() {
+                    wrappedIterator.remove();
+                    return null;
+                }
+            });
+        }
+    }
+    
+    
+
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return new SimpleImmutableGraph(this);
+    }
+}
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
similarity index 54%
copy from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
copy to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
index da961c2..f9367ac 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
@@ -16,41 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.graph;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.ImmutableGraph;
 
 /**
- *
- * @deprecated Use SimpleGraph
- * @author reto
+ * Calls the methods of the wrapped <code>ImmutableGraph</code> as privileged
+ * code, because they may need permissions like writing to disk or accessing       
+ * network.
+ * 
+ * @author mir
  */
-@Deprecated
-public class SimpleMGraph extends SimpleGraph implements Graph {
-
-    /**
-     * Creates an empty SimpleMGraph
-     */
-    public SimpleMGraph() {
-    }
-
-    public SimpleMGraph(Set<Triple> baseSet) {
-        super(baseSet);
-    }
-
-    public SimpleMGraph(Collection<Triple> baseCollection) {
-        super(baseCollection);
-    }
+public class PrivilegedImmuatbleGraphWrapper extends PrivilegedGraphWrapper
+        implements ImmutableGraph {
 
-    public SimpleMGraph(Iterator<Triple> iterator) {
-        super(iterator);
+    public PrivilegedImmuatbleGraphWrapper(ImmutableGraph ImmutableGraph) {
+        super(ImmutableGraph);
     }
-
 }
-
-    
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
similarity index 55%
copy from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
copy to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
index da961c2..ea5456f 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
@@ -16,41 +16,35 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.graph;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.Triple;
+import java.security.AccessControlException;
 
 /**
+ * is thrown on an attempt to add or remove triples to a 
+ * read-only mutable ImmutableGraph 
  *
- * @deprecated Use SimpleGraph
- * @author reto
+ * @author tsuy
  */
-@Deprecated
-public class SimpleMGraph extends SimpleGraph implements Graph {
+public class ReadOnlyException extends AccessControlException {
+
+    private String action;
 
     /**
-     * Creates an empty SimpleMGraph
+     * creates an exception indicating that the mutable ImmutableGraph is read-only
+     * 
+     * @param action
      */
-    public SimpleMGraph() {
-    }
-
-    public SimpleMGraph(Set<Triple> baseSet) {
-        super(baseSet);
-    }
-
-    public SimpleMGraph(Collection<Triple> baseCollection) {
-        super(baseCollection);
+    public ReadOnlyException(String action) {
+        super("read only mutable ImmutableGraph, not allowed to "+action);
+        this.action = action;
     }
 
-    public SimpleMGraph(Iterator<Triple> iterator) {
-        super(iterator);
+    /**
+     * 
+     * @return the name of the action
+     */
+    public String getAction() {
+        return action;
     }
-
 }
-
-    
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
similarity index 92%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
index 7220532..0209c28 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
@@ -16,25 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.graph;
 
-import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.AbstractGraph;
+import org.apache.clerezza.api.*;
 
 import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ConcurrentModificationException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.ImmutableGraph;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
+import java.util.*;
 
 /**
  * For now this is a minimalistic implementation, without any indexes or other
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
similarity index 96%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
index d48fe5c..46b95ad 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
@@ -16,9 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
-
-import org.apache.clerezza.api.impl.AbstractImmutableGraph;
+package org.apache.clerezza.api.impl.graph;
 
 import java.util.Iterator;
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
similarity index 96%
copy from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
copy to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
index da961c2..94cd03a 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.graph;
 
 import java.util.Collection;
 import java.util.Iterator;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
similarity index 91%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
index 5533c9b..c86156d 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
@@ -13,29 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.graph;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.event.*;
 
 import java.lang.ref.WeakReference;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.locks.ReadWriteLock;
 
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.ImmutableGraph;
-import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.WatchableGraph;
-import org.apache.clerezza.api.event.AddEvent;
-import org.apache.clerezza.api.event.FilterTriple;
-import org.apache.clerezza.api.event.GraphEvent;
-import org.apache.clerezza.api.event.GraphListener;
-import org.apache.clerezza.api.event.RemoveEvent;
-
 /**
  *
  * @author developer
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java
new file mode 100644
index 0000000..71fce87
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java
@@ -0,0 +1,113 @@
+/*
+ * 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 java.util.Collection;
+import java.util.Iterator;
+
+/**
+ *
+ * This is a wrapper object for <code>Graph</code>. If <code>SecurityManger</code> 
+ * is not <code>null</code> <code>TcManager</code> checks the <code>TcPermission</code>. 
+ * If read-only permissions are set this wrapper is used instead of <code>Graph</code> 
+ * and throws exceptions when add or remove methods are called.
+ *
+ * @author tsuy
+ */
+public class WriteBlockedGraph extends AbstractGraph
+        implements Graph {
+
+    private Graph triples;
+
+    public WriteBlockedGraph(Graph triples) {
+        this.triples = triples;
+    }
+
+    @Override
+    protected int performSize() {
+        return triples.size();
+    }
+
+    @Override
+    protected Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        final Iterator<Triple> baseIter = triples.filter(subject, predicate, object);
+        return new Iterator<Triple>() {
+            
+            @Override
+            public boolean hasNext() {
+                return baseIter.hasNext();
+            }
+
+            @Override
+            public Triple next() {
+                return baseIter.next();
+            }
+
+            @Override
+            public void remove() {
+                throw new ReadOnlyException("remove");
+            }
+
+            
+        };
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        throw new ReadOnlyException("add");
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        throw new ReadOnlyException("add all");
+    }
+
+    @Override
+    public void clear() {
+        throw new ReadOnlyException("clear");
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new ReadOnlyException("remove");
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new ReadOnlyException("remove all");
+    }
+    
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        throw new ReadOnlyException("retain all");
+    }
+
+    @Override
+    public Iterator iterator() {
+        return filter(null, null, null);
+    }
+    
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return this.triples.getImmutableGraph();
+    }
+
+}
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
index 9180ae0..754e05d 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
@@ -32,7 +32,7 @@ import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.RDFTerm;
 import org.apache.clerezza.api.Triple;
 import org.apache.clerezza.api.impl.TripleImpl;
-import org.apache.clerezza.api.impl.simple.SimpleMGraph;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 
 /**
  * @author reto
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
similarity index 97%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
index 48e3221..8444813 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.literal;
 
 import org.apache.clerezza.api.Literal;
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
similarity index 56%
copy from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
copy to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
index da961c2..f4665db 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
@@ -16,41 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.literal;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.IRI;
 
 /**
+ * Thrown when a literal is of the wrong type for conversion to a java-type
  *
- * @deprecated Use SimpleGraph
  * @author reto
  */
-@Deprecated
-public class SimpleMGraph extends SimpleGraph implements Graph {
-
+public class InvalidLiteralTypeException extends RuntimeException {
+    
     /**
-     * Creates an empty SimpleMGraph
+     * Constructs the exception to be thrown when a literal cannot be 
+     * converted to an instance of the specified class
+     *
+     * @param javaType the <code>Class</code> to convert to
+     * @param literalType the literalType which can't be converted
      */
-    public SimpleMGraph() {
-    }
-
-    public SimpleMGraph(Set<Triple> baseSet) {
-        super(baseSet);
-    }
-
-    public SimpleMGraph(Collection<Triple> baseCollection) {
-        super(baseCollection);
-    }
-
-    public SimpleMGraph(Iterator<Triple> iterator) {
-        super(iterator);
+    public InvalidLiteralTypeException(Class<?> javaType, IRI literalType) {
+        super("Cannot create a "+javaType+" from a literal of type "+literalType);
     }
-
 }
-
-    
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java
new file mode 100644
index 0000000..fc971bd
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.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.clerezza.api.impl.literal;
+
+import org.apache.clerezza.api.Literal;
+
+/**
+ * This class provides methods to convert java objects to typed literals and
+ * vice versa. While the default implementation will provide literal objects
+ * storing the data's lexical form in memory, other implementations may
+ * create literal optimized for processing within the store.
+ *
+ * Note: this class uses the notion of "Convertor" (in the Exception naming), 
+ * but does not currently provide a mechanism to register such
+ * <code>Convertor</code>s. An implementation is said to provide
+ * <code>Convertor</code>s for the types it supports.
+ *
+ * @since 0.3
+ * @author reto
+ */
+public abstract class LiteralFactory {
+
+    private static LiteralFactory instance = new SimpleLiteralFactory();
+
+    /**
+     * Get a <code>LiteralFactory</code>. If this has not been set using
+     * setInstance it returns an instance of
+     * {@link org.apache.clerezza.model.impl.SimpleLiteralFactory}.
+     *
+     * @return a concrete <code>LiteralFactory</code>
+     */
+    public static LiteralFactory getInstance() {
+        return instance;
+    }
+
+    /**
+     * Set the instance returned by <code>getInstance</code>.
+     *
+     * @param instance the new default <code>LiteralFactory</code>
+     */
+    public static void setInstance(LiteralFactory instance) {
+        LiteralFactory.instance = instance;
+    }
+
+    /**
+     * Create a typed literal for the specified object
+     *
+     * @param value the value of the literal to be created
+     * @return a TypedLiteral representing the value
+     * @throws NoConvertorException thrown if <code>value</code> is of an invalid type
+     */
+    public abstract Literal createTypedLiteral(Object value)
+            throws NoConvertorException;
+
+    /**
+     * Converts a literal to an instance of the specified class
+     *
+     * @param <T>
+     * @param type the <code>Class</code> of the returned object
+     * @param literal the literal to be converted
+     * @return a java object representing the value of the literal
+     * @throws NoConvertorException thrown if <code>type</code> is unsupported
+     * @throws InvalidLiteralTypeException if the literal type doesn't match the requested java type
+     */
+    public abstract <T> T createObject(Class<T> type, Literal literal)
+            throws NoConvertorException, InvalidLiteralTypeException;
+}
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
similarity index 97%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
index e8ac986..7d86242 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.literal;
 
 import java.io.Serializable;
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
similarity index 57%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
index da961c2..a462394 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
@@ -16,41 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.literal;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.Triple;
+import java.lang.reflect.Type;
 
 /**
+ * This exception is thrown when no convertor is available to do a required
+ * java-object to literal or literal to java-object conversion.
  *
- * @deprecated Use SimpleGraph
+ * @since 0.3
  * @author reto
  */
-@Deprecated
-public class SimpleMGraph extends SimpleGraph implements Graph {
+public class NoConvertorException extends RuntimeException {
 
     /**
-     * Creates an empty SimpleMGraph
+     * Create an instance of <code>NoConvertorException</code>
+     * indicating that no convertor is available for the type.
+     *
+     * @param type the type for which no convertor is available
      */
-    public SimpleMGraph() {
-    }
-
-    public SimpleMGraph(Set<Triple> baseSet) {
-        super(baseSet);
-    }
-
-    public SimpleMGraph(Collection<Triple> baseCollection) {
-        super(baseCollection);
+    public NoConvertorException(Type type) {
+        super("No convertor available for type "+type);
     }
-
-    public SimpleMGraph(Iterator<Triple> iterator) {
-        super(iterator);
-    }
-
 }
-
-    
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
similarity index 98%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
index 012aeca..aeef1ea 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.literal;
 
 import java.io.Serializable;
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java
new file mode 100644
index 0000000..9bbbb1b
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java
@@ -0,0 +1,305 @@
+/*
+ * 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.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.impl.util.Base64;
+import org.apache.clerezza.api.impl.util.W3CDateFormat;
+
+import java.math.BigInteger;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.*;
+
+/**
+ * An implementation of literal factory currently supporting only
+ * byte[]/base64Binary and Java.util.Date/date
+ * 
+ * @author reto
+ */
+
+public class SimpleLiteralFactory extends LiteralFactory {
+
+    private static final String XSD = "http://www.w3.org/2001/XMLSchema#";
+    final private static IRI xsdInteger = xsd("integer");
+    final private static IRI xsdInt = xsd("int");
+    final private static IRI xsdShort = xsd("short");
+    final private static IRI xsdByte = xsd("byte");
+    final private static IRI xsdLong = xsd("long");
+    
+
+    final private static Set<IRI> decimalTypes = new HashSet<IRI>();
+
+    final private static Map<Class<?>, TypeConverter<?>> typeConverterMap = new HashMap<Class<?>, TypeConverter<?>>();
+    final static Class<? extends byte[]> byteArrayType;
+
+    static {
+        Collections.addAll(decimalTypes, xsdInteger, xsdInt, xsdByte, xsdShort, xsdLong );
+
+        byte[] byteArray = new byte[0];
+        byteArrayType = byteArray.getClass();
+        typeConverterMap.put(byteArrayType, new ByteArrayConverter());
+        typeConverterMap.put(Date.class, new DateConverter());
+        typeConverterMap.put(Boolean.class, new BooleanConverter());
+        typeConverterMap.put(String.class, new StringConverter());
+        typeConverterMap.put(Integer.class, new IntegerConverter());
+        typeConverterMap.put(BigInteger.class, new BigIntegerConverter());
+        typeConverterMap.put(Long.class, new LongConverter());
+        typeConverterMap.put(Double.class, new DoubleConverter());
+        typeConverterMap.put(Float.class, new FloatConverter());
+        typeConverterMap.put(IRI.class, new UriRefConverter());
+    }
+
+    final private static IRI xsdDouble =xsd("double");
+    final private static IRI xsdFloat =xsd("float");
+    final private static IRI xsdAnyURI =xsd("anyURI");
+
+    final private static IRI xsd(String name) {
+       return new IRI(XSD+name);
+    }
+
+    private static interface TypeConverter<T> {
+        Literal createLiteral(T value);
+        T createObject(Literal literal);        
+    }
+
+    private static class  ByteArrayConverter implements TypeConverter<byte[]> {
+
+        private static final IRI base64Uri =xsd("base64Binary");
+
+        @Override
+        public Literal createLiteral(byte[] value) {
+            return new TypedLiteralImpl(Base64.encode((byte[]) value), base64Uri);
+        }
+
+        @Override
+        public byte[] createObject(Literal literal) {
+            if (!literal.getDataType().equals(base64Uri)) {
+                throw new InvalidLiteralTypeException(byteArrayType, literal.getDataType());
+            }
+            return (byte[]) Base64.decode(literal.getLexicalForm());
+        }
+
+        
+    }
+    private static class DateConverter implements TypeConverter<Date> {
+
+        private static final IRI dateTimeUri =xsd("dateTime");
+        private static final DateFormat DATE_FORMAT = new W3CDateFormat();
+
+        @Override
+        public Literal createLiteral(Date value) {
+            return new TypedLiteralImpl(DATE_FORMAT.format(value), dateTimeUri);
+        }
+
+        @Override
+        public Date createObject(Literal literal) {
+            if (!literal.getDataType().equals(dateTimeUri)) {
+                throw new InvalidLiteralTypeException(Date.class, literal.getDataType());
+            }
+            try {
+                return DATE_FORMAT.parse(literal.getLexicalForm());
+            } catch (ParseException ex) {
+                throw new RuntimeException("Exception parsing literal as date", ex);
+            }
+        }
+
+
+    }
+
+    private static class BooleanConverter implements TypeConverter<Boolean> {
+
+        private static final IRI booleanUri =xsd("boolean");
+        public static final TypedLiteralImpl TRUE = new TypedLiteralImpl("true", booleanUri);
+        public static final TypedLiteralImpl FALSE = new TypedLiteralImpl("false", booleanUri);
+
+        @Override
+        public Literal createLiteral(Boolean value) {
+            if (value) return TRUE;
+            else return FALSE;
+        }
+
+        @Override
+        public Boolean createObject(Literal literal) {
+            if (literal == TRUE) return true;
+            else if (literal == FALSE) return false;
+            else if (!literal.getDataType().equals(booleanUri)) {
+                throw new InvalidLiteralTypeException(Boolean.class, literal.getDataType());
+            }
+            return Boolean.valueOf(literal.getLexicalForm());
+        }
+    }
+
+    private static class StringConverter implements TypeConverter<String> {
+
+        private static final IRI stringUri =xsd("string");
+
+        @Override
+        public Literal createLiteral(String value) {
+            return new TypedLiteralImpl(value, stringUri);
+        }
+
+        @Override
+        public String createObject(Literal literal) {
+            if (!literal.getDataType().equals(stringUri)) {
+                throw new InvalidLiteralTypeException(String.class, literal.getDataType());
+            }
+            return literal.getLexicalForm();
+        }
+    }
+
+    private static class IntegerConverter implements TypeConverter<Integer> {
+
+
+        @Override
+        public Literal createLiteral(Integer value) {
+            return new TypedLiteralImpl(value.toString(), xsdInt);
+        }
+
+        @Override
+        public Integer createObject(Literal literal) {
+            if (!decimalTypes.contains(literal.getDataType())) {
+                throw new InvalidLiteralTypeException(Integer.class, literal.getDataType());
+            }
+            return new Integer(literal.getLexicalForm());
+        }
+    }
+
+    private static class LongConverter implements TypeConverter<Long> {
+
+        
+
+        @Override
+        public Literal createLiteral(Long value) {
+            return new TypedLiteralImpl(value.toString(), xsdLong);
+        }
+
+        @Override
+        public Long createObject(Literal literal) {
+            if (!decimalTypes.contains(literal.getDataType())) {
+                throw new InvalidLiteralTypeException(Long.class, literal.getDataType());
+            }
+            return new Long(literal.getLexicalForm());
+        }
+    }
+
+
+    private static class FloatConverter implements TypeConverter<Float> {
+
+        @Override
+        public Literal createLiteral(Float value) {
+            return new TypedLiteralImpl(value.toString(), xsdFloat);
+        }
+
+        @Override
+        public Float createObject(Literal literal) {
+            if (!literal.getDataType().equals(xsdFloat)) {
+                throw new InvalidLiteralTypeException(Float.class, literal.getDataType());
+            }
+            return Float.valueOf(literal.getLexicalForm());
+        }
+    }
+    
+    private static class DoubleConverter implements TypeConverter<Double> {
+
+
+
+        @Override
+        public Literal createLiteral(Double value) {
+            return new TypedLiteralImpl(value.toString(), xsdDouble);
+        }
+
+        @Override
+        public Double createObject(Literal literal) {
+            if (!literal.getDataType().equals(xsdDouble)) {
+                throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
+            }
+            return new Double(literal.getLexicalForm());
+        }
+    }
+
+    private static class BigIntegerConverter implements TypeConverter<BigInteger> {
+
+
+
+        @Override
+        public Literal createLiteral(BigInteger value) {
+            return new TypedLiteralImpl(value.toString(), xsdInteger);
+        }
+
+        @Override
+        public BigInteger createObject(Literal literal) {
+            if (!literal.getDataType().equals(xsdInteger)) {
+                throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
+            }
+            return new BigInteger(literal.getLexicalForm());
+        }
+    }
+    
+    private static class UriRefConverter implements TypeConverter<IRI> {
+
+
+
+        @Override
+        public Literal createLiteral(IRI value) {
+            return new TypedLiteralImpl(value.getUnicodeString(), xsdAnyURI);
+        }
+
+        @Override
+        public IRI createObject(Literal literal) {
+            if (!literal.getDataType().equals(xsdAnyURI)) {
+                throw new InvalidLiteralTypeException(IRI.class, literal.getDataType());
+            }
+            return new IRI(literal.getLexicalForm());
+        }
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Literal createTypedLiteral(Object value) throws NoConvertorException {
+        TypeConverter converter = getConverterFor(value.getClass());
+        return converter.createLiteral(value);
+    }
+
+    
+    
+    @Override
+    public <T> T createObject(Class<T> type, Literal literal)
+            throws NoConvertorException, InvalidLiteralTypeException {
+        final TypeConverter<T> converter = getConverterFor(type);
+        return converter.createObject(literal);
+        
+    }
+
+    @SuppressWarnings("unchecked")
+    private <T> TypeConverter<T> getConverterFor(Class<T> type) throws NoConvertorException {
+        TypeConverter<T> convertor = (TypeConverter<T>) typeConverterMap.get(type);
+        if (convertor != null) {
+            return convertor;
+        }
+        for (Map.Entry<Class<?>, TypeConverter<?>> converterEntry : typeConverterMap.entrySet()) {
+            if (type.isAssignableFrom(converterEntry.getKey())) {
+                return (TypeConverter<T>) converterEntry.getValue();
+            }
+        }
+        throw new NoConvertorException(type);
+    }
+}
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
similarity index 97%
rename from api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
index 0be7ab3..8b029d2 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl;
+package org.apache.clerezza.api.impl.literal;
 
 import java.io.Serializable;
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
index 6a35ba4..80652e5 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
@@ -15,7 +15,4 @@
  * limitations under the License.
  */
 
-/**
- * Common RDF API Implementation utilities.
- */
 package org.apache.clerezza.api.impl;
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java
new file mode 100644
index 0000000..28607eb
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java
@@ -0,0 +1,120 @@
+/*
+ * Taken from the book:
+ * Jonathan Knudsen, "Java Cryptography", O'Reilly Media, Inc., 1998
+ */
+package org.apache.clerezza.api.impl.util;
+/*
+ *
+ * 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.
+ *
+*/
+
+
+public class Base64 {
+
+    public static String encode(byte[] raw) {
+        StringBuffer encoded = new StringBuffer();
+        for (int i = 0; i < raw.length; i += 3) {
+            encoded.append(encodeBlock(raw, i));
+        }
+        return encoded.toString();
+    }
+
+    protected static char[] encodeBlock(byte[] raw, int offset) {
+        int block = 0;
+        int slack = raw.length - offset - 1;
+        int end = (slack >= 2) ? 2 : slack;
+        for (int i = 0; i <= end; i++) {
+            byte b = raw[offset + i];
+            int neuter = (b < 0) ? b + 256 : b;
+            block += neuter << (8 * (2 - i));
+        }
+        char[] base64 = new char[4];
+        for (int i = 0; i < 4; i++) {
+            int sixbit = (block >>> (6 * (3 - i))) & 0x3f;
+            base64[i] = getChar(sixbit);
+        }
+        if (slack < 1) {
+            base64[2] = '=';
+        }
+        if (slack < 2) {
+            base64[3] = '=';
+        }
+        return base64;
+    }
+
+    protected static char getChar(int sixBit) {
+        if (sixBit >= 0 && sixBit <= 25) {
+            return (char) ('A' + sixBit);
+        }
+        if (sixBit >= 26 && sixBit <= 51) {
+            return (char) ('a' + (sixBit - 26));
+        }
+        if (sixBit >= 52 && sixBit <= 61) {
+            return (char) ('0' + (sixBit - 52));
+        }
+        if (sixBit == 62) {
+            return '+';
+        }
+        if (sixBit == 63) {
+            return '/';
+        }
+        return '?';
+    }
+
+    public static byte[] decode(String base64) {
+        int pad = 0;
+        for (int i = base64.length() - 1; base64.charAt(i) == '='; i--) {
+            pad++;
+        }
+        int length = base64.length() * 6 / 8 - pad;
+        byte[] raw = new byte[length];
+        int rawIndex = 0;
+        for (int i = 0; i < base64.length(); i += 4) {
+            int block = (getValue(base64.charAt(i)) << 18) + (getValue(base64.charAt(i + 1)) << 12) + (getValue(base64.charAt(i + 2)) << 6) + (getValue(base64.charAt(i + 3)));
+            for (int j = 0; j < 3 && rawIndex + j < raw.length; j++) {
+                raw[rawIndex + j] = (byte) ((block >> (8 * (2 - j))) & 0xff);
+            }
+            rawIndex += 3;
+        }
+        return raw;
+    }
+
+    protected static int getValue(char c) {
+        if (c >= 'A' && c <= 'Z') {
+            return c - 'A';
+        }
+        if (c >= 'a' && c <= 'z') {
+            return c - 'a' + 26;
+        }
+        if (c >= '0' && c <= '9') {
+            return c - '0' + 52;
+        }
+        if (c == '+') {
+            return 62;
+        }
+        if (c == '/') {
+            return 63;
+        }
+        if (c == '=') {
+            return 0;
+        }
+        return -1;
+    }
+
+}
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java
new file mode 100644
index 0000000..a337064
--- /dev/null
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java
@@ -0,0 +1,196 @@
+//taken from GVS MillisDateFormat.java, modified to support different precision
+
+/*
+ (c) Copyright 2005, 2006, Hewlett-Packard Development Company, LP
+ [See end of file]
+ $Id: W3CDateFormat.java,v 1.6 2007/05/07 18:45:22 rebach Exp $
+ */
+package org.apache.clerezza.api.impl.util;
+/*
+ *
+ * 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 java.text.DateFormat;
+import java.text.FieldPosition;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.SimpleTimeZone;
+import java.util.TimeZone;
+
+/**
+ * @author reto implements http://www.w3.org/TR/NOTE-datetime with the
+ *         limitation that it expects exactly a three digits decimal fraction of
+ *         seconds. if a time zone designator other than 'Z' is present it must
+ *         contain a column
+ */
+public class W3CDateFormat extends DateFormat {
+    /**
+     * An instance of this class
+     */
+    public static final W3CDateFormat instance = new W3CDateFormat();
+
+    private static final SimpleDateFormat dateFormatWithMillis = new SimpleDateFormat(
+            "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+    private static final SimpleDateFormat dateFormatNoMillis = new SimpleDateFormat(
+            "yyyy-MM-dd'T'HH:mm:ssZ");
+
+    private static final long serialVersionUID = 3258407344076372025L;
+
+    private static final TimeZone utcTZ = new SimpleTimeZone(0, "UTC");
+
+    static {
+        dateFormatWithMillis.setTimeZone(utcTZ);
+        dateFormatNoMillis.setTimeZone(utcTZ);
+    }
+
+    @Override
+    public void setTimeZone(TimeZone zone) {
+        super.setTimeZone(zone);
+    }
+
+
+    /**
+     * @see java.text.DateFormat#format(java.util.Date, java.lang.StringBuffer,
+     *      java.text.FieldPosition)
+     */
+    @Override
+    public StringBuffer format(Date date, StringBuffer toAppendTo,
+            FieldPosition fieldPosition) {
+
+        final DateFormat dateFormat = (date.getTime() % 1000) == 0 ?
+            dateFormatNoMillis : dateFormatWithMillis;
+        String string = dateFormat.format(date);
+        if (string.endsWith("0000")) {
+            StringBuffer result = new StringBuffer(string.substring(0, string.length()-5));
+            result.append('Z');
+            return result;
+        } else {
+            StringBuffer result = new StringBuffer(string);
+            result.insert(string.length() - 2, ':');
+            return result;
+        }
+    }
+
+    /**
+     * @see java.text.DateFormat#parse(java.lang.String,
+     *      java.text.ParsePosition)
+     */
+    public Date parse(String dateString, ParsePosition parsePos) {
+
+        int position = parsePos.getIndex();
+
+        int y1 = dateString.charAt(position++) - '0';
+        int y2 = dateString.charAt(position++) - '0';
+        int y3 = dateString.charAt(position++) - '0';
+        int y4 = dateString.charAt(position++) - '0';
+        int year = 1000 * y1 + 100 * y2 + 10 * y3 + y4;
+        position++; // skip '-'
+        int m1 = dateString.charAt(position++) - '0';
+        int m2 = dateString.charAt(position++) - '0';
+        int month = 10 * m1 + m2;
+        position++; // skip '-'
+        int d1 = dateString.charAt(position++) - '0';
+        int d2 = dateString.charAt(position++) - '0';
+        int day = 10 * d1 + d2;
+        position++; // skip 'T'
+        int h1 = dateString.charAt(position++) - '0';
+        int h2 = dateString.charAt(position++) - '0';
+        int hour = 10 * h1 + h2;
+        position++; // skip ':'
+        int min1 = dateString.charAt(position++) - '0';
+        int min2 = dateString.charAt(position++) - '0';
+        int minutes = 10 * min1 + min2;
+        position++; // skip ':'
+        int s1 = dateString.charAt(position++) - '0';
+        int s2 = dateString.charAt(position++) - '0';
+        int secs = 10 * s1 + s2;
+        Calendar resultCalendar = new GregorianCalendar(year, month - 1, day,
+                hour, minutes, secs);
+        resultCalendar.setTimeZone(utcTZ);
+        char afterSecChar = dateString.charAt(position++);
+        int msecs = 0;
+        char tzd1;
+        if (afterSecChar == '.') {
+            int startPos = position;
+            //read decimal part, this is till there is a 'Z', a '+' or a '-'
+            char nextChar = dateString.charAt(position++);
+            while ((nextChar != 'Z') && (nextChar != '-') && (nextChar != '+')) {
+                msecs += (nextChar - '0')*Math.pow(10, 3+startPos-position);
+                nextChar = dateString.charAt(position++);
+            }
+            tzd1 = nextChar;
+        } else {
+            tzd1 = afterSecChar;
+        }
+        long timeInMillis = resultCalendar.getTimeInMillis() + msecs;
+        if (tzd1 != 'Z') {
+            int htz1 = dateString.charAt(position++) - '0';
+            int htz2 = dateString.charAt(position++) - '0';
+            int hourtz = 10 * htz1 + htz2;
+            position++; // skip ':'
+            int mintz1 = dateString.charAt(position++) - '0';
+            int mintz2 = dateString.charAt(position++) - '0';
+            int minutestz = 10 * mintz1 + mintz2;
+            int offSetInMillis = (hourtz * 60 + minutestz) * 60000;
+            if (tzd1 == '+') {
+                timeInMillis -= offSetInMillis;
+            } else {
+                timeInMillis += offSetInMillis;
+            }
+        }
+        parsePos.setIndex(position);
+        return new Date(timeInMillis);
+
+    }
+}
+
+/*
+ * (c) Copyright 2005, 2006 Hewlett-Packard Development Company, LP All rights
+ * reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
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));
+    }
+    
+}
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/graph/SimpleGraphTest.java
similarity index 98%
rename from api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/graph/SimpleGraphTest.java
index ff3280d..cdfadab 100644
--- 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/graph/SimpleGraphTest.java
@@ -16,12 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+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;
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;
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;
 
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/literal/PlainLiteralImplTest.java
similarity index 96%
rename from api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/literal/PlainLiteralImplTest.java
index ff6e678..ff55388 100644
--- 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/literal/PlainLiteralImplTest.java
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.api.impl.simple;
+package org.apache.clerezza.api.impl.literal;
 
-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
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/literal/TripleImplTest.java
similarity index 96%
rename from api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TripleImplTest.java
index 9b38af9..99e59ce 100644
--- 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/literal/TripleImplTest.java
@@ -30,7 +30,7 @@ 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.literal.PlainLiteralImpl;
 import org.apache.clerezza.api.impl.TripleImpl;
 import org.junit.Test;
 import junit.framework.Assert;
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/literal/TypedLiteralImplTest.java
similarity index 97%
rename from api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/literal/TypedLiteralImplTest.java
index dbde617..8589c4e 100644
--- 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/literal/TypedLiteralImplTest.java
@@ -19,7 +19,7 @@
 package org.apache.clerezza.api.impl.simple;
 
 import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.TypedLiteralImpl;
+import org.apache.clerezza.api.impl.literal.TypedLiteralImpl;
 import org.junit.Test;
 import junit.framework.Assert;
 


[clerezza] 28/45: CLEREZZA-1037: Move utils from rdf module to api.utils module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 334c046f90bc904f4f051cebf2488f3c6220f866
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 07:05:28 2019 +0100

    CLEREZZA-1037: Move utils from rdf module to api.utils module
---
 api.utils/pom.xml                                  |  75 +++
 .../org/apache/clerezza/api/utils/GraphNode.java   | 720 +++++++++++++++++++++
 .../org/apache/clerezza/api/utils/GraphUtils.java  | 158 +++++
 .../org/apache/clerezza/api/utils/IRIUtil.java     |  62 ++
 .../org/apache/clerezza/api/utils/RdfList.java     | 350 ++++++++++
 .../apache/clerezza/api/utils/SeeAlsoExpander.java | 113 ++++
 .../org/apache/clerezza/api/utils/Smusher.java     |  61 ++
 .../org/apache/clerezza/api/utils/UnionGraph.java  | 279 ++++++++
 .../clerezza/api/utils/UnionWatchableGraph.java    |  57 ++
 .../clerezza/api/utils/UriMutatingGraph.java       | 217 +++++++
 .../utils/graphnodeprovider/GraphNodeProvider.java |  51 ++
 .../clerezza/api/utils/smushing/BaseSmusher.java   | 130 ++++
 .../clerezza/api/utils/smushing/IfpSmusher.java    | 165 +++++
 .../clerezza/api/utils/smushing/SameAsSmusher.java | 109 ++++
 .../apache/clerezza/api/utils/GraphUtilsTest.java  | 103 +++
 .../apache/clerezza/api/utils/IfpSmushTest.java    | 115 ++++
 .../org/apache/clerezza/api/utils/RdfListTest.java | 182 ++++++
 .../apache/clerezza/api/utils/SameAsSmushTest.java |  77 +++
 .../apache/clerezza/api/utils/TestGraphNode.java   | 266 ++++++++
 .../apache/clerezza/api/utils/UnionGraphTest.java  |  79 +++
 .../api/utils/smushing/SameAsSmushTest.java        |  91 +++
 21 files changed, 3460 insertions(+)

diff --git a/api.utils/pom.xml b/api.utils/pom.xml
new file mode 100644
index 0000000..e67e3be
--- /dev/null
+++ b/api.utils/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
+        <version>8-SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>api.utils</artifactId>
+    <packaging>bundle</packaging>
+    <version>8-SNAPSHOT</version>
+    <name>Clerezza - API Utilities</name>
+    <description>Utility classes to work with Clerezza API</description>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>representation</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>dataset</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>ontologies</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>test.utils</artifactId>
+            <version>8-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java
new file mode 100644
index 0000000..bedf30d
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java
@@ -0,0 +1,720 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.LiteralFactory;
+
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * This class represents a node in the context of a graph. It provides
+ * utility methods to explore and modify its neighbourhood. The method
+ * modifying the graph will throw an {@link UnsupportedOperationException}
+ * it the underlying Graph in immutable (i.e. is a {@link ImmutableGraph}.
+ *
+ * @since 0.2
+ * @author reto, mir
+ */
+public class GraphNode {
+
+    private final RDFTerm resource;
+    private final Graph graph;
+
+    /**
+     * Create a GraphNode representing resource within graph.
+     *
+     * @param resource the resource this GraphNode represents
+     * @param graph the Graph that describes the resource
+     */
+    public GraphNode(RDFTerm resource, Graph graph) {
+        if (resource == null) {
+            throw new IllegalArgumentException("resource may not be null");
+        }
+        if (graph == null) {
+            throw new IllegalArgumentException("graph may not be null");
+        }
+        this.resource = resource;
+        this.graph = graph;
+    }
+
+    /**
+     * Gets the graph the node represented by this instance is in
+     *
+     * @return the graph of this GraphNode
+     */
+    public Graph getGraph() {
+        return graph;
+    }
+
+    /**
+     * Gets the unwrapped node
+     *
+     * @return the node represented by this GraphNode
+     */
+    public RDFTerm getNode() {
+        return resource;
+    }
+
+    /**
+     * Deletes the context of a node
+     * @see getNodeContext()
+     */
+    public void deleteNodeContext() {
+        for (Triple triple : getNodeContext()) {
+            graph.remove(triple);
+        }
+    }
+
+    /**
+     * The context of a node are the triples containing a node
+     * as subject or object and recursively the context of the b-nodes in any
+     * of these statements.
+     *
+     * The triples in the ImmutableGraph returned by this method contain the same bnode
+     * instances as in the original graph.
+     *
+     * @return the context of the node represented by the instance
+     */
+    public ImmutableGraph getNodeContext() {
+        Lock l = readLock();
+        l.lock();
+        try {
+            final HashSet<RDFTerm> dontExpand = new HashSet<RDFTerm>();
+            dontExpand.add(resource);
+            if (resource instanceof IRI) {
+                return getContextOf((IRI) resource, dontExpand).getImmutableGraph();
+            }
+            return getContextOf(resource, dontExpand).getImmutableGraph();
+        } finally {
+            l.unlock();
+        }
+
+    }
+
+    private Graph getContextOf(IRI node, final Set<RDFTerm> dontExpand) {
+        final String uriPrefix = node.getUnicodeString()+'#';
+        return getContextOf(node, dontExpand, new Acceptor() {
+
+            @Override
+            public boolean expand(RDFTerm resource) {
+                if (resource instanceof BlankNode) {
+                    return true;
+                }
+                if (resource instanceof IRI) {
+                    return ((IRI)resource).getUnicodeString().startsWith(uriPrefix);
+                }
+                return false;
+            }
+        });
+    }
+
+    /**
+     * Returns the context of a <code>BlankNodeOrIRI</code>
+     *
+     * @param node
+     * @param dontExpand a list of bnodes at which to stop expansion, if node
+     * is a BlankNode it should be contained (potentially faster)
+     * @return the context of a node
+     */
+    private Graph getContextOf(RDFTerm node, final Set<RDFTerm> dontExpand) {
+        return getContextOf(node, dontExpand, new Acceptor() {
+
+            @Override
+            public boolean expand(RDFTerm resource) {
+                if (resource instanceof BlankNode) {
+                    return true;
+                }
+                return false;
+            }
+        });
+    }
+
+    private interface Acceptor {
+        boolean expand(RDFTerm resource);
+    }
+    private Graph getContextOf(RDFTerm node, final Set<RDFTerm> dontExpand, Acceptor acceptor) {
+        Graph result = new SimpleGraph();
+        if (node instanceof BlankNodeOrIRI) {
+            Iterator<Triple> forwardProperties = graph.filter((BlankNodeOrIRI) node, null, null);
+            while (forwardProperties.hasNext()) {
+                Triple triple = forwardProperties.next();
+                result.add(triple);
+                RDFTerm object = triple.getObject();
+                if (acceptor.expand(object) && !dontExpand.contains(object)) {
+                    dontExpand.add(object);
+                    result.addAll(getContextOf(object, dontExpand, acceptor));
+                }
+            }
+        }
+        Iterator<Triple> backwardProperties = graph.filter(null, null, node);
+        while (backwardProperties.hasNext()) {
+            Triple triple = backwardProperties.next();
+            result.add(triple);
+            BlankNodeOrIRI subject = triple.getSubject();
+            if (acceptor.expand(subject) && !dontExpand.contains(subject)) {
+                dontExpand.add(subject);
+                result.addAll(getContextOf(subject, dontExpand, acceptor));
+            }
+        }
+        return result;
+    }
+
+    private <T> Iterator<T> getTypeSelectedObjects(IRI property, final Class<T> type) {
+        final Iterator<RDFTerm> objects = getObjects(property);
+        return new Iterator<T>() {
+
+            T next = prepareNext();
+
+            @Override
+            public boolean hasNext() {
+                return next != null;
+            }
+
+            @Override
+            public T next() {
+                T result = next;
+                next = prepareNext();
+                return result;
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            private T prepareNext() {
+                while (objects.hasNext()) {
+                    RDFTerm nextObject = objects.next();
+                    if (type.isAssignableFrom(nextObject.getClass())) {
+                        return (T) nextObject;
+                    }
+                }
+                return null;
+            }
+        };
+    }
+
+    public Iterator<Literal> getLiterals(IRI property) {
+        final Iterator<RDFTerm> objects = getObjects(property);
+        return new Iterator<Literal>() {
+
+            Literal next = prepareNext();
+
+            @Override
+            public boolean hasNext() {
+                return next != null;
+            }
+
+            @Override
+            public Literal next() {
+                Literal result = next;
+                next = prepareNext();
+                return result;
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            private Literal prepareNext() {
+                while (objects.hasNext()) {
+                    RDFTerm nextObject = objects.next();
+                    if (nextObject instanceof Literal) {
+                        return (Literal) nextObject;
+                    }
+                }
+                return null;
+            }
+        };
+    }
+
+    /**
+     * Count the number of triples in the underlying triple-collection
+     * with this node as subject and a specified property as predicate.
+     *
+     * @param property the property to be examined
+     * @return the number of triples in the underlying triple-collection
+     *        which meet the specified condition
+     */
+    public int countObjects(IRI property) {
+        return countTriples(graph.filter((BlankNodeOrIRI) resource, property, null));
+    }
+
+    private int countTriples(final Iterator<Triple> triples) {
+        int count = 0;
+        while (triples.hasNext()) {
+            triples.next();
+            count++;
+        }
+        return count;
+    }
+
+    /**
+     * Get the objects of statements with this node as subject and a specified
+     * property as predicate.
+     *
+     * @param property the property
+     * @return
+     */
+    public Iterator<RDFTerm> getObjects(IRI property) {
+        if (resource instanceof BlankNodeOrIRI) {
+            final Iterator<Triple> triples = graph.filter((BlankNodeOrIRI) resource, property, null);
+            return new Iterator<RDFTerm>() {
+
+                @Override
+                public boolean hasNext() {
+                    return triples.hasNext();
+                }
+
+                @Override
+                public RDFTerm next() {
+                    final Triple triple = triples.next();
+                    if (triple != null) {
+                        return triple.getObject();
+                    } else {
+                        return null;
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+            };
+        } else {
+            return new Iterator<RDFTerm>() {
+
+                @Override
+                public boolean hasNext() {
+                    return false;
+                }
+
+                @Override
+                public RDFTerm next() {
+                    return null;
+                }
+
+                @Override
+                public void remove() {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+            };
+        }
+    }
+
+    /**
+     * Checks wether this node has the given property with the given value.
+     * If the given value is null, then it is checked if this node has the
+     * specified property regardless of its value.
+     *
+     * @param property
+     * @param object
+     * @return true if the node represented by this object is the subject of a
+     *         statement with the given prediate and object, false otherwise
+     */
+    public boolean hasProperty(IRI property, RDFTerm object) {
+        Lock l = readLock();
+        l.lock();
+        try {
+            Iterator<RDFTerm> objects = getObjects(property);
+            if (object == null) {
+                return objects.hasNext();
+            }
+            while (objects.hasNext()) {
+                if (objects.next().equals(object)) {
+                    return true;
+                }
+            }
+            return false;
+        } finally {
+            l.unlock();
+        }
+    }
+
+    /**
+     * Count the number of triples in the underlying triple-collection
+     * with this node as object and a specified property as predicate.
+     *
+     * @param property the property to be examined
+     * @return the number of triples in the underlying triple-collection
+     *        which meet the specified condition
+     */
+    public int countSubjects(IRI property) {
+        Lock l = readLock();
+        l.lock();
+        try {
+            return countTriples(graph.filter(null, property, resource));
+        } finally {
+            l.unlock();
+        }
+    }
+
+    /**
+     * Get the subjects of statements with this node as object and a specified
+     * property as predicate.
+     *
+     * @param property the property
+     * @return
+     */
+    public Iterator<BlankNodeOrIRI> getSubjects(IRI property) {
+        final Iterator<Triple> triples = graph.filter(null, property, resource);
+        return new Iterator<BlankNodeOrIRI>() {
+
+            @Override
+            public boolean hasNext() {
+                return triples.hasNext();
+            }
+
+            @Override
+            public BlankNodeOrIRI next() {
+                return triples.next().getSubject();
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        };
+    }
+
+    public Iterator<IRI> getIRIObjects(IRI property) {
+        return getTypeSelectedObjects(property, IRI.class);
+
+    }
+
+    /**
+     * Get all available properties as an {@link Iterator}<{@link IRI}>.
+     * You can use <code>getObjects(IRI property)</code> to get the values of
+     * each property
+     *
+     * @return an iterator over properties of this node
+     */
+    public Iterator<IRI> getProperties() {
+        if (resource instanceof BlankNodeOrIRI) {
+            final Iterator<Triple> triples = graph.filter((BlankNodeOrIRI) resource, null, null);
+            return getUniquePredicates(triples);
+        } else {
+            return new Iterator<IRI>() {
+
+                @Override
+                public boolean hasNext() {
+                    return false;
+                }
+
+                @Override
+                public IRI next() {
+                    return null;
+                }
+
+                @Override
+                public void remove() {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+            };
+        }
+    }
+
+    /**
+     * Get all inverse properties as an {@link Iterator}<{@link IRI}>.
+     * You can use <code>getSubject(IRI property)</code> to get the values of
+     * each inverse property
+     *
+     * @return an iterator over properties pointing to this node
+     */
+    public Iterator<IRI> getInverseProperties() {
+        final Iterator<Triple> triples = graph.filter(null, null, resource);
+        return getUniquePredicates(triples);
+    }
+
+    /**
+     *
+     * @param triples
+     * @returnan {@link Iterator}<{@link IRI}> containing the predicates from
+     * an {@link Iterator}<{@link Triple}>
+     */
+    private Iterator<IRI> getUniquePredicates(final Iterator<Triple> triples) {
+        final Set<IRI> resultSet = new HashSet<IRI>();
+        while (triples.hasNext()) {
+            resultSet.add(triples.next().getPredicate());
+        }
+        return resultSet.iterator();
+    }
+
+    /**
+     * Adds a property to the node with the specified predicate and object
+     *
+     * @param predicate
+     * @param object
+     */
+    public void addProperty(IRI predicate, RDFTerm object) {
+        if (resource instanceof BlankNodeOrIRI) {
+            graph.add(new TripleImpl((BlankNodeOrIRI) resource, predicate, object));
+        } else {
+            throw new RuntimeException("Literals cannot be the subject of a statement");
+        }
+    }
+
+
+    /**
+     * Coverts the value into a typed literals and sets it as object of the
+     * specified property
+     *
+     * @param property the predicate of the triple to be created
+     * @param value the value of the typed literal object
+     */
+    public void addPropertyValue(IRI property, Object value) {
+        addProperty(property,
+                LiteralFactory.getInstance().createTypedLiteral(value));
+    }
+
+    /**
+     * Adds a property to the node with the inverse of the specified predicate and object
+     * In other words <code>subject</code> will be related via the property <code>relation</code> to this node.
+     *
+     * @param predicate
+     * @param subject
+     */
+    public void addInverseProperty(IRI predicate, RDFTerm subject) {
+        if (subject instanceof BlankNodeOrIRI) {
+            graph.add(new TripleImpl((BlankNodeOrIRI) subject, predicate, resource));
+        } else {
+            throw new RuntimeException("Literals cannot be the subject of a statement");
+        }
+    }
+
+
+    /**
+     * creates and returns an <code>RdfList</code> for the node and
+     * Graph represented by this object.
+     *
+     * @return a List to easy access the rdf:List represented by this node
+     */
+    public List<RDFTerm> asList() {
+        if (resource instanceof BlankNodeOrIRI) {
+            return new RdfList((BlankNodeOrIRI) resource, graph);
+        } else {
+            throw new RuntimeException("Literals cannot be the subject of a List");
+        }
+    }
+
+    /**
+     * Deletes all statement with the current node as subject and the specified
+     * predicate
+     *
+     * @param predicate
+     */
+    public void deleteProperties(IRI predicate) {
+        if (resource instanceof BlankNodeOrIRI) {
+            Iterator<Triple> tripleIter = graph.filter((BlankNodeOrIRI) resource, predicate, null);
+            Collection<Triple> toDelete = new ArrayList<Triple>();
+            while (tripleIter.hasNext()) {
+                Triple triple = tripleIter.next();
+                toDelete.add(triple);
+            }
+            for (Triple triple : toDelete) {
+                graph.remove(triple);
+            }
+        }
+    }
+
+    /**
+     * Delete property to the node with the specified predicate and object
+     *
+     * @param predicate
+     * @param object
+     */
+    public void deleteProperty(IRI predicate, RDFTerm object) {
+        if (resource instanceof BlankNodeOrIRI) {
+            graph.remove(new TripleImpl((BlankNodeOrIRI) resource, predicate, object));
+        }
+    }
+
+    @Override
+    public String toString() {
+        return resource.toString();
+    }
+
+    /**
+     * Replaces the graph node resouce with the specified <code>BlankNodeOrIRI</code>.
+     * The resource is only replaced where it is either subject or object.
+     * @param replacement
+     * @return a GraphNode representing the replecement node
+     */
+    public GraphNode replaceWith(BlankNodeOrIRI replacement) {
+        return replaceWith(replacement, false);
+    }
+
+    /**
+     * Replaces the graph node resouce with the specified <code>BlankNodeOrIRI</code>.
+     * Over the boolean <code>checkPredicate</code> it can be specified if the
+     * resource should also be replaced where it is used as predicate.
+     * @param replacement
+     * @param checkPredicates
+     * @return a GraphNode representing the replecement node
+     */
+    public GraphNode replaceWith(BlankNodeOrIRI replacement, boolean checkPredicates) {
+        Graph newTriples = new SimpleGraph();
+        if (!(resource instanceof Literal)) {
+            Iterator<Triple> subjectTriples = graph.filter((BlankNodeOrIRI) resource, null,
+                    null);
+            while (subjectTriples.hasNext()) {
+                Triple triple = subjectTriples.next();
+                Triple newTriple = new TripleImpl(replacement, triple.getPredicate(),
+                        triple.getObject());
+                subjectTriples.remove();
+                newTriples.add(newTriple);
+            }
+            graph.addAll(newTriples);
+            newTriples.clear();
+        }
+
+        Iterator<Triple> objectTriples = graph.filter(null, null, resource);
+        while (objectTriples.hasNext()) {
+            Triple triple = objectTriples.next();
+            Triple newTriple = new TripleImpl(triple.getSubject(),
+                    triple.getPredicate(), replacement);
+            objectTriples.remove();
+            newTriples.add(newTriple);
+        }
+        graph.addAll(newTriples);
+        newTriples.clear();
+
+        if (checkPredicates && replacement instanceof IRI
+                && resource instanceof IRI) {
+            Iterator<Triple> predicateTriples = graph.filter(null,
+                    (IRI) resource, null);
+            while (predicateTriples.hasNext()) {
+                Triple triple = predicateTriples.next();
+                Triple newTriple = new TripleImpl(triple.getSubject(),
+                        (IRI) replacement, triple.getObject());
+                predicateTriples.remove();
+                newTriples.add(newTriple);
+            }
+            graph.addAll(newTriples);
+        }
+        return new GraphNode(replacement, graph);
+    }
+
+    /**
+     * Returns a iterator containing all objects of the triples where this
+     * graph node is the subject and has the specified property. The objects
+     * are returned as <code>GraphNode</code>s.
+     *
+     * @param property
+     * @return
+     */
+    public Iterator<GraphNode> getObjectNodes(IRI property) {
+        final Iterator<RDFTerm> objects = this.getObjects(property);
+        return new Iterator<GraphNode>() {
+
+            @Override
+            public boolean hasNext() {
+                return objects.hasNext();
+            }
+
+            @Override
+            public GraphNode next() {
+                RDFTerm object = objects.next();
+                return new GraphNode(object, graph);
+
+            }
+
+            @Override
+            public void remove() {
+                objects.remove();
+            }
+        };
+    }
+
+    /**
+     * Returns a iterator containing all subjects of the triples where this
+     * graph node is the object and has the specified property. The subjects
+     * are returned as <code>GraphNode</code>s.
+     *
+     * @param property
+     * @return
+     */
+    public Iterator<GraphNode> getSubjectNodes(IRI property) {
+        final Iterator<BlankNodeOrIRI> subjects = this.getSubjects(property);
+        return new Iterator<GraphNode>() {
+
+            @Override
+            public boolean hasNext() {
+                return subjects.hasNext();
+            }
+
+            @Override
+            public GraphNode next() {
+                RDFTerm object = subjects.next();
+                return new GraphNode(object, graph);
+
+            }
+
+            @Override
+            public void remove() {
+                subjects.remove();
+            }
+        };
+    }
+
+    /**
+     *
+     * @param obj
+     * @return true if obj is an instance of the same class represening the same
+     * node in the same graph, subclasses may have different identity criteria.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj.getClass().equals(getClass()))) {
+            return false;
+        }
+        GraphNode other = (GraphNode) obj;
+        return getNode().equals(other.getNode())
+                && getGraph().equals(other.getGraph());
+    }
+
+    @Override
+    public int hashCode() {
+        return 13 * getNode().hashCode() + getGraph().hashCode();
+    }
+
+    /**
+     * @return a ReadLock if the underlying ImmutableGraph is a LockableGraph it returns its lock, otherwise null
+     */
+    public Lock readLock() {
+
+            return getGraph().getLock().readLock();
+
+    }
+
+    /**
+     *
+     * @return
+     */
+    public Lock writeLock() {
+
+            return (getGraph()).getLock().writeLock();
+
+    }
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java
new file mode 100644
index 0000000..51e25b1
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java
@@ -0,0 +1,158 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Utility methods to manipulate <code>Graph</code>s
+ *
+ * @author reto
+ */
+public class GraphUtils {
+
+    /**
+     * Removes a subGraph from an Graph. The subGraph must match a subgraph of
+     * Graph so that for every node in <code>subGraph</code>
+     * each triple it appears in is also present in <code>mGraph</code>. Two
+     * bnodes are considered equals if their contexts (as returned by
+     * <code>GraphNode.getNodeContext</code> are equals.
+     *
+     * @param mGraph
+     * @param subGraph
+     * @throws org.apache.clerezza.rdf.utils.GraphUtils.NoSuchSubGraphException
+     */
+    public static void removeSubGraph(Graph mGraph, Graph subGraph)
+            throws NoSuchSubGraphException {
+        //point to triples of mGraph that are to be removed (if something is removed)
+        final Set<Triple> removingTriples = new HashSet<Triple>();
+        //we first check only the grounded triples and put the non-grounded in here:
+        final Graph unGroundedTriples = new SimpleGraph();
+        for (Triple triple : subGraph) {
+            if (isGrounded(triple)) {
+                if (!mGraph.contains(triple)) {
+                    throw new NoSuchSubGraphException();
+                }
+                removingTriples.add(triple);
+            } else {
+                unGroundedTriples.add(triple);
+            }
+        }
+
+        //we first remove the context of bnodes we find in object position
+        OBJ_BNODE_LOOP: while (true) {
+            final Triple triple = getTripleWithBlankNodeObject(unGroundedTriples);
+            if (triple == null) {
+                break;
+            }
+            final GraphNode objectGN = new GraphNode(triple.getObject(), unGroundedTriples);
+            BlankNodeOrIRI subject = triple.getSubject();
+            ImmutableGraph context = objectGN.getNodeContext();
+            Iterator<Triple> potentialIter = mGraph.filter(subject, triple.getPredicate(), null);
+            while (potentialIter.hasNext()) {
+                try {
+                    final Triple potentialTriple = potentialIter.next();
+                    BlankNode potentialMatch = (BlankNode)potentialTriple.getObject();
+                    final ImmutableGraph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
+                    if (potentialContext.equals(context)) {
+                        removingTriples.addAll(potentialContext);
+                        unGroundedTriples.removeAll(context);
+                        continue OBJ_BNODE_LOOP;
+                    }
+                } catch (ClassCastException e) {
+                    continue;
+                }
+            }
+            throw new NoSuchSubGraphException();
+        }
+        SUBJ_BNODE_LOOP: while (true) {
+            final Triple triple = getTripleWithBlankNodeSubject(unGroundedTriples);
+            if (triple == null) {
+                break;
+            }
+            final GraphNode subjectGN = new GraphNode(triple.getSubject(), unGroundedTriples);
+            RDFTerm object = triple.getObject();
+            if (object instanceof BlankNode) {
+                object = null;
+            }
+            ImmutableGraph context = subjectGN.getNodeContext();
+            Iterator<Triple> potentialIter = mGraph.filter(null, triple.getPredicate(), object);
+            while (potentialIter.hasNext()) {
+                try {
+                    final Triple potentialTriple = potentialIter.next();
+                    BlankNode potentialMatch = (BlankNode)potentialTriple.getSubject();
+                    final ImmutableGraph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
+                    if (potentialContext.equals(context)) {
+                        removingTriples.addAll(potentialContext);
+                        unGroundedTriples.removeAll(context);
+                        continue SUBJ_BNODE_LOOP;
+                    }
+                } catch (ClassCastException e) {
+                    continue;
+                }
+            }
+            throw new NoSuchSubGraphException();
+        }
+        mGraph.removeAll(removingTriples);
+    }
+
+    private static boolean isGrounded(Triple triple) {
+        if (triple.getSubject() instanceof BlankNode) {
+            return false;
+        }
+        if (triple.getObject() instanceof BlankNode) {
+            return false;
+        }
+        return true;
+    }
+
+    /** retrun triples with a bnode only at object position
+     *
+     * @param triples
+     * @return
+     */
+    private static Triple getTripleWithBlankNodeObject(Graph triples) {
+        for (Triple triple : triples) {
+            if (triple.getSubject() instanceof BlankNode) {
+                continue;
+            }
+            if (triple.getObject() instanceof BlankNode) {
+                return triple;
+            }
+        }
+        return null;
+    }
+    private static Triple getTripleWithBlankNodeSubject(Graph triples) {
+        for (Triple triple : triples) {
+            if (triple.getSubject() instanceof BlankNode) {
+                return triple;
+            }
+        }
+        return null;
+    }
+
+    public static class NoSuchSubGraphException extends Exception {
+    }
+
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java
new file mode 100644
index 0000000..e233052
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java
@@ -0,0 +1,62 @@
+/*
+ * 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.utils;
+
+/**
+ * A utility class for IRI and String manipulations.
+ *
+ * @author tio
+ */
+public class IRIUtil {
+
+    /**
+     * Strips #x00 - #x1F and #x7F-#x9F from a Unicode string
+     * @see <a href="http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference">
+     * http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference</a> and
+     * replaces all US-ASCII space character with a "+".
+     *
+     * @param inputChars
+     * @return the stripped string
+     * 
+     */
+    public static String stripNonIRIChars(CharSequence inputChars) {
+
+        if (inputChars == null) {
+            return "";
+        }
+
+        StringBuffer buffer = new StringBuffer();
+
+        for (int i = 0; i < inputChars.length(); i++) {
+            char c = inputChars.charAt(i);
+
+            if (!isIllegal(c)) {
+                buffer.append(c);
+            }
+        }
+        return buffer.toString().replaceAll("\\s+", "+");
+    }
+
+    private static boolean isIllegal(char ch) {
+        if ((ch >= 0x7F) && (ch <= 0x9F)) {
+            return true;
+        }
+        return false;
+    }
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java
new file mode 100644
index 0000000..e3bdc34
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java
@@ -0,0 +1,350 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.ontologies.OWL;
+import org.apache.clerezza.ontologies.RDF;
+import org.apache.clerezza.representation.Serializer;
+import org.apache.clerezza.representation.SupportedFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileOutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.*;
+
+/**
+ * An implementation of an <code>java.util.List</code> backed by an RDF
+ * collection (rdf:List). The list allows modification that are reflected
+ * to the underlying <code>Graph</code>. It reads the data from the
+ * <code>Graph</code> when it is first needed, so changes to the
+ * Graph affecting the rdf:List may or may not have an effect on the
+ * values returned by instances of this class. For that reason only one
+ * instance of this class should be used for accessing an rdf:List of sublists
+ * thereof when the lists are being modified, having multiple lists exclusively
+ * for read operations (such as for immutable <code>Graph</code>s) is
+ * not problematic.
+ *
+ * @author rbn, mir
+ */
+public class RdfList extends AbstractList<RDFTerm> {
+
+    private static final Logger logger = LoggerFactory.getLogger(RdfList.class);
+
+    private final static IRI RDF_NIL =
+            new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+    /**
+     * a list of the linked rdf:List elements in order
+     */
+    private List<BlankNodeOrIRI> listList = new ArrayList<BlankNodeOrIRI>();
+    private List<RDFTerm> valueList = new ArrayList<RDFTerm>();
+    private BlankNodeOrIRI firstList;
+    private Graph tc;
+    private boolean totallyExpanded = false;
+
+    /**
+     * Get a list for the specified resource.
+     *
+     * If the list is modified using the created instance
+     * <code>listRDFTerm</code> will always be the first list.
+     *
+     * @param listRDFTerm
+     * @param tc
+     */
+    public RdfList(BlankNodeOrIRI listRDFTerm, Graph tc) {
+        firstList = listRDFTerm;
+        this.tc = tc;
+
+    }
+
+    /**
+     * Get a list for the specified resource node.
+     *
+     * @param listNode
+     */
+    public RdfList(GraphNode listNode) {
+        this((BlankNodeOrIRI)listNode.getNode(), listNode.getGraph());
+    }
+
+    /**
+     * Creates an empty RdfList by writing a triple
+     * "{@code listRDFTerm} owl:sameAs rdf.nil ." to {@code tc}.
+     *
+     * @param listRDFTerm
+     * @param tc
+     * @return    an empty rdf:List.
+     * @throws IllegalArgumentException
+     *        if the provided {@code  listRDFTerm} is a non-empty rdf:List.
+     */
+    public static RdfList createEmptyList(BlankNodeOrIRI listRDFTerm, Graph tc)
+            throws IllegalArgumentException {
+
+        if (!tc.filter(listRDFTerm, RDF.first, null).hasNext()) {
+            RdfList list = new RdfList(listRDFTerm, tc);
+            list.tc.add(new TripleImpl(listRDFTerm, OWL.sameAs, RDF_NIL));
+            return list;
+        } else {
+            throw new IllegalArgumentException(listRDFTerm + "is a non-empty rdf:List.");
+        }
+    }
+
+    private void expandTill(int pos) {
+        if (totallyExpanded) {
+            return;
+        }
+        BlankNodeOrIRI currentList;
+        if (listList.size() > 0) {
+            currentList = listList.get(listList.size()-1);
+        } else {
+            currentList = firstList;
+            if (!tc.filter(currentList, RDF.first, null).hasNext()) {
+                return;
+            }
+            listList.add(currentList);
+            valueList.add(getFirstEntry(currentList));
+        }
+        if (listList.size() >= pos) {
+            return;
+        }
+        while (true) {                
+            currentList = getRest(currentList);
+            if (currentList.equals(RDF_NIL)) {
+                totallyExpanded = true;
+                break;
+            }
+            if (listList.size() == pos) {
+                break;
+            }
+            valueList.add(getFirstEntry(currentList));
+            listList.add(currentList);
+        }
+    }
+
+
+
+    @Override
+    public RDFTerm get(int index) {
+        expandTill(index + 1);
+        return valueList.get(index);
+    }
+
+    @Override
+    public int size() {
+        expandTill(Integer.MAX_VALUE);        
+        return valueList.size();
+    }
+
+    @Override
+    public void add(int index, RDFTerm element) {
+        expandTill(index);
+        if (index == 0) {
+            //special casing to make sure the first list remains the same resource
+            if (listList.size() == 0) {
+                tc.remove(new TripleImpl(firstList, OWL.sameAs, RDF_NIL));
+                tc.add(new TripleImpl(firstList, RDF.rest, RDF_NIL));
+                tc.add(new TripleImpl(firstList, RDF.first, element));
+                listList.add(firstList);
+            } else {
+                tc.remove(new TripleImpl(listList.get(0), RDF.first, valueList.get(0)));
+                tc.add(new TripleImpl(listList.get(0), RDF.first, element));
+                addInRdfList(1, valueList.get(0));
+            }
+        } else {
+            addInRdfList(index, element);
+        }
+        valueList.add(index, element);
+    }
+    
+    /**
+     *
+     * @param index is > 0
+     * @param element
+     */
+    private void addInRdfList(int index, RDFTerm element) {
+        expandTill(index+1);
+        BlankNodeOrIRI newList = new BlankNode() {
+        };
+        tc.add(new TripleImpl(newList, RDF.first, element));
+        if (index < listList.size()) {
+            tc.add(new TripleImpl(newList, RDF.rest, listList.get(index)));
+            tc.remove(new TripleImpl(listList.get(index - 1), RDF.rest, listList.get(index)));
+        } else {
+            tc.remove(new TripleImpl(listList.get(index - 1), RDF.rest, RDF_NIL));
+            tc.add(new TripleImpl(newList, RDF.rest, RDF_NIL));
+
+        }
+        tc.add(new TripleImpl(listList.get(index - 1), RDF.rest, newList));
+        listList.add(index, newList);
+    }
+
+    @Override
+    public RDFTerm remove(int index) {
+        //keeping the first list resource
+        tc.remove(new TripleImpl(listList.get(index), RDF.first, valueList.get(index)));
+        if (index == (listList.size() - 1)) {
+            tc.remove(new TripleImpl(listList.get(index), RDF.rest, RDF_NIL));    
+            if (index > 0) {
+                tc.remove(new TripleImpl(listList.get(index - 1), RDF.rest, listList.get(index)));
+                tc.add(new TripleImpl(listList.get(index - 1), RDF.rest, RDF_NIL));
+            } else {
+                tc.add(new TripleImpl(listList.get(index), OWL.sameAs, RDF_NIL));
+            }
+            listList.remove(index);
+        } else {
+            tc.add(new TripleImpl(listList.get(index), RDF.first, valueList.get(index+1)));
+            tc.remove(new TripleImpl(listList.get(index), RDF.rest, listList.get(index + 1)));
+            tc.remove(new TripleImpl(listList.get(index + 1), RDF.first, valueList.get(index + 1)));
+            if (index == (listList.size() - 2)) {
+                tc.remove(new TripleImpl(listList.get(index + 1), RDF.rest, RDF_NIL));
+                tc.add(new TripleImpl(listList.get(index), RDF.rest, RDF_NIL));
+            } else {
+                tc.remove(new TripleImpl(listList.get(index + 1), RDF.rest, listList.get(index + 2)));
+                tc.add(new TripleImpl(listList.get(index), RDF.rest, listList.get(index + 2)));
+            }
+            listList.remove(index+1);
+        }
+        return valueList.remove(index);
+    }
+
+    private BlankNodeOrIRI getRest(BlankNodeOrIRI list) {
+        return (BlankNodeOrIRI) tc.filter(list, RDF.rest, null).next().getObject();
+    }
+
+    private RDFTerm getFirstEntry(final BlankNodeOrIRI listRDFTerm) {
+        try {
+            return tc.filter(listRDFTerm, RDF.first, null).next().getObject();
+        } catch (final NullPointerException e) {
+            RuntimeException runtimeEx = AccessController.doPrivileged(new PrivilegedAction<RuntimeException>() {
+                @Override
+                public RuntimeException run(){
+                    try {
+                        final FileOutputStream fileOutputStream = new FileOutputStream("/tmp/broken-list.nt");
+                        final GraphNode graphNode = new GraphNode(listRDFTerm, tc);
+                        Serializer.getInstance().serialize(fileOutputStream, graphNode.getNodeContext(), SupportedFormat.N_TRIPLE);
+                        fileOutputStream.flush();
+                        logger.warn("GraphNode: " + graphNode);
+                        final Iterator<IRI> properties = graphNode.getProperties();
+                        while (properties.hasNext()) {
+                            logger.warn("available: " + properties.next());
+                        }
+                        return new RuntimeException("broken list " + listRDFTerm, e);
+                    } catch (Exception ex) {
+                        return new RuntimeException(ex);
+                    }
+
+                }
+            });
+            throw runtimeEx;
+        }
+    }
+
+    public BlankNodeOrIRI getListRDFTerm() {
+        return firstList;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final RdfList other = (RdfList) obj;
+
+        if (!other.firstList.equals(this.firstList)) {
+            return false;
+        }
+
+        if (!other.tc.equals(this.tc)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return 17 * this.firstList.hashCode() + this.tc.hashCode();
+    }
+
+    /**
+     * Returns the rdf lists of which the specified <code>GraphNode</code> is
+     * an element of. Sublists of other lists are not returned.
+     *
+     * @param element
+     * @return
+     */
+    public static Set<RdfList> findContainingLists(GraphNode element) {
+        Set<GraphNode> listNodes = findContainingListNodes(element);
+        if (listNodes.isEmpty()) {
+            return null;
+        }
+
+        Set<RdfList> rdfLists = new HashSet<RdfList>();
+        for (Iterator<GraphNode> it = listNodes.iterator(); it.hasNext();) {
+            GraphNode listNode = it.next();
+            rdfLists.add(new RdfList(listNode));
+        }
+        return rdfLists;
+    }
+
+    /**
+     * Returns a set of <code>GraphNode</code>S which are the first list nodes (meaning
+     * they are not the beginning of a sublist) of the list containing the specified
+     * <code>GraphNode</code> as an element.
+     *
+     * @param element
+     * @return
+     */
+    public static Set<GraphNode> findContainingListNodes(GraphNode element) {
+        Iterator<GraphNode> partOfaListNodesIter = element.getSubjectNodes(RDF.first);
+        if (!partOfaListNodesIter.hasNext()) {
+            return null;
+        }
+        Set<GraphNode> listNodes = new HashSet<GraphNode>();
+
+        while (partOfaListNodesIter.hasNext()) {
+            listNodes.addAll(findAllListNodes(partOfaListNodesIter.next()));
+        }
+        return listNodes;
+    }
+    
+    private static Set<GraphNode> findAllListNodes(GraphNode listPart) {
+        Iterator<GraphNode> invRestNodesIter;
+        Set<GraphNode> listNodes = new HashSet<GraphNode>();
+        do {
+            invRestNodesIter = listPart.getSubjectNodes(RDF.rest);
+            if (invRestNodesIter.hasNext()) {
+                listPart = invRestNodesIter.next();
+                while (invRestNodesIter.hasNext()) {
+                    GraphNode graphNode = invRestNodesIter.next();
+                    listNodes.addAll(findAllListNodes(graphNode));
+                }
+            } else {
+                listNodes.add(listPart);
+                break;
+            }
+        } while (true);
+        return listNodes;
+    }
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java
new file mode 100644
index 0000000..2cf73cd
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java
@@ -0,0 +1,113 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManager;
+import org.apache.clerezza.ontologies.RDFS;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Expands a GraphNode expanding SeeAlso-References of the node.
+ *
+ * @author reto
+ */
+public class SeeAlsoExpander {
+    /**
+     * using TcManger instead of TcProvider as this ensures LockableGraphs
+     */
+    private final TcManager tcManager;
+    public SeeAlsoExpander(TcManager tcManager) {
+        this.tcManager = tcManager;
+
+    }
+
+    /**
+     * expands a node dereferencing its rdfs:seeAlso references using the
+     * tcManager associated to this instance. If the added TripleCollections
+     * also associate rdfs:seeAlso properties to node this are expanded till
+     * the maximum recursion depth specified.
+     *
+     * @param node the node to be expanded
+     * @param recursion the maximum recursion depth
+     * @return a new GraphNode over the union of the original and all expansion graphs
+     */
+    public GraphNode expand(GraphNode node, int recursion) {
+        Set<IRI> alreadyVisited = new HashSet();
+        Set<Graph> resultTripleCollections = new HashSet<Graph>();
+        resultTripleCollections.add(node.getGraph());
+        for (IRI uriRef : expand(node, alreadyVisited, recursion)) {
+            try {
+                resultTripleCollections.add(tcManager.getGraph(uriRef));
+            } catch (NoSuchEntityException e) {
+                //ignore
+            }
+        }
+        return new GraphNode(node.getNode(),
+                new UnionGraph(resultTripleCollections.toArray(
+                new Graph[resultTripleCollections.size()])));
+
+    }
+
+    private Set<IRI> getSeeAlsoObjectUris(GraphNode node) {
+        Set<IRI> result = new HashSet<IRI>();
+        Lock l = node.readLock();
+        l.lock();
+        try {
+            Iterator<RDFTerm> objects = node.getObjects(RDFS.seeAlso);
+            while (objects.hasNext()) {
+                RDFTerm next = objects.next();
+                if (next instanceof IRI) {
+                    result.add((IRI)next);
+                }
+            }
+        } finally {
+            l.unlock();
+        }
+        return result;
+    }
+
+    private Set<IRI> expand(GraphNode node, Set<IRI> alreadyVisited, int recursion) {
+        Set<IRI> rdfSeeAlsoTargets = getSeeAlsoObjectUris(node);
+        Set<IRI> result = new HashSet<IRI>();
+        result.addAll(rdfSeeAlsoTargets);
+        recursion++;
+        if (recursion > 0) {
+            rdfSeeAlsoTargets.removeAll(alreadyVisited);
+            alreadyVisited.addAll(rdfSeeAlsoTargets);
+            for (IRI target : rdfSeeAlsoTargets) {
+                try {
+                    result.addAll(expand(new GraphNode(node.getNode(),
+                        tcManager.getGraph(target)), alreadyVisited, recursion));
+                } catch (NoSuchEntityException e) {
+                    //ignore
+                }
+            }
+        }
+        return result;
+    }
+
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java
new file mode 100644
index 0000000..1dbb8f2
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java
@@ -0,0 +1,61 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.utils.smushing.IfpSmusher;
+import org.apache.clerezza.api.utils.smushing.SameAsSmusher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A utility to smush equivalent resources. For greater flexibility use the 
+ * classes in the smushing package.
+ * 
+ * @author reto
+ */
+public class Smusher {
+
+    static final Logger log = LoggerFactory.getLogger(Smusher.class);
+
+    /**
+     * smush mGaph given the ontological facts. Currently it does only one step
+     * ifp smushin, i.e. only ifps are taken in account and only nodes that have
+     * the same node as ifp object in the orignal graph are equates. (calling
+     * the method a second time might lead to additional smushings.)
+     *
+     * @param mGraph
+     * @param tBox
+     */
+    public static void smush(Graph mGraph, Graph tBox) {
+        new IfpSmusher().smush(mGraph, tBox);
+    }
+
+    /**
+     * Smushes the specified graph adding owl:sameAs statements pointing to the new canonical IRI
+     * 
+     * @param mGraph
+     * @param owlSameStatements 
+     */
+    public static void sameAsSmush(Graph mGraph, Graph owlSameStatements) {
+        new SameAsSmusher().smush(mGraph, owlSameStatements, true);
+    }
+
+
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java
new file mode 100644
index 0000000..3f939ce
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java
@@ -0,0 +1,279 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.graph.AbstractGraph;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ *
+ * This class represents the union of multiple triple collections. A UnionGraph
+ * appears like a merge of the different graphs (see.
+ * http://www.w3.org/TR/rdf-mt/#graphdefs).
+ *
+ * @author hasan
+ */
+public class UnionGraph extends AbstractGraph {
+
+    protected Graph[] baseTripleCollections;
+    private Lock readLock;
+    private Lock writeLock;
+
+    /**
+     * Constructs a UnionGraph over the specified baseTripleCollections. Write
+     * and delete operations are forwarded to the first baseTripleCollections.
+     *
+     * @param baseTripleCollections the baseTripleCollections
+     */
+    public UnionGraph(Graph... baseTripleCollections) {
+        this.baseTripleCollections = baseTripleCollections;
+        readLock = getPartialReadLock(0);
+        writeLock = createWriteLock();
+    }
+
+    @Override
+    public int performSize() {
+        int size = 0;
+        for (Graph graph : baseTripleCollections) {
+            size += graph.size();
+        }
+        return size;
+    }
+
+    @Override
+    public Iterator<Triple> performFilter(final BlankNodeOrIRI subject,
+            final IRI predicate, final RDFTerm object) {
+        if (baseTripleCollections.length == 0) {
+            return new HashSet<Triple>(0).iterator();
+        }
+        return new Iterator<Triple>() {
+
+            int currentBaseTC = 0;
+            Iterator<Triple> currentBaseIter = baseTripleCollections[0].filter(
+                    subject, predicate, object);
+            private Triple lastReturned;
+
+            @Override
+            public boolean hasNext() {
+                if (currentBaseIter.hasNext()) {
+                    return true;
+                }
+                if (currentBaseTC == baseTripleCollections.length - 1) {
+                    return false;
+                }
+                currentBaseTC++;
+                currentBaseIter = baseTripleCollections[currentBaseTC].filter(
+                        subject, predicate, object);
+                return hasNext();
+            }
+
+            @Override
+            public Triple next() {
+                lastReturned = hasNext() ? currentBaseIter.next() : null;
+                return lastReturned;
+            }
+
+            @Override
+            public void remove() {
+                if (lastReturned == null) {
+                    throw new IllegalStateException();
+                }
+                if (currentBaseTC == 0) {
+                    currentBaseIter.remove();
+                }
+                lastReturned = null;
+            }
+        };
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        if (baseTripleCollections.length == 0) {
+            throw new RuntimeException("no base graph for adding triples");
+        }
+        return baseTripleCollections[0].add(e);
+    }
+
+    @Override
+    public boolean remove(Object e) {
+        if (baseTripleCollections.length == 0) {
+            throw new RuntimeException("no base graph for removing triples");
+        }
+        return baseTripleCollections[0].remove(e);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj.getClass().equals(getClass()))) {
+            return false;
+        }
+        UnionGraph other = (UnionGraph) obj;
+        Set<Graph> otherGraphs
+                = new HashSet(Arrays.asList(other.baseTripleCollections));
+        Set<Graph> thisGraphs
+                = new HashSet(Arrays.asList(baseTripleCollections));
+        return thisGraphs.equals(otherGraphs)
+                && baseTripleCollections[0].equals(other.baseTripleCollections[0]);
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        for (Graph graph : baseTripleCollections) {
+            hash += graph.hashCode();
+        }
+        hash *= baseTripleCollections[0].hashCode();
+        return hash;
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return readWriteLock;
+    }
+    private ReadWriteLock readWriteLock = new ReadWriteLock() {
+
+        @Override
+        public Lock readLock() {
+            return readLock;
+        }
+
+        @Override
+        public Lock writeLock() {
+            return writeLock;
+        }
+    };
+
+    private Lock getPartialReadLock(int startPos) {
+        ArrayList<Lock> resultList = new ArrayList<Lock>();
+        for (int i = startPos; i < baseTripleCollections.length; i++) {
+            Graph graph = baseTripleCollections[i];
+
+            final Lock lock = graph.getLock().readLock();
+            resultList.add(lock);
+        }
+        return new UnionLock(resultList.toArray(new Lock[resultList.size()]));
+    }
+
+    private Lock createWriteLock() {
+        Lock partialReadLock = getPartialReadLock(1);
+
+        Lock baseWriteLock
+                = (baseTripleCollections[0]).getLock().writeLock();
+        return new UnionLock(baseWriteLock, partialReadLock);
+
+    }
+
+    ;
+
+
+    private static class UnionLock implements Lock {
+
+        Lock[] locks;
+
+        public UnionLock(Lock... locks) {
+            this.locks = locks;
+        }
+
+        @Override
+        public void lock() {
+            boolean isLocked = false;
+            while (!isLocked) {
+                try {
+                    isLocked = tryLock(10000, TimeUnit.NANOSECONDS);
+                } catch (InterruptedException ex) {
+
+                }
+            }
+        }
+
+        @Override
+        public void lockInterruptibly() throws InterruptedException {
+            Set<Lock> aquiredLocks = new HashSet<Lock>();
+            try {
+                for (Lock lock : locks) {
+                    lock.lockInterruptibly();
+                    aquiredLocks.add(lock);
+                }
+            } catch (InterruptedException e) {
+                for (Lock lock : aquiredLocks) {
+                    lock.unlock();
+                }
+                throw e;
+            }
+        }
+
+        @Override
+        public boolean tryLock() {
+            Set<Lock> aquiredLocks = new HashSet<Lock>();
+            for (Lock lock : locks) {
+                if (!lock.tryLock()) {
+                    for (Lock aquiredLock : aquiredLocks) {
+                        aquiredLock.unlock();
+                    }
+                    return false;
+                }
+                aquiredLocks.add(lock);
+            }
+            return true;
+        }
+
+        @Override
+        public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+            Set<Lock> aquiredLocks = new HashSet<Lock>();
+            long timeInNanos = unit.convert(time, TimeUnit.NANOSECONDS);
+            long startTime = System.nanoTime();
+            try {
+                for (Lock lock : locks) {
+                    if (!lock.tryLock((timeInNanos + startTime) - System.nanoTime(),
+                            TimeUnit.NANOSECONDS)) {
+                        for (Lock aquiredLock : aquiredLocks) {
+                            aquiredLock.unlock();
+                        }
+                        return false;
+                    }
+                    aquiredLocks.add(lock);
+                }
+            } catch (InterruptedException e) {
+                for (Lock lock : aquiredLocks) {
+                    lock.unlock();
+                }
+                throw e;
+            }
+            return true;
+        }
+
+        @Override
+        public void unlock() {
+            for (Lock lock : locks) {
+                lock.unlock();
+            }
+        }
+
+        @Override
+        public Condition newCondition() {
+            throw new UnsupportedOperationException("Conditions not supported.");
+        }
+    }
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java
new file mode 100644
index 0000000..81b2dbf
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.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.clerezza.api.utils;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.WatchableGraph;
+import org.apache.clerezza.api.event.FilterTriple;
+import org.apache.clerezza.api.event.GraphListener;
+
+/**
+ *
+ * @author developer
+ */
+public class UnionWatchableGraph extends UnionGraph implements WatchableGraph {
+    
+    public UnionWatchableGraph(WatchableGraph... baseTripleCollections) {
+        super(baseTripleCollections);
+    }
+        @Override
+    public void addGraphListener(GraphListener listener, FilterTriple filter) {
+        for (Graph graph : baseTripleCollections) {
+            ((WatchableGraph)graph).addGraphListener(listener, filter);
+        }
+    }
+
+    @Override
+    public void addGraphListener(GraphListener listener, FilterTriple filter, long delay) {
+        for (Graph graph : baseTripleCollections) {
+            ((WatchableGraph)graph).addGraphListener(listener, filter, delay);
+        }
+    }
+
+    @Override
+    public void removeGraphListener(GraphListener listener) {
+        for (Graph graph : baseTripleCollections) {
+            ((WatchableGraph)graph).removeGraphListener(listener);
+        }
+    }
+
+    
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java
new file mode 100644
index 0000000..0c6871c
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java
@@ -0,0 +1,217 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleImmutableGraph;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ * This wrapps a Triplecollection changing a prefix for the IRIs contained
+ * in subject or object position.
+ *
+ * Currently it only supports read opearations.
+ *
+ * @author reto
+ */
+public class UriMutatingGraph implements Graph {
+
+    private final Graph base;
+    private final String sourcePrefix;
+    private final String targetPrefix;
+    private final int sourcePrefixLength;
+    private final int targetPrefixLength;
+
+    public UriMutatingGraph(Graph base, String sourcePrefix,
+            String targetPrefix) {
+        this.base = base;
+        this.sourcePrefix = sourcePrefix;
+        sourcePrefixLength= sourcePrefix.length();
+        this.targetPrefix = targetPrefix;
+        targetPrefixLength= targetPrefix.length();
+    }
+
+    private <R extends RDFTerm> R toTargetRDFTerm(final R sourceRDFTerm) {
+        if (sourceRDFTerm instanceof IRI) {
+            final IRI sourceIRI = (IRI) sourceRDFTerm;
+            if (sourceIRI.getUnicodeString().startsWith(sourcePrefix)) {
+                final String uriRest = sourceIRI.getUnicodeString()
+                        .substring(sourcePrefixLength);
+                return (R) new IRI(targetPrefix+uriRest);
+            }
+        }
+        return sourceRDFTerm;            
+    }
+
+    private Triple toTargetTriple(Triple triple) {
+        if (triple == null) {
+            return null;
+        }
+        return new TripleImpl(toTargetRDFTerm(triple.getSubject()),
+                triple.getPredicate(), toTargetRDFTerm(triple.getObject()));
+    }
+
+    private <R extends RDFTerm> R toSourceRDFTerm(final R targetRDFTerm) {
+        if (targetRDFTerm instanceof IRI) {
+            final IRI sourceIRI = (IRI) targetRDFTerm;
+            if (sourceIRI.getUnicodeString().startsWith(targetPrefix)) {
+                final String uriRest = sourceIRI.getUnicodeString()
+                        .substring(targetPrefixLength);
+                return (R) new IRI(sourcePrefix+uriRest);
+            }
+        }
+        return targetRDFTerm;
+    }
+
+    private Triple toSourceTriple(Triple triple) {
+        if (triple == null) {
+            return null;
+        }
+        return new TripleImpl(toSourceRDFTerm(triple.getSubject()),
+                triple.getPredicate(), toSourceRDFTerm(triple.getObject()));
+    }
+
+    @Override
+    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        final Iterator<Triple> baseIter = base.filter(toSourceRDFTerm(subject),
+                predicate, toSourceRDFTerm(object));
+        return new WrappedIteraror(baseIter);
+
+
+    }
+
+
+    @Override
+    public int size() {
+        return base.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return base.isEmpty();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        return base.contains(toSourceTriple((Triple)o));
+    }
+
+    @Override
+    public Iterator<Triple> iterator() {
+        return filter(null, null, null);
+    }
+
+    @Override
+    public Object[] toArray() {
+        Object[] result = base.toArray();
+        for (int i = 0; i < result.length; i++) {
+            Triple triple = (Triple) result[i];
+            result[i] = toTargetTriple(triple);
+        }
+        return result;
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        T[] result = base.toArray(a);
+        for (int i = 0; i < result.length; i++) {
+            Triple triple = (Triple) result[i];
+            result[i] = (T) toTargetTriple(triple);
+        }
+        return result;
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        for (Object object : c) {
+            if (!contains(object)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public void clear() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return new SimpleImmutableGraph(this);
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return base.getLock();
+    }
+
+    class WrappedIteraror implements Iterator<Triple>{
+        private final Iterator<Triple> baseIter;
+
+        private WrappedIteraror(Iterator<Triple> baseIter) {
+            this.baseIter = baseIter;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return baseIter.hasNext();
+        }
+
+        @Override
+        public Triple next() {
+            return toTargetTriple(baseIter.next());
+        }
+
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+    }
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java
new file mode 100644
index 0000000..f72106d
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java
@@ -0,0 +1,51 @@
+/*
+ * 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.utils.graphnodeprovider;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.utils.GraphNode;
+
+/**
+ * A service that returns a GraphNode for a specified named resource, the
+ * returned GraphNode has as BaseGraph the ContentGraph provided by the
+ * ContentGraphProvider and the for remote uris the Graphs they dereference to
+ * and for local URIs with a path-section starting with /user/{username}/ the
+ * local-public-graph of that user.
+ */
+public interface GraphNodeProvider {
+
+    /**
+     * Get a GraphNode for the specified resource, see class comments for
+     * details.
+     */
+    GraphNode get(IRI uriRef);
+
+    /**
+     * Get a GraphNode for the specified resource, The resource is assumed to be
+     * local, i.e. the method behaves like get(IRI) for a Uri with an
+ authority section contained in the Set retuned by
+ <code>org.apache.clerezza.platform.config.PlatformConfig#getBaseUris()</code>
+     */
+    GraphNode getLocal(IRI uriRef);
+
+    /**
+     * return true iff getLocal(uriRef).getNodeContext.size > 0
+     */
+    boolean existsLocal(IRI uriRef);
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java
new file mode 100644
index 0000000..569e638
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java
@@ -0,0 +1,130 @@
+/*
+ * 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.utils.smushing;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.ontologies.OWL;
+
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+
+/**
+ *
+ * @author Reto
+ */
+public class BaseSmusher {
+
+    /**
+     * Smushes the resources in mGraph that belong to the same set in equivalenceSets,
+     * i.e. it adds all properties to one of the resources in the equivalence set.
+     * 
+     * Optionally owl:sameAs statement are added that point from the IRIs that 
+     * no longer have properties to the one with properties. If addOwlSameAs
+     * is false the IRIs will just disappear from the graph.
+     * 
+     * @param mGraph the graph to smush
+     * @param equivalenceSets sets of equivalent resources
+     * @param addOwlSameAs whether owl:sameAs statements should be added
+     */
+    public void smush(Graph mGraph, Set<Set<BlankNodeOrIRI>> equivalenceSets, boolean addOwlSameAs) {
+        Map<BlankNodeOrIRI, BlankNodeOrIRI> current2ReplacementMap = new HashMap<BlankNodeOrIRI, BlankNodeOrIRI>();
+        final Graph owlSameAsGraph = new SimpleGraph();
+        for (Set<BlankNodeOrIRI> equivalenceSet : equivalenceSets) {
+            final BlankNodeOrIRI replacement = getReplacementFor(equivalenceSet, owlSameAsGraph);
+            for (BlankNodeOrIRI current : equivalenceSet) {
+                if (!current.equals(replacement)) {
+                    current2ReplacementMap.put(current, replacement);
+                }
+            }
+        }
+        final Set<Triple> newTriples = new HashSet<Triple>();
+        Lock l = mGraph.getLock().writeLock();
+        l.lock();
+        try {
+            for (Iterator<Triple> it = mGraph.iterator(); it.hasNext();) {
+                final Triple triple = it.next();
+                final BlankNodeOrIRI subject = triple.getSubject();
+                BlankNodeOrIRI subjectReplacement = current2ReplacementMap.get(subject);
+                final RDFTerm object = triple.getObject();
+                @SuppressWarnings(value = "element-type-mismatch")
+                RDFTerm objectReplacement = current2ReplacementMap.get(object);
+                if ((subjectReplacement != null) || (objectReplacement != null)) {
+                    it.remove();
+                    if (subjectReplacement == null) {
+                        subjectReplacement = subject;
+                    }
+                    if (objectReplacement == null) {
+                        objectReplacement = object;
+                    }
+                    newTriples.add(new TripleImpl(subjectReplacement, triple.getPredicate(), objectReplacement));
+                }
+            }
+            for (Triple triple : newTriples) {
+                mGraph.add(triple);
+            }
+            mGraph.addAll(owlSameAsGraph);
+        } finally {
+            l.unlock();
+        }
+    }
+    
+    private BlankNodeOrIRI getReplacementFor(Set<BlankNodeOrIRI> equivalenceSet, 
+            Graph owlSameAsGraph) {
+        final Set<IRI> uriRefs = new HashSet<IRI>();
+        for (BlankNodeOrIRI nonLiteral : equivalenceSet) {
+            if (nonLiteral instanceof IRI) {
+                uriRefs.add((IRI) nonLiteral);
+            }
+        }
+        switch (uriRefs.size()) {
+            case 1:
+                return uriRefs.iterator().next();
+            case 0:
+                return new BlankNode();
+        }
+        final IRI preferedIRI = getPreferedIRI(uriRefs);
+        final Iterator<IRI> uriRefIter = uriRefs.iterator();
+        while (uriRefIter.hasNext()) {
+            IRI uriRef = uriRefIter.next();
+            if (!uriRef.equals(preferedIRI)) {
+                owlSameAsGraph.add(new TripleImpl(uriRef, OWL.sameAs, preferedIRI));
+            }
+        }
+        return preferedIRI;
+    }
+
+    
+    /**
+     * Returns a prefered IRI for the IRIs in a set. Typically and in the
+     * default implementation the IRI will be one of the set. Note however that 
+     * subclass implementations may also return another IRI to be used.
+     * 
+     * @param uriRefs
+     * @return 
+     */
+    protected IRI getPreferedIRI(Set<IRI> uriRefs) {
+        final Iterator<IRI> uriRefIter = uriRefs.iterator();
+        //instead of an arbitrary one we might either decide lexicographically
+        //or look at their frequency in mGraph
+        return uriRefIter.next();
+    }
+    
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java
new file mode 100644
index 0000000..4c57af5
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java
@@ -0,0 +1,165 @@
+/*
+ * 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.utils.smushing;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.ontologies.OWL;
+import org.apache.clerezza.ontologies.RDF;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+/**
+ * A utility to equate duplicate nodes in an Mgarph, currently only nodes with 
+ * a shared ifp are equated.
+ *
+ * @author reto
+ */
+public class IfpSmusher extends BaseSmusher {
+    
+    static final Logger log = LoggerFactory.getLogger(IfpSmusher.class);
+
+    /**
+     * smush mGaph given the ontological facts. Currently it does only
+     * one step ifp smushin, i.e. only ifps are taken in account and only
+     * nodes that have the same node as ifp object in the orignal graph are
+     * equates. (calling the method a second time might lead to additional
+     * smushings.)
+     *
+     * @param mGraph
+     * @param tBox
+     */
+    public void smush(Graph mGraph, Graph tBox) {
+        final Set<IRI> ifps = getIfps(tBox);
+        final Map<PredicateObject, Set<BlankNodeOrIRI>> ifp2nodesMap = new HashMap<PredicateObject, Set<BlankNodeOrIRI>>();
+        for (Iterator<Triple> it = mGraph.iterator(); it.hasNext();) {
+            final Triple triple = it.next();
+            final IRI predicate = triple.getPredicate();
+            if (!ifps.contains(predicate)) {
+                continue;
+            }
+            final PredicateObject po = new PredicateObject(predicate, triple.getObject());
+            Set<BlankNodeOrIRI> equivalentNodes = ifp2nodesMap.get(po);
+            if (equivalentNodes == null) {
+                equivalentNodes = new HashSet<BlankNodeOrIRI>();
+                ifp2nodesMap.put(po, equivalentNodes);
+            }
+            equivalentNodes.add(triple.getSubject());
+        }
+        Set<Set<BlankNodeOrIRI>> unitedEquivalenceSets = uniteSetsWithCommonElement(ifp2nodesMap.values());
+        smush(mGraph, unitedEquivalenceSets, true);
+    }
+    
+
+    private Set<IRI> getIfps(Graph tBox) {
+        final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type,
+                OWL.InverseFunctionalProperty);
+        final Set<IRI> ifps = new HashSet<IRI>();
+        while (ifpDefinitions.hasNext()) {
+            final Triple triple = ifpDefinitions.next();
+            ifps.add((IRI) triple.getSubject());
+        }
+        return ifps;
+    }
+
+    private <T> Set<Set<T>> uniteSetsWithCommonElement(
+            Collection<Set<T>> originalSets) {
+        Set<Set<T>> result = new HashSet<Set<T>>();
+        Iterator<Set<T>> iter = originalSets.iterator();
+        while (iter.hasNext()) {
+            Set<T> originalSet = iter.next();
+            //TODO this could be done more efficiently with a map
+            Set<T> matchingSet = getMatchinSet(originalSet, result);
+            if (matchingSet != null) {
+                matchingSet.addAll(originalSet);
+            } else {
+                result.add(new HashSet<T>(originalSet));
+            }
+        }
+        if (result.size() < originalSets.size()) {
+            return uniteSetsWithCommonElement(result);
+        } else {
+            return result;
+        }
+    }
+
+    private <T> Set<T> getMatchinSet(Set<T> set, Set<Set<T>> setOfSet) {
+        for (Set<T> current : setOfSet) {
+            if (shareElements(set,current)) {
+                return current;
+            }
+        }
+        return null;
+    }
+
+    private <T> boolean shareElements(Set<T> set1, Set<T> set2) {
+        for (T elem : set2) {
+            if (set1.contains(elem)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+
+    class PredicateObject {
+
+        final IRI predicate;
+        final RDFTerm object;
+
+        public PredicateObject(IRI predicate, RDFTerm object) {
+            this.predicate = predicate;
+            this.object = object;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final PredicateObject other = (PredicateObject) obj;
+            if (this.predicate != other.predicate && !this.predicate.equals(other.predicate)) {
+                return false;
+            }
+            if (this.object != other.object && !this.object.equals(other.object)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            int hash = 3;
+            hash = 29 * hash + this.predicate.hashCode();
+            hash = 13 * hash + this.object.hashCode();
+            return hash;
+        }
+
+        @Override
+        public String toString() {
+            return "("+predicate+", "+object+")";
+        }
+
+
+    };
+}
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java
new file mode 100644
index 0000000..3571ae6
--- /dev/null
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java
@@ -0,0 +1,109 @@
+/*
+ * 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.utils.smushing;
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.ontologies.OWL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+/**
+ * A utility to equate duplicate nodes in an Mgraph. This unifies owl:sameAs
+ * resources.
+ *
+ * @author reto
+ */
+public class SameAsSmusher extends BaseSmusher {
+    
+    static final Logger log = LoggerFactory.getLogger(SameAsSmusher.class);
+    
+    /**
+     * This will ensure that all properties of sameAs resources are associated
+     * to the preferedIRI as returned by {@code getPreferedIRI}
+     * @param mGraph
+     * @param owlSameStatements 
+     * @param addCanonicalSameAsStatements if true owl:sameAsStatements with the preferedIRI as object will be added
+     */
+    public void smush(Graph mGraph, 
+            Graph owlSameStatements,
+            boolean addCanonicalSameAsStatements) {
+    	
+    	log.info("Starting smushing");
+        
+    	// This hashmap contains a uri (key) and the set of equivalent uris (value)
+    	final Map<BlankNodeOrIRI, Set<BlankNodeOrIRI>> node2EquivalenceSet = new HashMap<BlankNodeOrIRI, Set<BlankNodeOrIRI>>();
+    	
+    	log.info("Creating the sets of equivalent uris of each subject or object in the owl:sameAs statements");
+    	// Determines for each subject and object in all the owl:sameAs statements the set of ewquivalent uris 
+    	for (Iterator<Triple> it = owlSameStatements.iterator(); it.hasNext();) {            
+    		final Triple triple = it.next();
+            final IRI predicate = triple.getPredicate();
+            if (!predicate.equals(OWL.sameAs)) {
+                throw new RuntimeException("Statements must use only <http://www.w3.org/2002/07/owl#sameAs> predicate.");
+            }
+            final BlankNodeOrIRI subject = triple.getSubject();
+            //literals not yet supported
+            final BlankNodeOrIRI object = (BlankNodeOrIRI)triple.getObject();
+            
+            Set<BlankNodeOrIRI> equivalentNodes = node2EquivalenceSet.get(subject);
+            
+            // if there is not a set of equivalent uris then create a new set
+            if (equivalentNodes == null) {
+            	equivalentNodes = node2EquivalenceSet.get(object);
+            	if (equivalentNodes == null) {
+                    equivalentNodes = new HashSet<BlankNodeOrIRI>();
+                }
+            } else {
+                Set<BlankNodeOrIRI> objectSet = node2EquivalenceSet.get(object);
+                if ((objectSet != null) && (objectSet != equivalentNodes)) {
+                    //merge two sets
+                    for (BlankNodeOrIRI res : objectSet) {
+                        node2EquivalenceSet.remove(res);
+                    }
+                    for (BlankNodeOrIRI res : objectSet) {
+                        node2EquivalenceSet.put(res,equivalentNodes);
+                    }
+                    equivalentNodes.addAll(objectSet);
+                }
+            }
+            
+            // add both subject and object of the owl:sameAs statement to the set of equivalent uris
+            equivalentNodes.add(subject);
+            equivalentNodes.add(object);
+            
+            // use both uris in the owl:sameAs statement as keys for the set of equivalent uris
+            node2EquivalenceSet.put(subject, equivalentNodes);
+            node2EquivalenceSet.put(object, equivalentNodes);
+            
+            log.info("Sets of equivalent uris created.");
+        
+    	}
+    	
+    	// This set contains the sets of equivalent uris
+    	Set<Set<BlankNodeOrIRI>> unitedEquivalenceSets = new HashSet<Set<BlankNodeOrIRI>>(node2EquivalenceSet.values());
+        smush(mGraph, unitedEquivalenceSets, addCanonicalSameAsStatements);
+    }
+
+    
+}
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java
new file mode 100644
index 0000000..f5df426
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.utils.GraphUtils.NoSuchSubGraphException;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class GraphUtilsTest {
+
+    final IRI u1 = new IRI("http://ex.org/1");
+    final IRI u2 = new IRI("http://ex.org/2");
+    final IRI u3 = new IRI("http://ex.org/3");
+
+    @Test
+    public void removeSubGraph() throws NoSuchSubGraphException {
+        Graph baseGraph = createBaseGraph();
+
+        Graph subGraph = new SimpleGraph();
+        {
+            BlankNode bNode1 = new BlankNode();
+            BlankNode bNode2 = new BlankNode();
+            subGraph.add(new TripleImpl(u1, u2, bNode2));
+            subGraph.add(new TripleImpl(bNode2, u2, bNode2));
+            subGraph.add(new TripleImpl(bNode2, u2, bNode1));
+        }
+        GraphUtils.removeSubGraph(baseGraph, subGraph);
+        Assert.assertEquals(1, baseGraph.size());
+    }
+
+    private Graph createBaseGraph() {
+        Graph baseGraph = new SimpleGraph();
+        {
+            BlankNode bNode1 = new BlankNode();
+            BlankNode bNode2 = new BlankNode();
+            baseGraph.add(new TripleImpl(u1, u2, bNode2));
+            baseGraph.add(new TripleImpl(bNode2, u2, bNode2));
+            baseGraph.add(new TripleImpl(bNode2, u2, bNode1));
+            baseGraph.add(new TripleImpl(u3, u2, u1));
+        }
+        return baseGraph;
+    }
+    
+    /** It is required that the subgraph comprises the whole context of the Bnodes it ioncludes
+     * 
+     * @throws org.apache.clerezza.utils.GraphUtils.NoSuchSubGraphException
+     */
+    @Test(expected=NoSuchSubGraphException.class)
+    public void removeIncompleteSubGraph() throws NoSuchSubGraphException {
+        Graph baseGraph = createBaseGraph();
+
+        Graph subGraph = new SimpleGraph();
+        {
+            BlankNode bNode1 = new BlankNode();
+            BlankNode bNode2 = new BlankNode();
+            subGraph.add(new TripleImpl(u1, u2, bNode2));
+            subGraph.add(new TripleImpl(bNode2, u2, bNode2));
+        }
+        GraphUtils.removeSubGraph(baseGraph, subGraph);
+    }
+
+    @Test(expected=NoSuchSubGraphException.class)
+    public void removeInvalidSubGraph() throws NoSuchSubGraphException {
+        Graph baseGraph = createBaseGraph();
+
+        Graph subGraph = new SimpleGraph();
+        {
+            BlankNode bNode1 = new BlankNode();
+            BlankNode bNode2 = new BlankNode();
+            subGraph.add(new TripleImpl(u1, u2, bNode2));
+            subGraph.add(new TripleImpl(bNode2, u2, bNode2));
+            baseGraph.add(new TripleImpl(bNode2, u2, bNode1));
+            baseGraph.add(new TripleImpl(bNode2, u2, new BlankNode()));
+        }
+        GraphUtils.removeSubGraph(baseGraph, subGraph);
+    }
+}
+
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java
new file mode 100644
index 0000000..18d3f9d
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.ontologies.FOAF;
+import org.apache.clerezza.ontologies.OWL;
+import org.apache.clerezza.ontologies.RDF;
+import org.apache.clerezza.ontologies.RDFS;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class IfpSmushTest {
+
+    private Graph ontology = new SimpleGraph();
+    {
+        ontology.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
+    }
+
+    @Test
+    public void simpleBlankNode()  {
+        Graph mGraph = new SimpleGraph();
+        IRI mbox1 = new IRI("mailto:foo@example.org");
+        final BlankNode bNode1 = new BlankNode();
+        mGraph.add(new TripleImpl(bNode1, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(bNode1, RDFS.comment, 
+                new PlainLiteralImpl("a comment")));
+        final BlankNode bNode2 = new BlankNode();
+        mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(bNode2, RDFS.comment, 
+                new PlainLiteralImpl("another comment")));
+        Smusher.smush(mGraph, ontology);
+        Assert.assertEquals(3, mGraph.size());
+    }
+
+    @Test
+    public void overlappingEquivalenceClasses()  {
+        Graph mGraph = new SimpleGraph();
+        IRI mbox1 = new IRI("mailto:foo@example.org");
+        final BlankNode bNode1 = new BlankNode();
+        mGraph.add(new TripleImpl(bNode1, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(bNode1, RDFS.comment,
+                new PlainLiteralImpl("a comment")));
+        final BlankNode bNode2 = new BlankNode();
+        IRI mbox2 = new IRI("mailto:bar@example.org");
+        mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox2));
+        mGraph.add(new TripleImpl(bNode2, RDFS.comment,
+                new PlainLiteralImpl("another comment")));
+        final BlankNode bNode3 = new BlankNode();
+        mGraph.add(new TripleImpl(bNode3, FOAF.mbox, mbox2));
+        mGraph.add(new TripleImpl(bNode3, RDFS.comment,
+                new PlainLiteralImpl("yet another comment")));
+        Smusher.smush(mGraph, ontology);
+        Assert.assertEquals(5, mGraph.size());
+    }
+
+    @Test
+    public void oneIRI()  {
+        Graph mGraph = new SimpleGraph();
+        IRI mbox1 = new IRI("mailto:foo@example.org");
+        final IRI resource = new IRI("http://example.org/");
+        mGraph.add(new TripleImpl(resource, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(resource, RDFS.comment,
+                new PlainLiteralImpl("a comment")));
+        final BlankNode bNode2 = new BlankNode();
+        mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(bNode2, RDFS.comment,
+                new PlainLiteralImpl("another comment")));
+        Smusher.smush(mGraph, ontology);
+        Assert.assertEquals(3, mGraph.size());
+    }
+
+    @Test
+    public void twoIRIs()  {
+        Graph mGraph = new SimpleGraph();
+        IRI mbox1 = new IRI("mailto:foo@example.org");
+        final IRI resource1 = new IRI("http://example.org/");
+        mGraph.add(new TripleImpl(resource1, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(resource1, RDFS.comment,
+                new PlainLiteralImpl("a comment")));
+        final IRI resource2 = new IRI("http://2.example.org/");
+        mGraph.add(new TripleImpl(resource2, FOAF.mbox, mbox1));
+        mGraph.add(new TripleImpl(resource2, RDFS.comment,
+                new PlainLiteralImpl("another comment")));
+        Smusher.smush(mGraph, ontology);
+        Assert.assertEquals(4, mGraph.size());
+    }
+
+}
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java
new file mode 100644
index 0000000..ea19303
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java
@@ -0,0 +1,182 @@
+/*
+ * 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.utils;
+
+import junit.framework.Assert;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.junit.Test;
+
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ * @author rbn
+ */
+public class RdfListTest {
+
+    @Test
+    public void listCreationAndAccess() {
+        Graph tc = new SimpleGraph();
+        List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        assertEquals(0, list.size());
+        list.add(new PlainLiteralImpl("hello"));
+        list.add(new PlainLiteralImpl("world"));
+        assertEquals(new PlainLiteralImpl("hello"), list.get(0));
+        assertEquals(new PlainLiteralImpl("world"), list.get(1));
+        assertEquals(2, list.size());
+        list.add(new PlainLiteralImpl("welcome"));
+        assertEquals(3, list.size());
+        assertEquals(new PlainLiteralImpl("welcome"), list.get(2));
+        list.add(1, new PlainLiteralImpl("interesting"));
+        assertEquals(4, list.size());
+        assertEquals(new PlainLiteralImpl("interesting"), list.get(1));
+        assertEquals(new PlainLiteralImpl("world"), list.get(2));
+        assertEquals(new PlainLiteralImpl("welcome"), list.get(3));
+        list.add(0, new PlainLiteralImpl("start"));
+        assertEquals(5, list.size());
+        assertEquals(new PlainLiteralImpl("hello"), list.get(1));
+        assertEquals(new PlainLiteralImpl("interesting"), list.get(2));
+        List<RDFTerm> list2 = new RdfList(new IRI("http://example.org/mytest"), tc);
+        assertEquals(5, list2.size());
+        assertEquals(new PlainLiteralImpl("hello"), list2.get(1));
+        assertEquals(new PlainLiteralImpl("interesting"), list2.get(2));
+        list2.remove(2);
+        assertEquals(4, list2.size());
+        assertEquals(new PlainLiteralImpl("hello"), list2.get(1));
+        assertEquals(new PlainLiteralImpl("world"), list2.get(2));
+        while (list2.size() > 0) {
+            list2.remove(0);
+        }
+        assertEquals(1, tc.size()); //list = rdf:nil statement
+        list2.add(0, new PlainLiteralImpl("restart"));
+        list2.add(1, new PlainLiteralImpl("over"));
+        assertEquals(2, list2.size());
+        list2.add(new PlainLiteralImpl("2"));
+        list2.add(new PlainLiteralImpl("3"));
+        assertEquals(4, list2.size());
+        list2.add(new PlainLiteralImpl("4"));
+        list2.add(new PlainLiteralImpl("5"));
+        assertEquals(new PlainLiteralImpl("3"), list2.get(3));
+    }
+
+    @Test
+    public void listCreationAndAccess2() {
+        Graph tc = new SimpleGraph();
+        List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        assertEquals(0, list.size());
+        list.add(0,new PlainLiteralImpl("world"));
+        list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        list.add(0,new PlainLiteralImpl("beautifuly"));
+        list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        list.add(0,new PlainLiteralImpl("hello"));
+        assertEquals(new PlainLiteralImpl("hello"), list.get(0));
+        assertEquals(new PlainLiteralImpl("beautifuly"), list.get(1));
+        assertEquals(new PlainLiteralImpl("world"), list.get(2));
+    }
+
+    @Test
+    public void listCreationAndAccess3() {
+        Graph tc = new SimpleGraph();
+        List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        assertEquals(0, list.size());
+        BlankNode node0 = new BlankNode() {};
+        BlankNode node1 = new BlankNode() {};
+        BlankNode node2 = new BlankNode() {};
+        list.add(0,node2);
+        list.add(0,node1);
+        list.add(0,node0);
+        assertEquals(node0, list.get(0));
+        assertEquals(node1, list.get(1));
+        assertEquals(node2, list.get(2));
+    }
+
+    @Test
+    public void secondButLastElementAccessTest() {
+        Graph tc = new SimpleGraph();
+        List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest2"), tc);
+        list.add(new PlainLiteralImpl("hello"));
+        list.add(new PlainLiteralImpl("world"));
+        list.remove(1);
+        assertEquals(1, list.size());
+    }
+
+    @Test
+    public void cleanGraphAfterRemoval() {
+        Graph tc = new SimpleGraph();
+        List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
+        list.add(new PlainLiteralImpl("hello"));
+        list.add(new PlainLiteralImpl("world"));
+        list.remove(1);
+        Assert.assertEquals(2, tc.size());
+
+    }
+
+    @Test
+    public void findContainingListNodesAndfindContainingListsTest() {
+        Graph tc = new SimpleGraph();
+        GraphNode listA = new GraphNode(new IRI("http:///listA"), tc);
+        GraphNode listB = new GraphNode(new IRI("http:///listB"), tc);
+        BlankNode element1 = new BlankNode();
+        BlankNode element2 = new BlankNode();
+        BlankNode element3 = new BlankNode();
+        BlankNode element4 = new BlankNode();
+        BlankNode element5 = new BlankNode();
+
+        RdfList rdfListA = new RdfList(listA);
+        rdfListA.add(element1);
+        rdfListA.add(element2);
+        rdfListA.add(element3);
+        rdfListA.add(element4);
+
+        RdfList rdfListB = new RdfList(listB);
+        rdfListB.add(element2);
+        rdfListB.add(element4);
+        rdfListB.add(element5);
+
+        Set<GraphNode> containingListNodes = RdfList.findContainingListNodes(
+                new GraphNode(element3, tc));
+        Assert.assertEquals(1, containingListNodes.size());
+        Assert.assertTrue(containingListNodes.contains(listA));
+
+        Set<RdfList> containingLists = RdfList.findContainingLists(
+                new GraphNode(element3, tc));
+        Assert.assertEquals(1, containingLists.size());
+        Assert.assertTrue(containingLists.contains(rdfListA));
+
+        containingListNodes = RdfList.findContainingListNodes(
+                new GraphNode(element4, tc));
+        Assert.assertEquals(2, containingListNodes.size());
+        Assert.assertTrue(containingListNodes.contains(listA));
+        Assert.assertTrue(containingListNodes.contains(listB));
+
+        containingLists = RdfList.findContainingLists(
+                new GraphNode(element4, tc));
+        Assert.assertEquals(2, containingLists.size());
+        Assert.assertTrue(containingLists.contains(rdfListA));
+        Assert.assertTrue(containingLists.contains(rdfListB));
+    }
+}
\ No newline at end of file
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java
new file mode 100644
index 0000000..c03e3c8
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.ontologies.FOAF;
+import org.apache.clerezza.ontologies.OWL;
+import org.apache.clerezza.ontologies.RDFS;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Iterator;
+
+/**
+ *
+ * @author reto
+ */
+public class SameAsSmushTest {
+    
+    private final IRI uriA = new IRI("http://example.org/A");
+    private final IRI uriB = new IRI("http://example.org/B");
+    private final Literal lit = new PlainLiteralImpl("That's me (and you)");
+
+    private Graph sameAsStatements = new SimpleGraph();
+    {
+        sameAsStatements.add(new TripleImpl(uriA, OWL.sameAs, uriB));
+    }
+    
+    private Graph  dataGraph = new SimpleGraph();
+    {
+        dataGraph.add(new TripleImpl(uriA, FOAF.knows, uriB));
+        dataGraph.add(new TripleImpl(uriB, RDFS.label, lit));
+        dataGraph.add(new TripleImpl(uriA, RDFS.label, lit));
+    }
+
+    @Test
+    public void simple()  {
+        Assert.assertEquals(3, dataGraph.size());
+        Smusher.sameAsSmush(dataGraph, sameAsStatements);
+        Assert.assertEquals(3, dataGraph.size());
+        Assert.assertTrue(dataGraph.filter(null, OWL.sameAs, null).hasNext());
+        //exactly one statement with literal 
+        Iterator<Triple> litStmts = dataGraph.filter(null, null, lit);
+        Assert.assertTrue(litStmts.hasNext());
+        Triple litStmt = litStmts.next();
+        Assert.assertFalse(litStmts.hasNext());
+        Iterator<Triple> knowsStmts = dataGraph.filter(null, FOAF.knows, null);
+        Assert.assertTrue(knowsStmts.hasNext());
+        Triple knowStmt = knowsStmts.next();
+        Assert.assertEquals(knowStmt.getSubject(), knowStmt.getObject());
+        Assert.assertEquals(litStmt.getSubject(), knowStmt.getObject());
+        Assert.assertEquals(litStmt.getSubject(), dataGraph.filter(null, OWL.sameAs, null).next().getObject());
+    }
+
+}
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java
new file mode 100644
index 0000000..3d0f8e3
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java
@@ -0,0 +1,266 @@
+/*
+ * 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.utils;
+
+import junit.framework.Assert;
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.test.utils.RandomGraph;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ *
+ * @author reto, mir
+ */
+public class TestGraphNode {
+
+    @Test
+    public void nodeContext() {
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        IRI property2 = new IRI("http://example.org/property2");
+        g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
+        g.add(new TripleImpl(bNode1, property2, property1));
+        g.add(new TripleImpl(bNode2, property2, bNode1));
+        g.add(new TripleImpl(property1, property1, bNode2));
+        g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
+        GraphNode n = new GraphNode(bNode1, g);
+        Assert.assertEquals(4, n.getNodeContext().size());
+        n.deleteNodeContext();
+        Assert.assertEquals(1, g.size());
+        Assert.assertFalse(n.getObjects(property2).hasNext());
+    }
+
+    @Test
+    public void addNode() {
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        GraphNode n = new GraphNode(bNode1, g);
+        n.addProperty(property1, bNode2);
+        Assert.assertEquals(1, g.size());
+    }
+
+    @Test
+    public void testGetSubjectAndObjectNodes() {
+        RandomGraph graph = new RandomGraph(500, 20, new SimpleGraph());
+        for (int j = 0; j < 200; j++) {
+            Triple randomTriple = graph.getRandomTriple();
+            GraphNode node = new GraphNode(randomTriple.getSubject(), graph);
+            Iterator<IRI> properties = node.getProperties();
+            while (properties.hasNext()) {
+                IRI property = properties.next();
+                Set<RDFTerm> objects = createSet(node.getObjects(property));
+                Iterator<GraphNode> objectNodes = node.getObjectNodes(property);
+                while (objectNodes.hasNext()) {
+                    GraphNode graphNode = objectNodes.next();
+                    Assert.assertTrue(objects.contains(graphNode.getNode()));
+                }
+            }
+        }
+
+        for (int j = 0; j < 200; j++) {
+            Triple randomTriple = graph.getRandomTriple();
+            GraphNode node = new GraphNode(randomTriple.getObject(), graph);
+            Iterator<IRI> properties = node.getProperties();
+            while (properties.hasNext()) {
+                IRI property = properties.next();
+                Set<RDFTerm> subjects = createSet(node.getSubjects(property));
+                Iterator<GraphNode> subjectNodes = node.getSubjectNodes(property);
+                while (subjectNodes.hasNext()) {
+                    GraphNode graphNode = subjectNodes.next();
+                    Assert.assertTrue(subjects.contains(graphNode.getNode()));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void getAvailableProperties(){
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        IRI property2 = new IRI("http://example.org/property2");
+        IRI property3 = new IRI("http://example.org/property3");
+        IRI property4 = new IRI("http://example.org/property4");
+        ArrayList<IRI> props = new ArrayList<IRI>();
+        props.add(property1);
+        props.add(property2);
+        props.add(property3);
+        props.add(property4);
+        GraphNode n = new GraphNode(bNode1, g);
+        n.addProperty(property1, bNode2);
+        n.addProperty(property2, bNode2);
+        n.addProperty(property3, bNode2);
+        n.addProperty(property4, bNode2);
+        Iterator<IRI> properties = n.getProperties();
+        int i = 0;
+        while(properties.hasNext()){
+            i++;
+            IRI prop = properties.next();
+            Assert.assertTrue(props.contains(prop));
+            props.remove(prop);
+        }
+        Assert.assertEquals(i, 4);
+        Assert.assertEquals(props.size(), 0);
+
+    }
+
+    @Test
+    public void deleteAll() {
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        IRI property2 = new IRI("http://example.org/property2");
+        //the two properties two be deleted
+        g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
+        g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("bla bla")));
+        //this 3 properties should stay
+        g.add(new TripleImpl(bNode1, property2, property1));
+        g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
+        g.add(new TripleImpl(bNode2, property1, new PlainLiteralImpl("bla bla")));
+        GraphNode n = new GraphNode(bNode1, g);
+        n.deleteProperties(property1);
+        Assert.assertEquals(3, g.size());
+    }
+
+    @Test
+    public void deleteSingleProperty() {
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        IRI property2 = new IRI("http://example.org/property2");
+        //the properties two be deleted
+        g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
+        //this 4 properties should stay
+        g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("bla bla")));
+        g.add(new TripleImpl(bNode1, property2, property1));
+        g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
+        g.add(new TripleImpl(bNode2, property1, new PlainLiteralImpl("bla bla")));
+        GraphNode n = new GraphNode(bNode1, g);
+        n.deleteProperty(property1, new PlainLiteralImpl("literal"));
+        Assert.assertEquals(4, g.size());
+    }
+
+    @Test
+    public void replaceWith() {
+        Graph initialGraph = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode();
+        BlankNode bNode2 = new BlankNode();
+        BlankNode newBnode = new BlankNode();
+        IRI property1 = new IRI("http://example.org/property1");
+        IRI property2 = new IRI("http://example.org/property2");
+        IRI newIRI = new IRI("http://example.org/newName");
+        Literal literal1 = new PlainLiteralImpl("literal");
+        Literal literal2 = new PlainLiteralImpl("bla bla");
+
+        Triple triple1 = new TripleImpl(bNode1, property1, literal1);
+        Triple triple2 = new TripleImpl(bNode1, property2, property1);
+        Triple triple3 = new TripleImpl(bNode2, property2, bNode1);
+        Triple triple4 = new TripleImpl(property1, property1, bNode2);
+        Triple triple5 = new TripleImpl(property1, property1, literal2);
+        initialGraph.add(triple1);
+        initialGraph.add(triple2);
+        initialGraph.add(triple3);
+        initialGraph.add(triple4);
+        initialGraph.add(triple5);
+        GraphNode node = new GraphNode(property1,
+                new SimpleGraph(initialGraph.iterator()));
+
+        node.replaceWith(newIRI, true);
+        Assert.assertEquals(5, node.getGraph().size());
+        Triple expectedTriple1 = new TripleImpl(bNode1, newIRI, literal1);
+        Triple expectedTriple2 = new TripleImpl(bNode1, property2, newIRI);
+        Triple expectedTriple3 = new TripleImpl(newIRI, newIRI, bNode2);
+        Triple expectedTriple4 = new TripleImpl(newIRI, newIRI, literal2);
+
+        Assert.assertTrue(node.getGraph().contains(expectedTriple1));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple2));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple3));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple4));
+
+        Assert.assertFalse(node.getGraph().contains(triple1));
+        Assert.assertFalse(node.getGraph().contains(triple2));
+        Assert.assertFalse(node.getGraph().contains(triple4));
+        Assert.assertFalse(node.getGraph().contains(triple5));
+
+        node = new GraphNode(property1, new SimpleGraph(initialGraph.iterator()));
+        node.replaceWith(newBnode);
+        Triple expectedTriple5 = new TripleImpl(bNode1, property2, newBnode);
+        Triple expectedTriple6 = new TripleImpl(newBnode, property1, bNode2);
+        Triple expectedTriple7 = new TripleImpl(newBnode, property1, literal2);
+
+        Assert.assertTrue(node.getGraph().contains(triple1));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple5));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple6));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple7));
+
+        node = new GraphNode(literal1, new SimpleGraph(initialGraph.iterator()));
+        node.replaceWith(newBnode);
+        Triple expectedTriple8 = new TripleImpl(bNode1, property1, newBnode);
+        Assert.assertTrue(node.getGraph().contains(expectedTriple8));
+
+        node = new GraphNode(property1, new SimpleGraph(initialGraph.iterator()));
+        node.replaceWith(newIRI);
+        Triple expectedTriple9 = new TripleImpl(bNode1, property2, newIRI);
+        Triple expectedTriple10 = new TripleImpl(newIRI, property1, bNode2);
+        Triple expectedTriple11 = new TripleImpl(newIRI, property1, literal2);
+        Assert.assertTrue(node.getGraph().contains(triple1));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple9));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple10));
+        Assert.assertTrue(node.getGraph().contains(expectedTriple11));
+    }
+
+    @Test
+    public void equality() {
+        Graph g = new SimpleGraph();
+        BlankNode bNode1 = new BlankNode() {};
+        BlankNode bNode2 = new BlankNode() {};
+        IRI property1 = new IRI("http://example.org/property1");
+        GraphNode n = new GraphNode(bNode1, g);
+        n.addProperty(property1, bNode2);
+        Assert.assertTrue(n.equals(new GraphNode(bNode1, g)));
+        Assert.assertFalse(n.equals(new GraphNode(bNode2, g)));
+        GraphNode n2 = null;
+        Assert.assertFalse(n.equals(n2));
+    }
+
+    private Set<RDFTerm> createSet(Iterator<? extends RDFTerm> resources) {
+        Set<RDFTerm> set = new HashSet<RDFTerm>();
+        while (resources.hasNext()) {
+            RDFTerm resource = resources.next();
+            set.add(resource);
+        }
+        return set;
+    }
+
+}
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java
new file mode 100644
index 0000000..e1f8e33
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.utils;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Iterator;
+
+/**
+ *
+ * @author hasan
+ */
+public class UnionGraphTest {
+
+    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");
+
+    @Test
+    public void readAccess() {
+        Graph graph = new SimpleGraph();
+        Graph graph2 = new SimpleGraph();
+        BlankNode bnode = new BlankNode() {
+        };
+        graph.add(new TripleImpl(uriRef1, uriRef2, uriRef1));
+        graph2.add(new TripleImpl(bnode, uriRef1, uriRef3));
+        Graph unionGraph = new UnionGraph(graph, graph2);
+        Iterator<Triple> unionTriples = unionGraph.iterator();
+        Assert.assertTrue(unionTriples.hasNext());
+        unionTriples.next();
+        Assert.assertTrue(unionTriples.hasNext());
+        unionTriples.next();
+        Assert.assertFalse(unionTriples.hasNext());
+        Assert.assertEquals(2, unionGraph.size());
+    }
+    
+    @Test
+    public void writeAccess() {
+        Graph graph = new SimpleGraph();
+        Graph graph2 = new SimpleGraph();
+        BlankNode bnode = new BlankNode() {
+        };
+        graph2.add(new TripleImpl(bnode, uriRef1, uriRef3));
+        Graph unionGraph = new UnionGraph(graph, graph2);
+        Assert.assertEquals(1, unionGraph.size());
+        unionGraph.add(new TripleImpl(uriRef4, uriRef1, uriRef3));
+        Assert.assertEquals(1, graph.size());
+        Assert.assertEquals(2, unionGraph.size());
+        Assert.assertEquals(1, graph2.size());
+    }
+}
\ No newline at end of file
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java
new file mode 100644
index 0000000..10ae1f0
--- /dev/null
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.utils.smushing;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.ontologies.FOAF;
+import org.apache.clerezza.ontologies.OWL;
+import org.apache.clerezza.ontologies.RDFS;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ *
+ * @author reto
+ */
+public class SameAsSmushTest {
+    
+    private final IRI uriA = new IRI("http://example.org/A");
+    private final IRI uriB = new IRI("http://example.org/B");
+    private final IRI uriC = new IRI("http://example.org/C");
+    
+    private final Literal lit = new PlainLiteralImpl("That's me (and you)");
+
+    private Graph sameAsStatements = new SimpleGraph();
+    {
+        sameAsStatements.add(new TripleImpl(uriA, OWL.sameAs, uriB));
+    }
+    
+    private Graph  dataGraph = new SimpleGraph();
+    {
+        dataGraph.add(new TripleImpl(uriA, FOAF.knows, uriB));
+        dataGraph.add(new TripleImpl(uriB, RDFS.label, lit));
+        dataGraph.add(new TripleImpl(uriA, RDFS.label, lit));
+    }
+
+    @Test
+    public void simple()  {
+        SameAsSmusher smusher = new SameAsSmusher() {
+
+            @Override
+            protected IRI getPreferedIRI(Set<IRI> uriRefs) {
+                if (!uriRefs.contains(uriA)) throw new RuntimeException("not the set we excpect");
+                if (!uriRefs.contains(uriB)) throw new RuntimeException("not the set we excpect");
+                return uriC;
+            }
+            
+        };
+        Assert.assertEquals(3, dataGraph.size());
+        smusher.smush(dataGraph, sameAsStatements, true);
+        Assert.assertEquals(4, dataGraph.size());
+        Assert.assertTrue(dataGraph.filter(null, OWL.sameAs, null).hasNext());
+        //exactly one statement with literal 
+        Iterator<Triple> litStmts = dataGraph.filter(null, null, lit);
+        Assert.assertTrue(litStmts.hasNext());
+        Triple litStmt = litStmts.next();
+        Assert.assertFalse(litStmts.hasNext());
+        Iterator<Triple> knowsStmts = dataGraph.filter(null, FOAF.knows, null);
+        Assert.assertTrue(knowsStmts.hasNext());
+        Triple knowStmt = knowsStmts.next();
+        Assert.assertEquals(knowStmt.getSubject(), knowStmt.getObject());
+        Assert.assertEquals(litStmt.getSubject(), knowStmt.getObject());
+        Assert.assertEquals(litStmt.getSubject(), dataGraph.filter(null, OWL.sameAs, null).next().getObject());
+        Assert.assertEquals(knowStmt.getSubject(), uriC);
+    }
+
+}


[clerezza] 32/45: CLEREZZA-1032: Update ontologies pom.xml to export package and add ontology classes DCTERMS, PLATFORM, SKOS04, SKOS08

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit f0f27c90661fb1f47a15a64690e9adb024c51be4
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Feb 13 20:52:36 2019 +0100

    CLEREZZA-1032: Update ontologies pom.xml to export package and add ontology classes DCTERMS, PLATFORM, SKOS04, SKOS08
---
 ontologies/pom.xml                                 |  18 +-
 .../org/apache/clerezza/ontologies/DCTERMS.java    | 641 +++++++++++++++++++++
 .../org/apache/clerezza/ontologies/PLATFORM.java   |  94 +++
 .../org/apache/clerezza/ontologies/SKOS04.java     | 195 +++++++
 .../org/apache/clerezza/ontologies/SKOS08.java     | 234 ++++++++
 5 files changed, 1180 insertions(+), 2 deletions(-)

diff --git a/ontologies/pom.xml b/ontologies/pom.xml
index 615bd92..a936230 100644
--- a/ontologies/pom.xml
+++ b/ontologies/pom.xml
@@ -16,7 +16,6 @@
   either  express  or implied.  See  the License  for  the  specific
   language governing permissions and limitations under  the License.
 -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -33,6 +32,7 @@
     <version>8-SNAPSHOT</version>
     <name>Clerezza - Ontologies</name>
     <description>Ontology classes</description>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -41,4 +41,18 @@
         </dependency>
     </dependencies>
 
-</project>
\ No newline at end of file
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.ontologies.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/DCTERMS.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/DCTERMS.java
new file mode 100644
index 0000000..f4b4655
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/DCTERMS.java
@@ -0,0 +1,641 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class DCTERMS {
+	// Classes
+
+	/**
+	 * description: Examples of Agent include person, organization, and software agent.
+comment: A resource that acts or has the power to act.
+
+	 */
+	public static final IRI Agent = new IRI("http://purl.org/dc/terms/Agent");
+
+	/**
+	 * description: Examples of Agent Class include groups seen as classes, such as students, women, charities, lecturers.
+comment: A group of agents.
+
+	 */
+	public static final IRI AgentClass = new IRI("http://purl.org/dc/terms/AgentClass");
+
+	/**
+	 * comment: A book, article, or other documentary resource.
+
+	 */
+	public static final IRI BibliographicResource = new IRI("http://purl.org/dc/terms/BibliographicResource");
+
+	/**
+	 * comment: The set of regions in space defined by their geographic coordinates according to the DCMI Box Encoding Scheme.
+
+	 */
+	public static final IRI Box = new IRI("http://purl.org/dc/terms/Box");
+
+	/**
+	 * description: Examples include the formats defined by the list of Internet Media Types.
+comment: A digital resource format.
+
+	 */
+	public static final IRI FileFormat = new IRI("http://purl.org/dc/terms/FileFormat");
+
+	/**
+	 * comment: A rate at which something recurs.
+
+	 */
+	public static final IRI Frequency = new IRI("http://purl.org/dc/terms/Frequency");
+
+	/**
+	 * comment: The set of codes listed in ISO 3166-1 for the representation of names of countries.
+
+	 */
+	public static final IRI ISO3166 = new IRI("http://purl.org/dc/terms/ISO3166");
+
+	/**
+	 * comment: The three-letter alphabetic codes listed in ISO639-2 for the representation of names of languages.
+
+	 */
+	public static final IRI ISO639_2 = new IRI("http://purl.org/dc/terms/ISO639-2");
+
+	/**
+	 * comment: The set of three-letter codes listed in ISO 639-3 for the representation of names of languages.
+
+	 */
+	public static final IRI ISO639_3 = new IRI("http://purl.org/dc/terms/ISO639-3");
+
+	/**
+	 * comment: The extent or range of judicial, law enforcement, or other authority.
+
+	 */
+	public static final IRI Jurisdiction = new IRI("http://purl.org/dc/terms/Jurisdiction");
+
+	/**
+	 * comment: A legal document giving official permission to do something with a Resource.
+
+	 */
+	public static final IRI LicenseDocument = new IRI("http://purl.org/dc/terms/LicenseDocument");
+
+	/**
+	 * description: Examples include written, spoken, sign, and computer languages.
+comment: A system of signs, symbols, sounds, gestures, or rules used in communication.
+
+	 */
+	public static final IRI LinguisticSystem = new IRI("http://purl.org/dc/terms/LinguisticSystem");
+
+	/**
+	 * comment: A spatial region or named place.
+
+	 */
+	public static final IRI Location = new IRI("http://purl.org/dc/terms/Location");
+
+	/**
+	 * comment: A location, period of time, or jurisdiction.
+
+	 */
+	public static final IRI LocationPeriodOrJurisdiction = new IRI("http://purl.org/dc/terms/LocationPeriodOrJurisdiction");
+
+	/**
+	 * comment: A file format or physical medium.
+
+	 */
+	public static final IRI MediaType = new IRI("http://purl.org/dc/terms/MediaType");
+
+	/**
+	 * comment: A media type or extent.
+
+	 */
+	public static final IRI MediaTypeOrExtent = new IRI("http://purl.org/dc/terms/MediaTypeOrExtent");
+
+	/**
+	 * comment: A method by which resources are added to a collection.
+
+	 */
+	public static final IRI MethodOfAccrual = new IRI("http://purl.org/dc/terms/MethodOfAccrual");
+
+	/**
+	 * comment: A process that is used to engender knowledge, attitudes, and skills.
+
+	 */
+	public static final IRI MethodOfInstruction = new IRI("http://purl.org/dc/terms/MethodOfInstruction");
+
+	/**
+	 * comment: The set of time intervals defined by their limits according to the DCMI Period Encoding Scheme.
+
+	 */
+	public static final IRI Period = new IRI("http://purl.org/dc/terms/Period");
+
+	/**
+	 * comment: An interval of time that is named or defined by its start and end dates.
+
+	 */
+	public static final IRI PeriodOfTime = new IRI("http://purl.org/dc/terms/PeriodOfTime");
+
+	/**
+	 * description: Examples include paper, canvas, or DVD.
+comment: A physical material or carrier.
+
+	 */
+	public static final IRI PhysicalMedium = new IRI("http://purl.org/dc/terms/PhysicalMedium");
+
+	/**
+	 * comment: A material thing.
+
+	 */
+	public static final IRI PhysicalResource = new IRI("http://purl.org/dc/terms/PhysicalResource");
+
+	/**
+	 * comment: The set of points in space defined by their geographic coordinates according to the DCMI Point Encoding Scheme.
+
+	 */
+	public static final IRI Point = new IRI("http://purl.org/dc/terms/Point");
+
+	/**
+	 * comment: A plan or course of action by an authority, intended to influence and determine decisions, actions, and other matters.
+
+	 */
+	public static final IRI Policy = new IRI("http://purl.org/dc/terms/Policy");
+
+	/**
+	 * comment: A statement of any changes in ownership and custody of a resource since its creation that are significant for its authenticity, integrity, and interpretation.
+
+	 */
+	public static final IRI ProvenanceStatement = new IRI("http://purl.org/dc/terms/ProvenanceStatement");
+
+	/**
+	 * comment: The set of tags, constructed according to RFC 1766, for the identification of languages.
+
+	 */
+	public static final IRI RFC1766 = new IRI("http://purl.org/dc/terms/RFC1766");
+
+	/**
+	 * description: RFC 3066 has been obsoleted by RFC 4646.
+comment: The set of tags constructed according to RFC 3066 for the identification of languages.
+
+	 */
+	public static final IRI RFC3066 = new IRI("http://purl.org/dc/terms/RFC3066");
+
+	/**
+	 * description: RFC 4646 obsoletes RFC 3066.
+comment: The set of tags constructed according to RFC 4646 for the identification of languages.
+
+	 */
+	public static final IRI RFC4646 = new IRI("http://purl.org/dc/terms/RFC4646");
+
+	/**
+	 * comment: A statement about the intellectual property rights (IPR) held in or over a Resource, a legal document giving official permission to do something with a resource, or a statement about access rights.
+
+	 */
+	public static final IRI RightsStatement = new IRI("http://purl.org/dc/terms/RightsStatement");
+
+	/**
+	 * description: Examples include a number of pages, a specification of length, width, and breadth, or a period in hours, minutes, and seconds.
+comment: A dimension or extent, or a time taken to play or execute.
+
+	 */
+	public static final IRI SizeOrDuration = new IRI("http://purl.org/dc/terms/SizeOrDuration");
+
+	/**
+	 * comment: A basis for comparison; a reference point against which other things can be evaluated.
+
+	 */
+	public static final IRI Standard = new IRI("http://purl.org/dc/terms/Standard");
+
+	/**
+	 * comment: The set of identifiers constructed according to the generic syntax for Uniform Resource Identifiers as specified by the Internet Engineering Task Force.
+
+	 */
+	public static final IRI URI = new IRI("http://purl.org/dc/terms/URI");
+
+	/**
+	 * comment: The set of dates and times constructed according to the W3C Date and Time Formats Specification.
+
+	 */
+	public static final IRI W3CDTF = new IRI("http://purl.org/dc/terms/W3CDTF");
+
+	// Properties
+
+	/**
+	 * comment: A summary of the resource.
+
+	 */
+	public static final IRI abstract_ = new IRI("http://purl.org/dc/terms/abstract");
+
+	/**
+	 * description: Access Rights may include information regarding access or restrictions based on privacy, security, or other policies.
+comment: Information about who can access the resource or an indication of its security status.
+
+	 */
+	public static final IRI accessRights = new IRI("http://purl.org/dc/terms/accessRights");
+
+	/**
+	 * comment: The method by which items are added to a collection.
+
+	 */
+	public static final IRI accrualMethod = new IRI("http://purl.org/dc/terms/accrualMethod");
+
+	/**
+	 * comment: The frequency with which items are added to a collection.
+
+	 */
+	public static final IRI accrualPeriodicity = new IRI("http://purl.org/dc/terms/accrualPeriodicity");
+
+	/**
+	 * comment: The policy governing the addition of items to a collection.
+
+	 */
+	public static final IRI accrualPolicy = new IRI("http://purl.org/dc/terms/accrualPolicy");
+
+	/**
+	 * description: The distinction between titles and alternative titles is application-specific.
+comment: An alternative name for the resource.
+note: In current practice, this term is used primarily with literal values; however, there are important uses with non-literal values as well.  As of December 2007, the DCMI Usage Board is leaving this range unspecified pending an investigation of options.
+
+	 */
+	public static final IRI alternative = new IRI("http://purl.org/dc/terms/alternative");
+
+	/**
+	 * comment: A class of entity for whom the resource is intended or useful.
+
+	 */
+	public static final IRI audience = new IRI("http://purl.org/dc/terms/audience");
+
+	/**
+	 * comment: Date (often a range) that the resource became or will become available.
+
+	 */
+	public static final IRI available = new IRI("http://purl.org/dc/terms/available");
+
+	/**
+	 * description: Recommended practice is to include sufficient bibliographic detail to identify the resource as unambiguously as possible.
+comment: A bibliographic reference for the resource.
+
+	 */
+	public static final IRI bibliographicCitation = new IRI("http://purl.org/dc/terms/bibliographicCitation");
+
+	/**
+	 * comment: An established standard to which the described resource conforms.
+
+	 */
+	public static final IRI conformsTo = new IRI("http://purl.org/dc/terms/conformsTo");
+
+	/**
+	 * description: Examples of a Contributor include a person, an organization, or a service. Typically, the name of a Contributor should be used to indicate the entity.
+comment: An entity responsible for making contributions to the resource.
+
+	 */
+	public static final IRI contributor = new IRI("http://purl.org/dc/terms/contributor");
+
+	/**
+	 * description: Spatial topic and spatial applicability may be a named place or a location specified by its geographic coordinates. Temporal topic may be a named period, date, or date range. A jurisdiction may be a named administrative entity or a geographic place to which the resource applies. Recommended best practice is to use a controlled vocabulary such as the Thesaurus of Geographic Names [TGN]. Where appropriate, named places or time periods can be used in preference to numeric i [...]
+comment: The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant.
+
+	 */
+	public static final IRI coverage = new IRI("http://purl.org/dc/terms/coverage");
+
+	/**
+	 * comment: Date of creation of the resource.
+
+	 */
+	public static final IRI created = new IRI("http://purl.org/dc/terms/created");
+
+	/**
+	 * description: Examples of a Creator include a person, an organization, or a service. Typically, the name of a Creator should be used to indicate the entity.
+comment: An entity primarily responsible for making the resource.
+
+	 */
+	public static final IRI creator = new IRI("http://purl.org/dc/terms/creator");
+
+	/**
+	 * description: Date may be used to express temporal information at any level of granularity.  Recommended best practice is to use an encoding scheme, such as the W3CDTF profile of ISO 8601 [W3CDTF].
+comment: A point or period of time associated with an event in the lifecycle of the resource.
+
+	 */
+	public static final IRI date = new IRI("http://purl.org/dc/terms/date");
+
+	/**
+	 * description: Examples of resources to which a Date Accepted may be relevant are a thesis (accepted by a university department) or an article (accepted by a journal).
+comment: Date of acceptance of the resource.
+
+	 */
+	public static final IRI dateAccepted = new IRI("http://purl.org/dc/terms/dateAccepted");
+
+	/**
+	 * comment: Date of copyright.
+
+	 */
+	public static final IRI dateCopyrighted = new IRI("http://purl.org/dc/terms/dateCopyrighted");
+
+	/**
+	 * description: Examples of resources to which a Date Submitted may be relevant are a thesis (submitted to a university department) or an article (submitted to a journal).
+comment: Date of submission of the resource.
+
+	 */
+	public static final IRI dateSubmitted = new IRI("http://purl.org/dc/terms/dateSubmitted");
+
+	/**
+	 * description: Description may include but is not limited to: an abstract, a table of contents, a graphical representation, or a free-text account of the resource.
+comment: An account of the resource.
+
+	 */
+	public static final IRI description = new IRI("http://purl.org/dc/terms/description");
+
+	/**
+	 * comment: A class of entity, defined in terms of progression through an educational or training context, for which the described resource is intended.
+
+	 */
+	public static final IRI educationLevel = new IRI("http://purl.org/dc/terms/educationLevel");
+
+	/**
+	 * comment: The size or duration of the resource.
+
+	 */
+	public static final IRI extent = new IRI("http://purl.org/dc/terms/extent");
+
+	/**
+	 * description: Examples of dimensions include size and duration. Recommended best practice is to use a controlled vocabulary such as the list of Internet Media Types [MIME].
+comment: The file format, physical medium, or dimensions of the resource.
+
+	 */
+	public static final IRI format = new IRI("http://purl.org/dc/terms/format");
+
+	/**
+	 * comment: A related resource that is substantially the same as the pre-existing described resource, but in another format.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI hasFormat = new IRI("http://purl.org/dc/terms/hasFormat");
+
+	/**
+	 * comment: A related resource that is included either physically or logically in the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI hasPart = new IRI("http://purl.org/dc/terms/hasPart");
+
+	/**
+	 * comment: A related resource that is a version, edition, or adaptation of the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI hasVersion = new IRI("http://purl.org/dc/terms/hasVersion");
+
+	/**
+	 * description: Recommended best practice is to identify the resource by means of a string conforming to a formal identification system. 
+comment: An unambiguous reference to the resource within a given context.
+
+	 */
+	public static final IRI identifier = new IRI("http://purl.org/dc/terms/identifier");
+
+	/**
+	 * description: Instructional Method will typically include ways of presenting instructional materials or conducting instructional activities, patterns of learner-to-learner and learner-to-instructor interactions, and mechanisms by which group and individual levels of learning are measured.  Instructional methods include all aspects of the instruction and learning processes from planning and implementation through evaluation and feedback.
+comment: A process, used to engender knowledge, attitudes and skills, that the described resource is designed to support.
+
+	 */
+	public static final IRI instructionalMethod = new IRI("http://purl.org/dc/terms/instructionalMethod");
+
+	/**
+	 * comment: A related resource that is substantially the same as the described resource, but in another format.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isFormatOf = new IRI("http://purl.org/dc/terms/isFormatOf");
+
+	/**
+	 * comment: A related resource in which the described resource is physically or logically included.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isPartOf = new IRI("http://purl.org/dc/terms/isPartOf");
+
+	/**
+	 * comment: A related resource that references, cites, or otherwise points to the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isReferencedBy = new IRI("http://purl.org/dc/terms/isReferencedBy");
+
+	/**
+	 * comment: A related resource that supplants, displaces, or supersedes the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isReplacedBy = new IRI("http://purl.org/dc/terms/isReplacedBy");
+
+	/**
+	 * comment: A related resource that requires the described resource to support its function, delivery, or coherence.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isRequiredBy = new IRI("http://purl.org/dc/terms/isRequiredBy");
+
+	/**
+	 * description: Changes in version imply substantive changes in content rather than differences in format.
+comment: A related resource of which the described resource is a version, edition, or adaptation.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI isVersionOf = new IRI("http://purl.org/dc/terms/isVersionOf");
+
+	/**
+	 * comment: Date of formal issuance (e.g., publication) of the resource.
+
+	 */
+	public static final IRI issued = new IRI("http://purl.org/dc/terms/issued");
+
+	/**
+	 * description: Recommended best practice is to use a controlled vocabulary such as RFC 4646 [RFC4646].
+comment: A language of the resource.
+
+	 */
+	public static final IRI language = new IRI("http://purl.org/dc/terms/language");
+
+	/**
+	 * comment: A legal document giving official permission to do something with the resource.
+
+	 */
+	public static final IRI license = new IRI("http://purl.org/dc/terms/license");
+
+	/**
+	 * description: In an educational context, a mediator might be a parent, teacher, teaching assistant, or care-giver.
+comment: An entity that mediates access to the resource and for whom the resource is intended or useful.
+
+	 */
+	public static final IRI mediator = new IRI("http://purl.org/dc/terms/mediator");
+
+	/**
+	 * comment: The material or physical carrier of the resource.
+
+	 */
+	public static final IRI medium = new IRI("http://purl.org/dc/terms/medium");
+
+	/**
+	 * comment: Date on which the resource was changed.
+
+	 */
+	public static final IRI modified = new IRI("http://purl.org/dc/terms/modified");
+
+	/**
+	 * description: The statement may include a description of any changes successive custodians made to the resource.
+comment: A statement of any changes in ownership and custody of the resource since its creation that are significant for its authenticity, integrity, and interpretation.
+
+	 */
+	public static final IRI provenance = new IRI("http://purl.org/dc/terms/provenance");
+
+	/**
+	 * description: Examples of a Publisher include a person, an organization, or a service. Typically, the name of a Publisher should be used to indicate the entity.
+comment: An entity responsible for making the resource available.
+
+	 */
+	public static final IRI publisher = new IRI("http://purl.org/dc/terms/publisher");
+
+	/**
+	 * comment: A related resource that is referenced, cited, or otherwise pointed to by the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI references = new IRI("http://purl.org/dc/terms/references");
+
+	/**
+	 * description: Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system. 
+comment: A related resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI relation = new IRI("http://purl.org/dc/terms/relation");
+
+	/**
+	 * comment: A related resource that is supplanted, displaced, or superseded by the described resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI replaces = new IRI("http://purl.org/dc/terms/replaces");
+
+	/**
+	 * comment: A related resource that is required by the described resource to support its function, delivery, or coherence.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI requires = new IRI("http://purl.org/dc/terms/requires");
+
+	/**
+	 * description: Typically, rights information includes a statement about various property rights associated with the resource, including intellectual property rights.
+comment: Information about rights held in and over the resource.
+
+	 */
+	public static final IRI rights = new IRI("http://purl.org/dc/terms/rights");
+
+	/**
+	 * comment: A person or organization owning or managing rights over the resource.
+
+	 */
+	public static final IRI rightsHolder = new IRI("http://purl.org/dc/terms/rightsHolder");
+
+	/**
+	 * description: The described resource may be derived from the related resource in whole or in part. Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system.
+comment: A related resource from which the described resource is derived.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI source = new IRI("http://purl.org/dc/terms/source");
+
+	/**
+	 * comment: Spatial characteristics of the resource.
+
+	 */
+	public static final IRI spatial = new IRI("http://purl.org/dc/terms/spatial");
+
+	/**
+	 * description: Typically, the subject will be represented using keywords, key phrases, or classification codes. Recommended best practice is to use a controlled vocabulary. To describe the spatial or temporal topic of the resource, use the Coverage element.
+comment: The topic of the resource.
+note: This term is intended to be used with non-literal values as defined in the DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).  As of December 2007, the DCMI Usage Board is seeking a way to express this intention with a formal range declaration.
+
+	 */
+	public static final IRI subject = new IRI("http://purl.org/dc/terms/subject");
+
+	/**
+	 * comment: A list of subunits of the resource.
+
+	 */
+	public static final IRI tableOfContents = new IRI("http://purl.org/dc/terms/tableOfContents");
+
+	/**
+	 * comment: Temporal characteristics of the resource.
+
+	 */
+	public static final IRI temporal = new IRI("http://purl.org/dc/terms/temporal");
+
+	/**
+	 * description: A name given to the resource.
+note: In current practice, this term is used primarily with literal values; however, there are important uses with non-literal values as well.  As of December 2007, the DCMI Usage Board is leaving this range unspecified pending an investigation of options.
+
+	 */
+	public static final IRI title = new IRI("http://purl.org/dc/terms/title");
+
+	/**
+	 * description: Recommended best practice is to use a controlled vocabulary such as the DCMI Type Vocabulary [DCMITYPE]. To describe the file format, physical medium, or dimensions of the resource, use the Format element.
+comment: The nature or genre of the resource.
+
+	 */
+	public static final IRI type = new IRI("http://purl.org/dc/terms/type");
+
+	/**
+	 * comment: Date (often a range) of validity of a resource.
+
+	 */
+	public static final IRI valid = new IRI("http://purl.org/dc/terms/valid");
+
+	// Properties
+
+	/**
+	 * comment: The set of conceptual resources specified by the Dewey Decimal Classification.
+
+	 */
+	public static final IRI DDC = new IRI("http://purl.org/dc/terms/DDC");
+
+	/**
+	 * comment: The set of classes specified by the DCMI Type Vocabulary, used to categorize the nature or genre of the resource.
+
+	 */
+	public static final IRI DCMIType = new IRI("http://purl.org/dc/terms/DCMIType");
+
+	/**
+	 * comment: The set of media types specified by the Internet Assigned Numbers Authority.
+
+	 */
+	public static final IRI IMT = new IRI("http://purl.org/dc/terms/IMT");
+
+	/**
+	 * comment: The set of labeled concepts specified by the Library of Congress Subject Headings.
+
+	 */
+	public static final IRI LCSH = new IRI("http://purl.org/dc/terms/LCSH");
+
+	/**
+	 * comment: The set of labeled concepts specified by the Medical Subject Headings.
+
+	 */
+	public static final IRI MESH = new IRI("http://purl.org/dc/terms/MESH");
+
+	/**
+	 * comment: The set of conceptual resources specified by the Universal Decimal Classification.
+
+	 */
+	public static final IRI UDC = new IRI("http://purl.org/dc/terms/UDC");
+
+	/**
+	 * comment: The set of places specified by the Getty Thesaurus of Geographic Names.
+
+	 */
+	public static final IRI TGN = new IRI("http://purl.org/dc/terms/TGN");
+
+	/**
+	 * comment: The set of conceptual resources specified by the National Library of Medicine Classification.
+
+	 */
+	public static final IRI NLM = new IRI("http://purl.org/dc/terms/NLM");
+
+	/**
+	 * comment: The set of conceptual resources specified by the Library of Congress Classification.
+
+	 */
+	public static final IRI LCC = new IRI("http://purl.org/dc/terms/LCC");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/PLATFORM.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/PLATFORM.java
new file mode 100644
index 0000000..86537a2
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/PLATFORM.java
@@ -0,0 +1,94 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class PLATFORM {
+	// Classes
+
+	/**
+	 * definition: A web page typically rendered with a header.
+
+	 */
+	public static final IRI HeadedPage = new IRI("http://clerezza.org/2009/08/platform#HeadedPage");
+
+	/**
+	 * definition: 
+		An instance of a Clerezza platform.
+	
+
+	 */
+	public static final IRI Instance = new IRI("http://clerezza.org/2009/08/platform#Instance");
+
+	// Properties
+
+	/**
+	 * definition: Points to a base URI of the Clerezza
+		platform instance. A base Uri is the shortest URI of a URI-Hierarhy the
+		platform handles.
+	
+
+	 */
+	public static final IRI baseUri = new IRI("http://clerezza.org/2009/08/platform#baseUri");
+
+	/**
+	 * definition: Points to the default base URI of the Clerezza
+		platform instance.
+	
+
+	 */
+	public static final IRI defaultBaseUri = new IRI("http://clerezza.org/2009/08/platform#defaultBaseUri");
+
+	/**
+	 * definition: Points to a platform instance.
+	
+
+	 */
+	public static final IRI instance = new IRI("http://clerezza.org/2009/08/platform#instance");
+
+	/**
+	 * definition: Points to a rdf list containing the languages
+		supported by the platform instance. The first langague in the list is
+		the default language.
+	
+
+	 */
+	public static final IRI languages = new IRI("http://clerezza.org/2009/08/platform#languages");
+
+	/**
+	 * definition: Points to the last login time stamp of the user.
+	
+
+	 */
+	public static final IRI lastLogin = new IRI("http://clerezza.org/2009/08/platform#lastLogin");
+
+	/**
+	 * definition: Points to a literal which represents the ISO code of
+	a language.
+	
+
+	 */
+	public static final IRI preferredLangInISOCode = new IRI("http://clerezza.org/2009/08/platform#preferredLangInISOCode");
+
+	/**
+	 * definition: Points to a platform user.
+	
+
+	 */
+	public static final IRI user = new IRI("http://clerezza.org/2009/08/platform#user");
+
+	/**
+	 * definition: Points to a  unique name which is used as
+identifier for an online account of a platform. This is an inverse functional
+property.
+	
+
+	 */
+	public static final IRI userName = new IRI("http://clerezza.org/2009/08/platform#userName");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI THIS_ONTOLOGY = new IRI("http://clerezza.org/2009/08/platform#");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS04.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS04.java
new file mode 100644
index 0000000..1f858b1
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS04.java
@@ -0,0 +1,195 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class SKOS04 {
+	// Classes
+
+	/**
+	 * 
+	 */
+	public static final IRI Collection = new IRI("http://www.w3.org/2004/02/skos/core#Collection");
+
+	/**
+	 * 
+	 */
+	public static final IRI Concept = new IRI("http://www.w3.org/2004/02/skos/core#Concept");
+
+	/**
+	 * example: Thesauri, classification schemes, subject heading lists, taxonomies, 'folksonomies', and other types of controlled vocabulary are all examples of concept schemes. Concept schemes are also embedded in glossaries and terminologies.
+
+	 */
+	public static final IRI ConceptScheme = new IRI("http://www.w3.org/2004/02/skos/core#ConceptScheme");
+
+	/**
+	 * 
+	 */
+	public static final IRI OrderedCollection = new IRI("http://www.w3.org/2004/02/skos/core#OrderedCollection");
+
+	// Properties
+
+	/**
+	 * comment: The range of skos:altLabel is the class of RDF plain literals.
+comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
+example: Acronyms, abbreviations, spelling variants, and irregular plural/singular forms may be included among the alternative labels for a concept. Mis-spelled terms are normally included as hidden labels (see skos:hiddenLabel).
+
+	 */
+	public static final IRI altLabel = new IRI("http://www.w3.org/2004/02/skos/core#altLabel");
+
+	/**
+	 * 
+	 */
+	public static final IRI broadMatch = new IRI("http://www.w3.org/2004/02/skos/core#broadMatch");
+
+	/**
+	 * comment: Broader concepts are typically rendered as parents in a concept hierarchy (tree).
+
+	 */
+	public static final IRI broader = new IRI("http://www.w3.org/2004/02/skos/core#broader");
+
+	/**
+	 * 
+	 */
+	public static final IRI broaderTransitive = new IRI("http://www.w3.org/2004/02/skos/core#broaderTransitive");
+
+	/**
+	 * 
+	 */
+	public static final IRI changeNote = new IRI("http://www.w3.org/2004/02/skos/core#changeNote");
+
+	/**
+	 * 
+	 */
+	public static final IRI closeMatch = new IRI("http://www.w3.org/2004/02/skos/core#closeMatch");
+
+	/**
+	 * 
+	 */
+	public static final IRI definition = new IRI("http://www.w3.org/2004/02/skos/core#definition");
+
+	/**
+	 * 
+	 */
+	public static final IRI editorialNote = new IRI("http://www.w3.org/2004/02/skos/core#editorialNote");
+
+	/**
+	 * comment: skos:exactMatch is disjoint with each of the properties skos:broadMatch and skos:relatedMatch.
+
+	 */
+	public static final IRI exactMatch = new IRI("http://www.w3.org/2004/02/skos/core#exactMatch");
+
+	/**
+	 * 
+	 */
+	public static final IRI example = new IRI("http://www.w3.org/2004/02/skos/core#example");
+
+	/**
+	 * 
+	 */
+	public static final IRI hasTopConcept = new IRI("http://www.w3.org/2004/02/skos/core#hasTopConcept");
+
+	/**
+	 * comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
+comment: The range of skos:hiddenLabel is the class of RDF plain literals.
+
+	 */
+	public static final IRI hiddenLabel = new IRI("http://www.w3.org/2004/02/skos/core#hiddenLabel");
+
+	/**
+	 * 
+	 */
+	public static final IRI historyNote = new IRI("http://www.w3.org/2004/02/skos/core#historyNote");
+
+	/**
+	 * 
+	 */
+	public static final IRI inScheme = new IRI("http://www.w3.org/2004/02/skos/core#inScheme");
+
+	/**
+	 * comment: These concept mapping relations mirror semantic relations, and the data model defined below is similar (with the exception of skos:exactMatch) to the data model defined for semantic relations. A distinct vocabulary is provided for concept mapping relations, to provide a convenient way to differentiate links within a concept scheme from links between concept schemes. However, this pattern of usage is not a formal requirement of the SKOS data model, and relies on informal defi [...]
+
+	 */
+	public static final IRI mappingRelation = new IRI("http://www.w3.org/2004/02/skos/core#mappingRelation");
+
+	/**
+	 * 
+	 */
+	public static final IRI member = new IRI("http://www.w3.org/2004/02/skos/core#member");
+
+	/**
+	 * comment: For any resource, every item in the list given as the value of the
+      skos:memberList property is also a value of the skos:member property.
+
+	 */
+	public static final IRI memberList = new IRI("http://www.w3.org/2004/02/skos/core#memberList");
+
+	/**
+	 * 
+	 */
+	public static final IRI narrowMatch = new IRI("http://www.w3.org/2004/02/skos/core#narrowMatch");
+
+	/**
+	 * comment: Narrower concepts are typically rendered as children in a concept hierarchy (tree).
+
+	 */
+	public static final IRI narrower = new IRI("http://www.w3.org/2004/02/skos/core#narrower");
+
+	/**
+	 * 
+	 */
+	public static final IRI narrowerTransitive = new IRI("http://www.w3.org/2004/02/skos/core#narrowerTransitive");
+
+	/**
+	 * 
+	 */
+	public static final IRI notation = new IRI("http://www.w3.org/2004/02/skos/core#notation");
+
+	/**
+	 * 
+	 */
+	public static final IRI note = new IRI("http://www.w3.org/2004/02/skos/core#note");
+
+	/**
+	 * comment: A resource has no more than one value of skos:prefLabel per language tag, and no more than one value of skos:prefLabel without language tag.
+comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise
+      disjoint properties.
+comment: The range of skos:prefLabel is the class of RDF plain literals.
+
+	 */
+	public static final IRI prefLabel = new IRI("http://www.w3.org/2004/02/skos/core#prefLabel");
+
+	/**
+	 * comment: skos:related is disjoint with skos:broaderTransitive
+
+	 */
+	public static final IRI related = new IRI("http://www.w3.org/2004/02/skos/core#related");
+
+	/**
+	 * 
+	 */
+	public static final IRI relatedMatch = new IRI("http://www.w3.org/2004/02/skos/core#relatedMatch");
+
+	/**
+	 * 
+	 */
+	public static final IRI scopeNote = new IRI("http://www.w3.org/2004/02/skos/core#scopeNote");
+
+	/**
+	 * 
+	 */
+	public static final IRI semanticRelation = new IRI("http://www.w3.org/2004/02/skos/core#semanticRelation");
+
+	/**
+	 * 
+	 */
+	public static final IRI topConceptOf = new IRI("http://www.w3.org/2004/02/skos/core#topConceptOf");
+
+	// Properties
+
+	/**
+	 * title: SKOS Vocabulary
+description: An RDF vocabulary for describing the basic structure and content of concept schemes such as thesauri, classification schemes, subject heading lists, taxonomies, 'folksonomies', other types of controlled vocabulary, and also concept schemes embedded in glossaries and terminologies.
+
+	 */
+	public static final IRI core = new IRI("http://www.w3.org/2004/02/skos/core");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS08.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS08.java
new file mode 100644
index 0000000..985bbcd
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/SKOS08.java
@@ -0,0 +1,234 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class SKOS08 {
+	// Classes
+
+	/**
+	 * definition: A meaningful collection of concepts.
+comment: Labelled collections can be used with collectable semantic relation properties e.g. skos:narrower, where you would like a set of concepts to be displayed under a 'node label' in the hierarchy.
+
+	 */
+	public static final IRI Collection = new IRI("http://www.w3.org/2008/05/skos#Collection");
+
+	/**
+	 * definition: An abstract idea or notion; a unit of thought.
+
+	 */
+	public static final IRI Concept = new IRI("http://www.w3.org/2008/05/skos#Concept");
+
+	/**
+	 * definition: A set of concepts, optionally including statements about semantic relationships between those concepts.
+comment: A concept scheme may be defined to include concepts from different sources.
+comment: Thesauri, classification schemes, subject heading lists, taxonomies, 'folksonomies', and other types of controlled vocabulary are all examples of concept schemes.  Concept schemes are also embedded in glossaries and terminologies.
+
+	 */
+	public static final IRI ConceptScheme = new IRI("http://www.w3.org/2008/05/skos#ConceptScheme");
+
+	/**
+	 * definition: An ordered collection of concepts, where both the grouping and the ordering are meaningful.
+comment: Ordered collections can be used with collectable semantic relation properties, where you would like a set of concepts to be displayed in a specific order, and optionally under a 'node label'.
+
+	 */
+	public static final IRI OrderedCollection = new IRI("http://www.w3.org/2008/05/skos#OrderedCollection");
+
+	// Properties
+
+	/**
+	 * definition: An alternative lexical label for a resource.
+comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
+comment: The range of skos:altLabel is the class of RDF plain literals.
+comment: Acronyms, abbreviations, spelling variants, and irregular plural/singular forms may be included among the alternative labels for a concept.  Mis-spelled terms are normally included as hidden labels (see skos:hiddenLabel).
+
+	 */
+	public static final IRI altLabel = new IRI("http://www.w3.org/2008/05/skos#altLabel");
+
+	/**
+	 * definition: skos:broadMatch is used to state a hierarchical mapping link between two conceptual resources in different concept schemes.
+
+	 */
+	public static final IRI broadMatch = new IRI("http://www.w3.org/2008/05/skos#broadMatch");
+
+	/**
+	 * definition: A concept that is more general in meaning.
+comment: By convention, skos:broader is only used to assert an immediate (i.e. direct) hierarchical link between two conceptual resources.
+comment: Broader concepts are typically rendered as parents in a concept hierarchy (tree).
+
+	 */
+	public static final IRI broader = new IRI("http://www.w3.org/2008/05/skos#broader");
+
+	/**
+	 * definition: skos:broaderTransitive is a transitive superproperty of skos:broader.
+comment: By convention, skos:broaderTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application.
+
+	 */
+	public static final IRI broaderTransitive = new IRI("http://www.w3.org/2008/05/skos#broaderTransitive");
+
+	/**
+	 * definition: A note about a modification to a concept.
+
+	 */
+	public static final IRI changeNote = new IRI("http://www.w3.org/2008/05/skos#changeNote");
+
+	/**
+	 * definition: skos:closeMatch is used to link two concepts that are sufficiently similar that they can be used interchangeably in some information retrieval applications. In order to avoid the possibility of "compound errors" when combining mappings across more than two concept schemes, skos:closeMatch is not declared to be a transitive property.
+
+	 */
+	public static final IRI closeMatch = new IRI("http://www.w3.org/2008/05/skos#closeMatch");
+
+	/**
+	 * definition: A statement or formal explanation of the meaning of a concept.
+
+	 */
+	public static final IRI definition = new IRI("http://www.w3.org/2008/05/skos#definition");
+
+	/**
+	 * definition: A note for an editor, translator or maintainer of the vocabulary.
+
+	 */
+	public static final IRI editorialNote = new IRI("http://www.w3.org/2008/05/skos#editorialNote");
+
+	/**
+	 * definition: skos:exactMatch is used to link two concepts, indicating a high degree of confidence that the concepts can be used interchangeably across a wide range of information retrieval applications. skos:exactMatch is a transitive property, and is a sub-property of skos:closeMatch.
+comment: skos:exactMatch is disjoint with each of the properties skos:broadMatch and skos:relatedMatch.
+
+	 */
+	public static final IRI exactMatch = new IRI("http://www.w3.org/2008/05/skos#exactMatch");
+
+	/**
+	 * definition: An example of the use of a concept.
+
+	 */
+	public static final IRI example = new IRI("http://www.w3.org/2008/05/skos#example");
+
+	/**
+	 * definition: A top level concept in the concept scheme.
+
+	 */
+	public static final IRI hasTopConcept = new IRI("http://www.w3.org/2008/05/skos#hasTopConcept");
+
+	/**
+	 * definition: A lexical label for a resource that should be hidden when generating visual displays of the resource, but should still be accessible to free text search operations.
+comment: The range of skos:hiddenLabel is the class of RDF plain literals.
+comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
+
+	 */
+	public static final IRI hiddenLabel = new IRI("http://www.w3.org/2008/05/skos#hiddenLabel");
+
+	/**
+	 * definition: A note about the past state/use/meaning of a concept.
+
+	 */
+	public static final IRI historyNote = new IRI("http://www.w3.org/2008/05/skos#historyNote");
+
+	/**
+	 * definition: A concept scheme in which the concept is included.
+comment: A concept may be a member of more than one concept scheme.
+
+	 */
+	public static final IRI inScheme = new IRI("http://www.w3.org/2008/05/skos#inScheme");
+
+	/**
+	 * definition: Definition
+comment: These concept mapping relations mirror semantic relations, and the data model defined below is similar (with the exception of skos:exactMatch) to the data model defined for semantic relations. A distinct vocabulary is provided for concept mapping relations, to provide a convenient way to differentiate links within a concept scheme from links between concept schemes. However, this pattern of usage is not a formal requirement of the SKOS data model, and relies on informal definiti [...]
+
+	 */
+	public static final IRI mappingRelation = new IRI("http://www.w3.org/2008/05/skos#mappingRelation");
+
+	/**
+	 * definition: A member of a collection.
+
+	 */
+	public static final IRI member = new IRI("http://www.w3.org/2008/05/skos#member");
+
+	/**
+	 * definition: An RDF list containing the members of an ordered collection.
+comment: For any resource, every item in the list given as the value of the skos:memberList property is also a value of the skos:member property.
+
+	 */
+	public static final IRI memberList = new IRI("http://www.w3.org/2008/05/skos#memberList");
+
+	/**
+	 * definition: skos:narrowMatch is used to state a hierarchical mapping link between two conceptual resources in different concept schemes.
+
+	 */
+	public static final IRI narrowMatch = new IRI("http://www.w3.org/2008/05/skos#narrowMatch");
+
+	/**
+	 * definition: A concept that is more specific in meaning.
+comment: By convention, skos:broader is only used to assert an immediate (i.e. direct) hierarchical link between two conceptual resources.
+comment: Narrower concepts are typically rendered as children in a concept hierarchy (tree).
+
+	 */
+	public static final IRI narrower = new IRI("http://www.w3.org/2008/05/skos#narrower");
+
+	/**
+	 * definition: skos:narrowerTransitive is a transitive superproperty of skos:broader. By convention, skos:narrowerTransitive is not intended to be used in assertions, but provides a mechanism whereby the transitive closure of skos:narrower can be queried.
+comment: By convention, skos:narrowerTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application.
+
+	 */
+	public static final IRI narrowerTransitive = new IRI("http://www.w3.org/2008/05/skos#narrowerTransitive");
+
+	/**
+	 * definition: A notation, also known as classification code, is a string of characters such as "T58.5" or "303.4833" used to uniquely identify a concept within the scope of a given concept scheme.
+comment: By convention, skos:notation is used with a typed literal in the object position of the triple.
+
+	 */
+	public static final IRI notation = new IRI("http://www.w3.org/2008/05/skos#notation");
+
+	/**
+	 * definition: A general note, for any purpose.
+comment: This property may be used directly, or as a super-property for more specific note types.
+
+	 */
+	public static final IRI note = new IRI("http://www.w3.org/2008/05/skos#note");
+
+	/**
+	 * definition: The preferred lexical label for a resource, in a given language.
+comment: The range of skos:prefLabel is the class of RDF plain literals.
+comment: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
+comment: No two concepts in the same concept scheme may have the same value for skos:prefLabel in a given language.
+
+	 */
+	public static final IRI prefLabel = new IRI("http://www.w3.org/2008/05/skos#prefLabel");
+
+	/**
+	 * definition: A concept with which there is an associative semantic relationship.
+comment: skos:related is disjoint with skos:broaderTransitive
+
+	 */
+	public static final IRI related = new IRI("http://www.w3.org/2008/05/skos#related");
+
+	/**
+	 * definition: skos:relatedMatch is used to state an associative mapping link between two conceptual resources in different concept schemes.
+
+	 */
+	public static final IRI relatedMatch = new IRI("http://www.w3.org/2008/05/skos#relatedMatch");
+
+	/**
+	 * definition: A note that helps to clarify the meaning of a concept.
+
+	 */
+	public static final IRI scopeNote = new IRI("http://www.w3.org/2008/05/skos#scopeNote");
+
+	/**
+	 * definition: A concept related by meaning.
+comment: This property should not be used directly, but as a super-property for all properties denoting a relationship of meaning between concepts.
+
+	 */
+	public static final IRI semanticRelation = new IRI("http://www.w3.org/2008/05/skos#semanticRelation");
+
+	/**
+	 * definition: Relates a concept to the concept scheme that it is a top level concept of.
+
+	 */
+	public static final IRI topConceptOf = new IRI("http://www.w3.org/2008/05/skos#topConceptOf");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI skos = new IRI("http://www.w3.org/2008/05/skos");
+}


[clerezza] 23/45: CLEREZZA-1031: Move TcProviderTest from test.utils to dataset

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit c2efd15aeedb70b575e85852a7fc68d157bad289
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 10 16:16:52 2019 +0100

    CLEREZZA-1031: Move TcProviderTest from test.utils to dataset
---
 .../dataset/test/utils/TcProviderTest.java         | 480 +++++++++++++++++++++
 .../simple/storage/GenericTcProviderTest.java      |   2 +-
 2 files changed, 481 insertions(+), 1 deletion(-)

diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/test/utils/TcProviderTest.java b/dataset/src/test/java/org/apache/clerezza/dataset/test/utils/TcProviderTest.java
new file mode 100644
index 0000000..d319e5d
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/test/utils/TcProviderTest.java
@@ -0,0 +1,480 @@
+/*
+ * 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.dataset.test.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.dataset.EntityAlreadyExistsException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+/**
+ * 
+ * @author mir,rbn
+ */
+public abstract class TcProviderTest {
+
+    protected final IRI uriRefA = generateUri("a");
+    protected final IRI uriRefA1 = generateUri("a1");
+    protected final IRI uriRefB = generateUri("b");
+    protected final IRI uriRefB1 = generateUri("b1");
+    protected final IRI uriRefC = generateUri("c");
+
+    protected final IRI graphIRI = generateUri("myGraph");
+    protected final IRI otherGraphIRI = new IRI(graphIRI.getUnicodeString());
+
+    @Test
+    public void testCreateImmutableGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+
+        ImmutableGraph createdGraph = simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+
+        Iterator<Triple> iteratorInput = mGraph.iterator();
+        Iterator<Triple> iteratorCreated = createdGraph.iterator();
+        Assert.assertEquals(iteratorInput.next(), iteratorCreated.next());
+        Assert.assertFalse(iteratorCreated.hasNext());
+
+        try {
+            simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+            Assert.assertTrue(false);
+        } catch (EntityAlreadyExistsException e) {
+            Assert.assertTrue(true);
+        }
+        simpleTcmProvider.deleteGraph(uriRefA);
+    }
+
+    @Test
+    public void testCreateGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
+        Assert.assertTrue(mGraph.isEmpty());
+
+        try {
+            simpleTcmProvider.createGraph(uriRefA);
+            Assert.assertTrue(false);
+        } catch (EntityAlreadyExistsException e) {
+            Assert.assertTrue(true);
+        }
+        simpleTcmProvider.deleteGraph(uriRefA);
+    }
+
+    @Test
+    public void testGetImmutableGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        simpleTcmProvider.createImmutableGraph(uriRefA1, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+        simpleTcmProvider.createImmutableGraph(uriRefB1, mGraph);
+
+        ImmutableGraph bGraph = simpleTcmProvider.getImmutableGraph(uriRefB);
+        Iterator<Triple> iterator = bGraph.iterator();
+        Assert.assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+    }
+
+    @Test
+    public void testGetGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        mGraph = simpleTcmProvider.createGraph(uriRefA1);
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        mGraph = simpleTcmProvider.createGraph(uriRefB);
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
+        Assert.assertEquals(1, mGraph.size());
+        mGraph = simpleTcmProvider.createGraph(uriRefB1);
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+        Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
+        Iterator<Triple> iterator = bGraph.iterator();
+        Assert.assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+        
+    }
+
+    @Test
+    public void testGetTriples() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+        // add Graphs
+        mGraph = simpleTcmProvider.createGraph(uriRefA1);
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        mGraph = simpleTcmProvider.createGraph(uriRefB1);
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+        // get a ImmutableGraph
+        Graph tripleCollection = simpleTcmProvider.getGraph(uriRefA);
+        // get a Graph
+        Graph tripleCollection2 = simpleTcmProvider.getGraph(uriRefB1);
+
+        Iterator<Triple> iterator = tripleCollection.iterator();
+        Assert.assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+
+        iterator = tripleCollection2.iterator();
+        Assert.assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+    }
+
+    @Test
+    public void testDeleteEntity() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        ImmutableGraph graph = mGraph.getImmutableGraph();
+        simpleTcmProvider.createImmutableGraph(uriRefA, graph);
+        simpleTcmProvider.createImmutableGraph(uriRefC, graph);
+
+        simpleTcmProvider.deleteGraph(uriRefA);
+        try {
+            simpleTcmProvider.getGraph(uriRefA);
+            Assert.assertTrue(false);
+        } catch (NoSuchEntityException e) {
+            Assert.assertTrue(true);
+        }
+
+        // Check that graph is still available under uriRefC
+        ImmutableGraph cGraph = simpleTcmProvider.getImmutableGraph(uriRefC);
+        Assert.assertNotNull(cGraph);
+        simpleTcmProvider.deleteGraph(uriRefC);
+    }
+
+    /**
+     * Subclasses implement this method to provide implementation instances of
+     * <code>TcProvider</code>. The first call within a test method has to
+     * return a empty TcProvider. Subsequent calls within the test method
+     * should instantiate a new provider, but load the previously added data from
+     * its "persistent" store.
+     *
+     * @return a TcProvider of the implementation to be tested.
+     */
+    protected abstract TcProvider getInstance();
+
+//    @Test
+//    public void testGetNames() {
+//        Graph mGraph = new SimpleGraph();
+//        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+//        simpleTcmProvider.createGraph(uriRefB, mGraph.getGraph());
+//        
+//        mGraph = new SimpleGraph();
+//        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+//        ImmutableGraph graph = mGraph.getGraph();
+//        simpleTcmProvider.createGraph(uriRefA, graph);
+//        simpleTcmProvider.createGraph(uriRefC, graph);
+//
+//        Set<IRI> names = simpleTcmProvider.getNames(graph);
+//
+//        assertTrue(names.contains(uriRefA));
+//        assertTrue(names.contains(uriRefC));
+//        assertEquals(2, names.size());
+//
+//        assertFalse(names.contains(uriRefB));
+//    }
+
+    @Test
+    public void testCreateGraphExtended() throws Exception {
+
+        TcProvider provider = getInstance();
+        Graph graph = provider.createGraph(graphIRI);
+        Assert.assertNotNull(graph);
+        //get a new provider and check that graph is there
+        provider = getInstance();
+        graph = provider.getGraph(graphIRI);
+        Assert.assertNotNull(graph);
+        //check that there is no such graph, but only the mgraph
+        boolean expThrown = false;
+        try {
+            ImmutableGraph g = provider.getImmutableGraph(graphIRI);
+        } catch(NoSuchEntityException e) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateImmutableGraphExtended() throws Exception {
+
+        TcProvider provider = getInstance();
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
+
+        Assert.assertNotNull(graph);
+
+        //get a new provider and check that graph is there
+        provider = getInstance();
+        graph = provider.getImmutableGraph(graphIRI);
+        Assert.assertNotNull(graph);
+
+        //check that there is no such mgraph, but only the graph
+        boolean expThrown = false;
+
+        try {
+            Graph g = provider.getMGraph(graphIRI);
+        } catch(NoSuchEntityException e) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphNoDuplicateNames() throws Exception {
+
+        TcProvider provider = getInstance();
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
+        Assert.assertNotNull(graph);
+        boolean expThrown = false;
+        try {
+            ImmutableGraph other = provider.createImmutableGraph(otherGraphIRI, null);
+        } catch(EntityAlreadyExistsException eaee) {
+            expThrown = true;
+        }
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphNoDuplicateNames2() throws Exception {
+
+        TcProvider provider = getInstance();
+        Graph graph = provider.createGraph(graphIRI);
+        Assert.assertNotNull(graph);
+        boolean expThrown = false;
+        try {
+            Graph other = provider.createGraph(otherGraphIRI);
+        } catch(EntityAlreadyExistsException eaee) {
+            expThrown = true;
+        }
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphWithInitialCollection() throws Exception {
+
+        Triple t1 = createTestTriple();
+
+        TcProvider provider = getInstance();
+
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
+
+        Assert.assertEquals(1, graph.size());
+        Assert.assertTrue(graph.contains(t1));
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testGraphIsNotMutable() throws Exception {
+
+        Triple t1 = createTestTriple();
+        Set<Triple> t = new HashSet<Triple>();
+        t.add(t1);
+
+        TcProvider provider = getInstance();
+
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
+
+        boolean expThrown = false;
+
+        try {
+            graph.add(t1);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        expThrown = false;
+
+        try {
+            graph.remove(t1);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        expThrown = false;
+
+        try {
+            graph.addAll(t);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+
+        expThrown = false;
+
+        try {
+            graph.clear();
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+
+        expThrown = false;
+
+        try {
+            graph.removeAll(t);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+//    This tests can not pass, because equals in AbstractGraph is not implemented
+//    yet.
+//    @Test
+//    public void testGraphHasName() throws Exception {
+//
+//        TcProvider provider = getInstance();
+//
+//        Graph triples = createTestTripleCollection(createTestTriple());
+//        ImmutableGraph graph = provider.createGraph(graphIRI, triples);
+//
+//        provider = getInstance();
+//        Set<IRI> names = provider.getNames(graph);
+//        assertTrue(names.contains(graphIRI));
+//    }
+//
+//    @Test
+//    public void testCreateSameGraphWithDifferentNames() throws Exception {
+//
+//        Graph triples = createTestTripleCollection(createTestTriple());
+//
+//        TcProvider provider = getInstance();
+//        IRI name1 = new IRI("http://myGraph1");
+//        ImmutableGraph graph = provider.createGraph(name1, triples);
+//
+//        IRI name2 = new IRI("http://myGraph2");
+//        ImmutableGraph secondGraph = provider.createGraph(name2, triples);
+//
+//        Set<IRI> names = provider.getNames(graph);
+//        assertNotNull(names);
+//        assertEquals(2, names.size());
+//    }
+
+    @Test
+    public void testGraphDeletion() throws Exception {
+
+        Graph triples = createTestTripleCollection(createTestTriple());
+
+        TcProvider provider = getInstance();
+        IRI name1 = new IRI("http://myGraph1");
+        ImmutableGraph graph = provider.createImmutableGraph(name1, triples);
+
+        IRI name2 = new IRI("http://myGraph2");
+        ImmutableGraph secondGraph = provider.createImmutableGraph(name2, triples);
+
+        //if we delete graph with name1, the second graph should still be there
+        provider.deleteGraph(name1);
+
+        provider = getInstance();
+        ImmutableGraph firstGraph = provider.getImmutableGraph(name2);
+        Assert.assertNotNull(firstGraph);
+
+        //check second name is not there
+        boolean expThrown = false;
+
+        try {
+            ImmutableGraph g = provider.getImmutableGraph(name1);
+        } catch(NoSuchEntityException nses) {
+            expThrown = true;
+        }
+
+        Assert.assertTrue(expThrown);
+        provider.deleteGraph(name2);
+    }
+
+
+
+    @Test
+    public void testGetTriplesGraph() throws Exception {
+        TcProvider provider = getInstance();
+
+        Graph graph = provider.createGraph(graphIRI);
+
+        Graph tc = provider.getGraph(graphIRI);
+        Assert.assertNotNull(tc);
+        provider.deleteGraph(graphIRI);
+    }
+
+    private Triple createTestTriple() {
+        BlankNodeOrIRI subject = new BlankNode() {};
+        IRI predicate = new IRI("http://test.com/");
+        BlankNodeOrIRI object = new IRI("http://test.com/myObject");
+        return new TripleImpl(subject, predicate, object);
+    }
+
+    private Graph createTestTripleCollection(Triple t) {
+        Set<Triple> ts = new HashSet<Triple>();
+        ts.add(t);
+        return new SimpleGraph(ts);
+    }
+
+    protected IRI generateUri(String name) {
+        return new IRI("http://example.org/" + name);
+    }
+    
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java b/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java
index 65dcd10..c46a835 100644
--- a/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java
+++ b/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java
@@ -19,7 +19,7 @@
 package org.apache.clerezza.simple.storage;
 
 import org.apache.clerezza.dataset.TcProvider;
-import org.apache.clerezza.test.utils.TcProviderTest;
+import org.apache.clerezza.dataset.test.utils.TcProviderTest;
 import org.junit.After;
 
 /**


[clerezza] 34/45: CLEREZZA-1026: Reformat codes in api.impl

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 7a08040997383e4945d54c5f39154e87b39af4c8
Author: Hasan <ha...@apache.org>
AuthorDate: Thu Feb 14 22:21:38 2019 +0100

    CLEREZZA-1026: Reformat codes in api.impl
---
 api.impl/pom.xml                                   |  52 ++-
 .../org/apache/clerezza/api/impl/TripleImpl.java   |  36 +-
 .../clerezza/api/impl/debug/ReadLockDebug.java     |  27 +-
 .../impl/debug/ReentrantReadWriteLockTracker.java  |  27 +-
 .../clerezza/api/impl/debug/WriteLockDebug.java    |  26 +-
 .../clerezza/api/impl/graph/AbstractGraph.java     |  46 +--
 .../api/impl/graph/AbstractImmutableGraph.java     |  44 +-
 .../api/impl/graph/DelayedNotificator.java         |  38 +-
 .../clerezza/api/impl/graph/LockingIterator.java   |  29 +-
 .../api/impl/graph/PrivilegedGraphWrapper.java     |  32 +-
 .../graph/PrivilegedImmuatbleGraphWrapper.java     |  29 +-
 .../clerezza/api/impl/graph/ReadOnlyException.java |  34 +-
 .../clerezza/api/impl/graph/SimpleGraph.java       |  54 +--
 .../api/impl/graph/SimpleImmutableGraph.java       |  44 +-
 .../clerezza/api/impl/graph/SimpleMGraph.java      |  36 +-
 .../api/impl/graph/WatchableGraphWrapper.java      |  51 +--
 .../clerezza/api/impl/graph/WriteBlockedGraph.java |  40 +-
 .../api/impl/graphmatching/GraphMatcher.java       |  56 ++-
 .../graphmatching/GraphNotIsomorphicException.java |  27 +-
 .../impl/graphmatching/GroupMappingIterator.java   |  47 +--
 .../api/impl/graphmatching/HashMatching.java       |  90 ++---
 .../api/impl/graphmatching/MappingIterator.java    |  41 +-
 .../impl/graphmatching/PermutationIterator.java    |  40 +-
 .../clerezza/api/impl/graphmatching/Utils.java     |  36 +-
 .../impl/graphmatching/collections/IntHashMap.java | 131 +++---
 .../impl/graphmatching/collections/IntHashSet.java |  24 +-
 .../graphmatching/collections/IntIterator.java     |  23 +-
 .../api/impl/graphmatching/collections/IntSet.java |  27 +-
 .../clerezza/api/impl/literal/AbstractLiteral.java |  27 +-
 .../impl/literal/InvalidLiteralTypeException.java  |  33 +-
 .../clerezza/api/impl/literal/LiteralFactory.java  |  35 +-
 .../clerezza/api/impl/literal/LiteralImpl.java     |  42 +-
 .../api/impl/literal/NoConvertorException.java     |  29 +-
 .../api/impl/literal/PlainLiteralImpl.java         |  31 +-
 .../api/impl/literal/SimpleLiteralFactory.java     |  68 ++--
 .../api/impl/literal/TypedLiteralImpl.java         |  40 +-
 .../org/apache/clerezza/api/impl/package-info.java |  24 +-
 .../org/apache/clerezza/api/impl/util/Base64.java  |  31 +-
 .../clerezza/api/impl/util/W3CDateFormat.java      |  55 ++-
 .../org/apache/clerezza/api/impl/LanguageTest.java |  32 +-
 .../org/apache/clerezza/api/impl/UriRefTest.java   |  37 +-
 .../apache/clerezza/api/impl/graph/GraphTest.java  | 446 ++++++++++-----------
 .../clerezza/api/impl/graph/SimpleGraphTest.java   |  43 +-
 .../api/impl/graphmatching/GraphMatcherTest.java   |  82 ++--
 .../api/impl/graphmatching/HashMatchingTest.java   |  39 +-
 .../graphmatching/PermutationIteratorTest.java     |  31 +-
 .../api/impl/graphmatching/Utils4Testing.java      |  30 +-
 .../api/impl/literal/LiteralFactoryTest.java       |  42 +-
 .../api/impl/literal/PlainLiteralImplTest.java     |  47 +--
 .../clerezza/api/impl/literal/TripleImplTest.java  |  52 +--
 .../api/impl/literal/TypedLiteralImplTest.java     |  53 +--
 51 files changed, 1203 insertions(+), 1333 deletions(-)

diff --git a/api.impl/pom.xml b/api.impl/pom.xml
index 34f63ec..326b7e4 100644
--- a/api.impl/pom.xml
+++ b/api.impl/pom.xml
@@ -1,32 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
+  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
 
-   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.
+    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.
 -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
         <version>8-SNAPSHOT</version>
-        <relativePath />
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
+    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>api.impl</artifactId>
     <packaging>bundle</packaging>
@@ -39,15 +38,14 @@
         <system>jira</system>
         <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
     </issueManagement>
-    
-    <inceptionYear>2015</inceptionYear>
+
     <scm>
         <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
         <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
         <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
-      <tag>HEAD</tag>
-  </scm>
-    
+        <tag>HEAD</tag>
+    </scm>
+
     <build>
         <plugins>
             <plugin>
@@ -56,14 +54,13 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.api.impl.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
         </plugins>
     </build>
 
-
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -76,5 +73,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-
 </project>
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
index 1f67d39..2848028 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
@@ -1,30 +1,28 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 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.IRI;
 
 /**
- *
  * @author reto
  */
 public class TripleImpl implements Triple {
@@ -36,10 +34,10 @@ public class TripleImpl implements Triple {
     /**
      * Creates a new <code>TripleImpl</code>.
      *
-     * @param subject  the subject.
-     * @param predicate  the predicate.
-     * @param object  the object.
-     * @throws IllegalArgumentException  if an attribute is <code>null</code>.
+     * @param subject   the subject.
+     * @param predicate the predicate.
+     * @param object    the object.
+     * @throws IllegalArgumentException if an attribute is <code>null</code>.
      */
     public TripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
         if (subject == null) {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
index f826dee..1f63319 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.debug;
@@ -24,7 +23,6 @@ import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
 
 /**
- *
  * @author mir
  */
 public class ReadLockDebug extends ReadLock {
@@ -33,6 +31,7 @@ public class ReadLockDebug extends ReadLock {
     StackTraceElement[] stackTrace;
 
     ReadLock readLock;
+
     public ReadLockDebug(ReentrantReadWriteLockTracker lock) {
         super(lock);
         this.lock = lock;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
index 94e8a6c..70073cb 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.debug;
 
@@ -26,7 +25,6 @@ import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 /**
- *
  * @author mir
  */
 public class ReentrantReadWriteLockTracker extends ReentrantReadWriteLock {
@@ -34,6 +32,7 @@ public class ReentrantReadWriteLockTracker extends ReentrantReadWriteLock {
 
     private Set<ReadLockDebug> lockedReadLocks = Collections.synchronizedSet(new HashSet<ReadLockDebug>());
     private final WriteLockDebug writeLock = new WriteLockDebug(this);
+
     @Override
     protected Thread getOwner() {
         return super.getOwner();
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
index 82301a3..f0d567e 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.debug;
@@ -24,7 +23,6 @@ import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
 /**
- *
  * @author mir
  */
 public class WriteLockDebug extends WriteLock {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
index b4e996e..f03626f 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractGraph.java
@@ -1,39 +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
+ * 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.
+ * 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.debug.ReentrantReadWriteLockTracker;
+
 import java.util.AbstractCollection;
 import java.util.Collection;
 import java.util.Iterator;
-
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.ImmutableGraph;
-import org.apache.clerezza.api.impl.debug.ReentrantReadWriteLockTracker;
-
 /**
  * An abstract implementation of <code>Graph</code> implementing
  * <code>iterator</code> and <code>contains</code> calling <code>filter</code>.
@@ -43,7 +36,6 @@ import org.apache.clerezza.api.impl.debug.ReentrantReadWriteLockTracker;
 public abstract class AbstractGraph extends AbstractCollection<Triple>
         implements Graph {
 
-    
     private static final String DEBUG_MODE = "rdfLocksDebugging";
     private final ReadWriteLock lock;
 
@@ -67,7 +59,7 @@ public abstract class AbstractGraph extends AbstractCollection<Triple>
         readLock = lock.readLock();
         writeLock = lock.writeLock();
     }
-    
+
     public AbstractGraph(final ReadWriteLock lock) {
         this.lock = lock;
         readLock = lock.readLock();
@@ -88,7 +80,7 @@ public abstract class AbstractGraph extends AbstractCollection<Triple>
             readLock.unlock();
         }
     }
-    
+
     public ImmutableGraph performGetImmutableGraph() {
         return new SimpleImmutableGraph(this);
     }
@@ -234,7 +226,7 @@ public abstract class AbstractGraph extends AbstractCollection<Triple>
         }
     }
 
-    
+
     @Override
     public boolean equals(Object obj) {
         /*if (obj == null) {
@@ -302,5 +294,5 @@ public abstract class AbstractGraph extends AbstractCollection<Triple>
         return super.add(e);
     }
 
- 
+
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
index a9c35b6..d8fab05 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/AbstractImmutableGraph.java
@@ -1,45 +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
+ * 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.
+ * 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 java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.clerezza.api.impl.graphmatching.GraphMatcher;
 import org.apache.clerezza.api.BlankNode;
 import org.apache.clerezza.api.ImmutableGraph;
 import org.apache.clerezza.api.RDFTerm;
 import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.graphmatching.GraphMatcher;
+
+import java.util.Collection;
+import java.util.Iterator;
 
 /**
- * <code>AbstractGraph</code> is an abstract implementation of <code>ImmutableGraph</code> 
+ * <code>AbstractGraph</code> is an abstract implementation of <code>ImmutableGraph</code>
  * implementing the <code>equals</code> and the <code>hashCode</code> methods.
- * 
+ *
  * @author reto
- * 
  */
 public abstract class AbstractImmutableGraph extends AbstractGraph
         implements ImmutableGraph {
 
     public final synchronized int hashCode() {
         int result = 0;
-        for (Iterator<Triple> iter = iterator(); iter.hasNext();) {
+        for (Iterator<Triple> iter = iterator(); iter.hasNext(); ) {
             result += getBlankNodeBlindHash(iter.next());
         }
         return result;
@@ -89,8 +87,8 @@ public abstract class AbstractImmutableGraph extends AbstractGraph
     public void clear() {
         throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
     }
-    
-    
+
+
     @Override
     public ImmutableGraph getImmutableGraph() {
         return this;
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
index a3512e2..1eee4ea 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/DelayedNotificator.java
@@ -1,40 +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
+ * 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.
+ * 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.event.GraphEvent;
+import org.apache.clerezza.api.event.GraphListener;
+
 import java.lang.ref.WeakReference;
 import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.clerezza.api.event.GraphEvent;
-import org.apache.clerezza.api.event.GraphListener;
-
-
 /**
- *
  * @author reto
  */
 class DelayedNotificator {
 
     private static final Logger log = Logger.getLogger(DelayedNotificator.class.getName());
-    private static Timer timer = new Timer("Event delivery timer",true);
+    private static Timer timer = new Timer("Event delivery timer", true);
 
     static class ListenerHolder {
 
@@ -79,7 +76,7 @@ class DelayedNotificator {
             }
         }
     }
-    
+
     private final Map<GraphListener, ListenerHolder> map = Collections.synchronizedMap(
             new WeakHashMap<GraphListener, ListenerHolder>());
 
@@ -100,6 +97,7 @@ class DelayedNotificator {
     /**
      * if the listenerRef has not been registered as delayed listenerRef te events is
      * forwarded synchroneously
+     *
      * @param event
      */
     void sendEventToListener(GraphListener listener, GraphEvent event) {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
index 4db0d85..150b491 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/LockingIterator.java
@@ -1,31 +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
+ * 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.
+ * 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.Triple;
+
 import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.api.Triple;
 
 /**
  * Wrapps an iterator<Triple> reading entering a read-lock on every invocation
  * of hasNext and next
+ *
  * @author reto
  */
 class LockingIterator implements Iterator<Triple> {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java
index ce682b0..8a911a5 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedGraphWrapper.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -28,7 +27,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 
 /**
  * Calls the methods of the wrapped <code>Graph</code> as privileged
- * code, because they may need permissions like writing to disk or accessing       
+ * code, because they may need permissions like writing to disk or accessing
  * network.
  *
  * @author mir
@@ -43,7 +42,7 @@ public class PrivilegedGraphWrapper implements Graph {
 
     @Override
     public Iterator<Triple> filter(final BlankNodeOrIRI subject, final IRI predicate,
-            final RDFTerm object) {
+                                   final RDFTerm object) {
         return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
 
             @Override
@@ -244,8 +243,7 @@ public class PrivilegedGraphWrapper implements Graph {
             });
         }
     }
-    
-    
+
 
     @Override
     public ImmutableGraph getImmutableGraph() {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
index f9367ac..1a73b8c 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/PrivilegedImmuatbleGraphWrapper.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -22,9 +21,9 @@ import org.apache.clerezza.api.ImmutableGraph;
 
 /**
  * Calls the methods of the wrapped <code>ImmutableGraph</code> as privileged
- * code, because they may need permissions like writing to disk or accessing       
+ * code, because they may need permissions like writing to disk or accessing
  * network.
- * 
+ *
  * @author mir
  */
 public class PrivilegedImmuatbleGraphWrapper extends PrivilegedGraphWrapper
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
index ea5456f..2b7a933 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/ReadOnlyException.java
@@ -1,28 +1,27 @@
 /*
- * 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
+ * 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.
+ * 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 java.security.AccessControlException;
 
 /**
- * is thrown on an attempt to add or remove triples to a 
- * read-only mutable ImmutableGraph 
+ * is thrown on an attempt to add or remove triples to a
+ * read-only mutable ImmutableGraph
  *
  * @author tsuy
  */
@@ -32,16 +31,15 @@ public class ReadOnlyException extends AccessControlException {
 
     /**
      * creates an exception indicating that the mutable ImmutableGraph is read-only
-     * 
+     *
      * @param action
      */
     public ReadOnlyException(String action) {
-        super("read only mutable ImmutableGraph, not allowed to "+action);
+        super("read only mutable ImmutableGraph, not allowed to " + action);
         this.action = action;
     }
 
     /**
-     * 
      * @return the name of the action
      */
     public String getAction() {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
index 0209c28..922c81d 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleGraph.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -43,6 +42,7 @@ public class SimpleGraph extends AbstractGraph {
         public SimpleIterator(Iterator<Triple> listIter) {
             this.listIter = listIter;
         }
+
         private Triple currentNext;
 
         @Override
@@ -56,14 +56,14 @@ public class SimpleGraph extends AbstractGraph {
             checkValidity();
             currentNext = listIter.next();
             return currentNext;
-        }        
+        }
 
         @Override
         public void remove() {
             checkValidity();
             listIter.remove();
-            triples.remove(currentNext);            
-            invalidateIterators(this);            
+            triples.remove(currentNext);
+            invalidateIterators(this);
         }
 
         private void checkValidity() throws ConcurrentModificationException {
@@ -75,11 +75,11 @@ public class SimpleGraph extends AbstractGraph {
         private void invalidate() {
             isValid = false;
         }
-    }    
-    
+    }
+
     private final Set<SoftReference<SimpleIterator>> iterators =
             Collections.synchronizedSet(new HashSet<SoftReference<SimpleIterator>>());
-    
+
     /**
      * Creates an empty SimpleGraph
      */
@@ -88,9 +88,9 @@ public class SimpleGraph extends AbstractGraph {
     }
 
     /**
-     * Creates a SimpleGraph using the passed iterator, the iterator 
+     * Creates a SimpleGraph using the passed iterator, the iterator
      * is consumed before the constructor returns
-     * 
+     *
      * @param iterator
      */
     public SimpleGraph(Iterator<Triple> iterator) {
@@ -102,9 +102,9 @@ public class SimpleGraph extends AbstractGraph {
     }
 
     /**
-     * Creates a SimpleGraph for the specified set of triples, 
+     * Creates a SimpleGraph for the specified set of triples,
      * subsequent modification of baseSet do affect the created instance.
-     * 
+     *
      * @param baseSet
      */
     public SimpleGraph(Set<Triple> baseSet) {
@@ -166,13 +166,13 @@ public class SimpleGraph extends AbstractGraph {
         }
         return modified;
     }
-    
+
     private void invalidateIterators(SimpleIterator caller) {
         if (!checkConcurrency) {
             return;
         }
         Set<SoftReference> oldReferences = new HashSet<SoftReference>();
-        synchronized(iterators) {
+        synchronized (iterators) {
             for (SoftReference<SimpleGraph.SimpleIterator> softReference : iterators) {
                 SimpleIterator simpleIterator = softReference.get();
                 if (simpleIterator == null) {
@@ -197,8 +197,8 @@ public class SimpleGraph extends AbstractGraph {
     public void setCheckConcurrency(boolean bool) {
         checkConcurrency = bool;
     }
-    
-    
+
+
     @Override
     public ImmutableGraph getImmutableGraph() {
         return new SimpleImmutableGraph(this);
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
index 46b95ad..a0840f5 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleImmutableGraph.java
@@ -1,42 +1,36 @@
 /*
- * 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
+ * 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.
+ * 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 java.util.Iterator;
+import org.apache.clerezza.api.*;
 
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.IRI;
+import java.util.Iterator;
 
 /**
- *
  * @author reto
  */
 public class SimpleImmutableGraph extends AbstractImmutableGraph {
 
     private Graph graph;
-    
+
     /**
      * Creates a ImmutableGraph with the triples in Graph
-     * 
+     *
      * @param Graph the collection of triples this ImmutableGraph shall consist of
      */
     public SimpleImmutableGraph(Graph Graph) {
@@ -45,13 +39,13 @@ public class SimpleImmutableGraph extends AbstractImmutableGraph {
 
     /**
      * Creates a ImmutableGraph with the triples in Graph.
-     *
+     * <p>
      * This construction allows to specify if the Graph might change
      * in future. If GraphWillNeverChange is set to true it will
      * assume that the collection never changes, in this case the collection
      * isn't copied making things more efficient.
      *
-     * @param Graph the collection of triples this ImmutableGraph shall consist of
+     * @param Graph                the collection of triples this ImmutableGraph shall consist of
      * @param GraphWillNeverChange true if the caller promises Graph will never change
      */
     public SimpleImmutableGraph(Graph Graph, boolean GraphWillNeverChange) {
@@ -61,7 +55,7 @@ public class SimpleImmutableGraph extends AbstractImmutableGraph {
             this.graph = Graph;
         }
     }
-    
+
     public SimpleImmutableGraph(Iterator<Triple> tripleIter) {
         this.graph = new SimpleGraph(tripleIter);
     }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
index 94cd03a..cc5cd74 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/SimpleMGraph.java
@@ -1,34 +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
+ * 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.
+ * 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.Graph;
+import org.apache.clerezza.api.Triple;
+
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.Triple;
-
 /**
- *
- * @deprecated Use SimpleGraph
  * @author reto
+ * @deprecated Use SimpleGraph
  */
 @Deprecated
 public class SimpleMGraph extends SimpleGraph implements Graph {
@@ -52,5 +50,3 @@ public class SimpleMGraph extends SimpleGraph implements Graph {
     }
 
 }
-
-    
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
index c86156d..f82a48a 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WatchableGraphWrapper.java
@@ -1,17 +1,21 @@
 /*
  * Copyright 2015 The Apache Software Foundation.
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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;
 
@@ -23,18 +27,17 @@ import java.util.*;
 import java.util.concurrent.locks.ReadWriteLock;
 
 /**
- *
  * @author developer
  */
 public class WatchableGraphWrapper implements WatchableGraph {
-    
+
     final Graph wrapped;
 
     public WatchableGraphWrapper(Graph wrapped) {
         this.wrapped = wrapped;
     }
-    
-       
+
+
     //all listeners
     private final Set<ListenerConfiguration> listenerConfigs = Collections.synchronizedSet(
             new HashSet<ListenerConfiguration>());
@@ -91,10 +94,10 @@ public class WatchableGraphWrapper implements WatchableGraph {
     }
 
     /**
-     * A subclass of <code>AbstractGraph</code> should override 
+     * A subclass of <code>AbstractGraph</code> should override
      * this method instead of <code>add</code> for Graph event support to be
      * added.
-     * 
+     *
      * @param e The triple to be added to the triple collection
      * @return
      */
@@ -115,7 +118,7 @@ public class WatchableGraphWrapper implements WatchableGraph {
     @Override
     public boolean removeAll(Collection<?> c) {
         boolean modified = false;
-        for (Iterator<? extends Object> it = c.iterator(); it.hasNext();) {
+        for (Iterator<? extends Object> it = c.iterator(); it.hasNext(); ) {
             Object object = it.next();
             if (remove(object)) {
                 modified = true;
@@ -125,10 +128,10 @@ public class WatchableGraphWrapper implements WatchableGraph {
     }
 
     /**
-     * A subclass of <code>AbstractGraph</code> should override 
+     * A subclass of <code>AbstractGraph</code> should override
      * this method instead of <code>remove</code> for ImmutableGraph event support to be
      * added.
-     * 
+     *
      * @param o The triple to be removed from the triple collection
      * @return
      */
@@ -147,12 +150,12 @@ public class WatchableGraphWrapper implements WatchableGraph {
      * Dispatches a <code>GraphEvent</code> to all registered listeners for which
      * the specified <code>Triple</code> matches the <code>FilterTriple</code>s
      * of the listeners.
-     * 
+     *
      * @param triple The Triple that was modified
-     * @param type The type of modification
+     * @param type   The type of modification
      */
     protected void dispatchEvent(GraphEvent event) {
-        synchronized(listenerConfigs) {
+        synchronized (listenerConfigs) {
             Iterator<ListenerConfiguration> iter = listenerConfigs.iterator();
             while (iter.hasNext()) {
                 ListenerConfiguration config = iter.next();
@@ -175,7 +178,7 @@ public class WatchableGraphWrapper implements WatchableGraph {
 
     @Override
     public void addGraphListener(GraphListener listener, FilterTriple filter,
-            long delay) {
+                                 long delay) {
         listenerConfigs.add(new ListenerConfiguration(listener, filter));
         if (delay > 0) {
             delayedNotificator.addDelayedListener(listener, delay);
@@ -184,7 +187,7 @@ public class WatchableGraphWrapper implements WatchableGraph {
 
     @Override
     public void removeGraphListener(GraphListener listener) {
-        synchronized(listenerConfigs) {
+        synchronized (listenerConfigs) {
             Iterator<ListenerConfiguration> iter = listenerConfigs.iterator();
             while (iter.hasNext()) {
                 ListenerConfiguration listenerConfig = iter.next();
@@ -272,5 +275,5 @@ public class WatchableGraphWrapper implements WatchableGraph {
             return filter;
         }
     }
-    
+
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java
index 71fce87..cb80c3d 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graph/WriteBlockedGraph.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -24,10 +23,9 @@ import java.util.Collection;
 import java.util.Iterator;
 
 /**
- *
- * This is a wrapper object for <code>Graph</code>. If <code>SecurityManger</code> 
- * is not <code>null</code> <code>TcManager</code> checks the <code>TcPermission</code>. 
- * If read-only permissions are set this wrapper is used instead of <code>Graph</code> 
+ * This is a wrapper object for <code>Graph</code>. If <code>SecurityManger</code>
+ * is not <code>null</code> <code>TcManager</code> checks the <code>TcPermission</code>.
+ * If read-only permissions are set this wrapper is used instead of <code>Graph</code>
  * and throws exceptions when add or remove methods are called.
  *
  * @author tsuy
@@ -50,7 +48,7 @@ public class WriteBlockedGraph extends AbstractGraph
     protected Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
         final Iterator<Triple> baseIter = triples.filter(subject, predicate, object);
         return new Iterator<Triple>() {
-            
+
             @Override
             public boolean hasNext() {
                 return baseIter.hasNext();
@@ -66,7 +64,7 @@ public class WriteBlockedGraph extends AbstractGraph
                 throw new ReadOnlyException("remove");
             }
 
-            
+
         };
     }
 
@@ -94,7 +92,7 @@ public class WriteBlockedGraph extends AbstractGraph
     public boolean removeAll(Collection<?> c) {
         throw new ReadOnlyException("remove all");
     }
-    
+
     @Override
     public boolean retainAll(Collection<?> c) {
         throw new ReadOnlyException("retain all");
@@ -104,7 +102,7 @@ public class WriteBlockedGraph extends AbstractGraph
     public Iterator iterator() {
         return filter(null, null, null);
     }
-    
+
     @Override
     public ImmutableGraph getImmutableGraph() {
         return this.triples.getImmutableGraph();
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
index 754e05d..3061279 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
@@ -1,46 +1,38 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
-
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.apache.clerezza.api.BlankNode;
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
-import org.apache.clerezza.api.impl.TripleImpl;
-import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 
 /**
  * @author reto
- * 
  */
 public class GraphMatcher {
 
-
     private final static Logger log = Logger.getLogger(GraphMatcher.class.getName());
 
     /**
@@ -53,7 +45,7 @@ public class GraphMatcher {
      * nodes, a bnode in g1 is not a vraiable that may match any node, but must
      * match a bnode in g2.
      * <p/>
-     *
+     * <p>
      * On the algorithm:<br/>
      * - In a first step it checked if every grounded triple in g1 matches one
      * in g2<br/>
@@ -65,7 +57,7 @@ public class GraphMatcher {
      * each bnode, in the first step when calculating the hash  aconstant value
      * is taken for the bnodes that might be subject or object in the (inverse properties)
      * - hash-classes:
-     * 
+     *
      * @param g1
      * @param g2
      * @return a Set of NodePairs
@@ -73,7 +65,7 @@ public class GraphMatcher {
     public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) {
         Graph g1 = new SimpleMGraph(og1);
         Graph g2 = new SimpleMGraph(og2);
-        if (!Utils.removeGrounded(g1,g2)) {
+        if (!Utils.removeGrounded(g1, g2)) {
             return null;
         }
         final HashMatching hashMatching;
@@ -99,10 +91,10 @@ public class GraphMatcher {
     }
 
     private static Map<BlankNode, BlankNode> trialAndErrorMatching(Graph g1, Graph g2,
-            Map<Set<BlankNode>, Set<BlankNode>> matchingGroups) {
+                                                                   Map<Set<BlankNode>, Set<BlankNode>> matchingGroups) {
         if (log.isLoggable(Level.FINE)) {
-            Set<BlankNode> bn1  = Utils.getBNodes(g1);
-            log.log(Level.FINE,"doing trial and error matching for {0}"+" bnodes, "+"in graphs of size: {1}.", new Object[]{bn1.size(), g1.size()});
+            Set<BlankNode> bn1 = Utils.getBNodes(g1);
+            log.log(Level.FINE, "doing trial and error matching for {0}" + " bnodes, " + "in graphs of size: {1}.", new Object[]{bn1.size(), g1.size()});
         }
         Iterator<Map<BlankNode, BlankNode>> mappingIter
                 = GroupMappingIterator.create(matchingGroups);
@@ -128,13 +120,11 @@ public class GraphMatcher {
         final BlankNodeOrIRI oSubject = triple.getSubject();
 
         BlankNodeOrIRI subject = oSubject instanceof BlankNode ?
-            map.get((BlankNode)oSubject) : oSubject;
+                map.get((BlankNode) oSubject) : oSubject;
 
         RDFTerm oObject = triple.getObject();
         RDFTerm object = oObject instanceof BlankNode ?
-            map.get((BlankNode)oObject) : oObject;
+                map.get((BlankNode) oObject) : oObject;
         return new TripleImpl(subject, triple.getPredicate(), object);
     }
-
-
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
index 3137098..b40d608 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
@@ -1,26 +1,23 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
 /**
- *
  * @author reto
  */
 class GraphNotIsomorphicException extends Exception {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
index 1d271bf..2e58fd3 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
@@ -1,28 +1,23 @@
 /*
- *  Copyright 2010 reto.
- * 
- *  Licensed 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.
- *  under the License.
+ * 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.graphmatching;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Iterates over all mappings from each element of every Set<T> to each
@@ -30,14 +25,14 @@ import java.util.Set;
  *
  * @author reto
  */
-class GroupMappingIterator<T,U> implements Iterator<Map<T, U>> {
+class GroupMappingIterator<T, U> implements Iterator<Map<T, U>> {
 
     private Iterator<Map<T, U>> firstPartIter;
     private Map<T, U> currentFirstPart;
     final private Map<Set<T>, Set<U>> restMap;
     private Iterator<Map<T, U>> currentRestPartIter;
 
-    static <T,U> Iterator<Map<T, U>> create(Map<Set<T>, Set<U>> matchingGroups) {
+    static <T, U> Iterator<Map<T, U>> create(Map<Set<T>, Set<U>> matchingGroups) {
         if (matchingGroups.size() > 1) {
             return new GroupMappingIterator<T, U>(matchingGroups);
         } else {
@@ -45,8 +40,8 @@ class GroupMappingIterator<T,U> implements Iterator<Map<T, U>> {
                 return new ArrayList<Map<T, U>>(0).iterator();
             }
             Map.Entry<Set<T>, Set<U>> entry = matchingGroups.entrySet().iterator().next();
-            return new MappingIterator<T,U>(entry.getKey(),
-                        entry.getValue());
+            return new MappingIterator<T, U>(entry.getKey(),
+                    entry.getValue());
         }
     }
 
@@ -58,7 +53,7 @@ class GroupMappingIterator<T,U> implements Iterator<Map<T, U>> {
         boolean first = true;
         for (Map.Entry<Set<T>, Set<U>> entry : matchingGroups.entrySet()) {
             if (first) {
-                firstPartIter = new MappingIterator<T,U>(entry.getKey(),
+                firstPartIter = new MappingIterator<T, U>(entry.getKey(),
                         entry.getValue());
                 first = false;
             } else {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
index 13b8436..95ba4e8 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
@@ -1,43 +1,31 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
-
-import org.apache.clerezza.api.BlankNode;
-import org.apache.clerezza.api.Graph;
-import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.*;
 import org.apache.clerezza.api.impl.TripleImpl;
-import org.apache.clerezza.api.impl.graphmatching.collections.IntIterator;
 import org.apache.clerezza.api.impl.graphmatching.collections.IntHashMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import org.apache.clerezza.api.impl.graphmatching.collections.IntIterator;
 
-import org.apache.clerezza.api.BlankNodeOrIRI;
-import org.apache.clerezza.api.RDFTerm;
-import org.apache.clerezza.api.Triple;
+import java.util.*;
 
 /**
- *
  * @author reto
  */
 public class HashMatching {
@@ -73,7 +61,6 @@ public class HashMatching {
     }
 
     /**
-     *
      * @return a map containing set of which each bnodes mappes one of the other set
      */
     public Map<Set<BlankNode>, Set<BlankNode>> getMatchingGroups() {
@@ -84,7 +71,7 @@ public class HashMatching {
         return matchings;
     }
 
-    
+
     private static IntHashMap<Set<BlankNode>> getHashNodes(Map<BlankNode,
             Set<Property>> bNodePropMap, Map<BlankNode, Integer> bNodeHashMap) {
         IntHashMap<Set<BlankNode>> result = new IntHashMap<Set<BlankNode>>();
@@ -93,12 +80,13 @@ public class HashMatching {
             Set<BlankNode> bNodeSet = result.get(hash);
             if (bNodeSet == null) {
                 bNodeSet = new HashSet<BlankNode>();
-                result.put(hash,bNodeSet);
+                result.put(hash, bNodeSet);
             }
             bNodeSet.add(entry.getKey());
         }
         return result;
     }
+
     /*
      * returns a Map from bnodes to hash that can be used for future
      * refinements, this could be separate for each ImmutableGraph.
@@ -109,9 +97,9 @@ public class HashMatching {
      * be the correct if the graphs are isomorphic.
      */
     private Map<BlankNode, Integer> matchByHashes(Graph g1, Graph g2,
-            Map<BlankNode, Integer> bNodeHashMap) {
-        Map<BlankNode, Set<Property>> bNodePropMap1  = getBNodePropMap(g1);
-        Map<BlankNode, Set<Property>> bNodePropMap2  = getBNodePropMap(g2);
+                                                  Map<BlankNode, Integer> bNodeHashMap) {
+        Map<BlankNode, Set<Property>> bNodePropMap1 = getBNodePropMap(g1);
+        Map<BlankNode, Set<Property>> bNodePropMap2 = getBNodePropMap(g2);
         IntHashMap<Set<BlankNode>> hashNodeMap1 = getHashNodes(bNodePropMap1, bNodeHashMap);
         IntHashMap<Set<BlankNode>> hashNodeMap2 = getHashNodes(bNodePropMap2, bNodeHashMap);
         if (!hashNodeMap1.keySet().equals(hashNodeMap2.keySet())) {
@@ -133,13 +121,13 @@ public class HashMatching {
             }
             final BlankNode bNode1 = nodes1.iterator().next();
             final BlankNode bNode2 = nodes2.iterator().next();
-            matchings.put(bNode1,bNode2);
+            matchings.put(bNode1, bNode2);
             //in the graphs replace node occurences with grounded node,
             BlankNodeOrIRI mappedNode = new MappedNode(bNode1, bNode2);
-            replaceNode(g1,bNode1, mappedNode);
+            replaceNode(g1, bNode1, mappedNode);
             replaceNode(g2, bNode2, mappedNode);
             //remove grounded triples
-            if (!Utils.removeGrounded(g1,g2)) {
+            if (!Utils.removeGrounded(g1, g2)) {
                 return null;
             }
         }
@@ -148,6 +136,7 @@ public class HashMatching {
         addInverted(result, hashNodeMap2);
         return result;
     }
+
     private static int computeHash(Set<Property> propertySet, Map<BlankNode, Integer> bNodeHashMap) {
         int result = 0;
         for (Property property : propertySet) {
@@ -155,6 +144,7 @@ public class HashMatching {
         }
         return result;
     }
+
     private static Map<BlankNode, Set<Property>> getBNodePropMap(Graph g) {
         Set<BlankNode> bNodes = Utils.getBNodes(g);
         Map<BlankNode, Set<Property>> result = new HashMap<BlankNode, Set<Property>>();
@@ -163,6 +153,7 @@ public class HashMatching {
         }
         return result;
     }
+
     private static Set<Property> getProperties(BlankNode bNode, Graph g) {
         Set<Property> result = new HashSet<Property>();
         Iterator<Triple> ti = g.filter(bNode, null, null);
@@ -177,9 +168,10 @@ public class HashMatching {
         }
         return result;
     }
+
     private static int nodeHash(RDFTerm resource, Map<BlankNode, Integer> bNodeHashMap) {
         if (resource instanceof BlankNode) {
-            Integer mapValue = bNodeHashMap.get((BlankNode)resource);
+            Integer mapValue = bNodeHashMap.get((BlankNode) resource);
             if (mapValue == null) {
                 return 0;
             } else {
@@ -189,6 +181,7 @@ public class HashMatching {
             return resource.hashCode();
         }
     }
+
     private static void replaceNode(Graph graph, BlankNode bNode, BlankNodeOrIRI replacementNode) {
         Set<Triple> triplesToRemove = new HashSet<Triple>();
         for (Triple triple : graph) {
@@ -200,6 +193,7 @@ public class HashMatching {
         }
         graph.removeAll(triplesToRemove);
     }
+
     private static Triple getReplacement(Triple triple, BlankNode bNode, BlankNodeOrIRI replacementNode) {
         if (triple.getSubject().equals(bNode)) {
             if (triple.getObject().equals(bNode)) {
@@ -215,6 +209,7 @@ public class HashMatching {
             }
         }
     }
+
     private static void addInverted(Map<BlankNode, Integer> result, IntHashMap<Set<BlankNode>> hashNodeMap) {
         for (int hash : hashNodeMap.keySet()) {
             Set<BlankNode> bNodes = hashNodeMap.get(hash);
@@ -223,45 +218,48 @@ public class HashMatching {
             }
         }
     }
-    
+
     private static class BackwardProperty implements Property {
         private BlankNodeOrIRI subject;
         private IRI predicate;
-    
+
         public BackwardProperty(BlankNodeOrIRI subject, IRI predicate) {
             this.subject = subject;
             this.predicate = predicate;
         }
-    
+
         @Override
         public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
-            return  0xFF ^ predicate.hashCode() ^ nodeHash(subject, bNodeHashMap);
+            return 0xFF ^ predicate.hashCode() ^ nodeHash(subject, bNodeHashMap);
         }
-    
+
     }
+
     private static class ForwardProperty implements Property {
         private IRI predicate;
         private RDFTerm object;
-    
+
         public ForwardProperty(IRI predicate, RDFTerm object) {
             this.predicate = predicate;
             this.object = object;
         }
-    
+
         @Override
         public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
             return predicate.hashCode() ^ nodeHash(object, bNodeHashMap);
         }
     }
+
     private static class MappedNode implements BlankNodeOrIRI {
         private BlankNode bNode1, bNode2;
-    
+
         public MappedNode(BlankNode bNode1, BlankNode bNode2) {
             this.bNode1 = bNode1;
             this.bNode2 = bNode2;
         }
-        
+
     }
+
     private static interface Property {
         public int hashCode(Map<BlankNode, Integer> bNodeHashMap);
     }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
index 6c5c245..22dd267 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
@@ -1,42 +1,32 @@
-package org.apache.clerezza.api.impl.graphmatching;
-
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * An iterator over all possible mapping beetween the elemnets of two sets of
  * the same size, each mapping maps each element from set1 to a disctinct one of
  * set2.
  *
- *
- *
  * @author reto
  */
-class MappingIterator<T,U> implements Iterator<Map<T, U>> {
+class MappingIterator<T, U> implements Iterator<Map<T, U>> {
 
     private List<T> list1;
     private Iterator<List<U>> permutationList2Iterator;
@@ -72,5 +62,4 @@ class MappingIterator<T,U> implements Iterator<Map<T, U>> {
     }
 
 
-
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
index 74e9eff..70a0554 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
@@ -1,34 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
+import java.util.*;
 
 /**
- *
  * An Iterator over all permuations of a list.
  *
  * @author reto
@@ -77,8 +68,9 @@ class PermutationIterator<T> implements Iterator<List<T>> {
 
     private void prepareNext() {
         next = getNext();
-        
+
     }
+
     private List<T> getNext() {
         if (list.size() == 0) {
             return null;
@@ -91,7 +83,7 @@ class PermutationIterator<T> implements Iterator<List<T>> {
             }
         } else {
             if (!restIterator.hasNext()) {
-                if (posInList < (list.size()-1)) {
+                if (posInList < (list.size() - 1)) {
                     posInList++;
                     createRestList();
                 } else {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
index 30f0f0d..fb89099 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
@@ -1,34 +1,30 @@
-package org.apache.clerezza.api.impl.graphmatching;
 /*
- *
- * 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
+ * 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.
- *
-*/
+ * 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.graphmatching;
 
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Triple;
 
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.api.BlankNode;
-import org.apache.clerezza.api.Triple;
-
 public class Utils {
 
     static Set<BlankNode> getBNodes(Collection<Triple> s) {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
index ac117af..f4ca392 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
@@ -1,17 +1,21 @@
 /*
  * Copyright 2002-2004 The Apache Software Foundation.
  * 
- * Licensed 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.
+ * 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.
  */
 
 /*
@@ -21,11 +25,9 @@
 
 package org.apache.clerezza.api.impl.graphmatching.collections;
 
-
-
 /**
  * <p>A hash map that uses primitive ints for the key rather than objects.</p>
- *
+ * <p>
  * <p>Note that this class is for internal optimization purposes only, and may
  * not be supported in future releases of Jakarta Commons Lang.  Utilities of
  * this sort may be included in future releases of Jakarta Commons Collections.</p>
@@ -33,9 +35,9 @@ package org.apache.clerezza.api.impl.graphmatching.collections;
  * @author Justin Couch
  * @author Alex Chaffee (alex@apache.org)
  * @author Stephen Colebourne
- * @since 2.0
  * @version $Revision: 1.2 $
  * @see java.util.HashMap
+ * @since 2.0
  */
 public class IntHashMap<T> {
 
@@ -80,10 +82,10 @@ public class IntHashMap<T> {
         /**
          * <p>Create a new entry with the given values.</p>
          *
-         * @param hash The code used to hash the object with
-         * @param key The key used to enter this in the table
+         * @param hash  The code used to hash the object with
+         * @param key   The key used to enter this in the table
          * @param value The value for this key
-         * @param next A reference to the next entry in the table
+         * @param next  A reference to the next entry in the table
          */
         protected Entry(int hash, int key, T value, Entry<T> next) {
             this.hash = hash;
@@ -105,9 +107,9 @@ public class IntHashMap<T> {
      * <p>Constructs a new, empty hashtable with the specified initial capacity
      * and default load factor, which is <code>0.75</code>.</p>
      *
-     * @param  initialCapacity the initial capacity of the hashtable.
+     * @param initialCapacity the initial capacity of the hashtable.
      * @throws IllegalArgumentException if the initial capacity is less
-     *   than zero.
+     *                                  than zero.
      */
     public IntHashMap(int initialCapacity) {
         this(initialCapacity, 0.75f);
@@ -118,9 +120,9 @@ public class IntHashMap<T> {
      * capacity and the specified load factor.</p>
      *
      * @param initialCapacity the initial capacity of the hashtable.
-     * @param loadFactor the load factor of the hashtable.
-     * @throws IllegalArgumentException  if the initial capacity is less
-     *             than zero, or if the load factor is nonpositive.
+     * @param loadFactor      the load factor of the hashtable.
+     * @throws IllegalArgumentException if the initial capacity is less
+     *                                  than zero, or if the load factor is nonpositive.
      */
     public IntHashMap(int initialCapacity, float loadFactor) {
         super();
@@ -142,7 +144,7 @@ public class IntHashMap<T> {
     /**
      * <p>Returns the number of keys in this hashtable.</p>
      *
-     * @return  the number of keys in this hashtable.
+     * @return the number of keys in this hashtable.
      */
     public int size() {
         return count;
@@ -151,8 +153,8 @@ public class IntHashMap<T> {
     /**
      * <p>Tests if this hashtable maps no keys to values.</p>
      *
-     * @return  <code>true</code> if this hashtable maps no keys to values;
-     *          <code>false</code> otherwise.
+     * @return <code>true</code> if this hashtable maps no keys to values;
+     * <code>false</code> otherwise.
      */
     public boolean isEmpty() {
         return count == 0;
@@ -162,19 +164,19 @@ public class IntHashMap<T> {
      * <p>Tests if some key maps into the specified value in this hashtable.
      * This operation is more expensive than the <code>containsKey</code>
      * method.</p>
-     *
+     * <p>
      * <p>Note that this method is identical in functionality to containsValue,
      * (which is part of the Map interface in the collections framework).</p>
      *
-     * @param      value   a value to search for.
-     * @return     <code>true</code> if and only if some key maps to the
-     *             <code>value</code> argument in this hashtable as
-     *             determined by the <tt>equals</tt> method;
-     *             <code>false</code> otherwise.
-     * @throws  NullPointerException  if the value is <code>null</code>.
-     * @see        #containsKey(int)
-     * @see        #containsValue(Object)
-     * @see        java.util.Map
+     * @param value a value to search for.
+     * @return <code>true</code> if and only if some key maps to the
+     * <code>value</code> argument in this hashtable as
+     * determined by the <tt>equals</tt> method;
+     * <code>false</code> otherwise.
+     * @throws NullPointerException if the value is <code>null</code>.
+     * @see #containsKey(int)
+     * @see #containsValue(Object)
+     * @see java.util.Map
      */
     public boolean contains(Object value) {
         if (value == null) {
@@ -182,7 +184,7 @@ public class IntHashMap<T> {
         }
 
         Entry tab[] = table;
-        for (int i = tab.length; i-- > 0;) {
+        for (int i = tab.length; i-- > 0; ) {
             for (Entry e = tab[i]; e != null; e = e.next) {
                 if (e.value.equals(value)) {
                     return true;
@@ -195,12 +197,12 @@ public class IntHashMap<T> {
     /**
      * <p>Returns <code>true</code> if this HashMap maps one or more keys
      * to this value.</p>
-     *
+     * <p>
      * <p>Note that this method is identical in functionality to contains
      * (which predates the Map interface).</p>
      *
      * @param value value whose presence in this HashMap is to be tested.
-     * @see    java.util.Map
+     * @see java.util.Map
      * @since JDK1.2
      */
     public boolean containsValue(Object value) {
@@ -210,10 +212,10 @@ public class IntHashMap<T> {
     /**
      * <p>Tests if the specified object is a key in this hashtable.</p>
      *
-     * @param  key  possible key.
+     * @param key possible key.
      * @return <code>true</code> if and only if the specified object is a
-     *    key in this hashtable, as determined by the <tt>equals</tt>
-     *    method; <code>false</code> otherwise.
+     * key in this hashtable, as determined by the <tt>equals</tt>
+     * method; <code>false</code> otherwise.
      * @see #contains(Object)
      */
     public boolean containsKey(int key) {
@@ -231,11 +233,11 @@ public class IntHashMap<T> {
     /**
      * <p>Returns the value to which the specified key is mapped in this map.</p>
      *
-     * @param   key   a key in the hashtable.
-     * @return  the value to which the key is mapped in this hashtable;
-     *          <code>null</code> if the key is not mapped to any value in
-     *          this hashtable.
-     * @see     #put(int, Object)
+     * @param key a key in the hashtable.
+     * @return the value to which the key is mapped in this hashtable;
+     * <code>null</code> if the key is not mapped to any value in
+     * this hashtable.
+     * @see #put(int, Object)
      */
     public T get(int key) {
         Entry<T> tab[] = table;
@@ -253,7 +255,7 @@ public class IntHashMap<T> {
      * <p>Increases the capacity of and internally reorganizes this
      * hashtable, in order to accommodate and access its entries more
      * efficiently.</p>
-     *
+     * <p>
      * <p>This method is called automatically when the number of keys
      * in the hashtable exceeds this hashtable's capacity and load
      * factor.</p>
@@ -268,8 +270,8 @@ public class IntHashMap<T> {
         threshold = (int) (newCapacity * loadFactor);
         table = newMap;
 
-        for (int i = oldCapacity; i-- > 0;) {
-            for (Entry<T> old = oldMap[i]; old != null;) {
+        for (int i = oldCapacity; i-- > 0; ) {
+            for (Entry<T> old = oldMap[i]; old != null; ) {
                 Entry<T> e = old;
                 old = old.next;
 
@@ -284,19 +286,19 @@ public class IntHashMap<T> {
      * <p>Maps the specified <code>key</code> to the specified
      * <code>value</code> in this hashtable. The key cannot be
      * <code>null</code>. </p>
-     *
+     * <p>
      * <p>The value can be retrieved by calling the <code>get</code> method
      * with a key that is equal to the original key.</p>
      *
-     * @param key     the hashtable key.
-     * @param value   the value.
+     * @param key   the hashtable key.
+     * @param value the value.
      * @return the previous value of the specified key in this hashtable,
-     *         or <code>null</code> if it did not have one.
-     * @throws  NullPointerException  if the key is <code>null</code>.
-     * @see     #get(int)
+     * or <code>null</code> if it did not have one.
+     * @throws NullPointerException if the key is <code>null</code>.
+     * @see #get(int)
      */
     public Object put(int key, T value) {
-            keySet.add(key);
+        keySet.add(key);
         // Makes sure the key is not already in the hashtable.
         Entry<T> tab[] = table;
         int hash = key;
@@ -332,7 +334,7 @@ public class IntHashMap<T> {
      * hashtable.</p>
      *
      * @param   key   the key that needs to be removed.
-     * @return  the value to which the key had been mapped in this hashtable,
+     * @return the value to which the key had been mapped in this hashtable,
      *          or <code>null</code> if the key did not have a mapping.
      */
     /*public Object remove(int key) {
@@ -359,19 +361,18 @@ public class IntHashMap<T> {
      * <p>Clears this hashtable so that it contains no keys.</p>
      */
     public synchronized void clear() {
-            keySet.clear();
+        keySet.clear();
         Entry tab[] = table;
-        for (int index = tab.length; --index >= 0;) {
+        for (int index = tab.length; --index >= 0; ) {
             tab[index] = null;
         }
         count = 0;
     }
-    
+
     public IntSet keySet() {
-            return keySet;
+        return keySet;
     }
-    
-    
-    
+
+
 }
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
index 4d6b13b..e85518e 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
@@ -1,17 +1,21 @@
 /*
  * Copyright 2002-2004 The Apache Software Foundation.
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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.graphmatching.collections;
@@ -56,7 +60,7 @@ public class IntHashSet extends HashSet<Integer> implements IntSet {
 
     @Override
     public void add(int i) {
-        super.add((Integer)i);
+        super.add((Integer) i);
     }
 
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
index 3bf38ed..9f0309d 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
@@ -1,24 +1,27 @@
 /*
  * Copyright 2002-2004 The Apache Software Foundation.
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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.graphmatching.collections;
 
 import java.util.Iterator;
 
-
 /**
  * An iterator allowing to iterate over ints, Iterator<Integer> is extended for
  * compatibility, however accessing nextInt allows faster implementations.
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
index 8bd64c1..d6042e6 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
@@ -1,17 +1,21 @@
 /*
  * Copyright 2002-2004 The Apache Software Foundation.
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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.graphmatching.collections;
@@ -19,17 +23,16 @@ package org.apache.clerezza.api.impl.graphmatching.collections;
 import java.util.Set;
 
 /**
- * A IntSet allows directly adding primitive ints to a set, Set<Integer> is 
+ * A IntSet allows directly adding primitive ints to a set, Set<Integer> is
  * extended, but accessingt he respective methods is less efficient.
  *
  * @author reto
  */
 public interface IntSet extends Set<Integer> {
     /**
-     *
      * @return an iterator over the primitive int
      */
     public IntIterator intIterator();
-    
+
     public void add(int i);
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
index 8444813..4c0c385 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/AbstractLiteral.java
@@ -1,24 +1,27 @@
 /*
  * Copyright 2015 The Apache Software Foundation.
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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.apache.clerezza.api.Literal;
 
 /**
- *
  * @author developer
  */
 public abstract class AbstractLiteral implements Literal {
@@ -41,7 +44,7 @@ public abstract class AbstractLiteral implements Literal {
         }
         if (obj instanceof Literal) {
             Literal other = (Literal) obj;
-            
+
             if (getLanguage() == null) {
                 if (other.getLanguage() != null) {
                     return false;
@@ -57,5 +60,5 @@ public abstract class AbstractLiteral implements Literal {
             return false;
         }
     }
-    
+
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
index f4665db..e4a1482 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/InvalidLiteralTypeException.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -26,15 +25,15 @@ import org.apache.clerezza.api.IRI;
  * @author reto
  */
 public class InvalidLiteralTypeException extends RuntimeException {
-    
+
     /**
-     * Constructs the exception to be thrown when a literal cannot be 
+     * Constructs the exception to be thrown when a literal cannot be
      * converted to an instance of the specified class
      *
-     * @param javaType the <code>Class</code> to convert to
+     * @param javaType    the <code>Class</code> to convert to
      * @param literalType the literalType which can't be converted
      */
     public InvalidLiteralTypeException(Class<?> javaType, IRI literalType) {
-        super("Cannot create a "+javaType+" from a literal of type "+literalType);
+        super("Cannot create a " + javaType + " from a literal of type " + literalType);
     }
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java
index fc971bd..9bbbe76 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralFactory.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -25,14 +24,14 @@ import org.apache.clerezza.api.Literal;
  * vice versa. While the default implementation will provide literal objects
  * storing the data's lexical form in memory, other implementations may
  * create literal optimized for processing within the store.
- *
- * Note: this class uses the notion of "Convertor" (in the Exception naming), 
+ * <p>
+ * Note: this class uses the notion of "Convertor" (in the Exception naming),
  * but does not currently provide a mechanism to register such
  * <code>Convertor</code>s. An implementation is said to provide
  * <code>Convertor</code>s for the types it supports.
  *
- * @since 0.3
  * @author reto
+ * @since 0.3
  */
 public abstract class LiteralFactory {
 
@@ -72,10 +71,10 @@ public abstract class LiteralFactory {
      * Converts a literal to an instance of the specified class
      *
      * @param <T>
-     * @param type the <code>Class</code> of the returned object
+     * @param type    the <code>Class</code> of the returned object
      * @param literal the literal to be converted
      * @return a java object representing the value of the literal
-     * @throws NoConvertorException thrown if <code>type</code> is unsupported
+     * @throws NoConvertorException        thrown if <code>type</code> is unsupported
      * @throws InvalidLiteralTypeException if the literal type doesn't match the requested java type
      */
     public abstract <T> T createObject(Class<T> type, Literal literal)
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
index 7d86242..5c383ff 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/LiteralImpl.java
@@ -1,42 +1,40 @@
 /*
- * 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
+ * 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.
+ * 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 java.io.Serializable;
-
 import org.apache.clerezza.api.IRI;
 import org.apache.clerezza.api.Language;
 
+import java.io.Serializable;
+
 /**
- *
  * @author reto
  */
-public class LiteralImpl extends AbstractLiteral implements  Serializable {
+public class LiteralImpl extends AbstractLiteral implements Serializable {
     private String lexicalForm;
     private IRI dataType;
     private int hashCode;
     private Language language;
 
     /**
-     * @param lexicalForm 
-     * @param dataType 
-     * @param Language the language of this literal
+     * @param lexicalForm
+     * @param dataType
+     * @param Language    the language of this literal
      */
     public LiteralImpl(String lexicalForm, IRI dataType, Language language) {
         this.lexicalForm = lexicalForm;
@@ -44,7 +42,7 @@ public class LiteralImpl extends AbstractLiteral implements  Serializable {
         this.language = language;
         this.hashCode = super.hashCode();
     }
-    
+
     public IRI getDataType() {
         return dataType;
     }
@@ -61,7 +59,7 @@ public class LiteralImpl extends AbstractLiteral implements  Serializable {
     public int hashCode() {
         return hashCode;
     }
-    
+
 
     @Override
     public String toString() {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
index a462394..7eeb4d5 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/NoConvertorException.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -24,8 +23,8 @@ import java.lang.reflect.Type;
  * This exception is thrown when no convertor is available to do a required
  * java-object to literal or literal to java-object conversion.
  *
- * @since 0.3
  * @author reto
+ * @since 0.3
  */
 public class NoConvertorException extends RuntimeException {
 
@@ -36,6 +35,6 @@ public class NoConvertorException extends RuntimeException {
      * @param type the type for which no convertor is available
      */
     public NoConvertorException(Type type) {
-        super("No convertor available for type "+type);
+        super("No convertor available for type " + type);
     }
 }
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
index aeef1ea..0eec686 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/PlainLiteralImpl.java
@@ -1,31 +1,29 @@
 /*
- * 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
+ * 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.
+ * 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 java.io.Serializable;
-
 import org.apache.clerezza.api.IRI;
 import org.apache.clerezza.api.Language;
 import org.apache.clerezza.api.Literal;
 
+import java.io.Serializable;
+
 /**
- *
  * @author reto
  */
 public class PlainLiteralImpl extends AbstractLiteral implements Literal, Serializable {
@@ -74,6 +72,7 @@ public class PlainLiteralImpl extends AbstractLiteral implements Literal, Serial
     public IRI getDataType() {
         return dataType;
     }
+
     private final IRI dataType;
     private static final IRI XSD_STRING = new IRI("http://www.w3.org/2001/XMLSchema#string");
     private static final IRI RDF_LANG_STRING = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java
index 9bbbb1b..7b01843 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/SimpleLiteralFactory.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -31,7 +30,7 @@ import java.util.*;
 /**
  * An implementation of literal factory currently supporting only
  * byte[]/base64Binary and Java.util.Date/date
- * 
+ *
  * @author reto
  */
 
@@ -43,7 +42,7 @@ public class SimpleLiteralFactory extends LiteralFactory {
     final private static IRI xsdShort = xsd("short");
     final private static IRI xsdByte = xsd("byte");
     final private static IRI xsdLong = xsd("long");
-    
+
 
     final private static Set<IRI> decimalTypes = new HashSet<IRI>();
 
@@ -51,7 +50,7 @@ public class SimpleLiteralFactory extends LiteralFactory {
     final static Class<? extends byte[]> byteArrayType;
 
     static {
-        Collections.addAll(decimalTypes, xsdInteger, xsdInt, xsdByte, xsdShort, xsdLong );
+        Collections.addAll(decimalTypes, xsdInteger, xsdInt, xsdByte, xsdShort, xsdLong);
 
         byte[] byteArray = new byte[0];
         byteArrayType = byteArray.getClass();
@@ -67,22 +66,23 @@ public class SimpleLiteralFactory extends LiteralFactory {
         typeConverterMap.put(IRI.class, new UriRefConverter());
     }
 
-    final private static IRI xsdDouble =xsd("double");
-    final private static IRI xsdFloat =xsd("float");
-    final private static IRI xsdAnyURI =xsd("anyURI");
+    final private static IRI xsdDouble = xsd("double");
+    final private static IRI xsdFloat = xsd("float");
+    final private static IRI xsdAnyURI = xsd("anyURI");
 
     final private static IRI xsd(String name) {
-       return new IRI(XSD+name);
+        return new IRI(XSD + name);
     }
 
     private static interface TypeConverter<T> {
         Literal createLiteral(T value);
-        T createObject(Literal literal);        
+
+        T createObject(Literal literal);
     }
 
-    private static class  ByteArrayConverter implements TypeConverter<byte[]> {
+    private static class ByteArrayConverter implements TypeConverter<byte[]> {
 
-        private static final IRI base64Uri =xsd("base64Binary");
+        private static final IRI base64Uri = xsd("base64Binary");
 
         @Override
         public Literal createLiteral(byte[] value) {
@@ -97,11 +97,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
             return (byte[]) Base64.decode(literal.getLexicalForm());
         }
 
-        
+
     }
+
     private static class DateConverter implements TypeConverter<Date> {
 
-        private static final IRI dateTimeUri =xsd("dateTime");
+        private static final IRI dateTimeUri = xsd("dateTime");
         private static final DateFormat DATE_FORMAT = new W3CDateFormat();
 
         @Override
@@ -126,7 +127,7 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
     private static class BooleanConverter implements TypeConverter<Boolean> {
 
-        private static final IRI booleanUri =xsd("boolean");
+        private static final IRI booleanUri = xsd("boolean");
         public static final TypedLiteralImpl TRUE = new TypedLiteralImpl("true", booleanUri);
         public static final TypedLiteralImpl FALSE = new TypedLiteralImpl("false", booleanUri);
 
@@ -149,7 +150,7 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
     private static class StringConverter implements TypeConverter<String> {
 
-        private static final IRI stringUri =xsd("string");
+        private static final IRI stringUri = xsd("string");
 
         @Override
         public Literal createLiteral(String value) {
@@ -184,7 +185,6 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
     private static class LongConverter implements TypeConverter<Long> {
 
-        
 
         @Override
         public Literal createLiteral(Long value) {
@@ -216,9 +216,8 @@ public class SimpleLiteralFactory extends LiteralFactory {
             return Float.valueOf(literal.getLexicalForm());
         }
     }
-    
-    private static class DoubleConverter implements TypeConverter<Double> {
 
+    private static class DoubleConverter implements TypeConverter<Double> {
 
 
         @Override
@@ -238,7 +237,6 @@ public class SimpleLiteralFactory extends LiteralFactory {
     private static class BigIntegerConverter implements TypeConverter<BigInteger> {
 
 
-
         @Override
         public Literal createLiteral(BigInteger value) {
             return new TypedLiteralImpl(value.toString(), xsdInteger);
@@ -252,9 +250,8 @@ public class SimpleLiteralFactory extends LiteralFactory {
             return new BigInteger(literal.getLexicalForm());
         }
     }
-    
-    private static class UriRefConverter implements TypeConverter<IRI> {
 
+    private static class UriRefConverter implements TypeConverter<IRI> {
 
 
         @Override
@@ -279,14 +276,13 @@ public class SimpleLiteralFactory extends LiteralFactory {
         return converter.createLiteral(value);
     }
 
-    
-    
+
     @Override
     public <T> T createObject(Class<T> type, Literal literal)
             throws NoConvertorException, InvalidLiteralTypeException {
         final TypeConverter<T> converter = getConverterFor(type);
         return converter.createObject(literal);
-        
+
     }
 
     @SuppressWarnings("unchecked")
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
index 8b029d2..0f7e3dd 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/literal/TypedLiteralImpl.java
@@ -1,47 +1,45 @@
 /*
- * 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
+ * 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.
+ * 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 java.io.Serializable;
-
 import org.apache.clerezza.api.IRI;
 import org.apache.clerezza.api.Language;
 
+import java.io.Serializable;
+
 /**
- *
  * @author reto
  */
-public class TypedLiteralImpl extends AbstractLiteral implements  Serializable {
+public class TypedLiteralImpl extends AbstractLiteral implements Serializable {
     private String lexicalForm;
     private IRI dataType;
     private int hashCode;
 
     /**
-     * @param lexicalForm 
-     * @param dataType 
+     * @param lexicalForm
+     * @param dataType
      */
     public TypedLiteralImpl(String lexicalForm, IRI dataType) {
         this.lexicalForm = lexicalForm;
         this.dataType = dataType;
         this.hashCode = super.hashCode();
     }
-    
+
     public IRI getDataType() {
         return dataType;
     }
@@ -58,7 +56,7 @@ public class TypedLiteralImpl extends AbstractLiteral implements  Serializable {
     public int hashCode() {
         return hashCode;
     }
-    
+
 
     @Override
     public String toString() {
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
index 80652e5..a2c5f76 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
@@ -1,18 +1,18 @@
 /*
  * 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
+ * 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
+ *   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.
+ * 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;
\ No newline at end of file
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java
index 28607eb..f5b6dc3 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/Base64.java
@@ -2,28 +2,25 @@
  * Taken from the book:
  * Jonathan Knudsen, "Java Cryptography", O'Reilly Media, Inc., 1998
  */
-package org.apache.clerezza.api.impl.util;
 /*
  *
- * 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
+ * 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.
- *
-*/
-
+ * 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.util;
 
 public class Base64 {
 
diff --git a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java
index a337064..4921968 100644
--- a/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/util/W3CDateFormat.java
@@ -5,44 +5,37 @@
  [See end of file]
  $Id: W3CDateFormat.java,v 1.6 2007/05/07 18:45:22 rebach Exp $
  */
-package org.apache.clerezza.api.impl.util;
 /*
  *
- * 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
+ * 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.
- *
-*/
-
+ * 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.util;
 
 import java.text.DateFormat;
 import java.text.FieldPosition;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
+import java.util.*;
 
 /**
  * @author reto implements http://www.w3.org/TR/NOTE-datetime with the
- *         limitation that it expects exactly a three digits decimal fraction of
- *         seconds. if a time zone designator other than 'Z' is present it must
- *         contain a column
+ * limitation that it expects exactly a three digits decimal fraction of
+ * seconds. if a time zone designator other than 'Z' is present it must
+ * contain a column
  */
 public class W3CDateFormat extends DateFormat {
     /**
@@ -72,17 +65,17 @@ public class W3CDateFormat extends DateFormat {
 
     /**
      * @see java.text.DateFormat#format(java.util.Date, java.lang.StringBuffer,
-     *      java.text.FieldPosition)
+     * java.text.FieldPosition)
      */
     @Override
     public StringBuffer format(Date date, StringBuffer toAppendTo,
-            FieldPosition fieldPosition) {
+                               FieldPosition fieldPosition) {
 
         final DateFormat dateFormat = (date.getTime() % 1000) == 0 ?
-            dateFormatNoMillis : dateFormatWithMillis;
+                dateFormatNoMillis : dateFormatWithMillis;
         String string = dateFormat.format(date);
         if (string.endsWith("0000")) {
-            StringBuffer result = new StringBuffer(string.substring(0, string.length()-5));
+            StringBuffer result = new StringBuffer(string.substring(0, string.length() - 5));
             result.append('Z');
             return result;
         } else {
@@ -94,7 +87,7 @@ public class W3CDateFormat extends DateFormat {
 
     /**
      * @see java.text.DateFormat#parse(java.lang.String,
-     *      java.text.ParsePosition)
+     * java.text.ParsePosition)
      */
     public Date parse(String dateString, ParsePosition parsePos) {
 
@@ -136,7 +129,7 @@ public class W3CDateFormat extends DateFormat {
             //read decimal part, this is till there is a 'Z', a '+' or a '-'
             char nextChar = dateString.charAt(position++);
             while ((nextChar != 'Z') && (nextChar != '-') && (nextChar != '+')) {
-                msecs += (nextChar - '0')*Math.pow(10, 3+startPos-position);
+                msecs += (nextChar - '0') * Math.pow(10, 3 + startPos - position);
                 nextChar = dateString.charAt(position++);
             }
             tzd1 = nextChar;
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
index c50e41b..77c419a 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
@@ -1,35 +1,31 @@
 /*
- * 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
+ * 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.
+ * 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;
 
-
 import org.apache.clerezza.api.Language;
 import org.junit.Assert;
 import org.junit.Test;
 
-
 /**
- *
  * @author reto
  */
 public class LanguageTest {
-    
+
     @Test
     public void languageEqualityTest() {
         Language lang1 = new Language("DE");
@@ -39,7 +35,7 @@ public class LanguageTest {
         Language lang3 = new Language("EN");
         Assert.assertFalse(lang1.equals(lang3));
     }
-    
+
     @Test
     public void toStringTest() {
         final String id = "de";
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
index 5f924a8..8aefff6 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
@@ -1,37 +1,34 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 import org.apache.clerezza.api.IRI;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 
-import org.junit.Assert;
-import org.junit.Test;
-
 /**
- *
  * @author reto
  */
 public class UriRefTest {
-    
+
     @Test
     public void uriRefEqualityTest() throws UnsupportedEncodingException {
         String uriRefString = "http://example.org/üöä";
@@ -41,12 +38,12 @@ public class UriRefTest {
         IRI uriRef3 = new IRI(URLEncoder.encode(uriRefString, "utf-8"));
         Assert.assertFalse(uriRef1.equals(uriRef3));
     }
-    
+
     @Test
     public void toStringTest() {
         String uriRefString = "http://example.org/üöä";
         IRI uriRef = new IRI(uriRefString);
-        Assert.assertEquals("<"+uriRefString+">", uriRef.toString());
+        Assert.assertEquals("<" + uriRefString + ">", uriRef.toString());
     }
 
 }
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
index 66ad861..66a3b3c 100644
--- 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
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -27,8 +26,6 @@ import org.junit.Test;
 
 import java.util.*;
 
-
-
 /**
  * A generic abstract test class, implementations overwrite this class,
  * providing an implementation of the getEmptyGraph method.
@@ -55,7 +52,7 @@ public abstract class GraphTest {
     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,
@@ -64,7 +61,7 @@ public abstract class GraphTest {
      * @return an empty Graph of the implementation to be tested
      */
     protected abstract Graph getEmptyGraph();
-    
+
     @Test
     public void testAddCountAndGetTriples() {
         Graph graph = getEmptyGraph();
@@ -77,7 +74,8 @@ public abstract class GraphTest {
         Triple tripleGot = tripleIter.next();
         Assert.assertEquals(triple1, tripleGot);
         Assert.assertFalse(tripleIter.hasNext());
-        BlankNode bnode = new BlankNode() {};
+        BlankNode bnode = new BlankNode() {
+        };
         graph.add(new TripleImpl(bnode, uriRef1, uriRef3));
         graph.add(new TripleImpl(bnode, uriRef1, uriRef4));
         tripleIter = graph.filter(null, uriRef1, null);
@@ -106,7 +104,7 @@ public abstract class GraphTest {
         Assert.assertFalse(tripleIter.hasNext());
         Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
     }
-    
+
     @Test
     public void testRemoveAllTriples() {
         Graph graph = getEmptyGraph();
@@ -122,7 +120,7 @@ public abstract class GraphTest {
     public void testUseTypedLiterals() {
         Graph graph = getEmptyGraph();
         Assert.assertEquals(0, graph.size());
-        Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType);
+        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);
@@ -136,14 +134,14 @@ public abstract class GraphTest {
         Graph graph = getEmptyGraph();
         Assert.assertEquals(0, graph.size());
         Language language = new Language("it");
-        Literal value = new PlainLiteralImpl("<elem>value</elem>",language);
+        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());
+        Assert.assertEquals(language, ((Literal) gotValue).getLanguage());
     }
 
     @Test
@@ -174,7 +172,7 @@ public abstract class GraphTest {
     @Test
     public void testAddSingleTriple() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        final Triple triple = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
@@ -187,7 +185,7 @@ public abstract class GraphTest {
     @Test
     public void testAddSameTripleTwice() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        final Triple triple = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
@@ -201,7 +199,7 @@ public abstract class GraphTest {
     @Test
     public void testRemoveSingleTriple() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        final Triple triple = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
@@ -213,11 +211,11 @@ public abstract class GraphTest {
     @Test
     public void testRemoveSameTripleTwice() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple tripleAlice= createTriple(
+        final Triple tripleAlice = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
-        final Triple tripleBob= createTriple(
+        final Triple tripleBob = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/bob");
@@ -246,7 +244,7 @@ public abstract class GraphTest {
     @Test
     public void testContainsIfContained() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        final Triple triple = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
@@ -258,7 +256,7 @@ public abstract class GraphTest {
     @Test
     public void testContainsIfEmpty() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        final Triple triple = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
@@ -269,11 +267,11 @@ public abstract class GraphTest {
     @Test
     public void testContainsIfNotContained() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple tripleAdd= createTriple(
+        final Triple tripleAdd = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
-        final Triple tripleTest= createTriple(
+        final Triple tripleTest = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/bob");
@@ -293,14 +291,14 @@ public abstract class GraphTest {
     @Test
     public void testFilterSingleEntry() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple triple= createTriple(
+        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);
+        Collection<Triple> resultSet = toCollection(i);
         Assert.assertEquals(1, resultSet.size());
         Assert.assertTrue(resultSet.contains(triple));
     }
@@ -309,11 +307,11 @@ public abstract class GraphTest {
     @Test
     public void testFilterByObject() throws Exception {
         Graph graph = getEmptyGraph();
-        final Triple tripleAlice= createTriple(
+        final Triple tripleAlice = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/alice");
-        final Triple tripleBob= createTriple(
+        final Triple tripleBob = createTriple(
                 "http://example.org/ontology/Person",
                 "http://example.org/ontology/hasName",
                 "http://example.org/people/bob");
@@ -326,219 +324,220 @@ public abstract class GraphTest {
         // Find bob
         iterator = graph.filter(null, null,
                 new IRI("http://example.org/people/bob"));
-        resultSet= toCollection(iterator);
+        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);
+        resultSet = toCollection(iterator);
         Assert.assertEquals(1, resultSet.size());
         Assert.assertTrue(resultSet.contains(tripleAlice));
 
         // Find both
         iterator = graph.filter(null, null, null);
-        resultSet= toCollection(iterator);
+        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();
+    /*
+        @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());
         }
-        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();
+        @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));
         }
-        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());
+        @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());
         }
-        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);
-            }            
+        @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));
         }
 
-        public List<GraphEvent> getEvents() {
-            return events;
+        @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));
         }
 
-        public List<GraphEvent> getCumulatedEvents() {
-            return cumulatedEvents;
+        private Set<Triple> getCumulatedTriples(List<GraphEvent> cumulatedEvents) {
+            Set<Triple> triples = new HashSet<Triple>();
+            for(GraphEvent event: cumulatedEvents) {
+                triples.add(event.getTriple());
+            }
+            return triples;
         }
 
-        public void resetEvents() {
-            events = null;
+        @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);
         }
 
-        public void resetCumulatedEvents() {
-            cumulatedEvents = new ArrayList<GraphEvent>();
+        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()) {
@@ -549,15 +548,16 @@ public abstract class GraphTest {
 
     /**
      * 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>.
+     *
+     * @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) {
+                                String object) {
         return new TripleImpl(new IRI(subject), new IRI(predicate),
                 new IRI(object));
     }
-    
+
 }
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
index cdfadab..bc48622 100644
--- 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
@@ -1,35 +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
+ * 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.
+ * 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.IRI;
+import org.apache.clerezza.api.Triple;
 import org.apache.clerezza.api.impl.TripleImpl;
+import org.junit.Assert;
+import org.junit.Test;
 
 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 {
@@ -42,7 +39,7 @@ public class SimpleGraphTest {
     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();
@@ -74,7 +71,7 @@ public class SimpleGraphTest {
         stc.removeAll(stc2);
         Assert.assertEquals(2, stc.size());
     }
-    
+
     @Test
     public void filterIteratorRemove() {
         SimpleGraph stc = new SimpleGraph();
@@ -82,7 +79,7 @@ public class SimpleGraphTest {
         stc.add(triple2);
         stc.add(triple3);
         stc.add(triple4);
-        stc.add(triple5);        
+        stc.add(triple5);
         Iterator<Triple> iter = stc.filter(uriRef1, null, null);
         while (iter.hasNext()) {
             Triple triple = iter.next();
@@ -91,7 +88,7 @@ public class SimpleGraphTest {
         Assert.assertEquals(3, stc.size());
     }
 
-    @Test(expected=ConcurrentModificationException.class)
+    @Test(expected = ConcurrentModificationException.class)
     public void remove() {
         SimpleGraph stc = new SimpleGraph();
         stc.setCheckConcurrency(true);
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 4a39411..57208d9 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
@@ -1,36 +1,34 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.BlankNodeOrIRI;
 import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.apache.clerezza.api.impl.TripleImpl;
-
-import java.util.Map;
-import org.apache.clerezza.api.BlankNode;
-import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.Map;
+
 /**
- *
  * @author reto
  */
 public class GraphMatcherTest {
@@ -92,8 +90,8 @@ public class GraphMatcherTest {
     public void test6() {
         Graph tc1 = new SimpleMGraph();
         final BlankNode b11 = new BlankNode();
-        tc1.add(new TripleImpl(new BlankNode(), u1,b11));
-        tc1.add(new TripleImpl(new BlankNode(), u1,b11));
+        tc1.add(new TripleImpl(new BlankNode(), u1, b11));
+        tc1.add(new TripleImpl(new BlankNode(), u1, b11));
         Graph tc2 = new SimpleMGraph();
         tc2.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
@@ -110,7 +108,7 @@ public class GraphMatcherTest {
         }
         Graph result = new SimpleMGraph();
         BlankNodeOrIRI lastNode = firstNode;
-        for (int i = 0; i < (size-1); i++) {
+        for (int i = 0; i < (size - 1); i++) {
             final BlankNode newNode = new BlankNode();
             result.add(new TripleImpl(lastNode, u1, newNode));
             lastNode = newNode;
@@ -140,10 +138,10 @@ public class GraphMatcherTest {
     @Test
     public void test9() {
         BlankNodeOrIRI crossing = new IRI("http://example.org/");
-        Graph tc1 = generateCircle(2,crossing);
-        tc1.addAll(generateCircle(3,crossing));
-        Graph tc2 = generateCircle(2,crossing);
-        tc2.addAll(generateCircle(3,crossing));
+        Graph tc1 = generateCircle(2, crossing);
+        tc1.addAll(generateCircle(3, crossing));
+        Graph tc2 = generateCircle(2, crossing);
+        tc2.addAll(generateCircle(3, crossing));
         Assert.assertEquals(5, tc1.size());
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
         Assert.assertNotNull(mapping);
@@ -154,11 +152,11 @@ public class GraphMatcherTest {
     @Test
     public void test10() {
         BlankNodeOrIRI crossing1 = new BlankNode();
-        Graph tc1 = generateCircle(2,crossing1);
-        tc1.addAll(generateCircle(3,crossing1));
+        Graph tc1 = generateCircle(2, crossing1);
+        tc1.addAll(generateCircle(3, crossing1));
         BlankNodeOrIRI crossing2 = new BlankNode();
-        Graph tc2 = generateCircle(2,crossing2);
-        tc2.addAll(generateCircle(3,crossing2));
+        Graph tc2 = generateCircle(2, crossing2);
+        tc2.addAll(generateCircle(3, crossing2));
         Assert.assertEquals(5, tc1.size());
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
         Assert.assertNotNull(mapping);
@@ -169,11 +167,11 @@ public class GraphMatcherTest {
     @Test
     public void test11() {
         BlankNodeOrIRI crossing1 = new BlankNode();
-        Graph tc1 = generateCircle(2,crossing1);
-        tc1.addAll(generateCircle(4,crossing1));
+        Graph tc1 = generateCircle(2, crossing1);
+        tc1.addAll(generateCircle(4, crossing1));
         BlankNodeOrIRI crossing2 = new BlankNode();
-        Graph tc2 = generateCircle(3,crossing2);
-        tc2.addAll(generateCircle(3,crossing2));
+        Graph tc2 = generateCircle(3, crossing2);
+        tc2.addAll(generateCircle(3, crossing2));
         Assert.assertEquals(6, tc1.size());
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
         Assert.assertNull(mapping);
@@ -182,11 +180,11 @@ public class GraphMatcherTest {
     @Test
     public void test12() {
         BlankNodeOrIRI start1 = new BlankNode();
-        Graph tc1 = Utils4Testing.generateLine(4,start1);
-        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        Graph tc1 = Utils4Testing.generateLine(4, start1);
+        tc1.addAll(Utils4Testing.generateLine(5, start1));
         BlankNodeOrIRI start2 = new BlankNode();
-        Graph tc2 = Utils4Testing.generateLine(5,start2);
-        tc2.addAll(Utils4Testing.generateLine(4,start2));
+        Graph tc2 = Utils4Testing.generateLine(5, start2);
+        tc2.addAll(Utils4Testing.generateLine(4, start2));
         Assert.assertEquals(9, tc1.size());
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
         Assert.assertNotNull(mapping);
@@ -196,11 +194,11 @@ public class GraphMatcherTest {
     @Test
     public void test13() {
         BlankNodeOrIRI start1 = new BlankNode();
-        Graph tc1 = Utils4Testing.generateLine(4,start1);
-        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        Graph tc1 = Utils4Testing.generateLine(4, start1);
+        tc1.addAll(Utils4Testing.generateLine(5, start1));
         BlankNodeOrIRI start2 = new BlankNode();
-        Graph tc2 = Utils4Testing.generateLine(3,start2);
-        tc2.addAll(Utils4Testing.generateLine(3,start2));
+        Graph tc2 = Utils4Testing.generateLine(3, start2);
+        tc2.addAll(Utils4Testing.generateLine(3, start2));
         Assert.assertEquals(9, tc1.size());
         final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
         Assert.assertNull(mapping);
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
index 74f76e1..1d96575 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
@@ -1,35 +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
+ * 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.
+ * 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.graphmatching;
 
-
-import java.util.Map;
-
 import org.apache.clerezza.api.BlankNode;
 import org.apache.clerezza.api.BlankNodeOrIRI;
 import org.apache.clerezza.api.Graph;
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.Map;
+
 /**
- *
  * @author reto
  */
 public class HashMatchingTest {
@@ -37,11 +34,11 @@ public class HashMatchingTest {
     @Test
     public void twoLine() throws GraphNotIsomorphicException {
         BlankNodeOrIRI start1 = new BlankNode();
-        Graph tc1 = Utils4Testing.generateLine(4,start1);
-        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        Graph tc1 = Utils4Testing.generateLine(4, start1);
+        tc1.addAll(Utils4Testing.generateLine(5, start1));
         BlankNodeOrIRI start2 = new BlankNode();
-        Graph tc2 = Utils4Testing.generateLine(5,start2);
-        tc2.addAll(Utils4Testing.generateLine(4,start2));
+        Graph tc2 = Utils4Testing.generateLine(5, start2);
+        tc2.addAll(Utils4Testing.generateLine(4, start2));
         Assert.assertEquals(9, tc1.size());
         final Map<BlankNode, BlankNode> mapping = new HashMatching(tc1, tc2).getMatchings();
         Assert.assertNotNull(mapping);
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
index bc31dd6..e1ad191 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
@@ -1,33 +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
+ * 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.
+ * 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.graphmatching;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import org.junit.Assert;
-import org.junit.Test;
 
 /**
- *
  * @author reto
  */
 public class PermutationIteratorTest {
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 9dc1a8f..44c386d 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
@@ -1,33 +1,31 @@
 /*
- * 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
+ * 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.
+ * 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.graphmatching;
 
 import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.BlankNodeOrIRI;
 import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.IRI;
-import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.apache.clerezza.api.impl.TripleImpl;
-import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 
 /**
- *
  * @author reto
  */
 public class Utils4Testing {
diff --git a/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
index bba9db6..629fa6b 100644
--- a/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
@@ -1,44 +1,42 @@
 /*
- * 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
+ * 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.
+ * 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.apache.clerezza.api.Literal;
 import org.apache.clerezza.api.IRI;
-import java.util.Arrays;
-import java.util.Date;
-
+import org.apache.clerezza.api.Literal;
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.Arrays;
+import java.util.Date;
+
 /**
- *
  * @author reto
  */
 public class LiteralFactoryTest {
-    
+
     /**
      * Test that a NoConvertorException thrown for an unsupported convertor
      */
-    @Test(expected=NoConvertorException.class)
+    @Test(expected = NoConvertorException.class)
     public void unavailableConvertor() {
-        Object value = new Object() {};
+        Object value = new Object() {
+        };
         LiteralFactory.getInstance().createTypedLiteral(value);
     }
 
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
index ff55388..10aad34 100644
--- 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
@@ -1,53 +1,49 @@
 /*
- * 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
+ * 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.
+ * 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;
+import org.junit.Test;
 
 /**
- *
  * @author reto
- *
  */
-
 public class PlainLiteralImplTest {
 
-    
-    @Test public void plainLiteralEquality() {
+    @Test
+    public void plainLiteralEquality() {
         String stringValue = "some text";
         Literal literal1 = new PlainLiteralImpl(stringValue);
-        Literal literal2 = 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() {
+
+    @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);        
+        Literal literal2 = new PlainLiteralImpl(stringValue, lang);
         Assert.assertEquals(literal1, literal2);
         Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
         Language lang2 = new Language("de");
@@ -61,7 +57,8 @@ public class PlainLiteralImplTest {
     /**
      * hashCode of the lexical form plus the hashCode of the locale
      */
-    @Test public void checkHashCode() {
+    @Test
+    public void checkHashCode() {
         String stringValue = "some text";
         Language language = new Language("en");
         Literal literal = new PlainLiteralImpl(stringValue, language);
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
index 99e59ce..85e9729 100644
--- 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
@@ -1,57 +1,45 @@
 /*
- * 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
+ * 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.
- *
-*/
-
+ * 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 junit.framework.Assert;
 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.apache.clerezza.api.impl.literal.PlainLiteralImpl;
 import org.junit.Test;
-import junit.framework.Assert;
 
 /**
- *
  * @author reto
- *
  */
-
 public class TripleImplTest {
-    
-    
-    @Test public void tripleEquality() {
+
+    @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);    
+        Assert.assertEquals(triple1, triple2);
     }
 
 }
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
index 8589c4e..50f1ca7 100644
--- 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
@@ -1,49 +1,40 @@
 /*
- * 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
+ * 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.
+ * 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 junit.framework.Assert;
 import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
 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() {
+
+
+    @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);        
+        Literal literal2 = new TypedLiteralImpl(stringValue, uriRef);
         Assert.assertEquals(literal1, literal2);
         Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
         Literal literal3 = new TypedLiteralImpl("something else", uriRef);
@@ -53,14 +44,14 @@ public class TypedLiteralImplTest {
         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() {
+    @Test
+    public void checkHashCode() {
         String stringValue = "some text";
         IRI uriRef = new IRI("http://example.org/datatypes/magic");
-        Literal literal =  new TypedLiteralImpl(stringValue, uriRef);
+        Literal literal = new TypedLiteralImpl(stringValue, uriRef);
         Assert.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
     }
 


[clerezza] 10/45: CLEREZZA-1026: Add module sparql in reactor pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit fc1bbb0c4e098c5614a6ee8dcb30c7c9faca0e84
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 04:13:43 2018 +0100

    CLEREZZA-1026: Add module sparql in reactor pom.xml
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index 838d82f..6e43739 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,7 @@
     <modules>
         <module>api</module>
         <module>api.impl</module>
+        <module>sparql</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>


[clerezza] 04/45: CLEREZZA-1026: Fix reactor's pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 44fd93cecedf4ed44c0d3e0ef61f9f7ac52965cc
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Aug 17 00:39:12 2018 +0200

    CLEREZZA-1026: Fix reactor's pom.xml
---
 pom.xml | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3635f73..838d82f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,32 +1,31 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-         !!!!!!                                !!!!!!
-         !!!!!!    This pom is only provided   !!!!!!
-         !!!!!!   for build convenience and    !!!!!!
-         !!!!!!   should not be released       !!!!!!
-         !!!!!!                                !!!!!!
-         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+    <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+         !!!!!!                               !!!!!!
+         !!!!!!   This pom is only provided   !!!!!!
+         !!!!!!   for build convenience and   !!!!!!
+         !!!!!!   should not be released      !!!!!!
+         !!!!!!                               !!!!!!
+         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
 
     <modelVersion>4.0.0</modelVersion>
     
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>7</version>
+        <version>8-SNAPSHOT</version>
         <relativePath />
      </parent>
 
-    <groupId>org.apache.clerezza.commons-rdf</groupId>
     <artifactId>clerezza-reactor</artifactId>
     <packaging>pom</packaging>
-    <version>0.3-SNAPSHOT</version>
+    <version>8-SNAPSHOT</version>
     <name>Clerezza - Reactor</name>
     <description>
-        Apache Commons RDF provides an API modelling the RDF data model as defined by 
+        Apache Clerezza provides an API modelling RDF data as defined by 
         http://www.w3.org/TR/rdf11-concepts/
     </description>
     
-    <url>http://clerezza.apache.org/commons-rdf/</url>
+    <url>http://clerezza.apache.org/</url>
     
     <issueManagement>
         <system>jira</system>
@@ -37,13 +36,13 @@
     <scm>
         <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
         <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
       <tag>HEAD</tag>
   </scm>
 
     <modules>
         <module>api</module>
-        <module>impl.utils</module>
+        <module>api.impl</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>


[clerezza] 38/45: CLEREZZA-1039: Remove unnecessary or obsolete files, update README.md and NOTICE

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 1e2ae5f4b9f1936abdfcd3c5fc319d7ebbe5da53
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 21:02:41 2019 +0100

    CLEREZZA-1039: Remove unnecessary or obsolete files, update README.md and NOTICE
---
 LICENSE.txt   | 202 ----------------------------------------------------------
 NOTICE        |   3 +
 NOTICE.txt    |   8 ---
 README.md     |   6 --
 README.txt    |   5 --
 alerts.txt    |   0
 nbactions.xml |  53 ---------------
 7 files changed, 3 insertions(+), 274 deletions(-)

diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..5c678e2
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/NOTICE.txt b/NOTICE.txt
deleted file mode 100644
index 66a6d0f..0000000
--- a/NOTICE.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Apache Commons RDF
-Copyright 2001-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-This product includes software developed at
-https://github.com/commons-rdf/commons-rdf.
diff --git a/README.md b/README.md
index 5e05c3d..ca3a417 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,6 @@ Build using Apache Maven with
 
     mvn install
 
-## Documentation
-
-You can build the documentation with:
-
-    mvn site
-
 ## FAQ
 
 Some more advanced questions focused on showing the differences to other proposed APIs.
diff --git a/README.txt b/README.txt
deleted file mode 100644
index a83987d..0000000
--- a/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Clerezza
-
-See http://clerezza.apache.org/getting-started/ for instructions on how to build and launch Clerezza.
-
-This is a source distribution containing different modules to which different licenses and notices from copyright holders apply, see the LICENSE and NOTICE files in the root folders of the individual modules.
diff --git a/alerts.txt b/alerts.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/nbactions.xml b/nbactions.xml
deleted file mode 100644
index 0b6b82a..0000000
--- a/nbactions.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
-        <action>
-            <actionName>build</actionName>
-            <goals>
-                <goal>install</goal>
-            </goals>
-            <properties>
-                <Env.MAVEN_OPTS>-Xmx3g -XX:MaxPermSize=768M</Env.MAVEN_OPTS>
-            </properties>
-        </action>
-        <action>
-            <actionName>rebuild</actionName>
-            <goals>
-                <goal>clean</goal>
-                <goal>install</goal>
-            </goals>
-            <properties>
-                <Env.MAVEN_OPTS>-Xmx3g -XX:MaxPermSize=768M</Env.MAVEN_OPTS>            
-            </properties>
-        </action>
-        <action>
-            <actionName>test</actionName>
-            <goals>
-                <goal>test</goal>
-            </goals>
-            <properties>
-                <Env.MAVEN_OPTS>-Xmx3g -XX:MaxPermSize=768M</Env.MAVEN_OPTS>            
-            </properties>
-        </action>
-        <action>
-            <actionName>CUSTOM-update zz-version</actionName>
-            <displayName>update zz-version</displayName>
-            <goals>
-                <goal>versions:use-next-snapshots</goal>
-            </goals>
-            <properties>
-                <includesList>"org.apache.clerezza.*"</includesList>
-                <excludeReactor>false</excludeReactor>
-                <generateBackupPoms>false</generateBackupPoms>
-            </properties>
-        </action>
-        <action>
-            <actionName>CUSTOM-deploy</actionName>
-            <goals>
-                <goal>clean</goal>
-                <goal>deploy</goal>
-            </goals>
-            <properties>
-                <Env.MAVEN_OPTS>-Xmx1024M -XX:MaxPermSize=128M</Env.MAVEN_OPTS>            
-            </properties>
-        </action>
-    </actions>


[clerezza] 03/45: CLEREZZA-1026: Rename impl.utils to api.impl; rename packages within api and api.impl

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 9364e6d54d8a9956b16fa915279182bc30b2e02c
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Aug 15 08:28:35 2018 +0200

    CLEREZZA-1026: Rename impl.utils to api.impl; rename packages within api and api.impl
---
 {impl.utils => api.impl}/pom.xml                   | 27 +++++++--------
 .../apache/clerezza/api/impl}/AbstractGraph.java   | 29 ++++++-----------
 .../clerezza/api/impl}/AbstractImmutableGraph.java | 12 +++----
 .../apache/clerezza/api/impl}/AbstractLiteral.java |  4 +--
 .../clerezza/api/impl}/DelayedNotificator.java     |  6 ++--
 .../org/apache/clerezza/api/impl}/LiteralImpl.java |  6 ++--
 .../apache/clerezza/api/impl}/LockingIterator.java |  4 +--
 .../clerezza/api/impl}/PlainLiteralImpl.java       |  8 ++---
 .../org/apache/clerezza/api/impl}/TripleImpl.java  | 10 +++---
 .../clerezza/api/impl}/TypedLiteralImpl.java       |  7 ++--
 .../clerezza/api/impl}/WatchableGraphWrapper.java  | 29 +++++++++--------
 .../clerezza/api/impl}/debug/ReadLockDebug.java    |  2 +-
 .../impl}/debug/ReentrantReadWriteLockTracker.java |  2 +-
 .../clerezza/api/impl}/debug/WriteLockDebug.java   |  2 +-
 .../api/impl}/graphmatching/GraphMatcher.java      | 16 ++++-----
 .../graphmatching/GraphNotIsomorphicException.java |  2 +-
 .../impl}/graphmatching/GroupMappingIterator.java  |  3 +-
 .../api/impl}/graphmatching/HashMatching.java      | 22 ++++++-------
 .../api/impl}/graphmatching/MappingIterator.java   |  2 +-
 .../impl}/graphmatching/PermutationIterator.java   |  2 +-
 .../clerezza/api/impl}/graphmatching/Utils.java    |  6 ++--
 .../graphmatching/collections/IntHashMap.java      |  2 +-
 .../graphmatching/collections/IntHashSet.java      |  2 +-
 .../graphmatching/collections/IntIterator.java     |  2 +-
 .../impl}/graphmatching/collections/IntSet.java    |  2 +-
 .../apache/clerezza/api/impl}/package-info.java    |  2 +-
 .../clerezza/api/impl}/simple/SimpleGraph.java     | 15 +++++----
 .../api/impl}/simple/SimpleImmutableGraph.java     | 15 +++++----
 .../clerezza/api/impl}/simple/SimpleMGraph.java    |  7 ++--
 .../api/impl}/graphmatching/GraphMatcherTest.java  | 19 +++++------
 .../api/impl}/graphmatching/HashMatchingTest.java  |  8 ++---
 .../graphmatching/PermutationIteratorTest.java     |  3 +-
 .../api/impl}/graphmatching/Utils4Testing.java     | 14 ++++----
 .../api/impl}/simple/PlainLiteralImplTest.java     |  8 ++---
 .../clerezza/api/impl}/simple/SimpleGraphTest.java | 10 +++---
 .../clerezza/api/impl}/simple/TripleImplTest.java  | 14 ++++----
 .../api/impl}/simple/TypedLiteralImplTest.java     |  8 ++---
 api/pom.xml                                        | 38 ++++++++++------------
 .../clerezza/{commons/rdf => api}/BlankNode.java   |  2 +-
 .../{commons/rdf => api}/BlankNodeOrIRI.java       |  2 +-
 .../clerezza/{commons/rdf => api}/Graph.java       |  4 +--
 .../apache/clerezza/{commons/rdf => api}/IRI.java  |  2 +-
 .../{commons/rdf => api}/ImmutableGraph.java       |  2 +-
 .../clerezza/{commons/rdf => api}/Language.java    |  2 +-
 .../clerezza/{commons/rdf => api}/Literal.java     |  2 +-
 .../clerezza/{commons/rdf => api}/RDFTerm.java     |  2 +-
 .../clerezza/{commons/rdf => api}/Triple.java      |  2 +-
 .../{commons/rdf => api}/WatchableGraph.java       | 11 +++----
 .../{commons/rdf => api}/event/AddEvent.java       |  8 ++---
 .../{commons/rdf => api}/event/FilterTriple.java   | 10 +++---
 .../{commons/rdf => api}/event/GraphEvent.java     |  6 ++--
 .../{commons/rdf => api}/event/GraphListener.java  |  2 +-
 .../{commons/rdf => api}/event/RemoveEvent.java    |  8 ++---
 .../{commons/rdf => api}/package-info.java         |  2 +-
 54 files changed, 205 insertions(+), 232 deletions(-)

diff --git a/impl.utils/pom.xml b/api.impl/pom.xml
similarity index 72%
rename from impl.utils/pom.xml
rename to api.impl/pom.xml
index b217d7e..871beb6 100644
--- a/impl.utils/pom.xml
+++ b/api.impl/pom.xml
@@ -24,22 +24,17 @@
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>7</version>
+        <version>8-SNAPSHOT</version>
         <relativePath />
     </parent>
 
-    <groupId>org.apache.clerezza.commons-rdf</groupId>
-    <artifactId>commons-rdf-impl-utils</artifactId>
-    <version>0.3-SNAPSHOT</version>
+    <artifactId>api.impl</artifactId>
     <packaging>bundle</packaging>
-    <name>Clerezza Commons RDF Implementation Utils</name>
+    <name>Clerezza API Implementation</name>
     <description>
-        Apache Commons RDF provides an API modelling the RDF data model as defined by 
-        http://www.w3.org/TR/rdf11-concepts/
+        This module implements Apache Clerezza API
     </description>
 
-    <url>http://clerezza.apache.org/commons-rdf/</url>
-    
     <issueManagement>
         <system>jira</system>
         <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
@@ -47,9 +42,9 @@
     
     <inceptionYear>2015</inceptionYear>
     <scm>
-        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
       <tag>HEAD</tag>
   </scm>
     
@@ -61,7 +56,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.commons.rdf.impl.utils.*</Export-Package>
+                        <Export-Package>org.apache.clerezza.api.impl.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
@@ -71,9 +66,9 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.clerezza.commons-rdf</groupId>
-            <artifactId>commons-rdf-api</artifactId>
-            <version>0.3-SNAPSHOT</version>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java
similarity index 87%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java
index 15efce6..ab236b6 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractGraph.java
@@ -16,33 +16,24 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
-import java.lang.ref.WeakReference;
 import java.util.AbstractCollection;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
 
-import java.util.Set;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.WatchableGraph;
-import org.apache.clerezza.commons.rdf.event.AddEvent;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphEvent;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-import org.apache.clerezza.commons.rdf.event.RemoveEvent;
-import org.apache.clerezza.commons.rdf.impl.utils.debug.ReentrantReadWriteLockTracker;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.simple.SimpleImmutableGraph;
+import org.apache.clerezza.api.impl.debug.ReentrantReadWriteLockTracker;
 
 /**
  * An abstract implementation of <code>Graph</code> implementing
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java
similarity index 90%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java
index e5644ed..c46f0fc 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractImmutableGraph.java
@@ -16,16 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.GraphMatcher;
+import org.apache.clerezza.api.impl.graphmatching.GraphMatcher;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
 
 /**
  * <code>AbstractGraph</code> is an abstract implementation of <code>ImmutableGraph</code> 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java
similarity index 94%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java
index a236f06..48e3221 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/AbstractLiteral.java
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
-import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.api.Literal;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java
similarity index 95%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java
index 1cf3321..39d52f5 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/DelayedNotificator.java
@@ -16,15 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.lang.ref.WeakReference;
 import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.clerezza.commons.rdf.event.GraphEvent;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
+import org.apache.clerezza.api.event.GraphEvent;
+import org.apache.clerezza.api.event.GraphListener;
 
 
 /**
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java
similarity index 93%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java
index b2aa4be..e8ac986 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/LiteralImpl.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.io.Serializable;
 
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java
similarity index 95%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java
index 79747c2..84b73de 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/LockingIterator.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.api.Triple;
 
 /**
  * Wrapps an iterator<Triple> reading entering a read-lock on every invocation
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java
similarity index 92%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java
index 49f2633..012aeca 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/PlainLiteralImpl.java
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.io.Serializable;
-import org.apache.clerezza.commons.rdf.IRI;
 
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
similarity index 91%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
index 6137c4b..1f67d39 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/TripleImpl.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.IRI;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java
similarity index 91%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java
index 67f7c9c..0be7ab3 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/TypedLiteralImpl.java
@@ -16,13 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.io.Serializable;
 
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java
similarity index 91%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java
index de61fe4..5533c9b 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/WatchableGraphWrapper.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
+package org.apache.clerezza.api.impl;
 
 import java.lang.ref.WeakReference;
 import java.util.Collection;
@@ -22,18 +22,19 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.WatchableGraph;
-import org.apache.clerezza.commons.rdf.event.AddEvent;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphEvent;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-import org.apache.clerezza.commons.rdf.event.RemoveEvent;
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.WatchableGraph;
+import org.apache.clerezza.api.event.AddEvent;
+import org.apache.clerezza.api.event.FilterTriple;
+import org.apache.clerezza.api.event.GraphEvent;
+import org.apache.clerezza.api.event.GraphListener;
+import org.apache.clerezza.api.event.RemoveEvent;
 
 /**
  *
@@ -69,7 +70,7 @@ public class WatchableGraphWrapper implements WatchableGraph {
 
     @Override
     public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate,
-            RDFTerm object) {
+                                   RDFTerm object) {
         final Iterator<Triple> baseIter = wrapped.filter(subject, predicate, object);
         return new Iterator<Triple>() {
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
similarity index 97%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
index 1f47fe9..f826dee 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReadLockDebug.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.debug;
+package org.apache.clerezza.api.impl.debug;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
similarity index 98%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
index 8f382aa..94e8a6c 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/ReentrantReadWriteLockTracker.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.debug;
+package org.apache.clerezza.api.impl.debug;
 
 import java.util.Collection;
 import java.util.Collections;
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
similarity index 97%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
index a4261e3..82301a3 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/debug/WriteLockDebug.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.debug;
+package org.apache.clerezza.api.impl.debug;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
similarity index 91%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
index ce65d1a..9180ae0 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcher.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 
 
@@ -26,13 +26,13 @@ import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.simple.SimpleMGraph;
 
 /**
  * @author reto
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
similarity index 93%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
index 5b5600f..3137098 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GraphNotIsomorphicException.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
similarity index 97%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
index 4c7a0ae..1d271bf 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/GroupMappingIterator.java
@@ -15,11 +15,10 @@
  *  under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
similarity index 93%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
index 369cf5c..13b8436 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/HashMatching.java
@@ -17,24 +17,24 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections.IntHashMap;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graphmatching.collections.IntIterator;
+import org.apache.clerezza.api.impl.graphmatching.collections.IntHashMap;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections.IntIterator;
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
similarity index 97%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
index 016b590..6c5c245 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/MappingIterator.java
@@ -1,4 +1,4 @@
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
similarity index 97%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
index 6f01828..74e9eff 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/PermutationIterator.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
similarity index 93%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
index 68e178b..30f0f0d 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/Utils.java
@@ -1,4 +1,4 @@
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -26,8 +26,8 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Triple;
 
 public class Utils {
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
similarity index 99%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
index 776a6af..ac117af 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashMap.java
@@ -19,7 +19,7 @@
  * but rereleased by the original author under the ASF license (above).
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections;
+package org.apache.clerezza.api.impl.graphmatching.collections;
 
 
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
similarity index 95%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
index 70091b8..4d6b13b 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntHashSet.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections;
+package org.apache.clerezza.api.impl.graphmatching.collections;
 
 import java.util.HashSet;
 import java.util.Iterator;
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
similarity index 92%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
index d298066..3bf38ed 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntIterator.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections;
+package org.apache.clerezza.api.impl.graphmatching.collections;
 
 import java.util.Iterator;
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
similarity index 92%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
index b1d6c32..8bd64c1 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/graphmatching/collections/IntSet.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections;
+package org.apache.clerezza.api.impl.graphmatching.collections;
 
 import java.util.Set;
 
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/package-info.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
similarity index 94%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/package-info.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
index a353062..6a35ba4 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/package-info.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/package-info.java
@@ -18,4 +18,4 @@
 /**
  * Common RDF API Implementation utilities.
  */
-package org.apache.clerezza.commons.rdf.impl.utils;
\ No newline at end of file
+package org.apache.clerezza.api.impl;
\ No newline at end of file
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java
similarity index 94%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java
index 96f168b..7220532 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleGraph.java
@@ -16,9 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.AbstractGraph;
 
-import org.apache.clerezza.commons.rdf.impl.utils.AbstractGraph;
 import java.lang.ref.SoftReference;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -29,11 +31,10 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
 
 /**
  * For now this is a minimalistic implementation, without any indexes or other
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java
similarity index 86%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java
index 4cb3390..d48fe5c 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleImmutableGraph.java
@@ -16,16 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
+
+import org.apache.clerezza.api.impl.AbstractImmutableGraph;
 
-import org.apache.clerezza.commons.rdf.impl.utils.AbstractImmutableGraph;
 import java.util.Iterator;
 
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
 
 /**
  *
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.java b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
similarity index 86%
rename from impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.java
rename to api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
index 1c00cdd..da961c2 100644
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.java
+++ b/api.impl/src/main/java/org/apache/clerezza/api/impl/simple/SimpleMGraph.java
@@ -16,15 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
 
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
 
 /**
  *
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
similarity index 92%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
index 24b92c5..00e02a2 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/GraphMatcherTest.java
@@ -16,19 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+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.TripleImpl;
 
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.GraphMatcher;
 import java.util.Map;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.BlankNodeOrIRI;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
similarity index 87%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
index 8acbce5..74f76e1 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/HashMatchingTest.java
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
 
 import java.util.Map;
 
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.Graph;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
similarity index 94%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
index 3f61508..bc31dd6 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/PermutationIteratorTest.java
@@ -17,9 +17,8 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.PermutationIterator;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
similarity index 78%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
index ca3237c..85dbc20 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/graphmatching/Utils4Testing.java
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+package org.apache.clerezza.api.impl.graphmatching;
 
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+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.TripleImpl;
+import org.apache.clerezza.api.BlankNodeOrIRI;
 
 /**
  *
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/PlainLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
similarity index 92%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/PlainLiteralImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
index 538a16d..ff6e678 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/PlainLiteralImplTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/PlainLiteralImplTest.java
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
 
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.PlainLiteralImpl;
 import org.junit.Test;
 
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
 import org.junit.Assert;
 /**
  *
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
similarity index 92%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
index 9c94a8d..ff3280d 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/SimpleGraphTest.java
@@ -16,16 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
+
+import org.apache.clerezza.api.impl.TripleImpl;
 
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
 import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.IRI;
 
 /**
  *
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
similarity index 80%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
index b064a60..9b38af9 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TripleImplTest.java
@@ -3,7 +3,7 @@
  * and open the template in the editor.
  */
 
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
 /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -26,15 +26,15 @@ package org.apache.clerezza.commons.rdf.impl.utils.simple;
 */
 
 
+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;
 
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
 /**
  *
  * @author reto
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TypedLiteralImplTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
similarity index 90%
rename from impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TypedLiteralImplTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
index 2da82cd..dbde617 100644
--- a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TypedLiteralImplTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/simple/TypedLiteralImplTest.java
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.impl.utils.simple;
+package org.apache.clerezza.api.impl.simple;
 
-import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
+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.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.api.Literal;
 /**
  *
  * @author reto/**
diff --git a/api/pom.xml b/api/pom.xml
index a58ef72..83921d6 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -18,41 +18,37 @@
 
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-        <modelVersion>4.0.0</modelVersion>
-    
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>7</version>
-        <relativePath />
-     </parent>
+        <version>8-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
 
-    <groupId>org.apache.clerezza.commons-rdf</groupId>
-    <artifactId>commons-rdf-api</artifactId>
-    <version>0.3-SNAPSHOT</version>
+    <artifactId>api</artifactId>
     <packaging>bundle</packaging>
-    <name>Clerezza Commons RDF API</name>
+    <name>Clerezza API</name>
     <description>
-        Apache Clerezza Commons RDF provides an API modelling the RDF data model as defined by 
+        Apache Clerezza API implements the RDF data model as defined by
         http://www.w3.org/TR/rdf11-concepts/
     </description>
-    
-    <url>http://clerezza.apache.org/commons-rdf/</url>
-    
+
     <issueManagement>
         <system>jira</system>
         <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
     </issueManagement>
-    
+
     <inceptionYear>2015</inceptionYear>
     <scm>
-        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
-      <tag>HEAD</tag>
-  </scm>
-
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
+        <tag>HEAD</tag>
+    </scm>
 
     <dependencies>
         <dependency>
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java b/api/src/main/java/org/apache/clerezza/api/BlankNode.java
similarity index 97%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
rename to api/src/main/java/org/apache/clerezza/api/BlankNode.java
index 9952fce..fab6270 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
+++ b/api/src/main/java/org/apache/clerezza/api/BlankNode.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * A Blank Node represents a resource, 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java b/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
similarity index 96%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java
rename to api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
index 8d80b4b..0cf66ac 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java
+++ b/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * Represents a <code>Resource</code> that is not a <code>Literal</code>. 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java b/api/src/main/java/org/apache/clerezza/api/Graph.java
similarity index 95%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
rename to api/src/main/java/org/apache/clerezza/api/Graph.java
index 6904722..5c5648c 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
+++ b/api/src/main/java/org/apache/clerezza/api/Graph.java
@@ -16,13 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
 
 
 /**
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java b/api/src/main/java/org/apache/clerezza/api/IRI.java
similarity index 98%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java
rename to api/src/main/java/org/apache/clerezza/api/IRI.java
index be9b3a8..d17cc90 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java
+++ b/api/src/main/java/org/apache/clerezza/api/IRI.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 import java.io.Serializable;
 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java b/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
similarity index 97%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
rename to api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
index bd94671..efb7b49 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
+++ b/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * A graph, modeled as a set of triples.
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java b/api/src/main/java/org/apache/clerezza/api/Language.java
similarity index 97%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
rename to api/src/main/java/org/apache/clerezza/api/Language.java
index 62a921e..e5d24f4 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
+++ b/api/src/main/java/org/apache/clerezza/api/Language.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * Represents a language as expressed by the RDF 4646 language tag
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java b/api/src/main/java/org/apache/clerezza/api/Literal.java
similarity index 98%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
rename to api/src/main/java/org/apache/clerezza/api/Literal.java
index 0f96256..641a64b 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
+++ b/api/src/main/java/org/apache/clerezza/api/Literal.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 
 /**
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
similarity index 96%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java
rename to api/src/main/java/org/apache/clerezza/api/RDFTerm.java
index 197a182..58d3e4a 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java
+++ b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java b/api/src/main/java/org/apache/clerezza/api/Triple.java
similarity index 97%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
rename to api/src/main/java/org/apache/clerezza/api/Triple.java
index 67cdef0..f0f6ed4 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
+++ b/api/src/main/java/org/apache/clerezza/api/Triple.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
 /**
  * A structure containing a subject, a predicate, and an object. 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
similarity index 92%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
rename to api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
index 4ed2cd4..d239d2a 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
+++ b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
@@ -16,13 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf;
+package org.apache.clerezza.api;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
+import org.apache.clerezza.api.event.FilterTriple;
+import org.apache.clerezza.api.event.GraphListener;
 
 
 /**
@@ -67,7 +64,7 @@ public interface WatchableGraph extends Graph {
      * @param delay The time period afer which the listener will be notified in milliseconds.
      */
     public void addGraphListener(GraphListener listener, FilterTriple filter,
-            long delay);
+                                 long delay);
 
     /**
      * Adds the specified <code>GraphListener</code> to the graph. This listener
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
similarity index 84%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
rename to api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
index c2716d6..bf64ef9 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.event;
+package org.apache.clerezza.api.event;
 
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
 
 /**
  * This class represent a addition event that occured on a
@@ -30,7 +30,7 @@ import org.apache.clerezza.commons.rdf.Graph;
 public class AddEvent extends GraphEvent {
 
 
-    public AddEvent(Graph graph,  Triple triple) {
+    public AddEvent(Graph graph, Triple triple) {
         super(graph, triple);
     }
 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
similarity index 91%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
rename to api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
index 4e22df7..153241c 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.event;
+package org.apache.clerezza.api.event;
 
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
 
 /**
  * The <code>FilterTriple</code> class provides a match()-method that tests
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
similarity index 92%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
rename to api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
index b9e6ec0..aeea21c 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.event;
+package org.apache.clerezza.api.event;
 
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
 
 /**
  * This class represent a modification event that occured on a
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
similarity index 97%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
rename to api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
index 9041546..ce7ce5d 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.event;
+package org.apache.clerezza.api.event;
 
 import java.util.List;
 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
similarity index 83%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
rename to api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
index 103febc..8f0134f 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.commons.rdf.event;
+package org.apache.clerezza.api.event;
 
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
 
 /**
  * This class represent a removal event that occured on a
@@ -30,7 +30,7 @@ import org.apache.clerezza.commons.rdf.Graph;
 public class RemoveEvent extends GraphEvent {
 
 
-    public RemoveEvent(Graph graph,  Triple triple) {
+    public RemoveEvent(Graph graph, Triple triple) {
         super(graph, triple);
     }
 
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java b/api/src/main/java/org/apache/clerezza/api/package-info.java
similarity index 95%
rename from api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
rename to api/src/main/java/org/apache/clerezza/api/package-info.java
index 62354fe..0998a56 100644
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
+++ b/api/src/main/java/org/apache/clerezza/api/package-info.java
@@ -18,4 +18,4 @@
 /**
  * Common RDF API
  */
-package org.apache.clerezza.commons.rdf;
\ No newline at end of file
+package org.apache.clerezza.api;
\ No newline at end of file


[clerezza] 18/45: CLEREZZA-1035: Copy rdf.core.test from rdf module to test.utils

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 209ee5711d04aae1f0a3278f2c6d49f2149a4142
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Feb 6 21:38:53 2019 +0100

    CLEREZZA-1035: Copy rdf.core.test from rdf module to test.utils
---
 test.utils/LICENSE                                 | 201 ++++++++
 test.utils/pom.xml                                 |  62 +++
 .../org/apache/clerezza/test/utils/GraphTest.java  | 561 +++++++++++++++++++++
 .../apache/clerezza/test/utils/GraphWrapper.java   | 120 +++++
 .../apache/clerezza/test/utils/LockChecker.java    |  40 ++
 .../utils/LockableMGraphWrapperForTesting.java     |  72 +++
 .../test/utils/LockingIteratorForTesting.java      |  80 +++
 .../apache/clerezza/test/utils/RandomGraph.java    | 233 +++++++++
 .../apache/clerezza/test/utils/TcProviderTest.java | 479 ++++++++++++++++++
 9 files changed, 1848 insertions(+)

diff --git a/test.utils/LICENSE b/test.utils/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/test.utils/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/test.utils/pom.xml b/test.utils/pom.xml
new file mode 100644
index 0000000..0b14eae
--- /dev/null
+++ b/test.utils/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+  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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>8-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>test.utils</artifactId>
+    <packaging>jar</packaging>
+    <version>8-SNAPSHOT</version>
+    <name>Clerezza - Test Utilities</name>
+    <description>Utilities to test Clerezza API and dataset implementations</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>dataset</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java
new file mode 100644
index 0000000..03e8043
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java
@@ -0,0 +1,561 @@
+/*
+ * 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.test.utils;
+
+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));
+    }
+    
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphWrapper.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphWrapper.java
new file mode 100644
index 0000000..e4d52e5
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphWrapper.java
@@ -0,0 +1,120 @@
+/*
+ * 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.test.utils;
+
+import org.apache.clerezza.api.*;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ *
+ * @author mir
+ */
+class GraphWrapper implements Graph {
+
+    protected Graph wrapped;
+
+    public GraphWrapper(Graph tc) {
+        this.wrapped = tc;
+    }
+
+    @Override
+    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return wrapped.filter(subject, predicate, object);
+    }
+
+    
+    @Override
+    public int size() {
+        return wrapped.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return wrapped.isEmpty();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        return wrapped.contains(o);
+    }
+
+    @Override
+    public Iterator<Triple> iterator() {
+        return wrapped.iterator();
+    }
+
+    @Override
+    public Object[] toArray() {
+        return wrapped.toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        return wrapped.toArray(a);
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        return wrapped.add(e);
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        return wrapped.remove(o);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        return wrapped.containsAll(c);
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        return wrapped.addAll(c);
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        return wrapped.removeAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        return wrapped.retainAll(c);
+    }
+
+    @Override
+    public void clear() {
+        wrapped.clear();
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return wrapped.getImmutableGraph();
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return wrapped.getLock();
+    }
+
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/LockChecker.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockChecker.java
new file mode 100644
index 0000000..5fcf8d4
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockChecker.java
@@ -0,0 +1,40 @@
+/*
+ * 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.test.utils;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ *
+ * @author mir
+ */
+class LockChecker {
+
+    public static void checkIfReadLocked(ReentrantReadWriteLock lock) {
+        if (lock.getReadLockCount() == 0 && !lock.isWriteLockedByCurrentThread()) {
+            throw new RuntimeException("Neither read- nor write-locked");
+        }
+    }
+
+    public static void checkIfWriteLocked(ReentrantReadWriteLock lock) {
+        if (!lock.isWriteLockedByCurrentThread()) {
+            throw new RuntimeException("Not write-locked");
+        }
+    }
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/LockableMGraphWrapperForTesting.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockableMGraphWrapperForTesting.java
new file mode 100644
index 0000000..55bdb58
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockableMGraphWrapperForTesting.java
@@ -0,0 +1,72 @@
+/*
+ * 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.test.utils;
+
+import org.apache.clerezza.api.*;
+
+import java.util.Iterator;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Wrappes an Graph as a LockableGraph. If a method is called that reads
+ * or modifies the wrapped graph and the appropriate lock is not set, then a
+ * RuntimeException is thrown.
+ *
+ * @author rbn, mir
+ */
+public class LockableMGraphWrapperForTesting extends GraphWrapper {
+
+    private final ReentrantReadWriteLock lock = (ReentrantReadWriteLock) getLock();
+    private final Lock readLock = lock.readLock();
+    private final Graph wrapped;
+
+    /**
+     * Constructs a LocalbleGraph for an Graph.
+     *
+     * @param providedGraph a non-lockable mgraph
+     */
+    public LockableMGraphWrapperForTesting(final Graph providedGraph) {
+        super(providedGraph);
+        this.wrapped = providedGraph;
+    }
+
+    @Override
+    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        LockChecker.checkIfReadLocked(lock);
+        readLock.lock();
+        try {
+            return new LockingIteratorForTesting(wrapped.filter(subject, predicate, object), lock);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public Iterator<Triple> iterator() {
+        LockChecker.checkIfReadLocked(lock);
+        readLock.lock();
+        try {
+            return new LockingIteratorForTesting(wrapped.iterator(), lock);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/LockingIteratorForTesting.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockingIteratorForTesting.java
new file mode 100644
index 0000000..3e7b225
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/LockingIteratorForTesting.java
@@ -0,0 +1,80 @@
+/*
+ * 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.test.utils;
+
+import org.apache.clerezza.api.Triple;
+
+import java.util.Iterator;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Wrapps an iterator<Triple> reading all elements to a cache on construction
+ * and returning them from that cache.
+ * @author reto
+ */
+class LockingIteratorForTesting implements Iterator<Triple> {
+
+    private Iterator<Triple> base;
+    private Lock readLock;
+    private Lock writeLock;
+    private ReentrantReadWriteLock lock;
+
+    public LockingIteratorForTesting(Iterator<Triple> iterator, ReentrantReadWriteLock lock) {
+        base = iterator;
+        readLock = lock.readLock();
+        writeLock = lock.writeLock();
+        this.lock = lock;
+    }
+
+    @Override
+    public boolean hasNext() {
+        LockChecker.checkIfReadLocked(lock);
+        readLock.lock();
+        try {
+            return base.hasNext();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public Triple next() {
+        LockChecker.checkIfReadLocked(lock);
+        readLock.lock();
+        try {
+            return base.next();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public void remove() {
+        LockChecker.checkIfWriteLocked(lock);
+        writeLock.lock();
+        try {
+            base.remove();
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java
new file mode 100644
index 0000000..d028594
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java
@@ -0,0 +1,233 @@
+/*
+ * 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.test.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.commons.lang.RandomStringUtils;
+
+import java.util.Iterator;
+import java.util.UUID;
+
+/**
+ * A <code>Graph</code> wrapper that allows growing and shrinking of
+ * the wrapped mgraph.
+ *
+ * @author mir
+ */
+public class RandomGraph extends GraphWrapper {
+    
+    private int interconnectivity = 2;
+
+    public RandomGraph(Graph mGraph, int interconnectivity) {
+        super(mGraph);
+        this.interconnectivity = interconnectivity;
+    }
+
+    /**
+     * Creates a new random mutual graph.
+     *
+     * @param initialSize Determines the initial size of the content graph
+     * @param interconnectivity Determines the probability of using already existing
+     *        resource when creating a new triple. The probability of using an existing
+     *        resource over creating a new resouce is 1-(1/interconnectivity).
+     * @param mGraph
+     */
+    public RandomGraph(int initialSize, int interconnectivity, Graph mGraph) {
+        super(mGraph);
+        if (interconnectivity <= 0) {
+            throw new IllegalArgumentException("growth speed and the interconnectivity "
+                    + "value have to be equals or highter one");
+        }
+        this.interconnectivity = interconnectivity;
+
+        setupInitialSize(initialSize);
+    }
+
+    /**
+     * Add or removes randomly a triple.
+     *
+     * @return the triple that was added or removed.
+     */
+    public Triple evolve() {
+        Triple triple;
+        int random = rollDice(2);
+        if (random == 0 && size() != 0) {
+            triple = getRandomTriple();
+            remove(triple);
+        } else {
+            triple = createRandomTriple();
+            add(triple);
+        }
+        return triple;
+    }
+
+    /**
+     * Removes a random triple.
+     *
+     * @return the triple that was removed.
+     */
+    public Triple removeRandomTriple() {
+        Triple randomTriple = getRandomTriple();
+        remove(randomTriple);
+        return randomTriple;
+    }
+
+    /**
+     * Adds a random triple.
+     *
+     * @return the triple that was added.
+     */
+    public Triple addRandomTriple() {
+        Triple randomTriple;
+        do {
+         randomTriple = createRandomTriple();
+        } while(contains(randomTriple));
+        
+        add(randomTriple);
+        return randomTriple;
+    }
+    
+    private Triple createRandomTriple() {
+        return new TripleImpl(getSubject(), getPredicate(), getObject());
+    }
+
+    private BlankNodeOrIRI getSubject() {
+        int random = rollDice(interconnectivity);
+        if (size() == 0) {
+            random = 0;
+        }
+        switch (random) {
+            case 0: // create new BlankNodeOrIRI
+                RDFTerm newRDFTerm;
+                do {
+                    newRDFTerm = createRandomRDFTerm();
+                } while (!(newRDFTerm instanceof BlankNodeOrIRI));
+                return (BlankNodeOrIRI) newRDFTerm;
+            default: // get existing BlankNodeOrIRI
+                RDFTerm existingRDFTerm;
+                do {
+                    existingRDFTerm = getExistingRDFTerm();
+                    if (existingRDFTerm == null) {
+                        random = 0;
+                    }
+                } while (!(existingRDFTerm instanceof BlankNodeOrIRI));
+
+                return (BlankNodeOrIRI) existingRDFTerm;
+        }
+    }
+
+    private IRI getPredicate() {
+        int random = rollDice(interconnectivity);
+        if (size() == 0) {
+            random = 0;
+        }
+        switch (random) {
+            case 0: // create new IRI
+                return createRandomIRI();
+            default: // get existing IRI
+                RDFTerm existingRDFTerm;
+                do {
+                    existingRDFTerm = getExistingRDFTerm();
+                    if (existingRDFTerm == null) {
+                        random = 0;
+                    }
+                } while (!(existingRDFTerm instanceof IRI));
+                return (IRI) existingRDFTerm;
+        }
+    }
+
+    private RDFTerm getObject() {
+        int random = rollDice(interconnectivity);
+        if (size() == 0) {
+            random = 0;
+        }        
+        switch (random) {
+            case 0: // create new resource
+                return createRandomRDFTerm();
+            default: // get existing resource
+                RDFTerm existingRDFTerm = getExistingRDFTerm();
+                if (existingRDFTerm == null) {
+                    random = 0;
+                }
+                return existingRDFTerm;
+        }
+    }
+
+    private static int rollDice(int faces) {
+        return Double.valueOf(Math.random() * faces).intValue();
+    }
+
+    private RDFTerm createRandomRDFTerm() {
+        switch (rollDice(3)) {
+            case 0:
+                return new BlankNode();
+            case 1:
+                return createRandomIRI();
+            case 2:
+                return new PlainLiteralImpl(RandomStringUtils.random(rollDice(100) + 1));
+        }
+        throw new RuntimeException("in createRandomRDFTerm()");
+    }
+
+    private RDFTerm getExistingRDFTerm() {
+        Triple triple = getRandomTriple();
+        if (triple == null) {
+            return null;
+        }
+        switch (rollDice(3)) {
+            case 0:
+                return triple.getSubject();
+            case 1:
+                return triple.getPredicate();
+            case 2:
+                return triple.getObject();
+        }
+        return null;
+    }
+
+    private IRI createRandomIRI() {
+        return new IRI("http://" + UUID.randomUUID().toString());
+    }
+
+    /**
+     * Returns a random triple contained in the Graph.
+     */
+    public Triple getRandomTriple() {
+        int size = this.size();
+        if (size == 0) {
+            return null;
+        }
+        Iterator<Triple> triples = iterator();
+        while (triples.hasNext()) {
+            Triple triple = triples.next();
+            if (rollDice(this.size()) == 0) {
+                return triple;
+            }
+        }
+        return getRandomTriple();
+    }
+
+    private void setupInitialSize(int initialSize) {
+        for (int i = 0; i < initialSize; i++) {
+            addRandomTriple();
+        }
+    }
+}
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java
new file mode 100644
index 0000000..48ae397
--- /dev/null
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java
@@ -0,0 +1,479 @@
+/*
+ * 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.test.utils;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.dataset.EntityAlreadyExistsException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcProvider;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+/**
+ * 
+ * @author mir,rbn
+ */
+public abstract class TcProviderTest {
+
+    protected final IRI uriRefA = generateUri("a");
+    protected final IRI uriRefA1 = generateUri("a1");
+    protected final IRI uriRefB = generateUri("b");
+    protected final IRI uriRefB1 = generateUri("b1");
+    protected final IRI uriRefC = generateUri("c");
+
+    protected final IRI graphIRI = generateUri("myGraph");
+    protected final IRI otherGraphIRI = new IRI(graphIRI.getUnicodeString());
+
+    @Test
+    public void testCreateImmutableGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+
+        ImmutableGraph createdGraph = simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+
+        Iterator<Triple> iteratorInput = mGraph.iterator();
+        Iterator<Triple> iteratorCreated = createdGraph.iterator();
+        assertEquals(iteratorInput.next(), iteratorCreated.next());
+        assertFalse(iteratorCreated.hasNext());
+
+        try {
+            simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+            assertTrue(false);
+        } catch (EntityAlreadyExistsException e) {
+            assertTrue(true);
+        }
+        simpleTcmProvider.deleteGraph(uriRefA);
+    }
+
+    @Test
+    public void testCreateGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
+        assertTrue(mGraph.isEmpty());
+
+        try {
+            simpleTcmProvider.createGraph(uriRefA);
+            assertTrue(false);
+        } catch (EntityAlreadyExistsException e) {
+            assertTrue(true);
+        }
+        simpleTcmProvider.deleteGraph(uriRefA);
+    }
+
+    @Test
+    public void testGetImmutableGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        simpleTcmProvider.createImmutableGraph(uriRefA1, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+        simpleTcmProvider.createImmutableGraph(uriRefB1, mGraph);
+
+        ImmutableGraph bGraph = simpleTcmProvider.getImmutableGraph(uriRefB);
+        Iterator<Triple> iterator = bGraph.iterator();
+        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+        assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+    }
+
+    @Test
+    public void testGetGraph() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        mGraph = simpleTcmProvider.createGraph(uriRefA1);
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        mGraph = simpleTcmProvider.createGraph(uriRefB);
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
+        assertEquals(1, mGraph.size());
+        mGraph = simpleTcmProvider.createGraph(uriRefB1);
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+        Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
+        Iterator<Triple> iterator = bGraph.iterator();
+        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+        assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+        
+    }
+
+    @Test
+    public void testGetTriples() {
+        TcProvider simpleTcmProvider = getInstance();
+        // add Graphs
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
+        mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
+        // add Graphs
+        mGraph = simpleTcmProvider.createGraph(uriRefA1);
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        mGraph = simpleTcmProvider.createGraph(uriRefB1);
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+        // get a ImmutableGraph
+        Graph tripleCollection = simpleTcmProvider.getGraph(uriRefA);
+        // get a Graph
+        Graph tripleCollection2 = simpleTcmProvider.getGraph(uriRefB1);
+
+        Iterator<Triple> iterator = tripleCollection.iterator();
+        assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
+        assertFalse(iterator.hasNext());
+
+        iterator = tripleCollection2.iterator();
+        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
+        assertFalse(iterator.hasNext());
+        simpleTcmProvider.deleteGraph(uriRefA);
+        simpleTcmProvider.deleteGraph(uriRefA1);
+        simpleTcmProvider.deleteGraph(uriRefB);
+        simpleTcmProvider.deleteGraph(uriRefB1);
+    }
+
+    @Test
+    public void testDeleteEntity() {
+        TcProvider simpleTcmProvider = getInstance();
+        Graph mGraph = new SimpleGraph();
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        ImmutableGraph graph = mGraph.getImmutableGraph();
+        simpleTcmProvider.createImmutableGraph(uriRefA, graph);
+        simpleTcmProvider.createImmutableGraph(uriRefC, graph);
+
+        simpleTcmProvider.deleteGraph(uriRefA);
+        try {
+            simpleTcmProvider.getGraph(uriRefA);
+            assertTrue(false);
+        } catch (NoSuchEntityException e) {
+            assertTrue(true);
+        }
+
+        // Check that graph is still available under uriRefC
+        ImmutableGraph cGraph = simpleTcmProvider.getImmutableGraph(uriRefC);
+        assertNotNull(cGraph);
+        simpleTcmProvider.deleteGraph(uriRefC);
+    }
+
+    /**
+     * Subclasses implement this method to provide implementation instances of
+     * <code>TcProvider</code>. The first call within a test method has to
+     * return a empty TcProvider. Subsequent calls within the test method
+     * should instantiate a new provider, but load the previously added data from
+     * its "persistent" store.
+     *
+     * @return a TcProvider of the implementation to be tested.
+     */
+    protected abstract TcProvider getInstance();
+
+//    @Test
+//    public void testGetNames() {
+//        Graph mGraph = new SimpleGraph();
+//        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
+//        simpleTcmProvider.createGraph(uriRefB, mGraph.getGraph());
+//        
+//        mGraph = new SimpleGraph();
+//        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+//        ImmutableGraph graph = mGraph.getGraph();
+//        simpleTcmProvider.createGraph(uriRefA, graph);
+//        simpleTcmProvider.createGraph(uriRefC, graph);
+//
+//        Set<IRI> names = simpleTcmProvider.getNames(graph);
+//
+//        assertTrue(names.contains(uriRefA));
+//        assertTrue(names.contains(uriRefC));
+//        assertEquals(2, names.size());
+//
+//        assertFalse(names.contains(uriRefB));
+//    }
+
+    @Test
+    public void testCreateGraphExtended() throws Exception {
+
+        TcProvider provider = getInstance();
+        Graph graph = provider.createGraph(graphIRI);
+        assertNotNull(graph);
+        //get a new provider and check that graph is there
+        provider = getInstance();
+        graph = provider.getGraph(graphIRI);
+        assertNotNull(graph);
+        //check that there is no such graph, but only the mgraph
+        boolean expThrown = false;
+        try {
+            ImmutableGraph g = provider.getImmutableGraph(graphIRI);
+        } catch(NoSuchEntityException e) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateImmutableGraphExtended() throws Exception {
+
+        TcProvider provider = getInstance();
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
+
+        assertNotNull(graph);
+
+        //get a new provider and check that graph is there
+        provider = getInstance();
+        graph = provider.getImmutableGraph(graphIRI);
+        assertNotNull(graph);
+
+        //check that there is no such mgraph, but only the graph
+        boolean expThrown = false;
+
+        try {
+            Graph g = provider.getMGraph(graphIRI);
+        } catch(NoSuchEntityException e) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphNoDuplicateNames() throws Exception {
+
+        TcProvider provider = getInstance();
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
+        assertNotNull(graph);
+        boolean expThrown = false;
+        try {
+            ImmutableGraph other = provider.createImmutableGraph(otherGraphIRI, null);
+        } catch(EntityAlreadyExistsException eaee) {
+            expThrown = true;
+        }
+        assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphNoDuplicateNames2() throws Exception {
+
+        TcProvider provider = getInstance();
+        Graph graph = provider.createGraph(graphIRI);
+        assertNotNull(graph);
+        boolean expThrown = false;
+        try {
+            Graph other = provider.createGraph(otherGraphIRI);
+        } catch(EntityAlreadyExistsException eaee) {
+            expThrown = true;
+        }
+        assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testCreateGraphWithInitialCollection() throws Exception {
+
+        Triple t1 = createTestTriple();
+
+        TcProvider provider = getInstance();
+
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
+
+        assertEquals(1, graph.size());
+        assertTrue(graph.contains(t1));
+        provider.deleteGraph(graphIRI);
+    }
+
+    @Test
+    public void testGraphIsNotMutable() throws Exception {
+
+        Triple t1 = createTestTriple();
+        Set<Triple> t = new HashSet<Triple>();
+        t.add(t1);
+
+        TcProvider provider = getInstance();
+
+        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
+
+        boolean expThrown = false;
+
+        try {
+            graph.add(t1);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        expThrown = false;
+
+        try {
+            graph.remove(t1);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        expThrown = false;
+
+        try {
+            graph.addAll(t);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+
+        expThrown = false;
+
+        try {
+            graph.clear();
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+
+        expThrown = false;
+
+        try {
+            graph.removeAll(t);
+        } catch(UnsupportedOperationException uoe) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        provider.deleteGraph(graphIRI);
+    }
+
+//    This tests can not pass, because equals in AbstractGraph is not implemented
+//    yet.
+//    @Test
+//    public void testGraphHasName() throws Exception {
+//
+//        TcProvider provider = getInstance();
+//
+//        Graph triples = createTestTripleCollection(createTestTriple());
+//        ImmutableGraph graph = provider.createGraph(graphIRI, triples);
+//
+//        provider = getInstance();
+//        Set<IRI> names = provider.getNames(graph);
+//        assertTrue(names.contains(graphIRI));
+//    }
+//
+//    @Test
+//    public void testCreateSameGraphWithDifferentNames() throws Exception {
+//
+//        Graph triples = createTestTripleCollection(createTestTriple());
+//
+//        TcProvider provider = getInstance();
+//        IRI name1 = new IRI("http://myGraph1");
+//        ImmutableGraph graph = provider.createGraph(name1, triples);
+//
+//        IRI name2 = new IRI("http://myGraph2");
+//        ImmutableGraph secondGraph = provider.createGraph(name2, triples);
+//
+//        Set<IRI> names = provider.getNames(graph);
+//        assertNotNull(names);
+//        assertEquals(2, names.size());
+//    }
+
+    @Test
+    public void testGraphDeletion() throws Exception {
+
+        Graph triples = createTestTripleCollection(createTestTriple());
+
+        TcProvider provider = getInstance();
+        IRI name1 = new IRI("http://myGraph1");
+        ImmutableGraph graph = provider.createImmutableGraph(name1, triples);
+
+        IRI name2 = new IRI("http://myGraph2");
+        ImmutableGraph secondGraph = provider.createImmutableGraph(name2, triples);
+
+        //if we delete graph with name1, the second graph should still be there
+        provider.deleteGraph(name1);
+
+        provider = getInstance();
+        ImmutableGraph firstGraph = provider.getImmutableGraph(name2);
+        assertNotNull(firstGraph);
+
+        //check second name is not there
+        boolean expThrown = false;
+
+        try {
+            ImmutableGraph g = provider.getImmutableGraph(name1);
+        } catch(NoSuchEntityException nses) {
+            expThrown = true;
+        }
+
+        assertTrue(expThrown);
+        provider.deleteGraph(name2);
+    }
+
+
+
+    @Test
+    public void testGetTriplesGraph() throws Exception {
+        TcProvider provider = getInstance();
+
+        Graph graph = provider.createGraph(graphIRI);
+
+        Graph tc = provider.getGraph(graphIRI);
+        assertNotNull(tc);
+        provider.deleteGraph(graphIRI);
+    }
+
+    private Triple createTestTriple() {
+        BlankNodeOrIRI subject = new BlankNode() {};
+        IRI predicate = new IRI("http://test.com/");
+        BlankNodeOrIRI object = new IRI("http://test.com/myObject");
+        return new TripleImpl(subject, predicate, object);
+    }
+
+    private Graph createTestTripleCollection(Triple t) {
+        Set<Triple> ts = new HashSet<Triple>();
+        ts.add(t);
+        return new SimpleGraph(ts);
+    }
+
+    protected IRI generateUri(String name) {
+        return new IRI("http://example.org/" + name);
+    }
+    
+}


[clerezza] 29/45: CLEREZZA-1037: Add api.utils module to reactor's pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 1921aca8bb8ae74496f16c7cd93853eb775c0984
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 07:08:45 2019 +0100

    CLEREZZA-1037: Add api.utils module to reactor's pom.xml
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 50ea9b7..febb632 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,12 +44,12 @@
         <module>parent</module>
         <module>api</module>
         <module>api.impl</module>
+        <module>ontologies</module>
         <module>sparql</module>
         <module>representation</module>
         <module>test.utils</module>
-        <module>ontologies</module>
         <module>dataset</module>
-        <module>impl.sparql</module>
+        <module>api.utils</module>
         <module>jaxrs.rdf.providers</module>
     </modules>
     <profiles>


[clerezza] 13/45: CLEREZZA-1026: Move some tests from rdf.core to api.impl

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 57f001c88f05beab9277c0c936c015f29d9f35e3
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 04:57:07 2018 +0100

    CLEREZZA-1026: Move some tests from rdf.core to api.impl
---
 .../apache/clerezza/api/impl}/LanguageTest.java    |  4 +--
 .../org/apache/clerezza/api/impl}/UriRefTest.java  | 32 ++++++++--------------
 .../api/impl/literal}/LiteralFactoryTest.java      | 12 ++++----
 3 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/LanguageTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
similarity index 94%
rename from rdf/core/src/test/java/org/apache/clerezza/rdf/core/LanguageTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
index 21d53c3..c50e41b 100644
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/LanguageTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/LanguageTest.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.core;
+package org.apache.clerezza.api.impl;
 
 
-import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.api.Language;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/UriRefTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
similarity index 61%
rename from rdf/core/src/test/java/org/apache/clerezza/rdf/core/UriRefTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
index 71d6846..5f924a8 100644
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/UriRefTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/UriRefTest.java
@@ -16,16 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.core;
+package org.apache.clerezza.api.impl;
+
+import org.apache.clerezza.api.IRI;
 
-import org.apache.clerezza.commons.rdf.IRI;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
-import org.junit.Test;
-import junit.framework.Assert;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  *
@@ -33,21 +32,14 @@ import org.slf4j.LoggerFactory;
  */
 public class UriRefTest {
     
-    private Logger logger = LoggerFactory.getLogger(UriRefTest.class);
-    
     @Test
-    public void uriRefEqualityTest() {
-        try {
-            String uriRefString = "http://example.org/üöä";
-            IRI uriRef1 = new IRI(uriRefString);
-            IRI uriRef2 = new IRI(uriRefString);
-            Assert.assertEquals(uriRef1, uriRef2);
-            IRI uriRef3 =
-                    new IRI(URLEncoder.encode(uriRefString, "utf-8"));
-            Assert.assertFalse(uriRef1.equals(uriRef3));
-        } catch (UnsupportedEncodingException ex) {
-            logger.error("Exception {} ", ex);
-        }
+    public void uriRefEqualityTest() throws UnsupportedEncodingException {
+        String uriRefString = "http://example.org/üöä";
+        IRI uriRef1 = new IRI(uriRefString);
+        IRI uriRef2 = new IRI(uriRefString);
+        Assert.assertEquals(uriRef1, uriRef2);
+        IRI uriRef3 = new IRI(URLEncoder.encode(uriRefString, "utf-8"));
+        Assert.assertFalse(uriRef1.equals(uriRef3));
     }
     
     @Test
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/LiteralFactoryTest.java b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
similarity index 95%
rename from rdf/core/src/test/java/org/apache/clerezza/rdf/core/LiteralFactoryTest.java
rename to api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
index f0dbd79..bba9db6 100644
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/LiteralFactoryTest.java
+++ b/api.impl/src/test/java/org/apache/clerezza/api/impl/literal/LiteralFactoryTest.java
@@ -16,16 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.core;
+package org.apache.clerezza.api.impl.literal;
 
 
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.IRI;
 import java.util.Arrays;
 import java.util.Date;
-import org.junit.Test;
 
-import junit.framework.Assert;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  *
@@ -52,7 +52,7 @@ public class LiteralFactoryTest {
             bytes[i] = i;
         }
         Literal literal = LiteralFactory.getInstance().createTypedLiteral(bytes);
-        Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#base64Binary"), 
+        Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#base64Binary"),
                 literal.getDataType());
         //we are using bytes.getClass() but there should be a way to get
         //that instance of Class without getting it from an instance


[clerezza] 24/45: CLEREZZA-1026: Remove module rdf from reactor's pom.xml and update api and api.impl module names

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit dba24d100dbf9e51b61595b3e3f94d7fa97a0f97
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 10 16:24:29 2019 +0100

    CLEREZZA-1026: Remove module rdf from reactor's pom.xml and update api and api.impl module names
---
 api.impl/pom.xml | 2 +-
 api/pom.xml      | 2 +-
 pom.xml          | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/api.impl/pom.xml b/api.impl/pom.xml
index 871beb6..34f63ec 100644
--- a/api.impl/pom.xml
+++ b/api.impl/pom.xml
@@ -30,7 +30,7 @@
 
     <artifactId>api.impl</artifactId>
     <packaging>bundle</packaging>
-    <name>Clerezza API Implementation</name>
+    <name>Clerezza - API Implementation</name>
     <description>
         This module implements Apache Clerezza API
     </description>
diff --git a/api/pom.xml b/api/pom.xml
index 83921d6..5c19e7d 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -31,7 +31,7 @@
 
     <artifactId>api</artifactId>
     <packaging>bundle</packaging>
-    <name>Clerezza API</name>
+    <name>Clerezza - API</name>
     <description>
         Apache Clerezza API implements the RDF data model as defined by
         http://www.w3.org/TR/rdf11-concepts/
diff --git a/pom.xml b/pom.xml
index 46ccaf4..81f6d94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
   </scm>
 
     <modules>
+        <module>parent</module>
         <module>api</module>
         <module>api.impl</module>
         <module>sparql</module>
@@ -49,8 +50,6 @@
         <module>dataset</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
-        <module>parent</module>
-        <module>rdf</module>
     </modules>
     <profiles>
         <profile>


[clerezza] 02/45: CLEREZZA-1025: Copy serializedform in core to a new module called representation

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 9647fd3c481ce6a569ba38f0b89c52e718024919
Author: Hasan <ha...@apache.org>
AuthorDate: Mon May 14 00:52:52 2018 +0200

    CLEREZZA-1025: Copy serializedform in core to a new module called representation
---
 representation/pom.xml                             |  80 ++++++
 .../org/apache/clerezza/representation/Parser.java | 311 +++++++++++++++++++++
 .../clerezza/representation/ParsingProvider.java   |  49 ++++
 .../apache/clerezza/representation/Serializer.java | 253 +++++++++++++++++
 .../representation/SerializingProvider.java        |  49 ++++
 .../clerezza/representation/SupportedFormat.java   |  61 ++++
 .../representation/UnsupportedFormatException.java |  37 +++
 .../UnsupportedParsingFormatException.java         |  35 +++
 .../UnsupportedSerializationFormatException.java   |  35 +++
 .../apache/clerezza/representation/ParserTest.java |  88 ++++++
 .../clerezza/representation/SerializerTest.java    |  87 ++++++
 .../representation/TestServiceManagedProvider.java |  50 ++++
 ....apache.clerezza.representation.ParsingProvider |  18 ++
 13 files changed, 1153 insertions(+)

diff --git a/representation/pom.xml b/representation/pom.xml
new file mode 100644
index 0000000..274fc53
--- /dev/null
+++ b/representation/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
+        <version>8-SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>representation</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza.commons-rdf</groupId>
+            <artifactId>commons-rdf-api</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza.commons-rdf</groupId>
+            <artifactId>commons-rdf-impl-utils</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>utils</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.representation.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-scr-scrdescriptor</id>
+                        <goals>
+                            <goal>scr</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/representation/src/main/java/org/apache/clerezza/representation/Parser.java b/representation/src/main/java/org/apache/clerezza/representation/Parser.java
new file mode 100644
index 0000000..4202ad6
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/Parser.java
@@ -0,0 +1,311 @@
+/*
+ * 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.representation;
+
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.*;
+
+/**
+ * This singleton class provides a method
+ * <code>parse</code> to transform serialized RDF forms into {@link ImmutableGraph}s.
+ *
+ * Functionality is delegated to registered {@link ParsingProvider}s. Such
+ * <code>ParsingProvider</code>s can be registered and unregistered, later
+ * registered
+ * <code>ParsingProvider</code>s shadow previously registered providers for the
+ * same format.
+ *
+ * Note on synchronization:
+ * <code>ParsingProvider</code>s must be able to handle concurrent requests.
+ *
+ * @author reto
+ *
+ */
+@Component(service = Parser.class)
+public class Parser {
+
+    private ConfigurationAdmin configurationAdmin;
+    /**
+     * The list of providers in the order of registration
+     */
+    private List<ParsingProvider> providerList = new ArrayList<ParsingProvider>();
+    /**
+     * A map to quickly locate a provider
+     */
+    private volatile Map<String, ParsingProvider> providerMap = new HashMap<String, ParsingProvider>();
+    /**
+     * The singleton instance
+     */
+    private volatile static Parser instance;
+    private boolean active;
+
+    private static final Logger log = LoggerFactory.getLogger(Parser.class);
+    /**
+     * the constructor sets the singleton instance to allow instantiation
+     * by OSGi-DS. This constructor should not be called except by OSGi-DS,
+     * otherwise the static <code>getInstance</code> method should be used.
+     */
+    public Parser() {
+        log.info("constructing Parser");
+        Parser.instance = this;
+    }
+
+    /**
+     * A constructor for tests, which doesn't set the singleton instance
+     *
+     * @param dummy an ignored argument to distinguish this from the other constructor
+     */
+    Parser(Object dummy) {
+        active = true;
+    }
+
+    /**
+     * This returns the singleton instance, if an instance has been previously
+     * created (e.g. by OSGi declarative services) this instance is returned,
+     * otherwise a new instance is created and providers are injected using 
+     * the service provider interface (META-INF/services/)
+     *
+     * @return the singleton Parser instance
+     */
+    public static Parser getInstance() {
+        if (instance == null) {
+            synchronized (Parser.class) {
+                if (instance == null) {
+                    new Parser();
+                    Iterator<ParsingProvider> parsingProviders =
+                            ServiceLoader.load(ParsingProvider.class).iterator();
+                    while (parsingProviders.hasNext()) {
+                        ParsingProvider parsingProvider = parsingProviders.next();
+                        instance.bindParsingProvider(parsingProvider);
+                    }
+                    instance.active = true;
+                    instance.refreshProviderMap();
+                }
+            }
+        }
+        return instance;
+
+    }
+
+    @Activate
+    protected void activate(final ComponentContext componentContext) {
+        active = true;
+        refreshProviderMap();
+        //changing the congiguration before this finshed activating causes a new instance to be created
+        /*(new Thread() {
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException ex) {
+                    return;
+                }
+                refreshProviderMap();
+            }
+            
+            
+        }).start();*/
+    }
+
+    @Deactivate
+    protected void deactivate(final ComponentContext componentContext) {
+        active = false;
+    }
+    
+    @Modified
+    void modified(ComponentContext ctx) {
+        log.debug("modified");
+    }
+
+    /**
+     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
+     * processing to the provider registered for the specified format, if
+     * the formatIdentifier contains a ';'-character only the section before
+     * that character is used for choosing the provider.
+     *
+     * @param serializedGraph an inputstream with the serialization
+     * @param formatIdentifier a string identifying the format (usually the MIME-type)
+     * @return the ImmutableGraph read from the stream
+     * @throws UnsupportedFormatException
+     */
+    public ImmutableGraph parse(InputStream serializedGraph,
+            String formatIdentifier) throws UnsupportedFormatException {
+        return parse(serializedGraph, formatIdentifier, null);
+    }
+
+    /**
+     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
+     * processing to the provider registered for the specified format, if
+     * the formatIdentifier contains a ';'-character only the section before
+     * that character is used for choosing the provider.
+     *
+     * @param target the Graph to which the parsed triples are added
+     * @param serializedGraph an inputstream with the serialization
+     * @param formatIdentifier a string identifying the format (usually the MIME-type)
+     * @throws UnsupportedFormatException
+     */
+    public void parse(Graph target, InputStream serializedGraph,
+            String formatIdentifier) throws UnsupportedFormatException {
+        parse(target, serializedGraph, formatIdentifier, null);
+    }
+
+    /**
+     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
+     * processing to the provider registered for the specified format, if
+     * the formatIdentifier contains a ';'-character only the section before
+     * that character is used for choosing the provider.
+     *
+     * @param serializedGraph an inputstream with the serialization
+     * @param formatIdentifier a string identifying the format (usually the MIME-type)
+     * @param baseUri the uri against which relative uri-refs are evaluated
+     * @return the ImmutableGraph read from the stream
+     * @throws UnsupportedFormatException
+     */
+    public ImmutableGraph parse(InputStream serializedGraph,
+            String formatIdentifier, IRI baseUri) throws UnsupportedFormatException {
+        Graph graph = new SimpleMGraph();
+        parse(graph, serializedGraph, formatIdentifier, baseUri);
+        return graph.getImmutableGraph();
+    }
+
+    /**
+     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
+     * processing to the provider registered for the specified format, if
+     * the formatIdentifier contains a ';'-character only the section before
+     * that character is used for choosing the provider.
+     *
+     * @param target the Graph to which the parsed triples are added
+     * @param serializedGraph an inputstream with the serialization
+     * @param formatIdentifier a string identifying the format (usually the MIME-type)
+     * @param baseUri the uri against which relative uri-refs are evaluated
+     * @throws UnsupportedFormatException
+     */
+    public void parse(Graph target, InputStream serializedGraph,
+            String formatIdentifier, IRI baseUri) throws UnsupportedFormatException {
+        String deParameterizedIdentifier;
+        int semicolonPos = formatIdentifier.indexOf(';');
+        if (semicolonPos > -1) {
+            deParameterizedIdentifier = formatIdentifier.substring(0, semicolonPos);
+        } else {
+            deParameterizedIdentifier = formatIdentifier;
+        }
+        ParsingProvider provider = providerMap.get(deParameterizedIdentifier);
+        if (provider == null) {
+            throw new UnsupportedParsingFormatException(formatIdentifier);
+        }
+        provider.parse(target, serializedGraph, formatIdentifier, baseUri);
+    }
+
+    /**
+     * Get a set of supported formats
+     *
+     * @return a set if stings identifying formats (usually the MIME-type)
+     */
+    public Set<String> getSupportedFormats() {
+        return Collections.unmodifiableSet(providerMap.keySet());
+    }
+
+    /**
+     * Registers a parsing provider
+     *
+     * @param provider the provider to be registered
+     */
+    @Reference(policy = ReferencePolicy.DYNAMIC,
+            cardinality = ReferenceCardinality.MULTIPLE)
+    public void bindParsingProvider(ParsingProvider provider) {
+        providerList.add(provider);
+        refreshProviderMap();
+    }
+
+    /**
+     * Unregister a parsing provider
+     *
+     * @param provider the provider to be deregistered
+     */
+    public void unbindParsingProvider(ParsingProvider provider) {
+        providerList.remove(provider);
+        refreshProviderMap();
+    }
+
+    /**
+     * Update providerMap with the providers in the providerList
+     *
+     */
+    private void refreshProviderMap() {
+        if (active) {
+            try {
+                final Map<String, ParsingProvider> newProviderMap = new HashMap<String, ParsingProvider>();
+                for (ParsingProvider provider : providerList) {
+                    String[] formatIdentifiers = getFormatIdentifiers(provider);
+                    for (String formatIdentifier : formatIdentifiers) {
+                        newProviderMap.put(formatIdentifier, provider);
+                    }
+                }
+                providerMap = newProviderMap;
+                if (configurationAdmin != null) { //i.e. when we are in an OSGi environment
+                    Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
+                    if (newConfig == null) {
+                        newConfig = new Hashtable<String, Object>();
+                    }
+                    Set<String> supportedFormats = getSupportedFormats();
+                    String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
+                    newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
+                    configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
+                }
+            } catch (IOException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+    }
+
+    
+
+    /**
+     * Extract format identifiers for a parsing provider
+     *
+     * @param provider the provider to be registered
+     * @return formatIdentifiers
+     */
+    private String[] getFormatIdentifiers(ParsingProvider parsingProvider) {
+        Class<? extends ParsingProvider> clazz = parsingProvider.getClass();
+        SupportedFormat supportedFormatAnnotation = clazz.getAnnotation(SupportedFormat.class);
+        String[] formatIdentifiers = supportedFormatAnnotation.value();
+        return formatIdentifiers;
+    }
+
+    @Reference
+    protected void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+        this.configurationAdmin = configurationAdmin;
+    }
+
+    protected void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+        this.configurationAdmin = null;
+    }
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java b/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java
new file mode 100644
index 0000000..fbdf721
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java
@@ -0,0 +1,49 @@
+/*
+ * 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.representation;
+
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+
+import java.io.InputStream;
+
+/**
+ * An instance of this class parses RDF-ImmutableGraph from one or more serialization
+ * formats. The supported formats are indicated using the {@link SupportedFormat}
+ * annotation.
+ *
+ * @author reto
+ */
+public interface ParsingProvider {
+
+    /**
+     * Parses a stream as the specified RDF-format. This method will be invoked
+     * for a supported format, a format is considered as supported if the part
+     * before a ';'-character in the <code>formatIdentifier</code> matches
+     * a <code>SupportedFormat</code> annotation of the implementing class.
+     *
+     * @param target the mutable ImmutableGraph to which the read triples shall be added
+     * @param serializedGraph the stream from which the serialized ImmutableGraph is read
+     * @param formatIdentifier a String identifying the format
+     * @param baseUri the baseUri for interpreting relative uris, may be null
+     */
+    void parse(Graph target, InputStream serializedGraph,
+               String formatIdentifier, IRI baseUri);
+
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/Serializer.java b/representation/src/main/java/org/apache/clerezza/representation/Serializer.java
new file mode 100644
index 0000000..e36b9c7
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/Serializer.java
@@ -0,0 +1,253 @@
+/*
+ * 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.representation;
+
+import org.apache.clerezza.commons.rdf.Graph;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ * This singleton class provides a method <code>serialize</code> to transform a
+ * {@link ImmutableGraph} into serialized RDF forms.
+ * 
+ * Functionality is delegated to registered {@link SerializingProvider}s. Such
+ * <code>SerializingProvider</code>s can be registered and unregistered, later
+ * registered <code>SerializingProvider</code>s shadow previously registered
+ * providers for the same format.
+ * 
+ * Note on synchronization: <code>SerializingProvider</code>s must be able to
+ * handle concurrent requests.
+ * 
+ * @author mir
+ * 
+ */
+@Component(service = Serializer.class)
+public class Serializer {
+    
+    private ConfigurationAdmin configurationAdmin;
+
+    /**
+     * The list of providers in the order of registration
+     */
+    private List<SerializingProvider> providerList = new ArrayList<SerializingProvider>();
+
+    /**
+     * A map to quickly locate a provider
+     */
+    private volatile Map<String, SerializingProvider> providerMap = new HashMap<String, SerializingProvider>();
+
+    /**
+     * The singleton instance
+     */
+    private volatile static Serializer instance;
+    
+    private static final Logger log = LoggerFactory.getLogger(Serializer.class);
+    
+    private boolean active;
+
+    /**
+     * the constructor sets the singleton instance to allow instantiation
+     * by OSGi-DS. This constructor should not be called except by OSGi-DS,
+     * otherwise the static <code>getInstance</code> method should be used.
+     */
+    public Serializer() {
+        Serializer.instance = this;
+    }
+
+    /**
+     * A constructor for tests, which doesn't set the singleton instance
+     * 
+     * @param dummy
+     *            an ignored argument to distinguish this from the other
+     *            constructor
+     */
+    Serializer(Object dummy) {
+        active = true;
+    }
+
+    /**
+     * This returns the singleton instance, if an instance has been previously
+     * created (e.g. by OSGi declarative services) this instance is returned,
+     * otherwise a new instance is created and providers are injected using the
+     * service provider interface (META-INF/services/)
+     * 
+     * @return the singleton Serializer instance
+     */
+    public static Serializer getInstance() {
+        if (instance == null) {
+            synchronized (Serializer.class) {
+                if (instance == null) {
+                    new Serializer();
+                    Iterator<SerializingProvider> SerializingProviders = ServiceLoader
+                            .load(SerializingProvider.class).iterator();
+                    while (SerializingProviders.hasNext()) {
+                        SerializingProvider SerializingProvider = SerializingProviders
+                                .next();
+                        instance.bindSerializingProvider(SerializingProvider);
+                    }
+                    instance.active = true;
+                    instance.refreshProviderMap();
+                }
+            }
+        }
+        return instance;
+
+    }
+ 
+    @Activate
+    protected void activate(final ComponentContext componentContext) {
+        active = true;
+        refreshProviderMap();
+    }
+
+    @Deactivate
+    protected void deactivate(final ComponentContext componentContext) {
+        active = false;
+    }
+    
+    @Modified
+    void modified(ComponentContext ctx) {
+        log.debug("modified");
+    }
+
+    /**
+     * Serializes a ImmutableGraph into an OutputStream. This delegates the
+     * processing to the provider registered for the specified format, if
+     * the formatIdentifier contains a ';'-character only the section before
+     * that character is used for choosing the provider.
+     * 
+     * @param serializedGraph
+     *            an outputStream into which the ImmutableGraph will be serialized
+     * @param tc  the <code>Graph</code> to be serialized
+     * @param formatIdentifier
+     *            a string specifying the serialization format (usually the
+     *            MIME-type)
+     * @throws UnsupportedFormatException
+     */
+    public void serialize(OutputStream serializedGraph, Graph tc,
+            String formatIdentifier) throws UnsupportedFormatException {
+        String deParameterizedIdentifier;
+        int semicolonPos = formatIdentifier.indexOf(';');
+        if (semicolonPos > -1) {
+            deParameterizedIdentifier = formatIdentifier.substring(0, semicolonPos);
+        } else {
+            deParameterizedIdentifier = formatIdentifier;
+        }
+        SerializingProvider provider = providerMap.get(deParameterizedIdentifier);
+        if (provider == null) {
+            throw new UnsupportedSerializationFormatException(formatIdentifier);
+        }
+        provider.serialize(serializedGraph, tc, formatIdentifier);
+    }
+
+    /**
+     * Get a set of supported formats
+     *
+     * @return a set if stings identifying formats (usually the MIME-type)
+     */
+    public Set<String> getSupportedFormats() {
+        return Collections.unmodifiableSet(providerMap.keySet());
+    }
+    
+    /**
+     * Registers a Serializing provider
+     * 
+     * @param provider
+     *            the provider to be registered
+     */
+    @Reference(policy = ReferencePolicy.DYNAMIC, 
+            cardinality = ReferenceCardinality.MULTIPLE)
+    public void bindSerializingProvider(SerializingProvider provider) {
+        providerList.add(provider);
+        refreshProviderMap();
+
+    }
+
+    /**
+     * Unregister a Serializing provider
+     * 
+     * @param provider
+     *            the provider to be unregistered
+     */
+    public void unbindSerializingProvider(SerializingProvider provider) {
+        providerList.remove(provider);
+        refreshProviderMap();
+
+    }
+
+    private void refreshProviderMap() {
+        if (active) {
+            final Map<String, SerializingProvider> newProviderMap = new HashMap<String, SerializingProvider>();
+            //we want more generic providers first so they get overridden by more specific ones
+            Collections.sort(providerList, new Comparator<SerializingProvider>() {
+                @Override
+                public int compare(SerializingProvider s1, SerializingProvider s2) {
+                    return getFormatIdentifiers(s2).length - getFormatIdentifiers(s1).length;
+                }
+            });
+            for (SerializingProvider provider : providerList) {
+                String[] formatIdentifiers = getFormatIdentifiers(provider);
+                for (String formatIdentifier : formatIdentifiers) {
+                    newProviderMap.put(formatIdentifier, provider);
+                }
+            }
+            providerMap = newProviderMap;
+            if (configurationAdmin != null) { //we are in OSGi environment
+                try {
+                    Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
+                    if (newConfig == null) {
+                        newConfig = new Hashtable<String, Object>();
+                    }
+                    Set<String> supportedFormats = getSupportedFormats();
+                    String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
+                    newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
+                    configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
+                } catch (IOException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        }
+    }
+
+    private String[] getFormatIdentifiers(
+            SerializingProvider SerializingProvider) {
+        Class<? extends SerializingProvider> clazz = SerializingProvider
+                .getClass();
+        SupportedFormat supportedFormatAnnotation = clazz
+                .getAnnotation(SupportedFormat.class);
+        String[] formatIdentifiers = supportedFormatAnnotation.value();
+        return formatIdentifiers;
+    }
+    
+    @Reference
+    protected void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+        this.configurationAdmin = configurationAdmin;
+    }
+
+    protected void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+        this.configurationAdmin = null;
+    }
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java b/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java
new file mode 100644
index 0000000..3053e45
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java
@@ -0,0 +1,49 @@
+/*
+ * 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.representation;
+
+import org.apache.clerezza.commons.rdf.Graph;
+
+import java.io.OutputStream;
+
+
+/**
+ * An instance of this class serializes <code>Graph</code>s to a
+ * specified serialization format. The supported formats are indicated using the
+ * {@link SupportedFormat} annotation.
+ *
+ * @author mir
+ */
+public interface SerializingProvider {
+    
+    /** Serializes a <code>Graph</code> to a specified
+     * <code>OutputStream</code> in the format identified by
+     * <code>formatIdentifier</code>. This method will be invoked
+     * for a supported format, a format is considered as supported if the part
+     * before a ';'-character in the <code>formatIdentifier</code> matches
+     * a <code>SupportedFormat</code> annotation of the implementing class.
+     * 
+     * @param outputStream
+     * @param tc
+     * @param formatIdentifier
+     */
+    public void serialize(OutputStream outputStream, Graph tc,
+                          String formatIdentifier);
+
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java b/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java
new file mode 100644
index 0000000..d246a39
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java
@@ -0,0 +1,61 @@
+/*
+ * 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.representation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to annotate {@link ParsingProvider}s to indicate
+ * the format(s) they support.
+ *
+ * @author reto
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SupportedFormat {
+
+    /**
+     * used as a key for the OSGi service property
+     */
+    public static final String supportedFormat = "supportedFormat";
+    public static final String RDF_XML = "application/rdf+xml";
+    public static final String TURTLE = "text/turtle";
+    public static final String X_TURTLE = "application/x-turtle";
+    public static final String N_TRIPLE = "application/n-triples";
+    /**
+    * @deprecated: The mime-type for N Triples is "application/n-triples": http://www.w3.org/TR/n-triples/#sec-mediaReg-n-triples
+    */
+    @Deprecated
+    public static final String TEXT_RDF_NT = "text/rdf+nt";
+    public static final String N3 = "text/rdf+n3";
+    public static final String RDF_JSON = "application/rdf+json";
+    //both html and xhtml can be rdf formats with RDFa
+    public static final String XHTML = "application/xhtml+xml";
+    public static final String HTML = "text/html";
+
+    /**
+     * A list of format Identifiers (typically MIME-types) types without
+     * parameter (without ';'-character).
+     * E.g. {"application/rdf+xml","application/turtle"}
+     */
+    String[] value();
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java
new file mode 100644
index 0000000..d914a3d
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.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.clerezza.representation;
+
+/**
+ *
+ * This exception is thrown on an attempt to parse a format for which no 
+ * <code>ParsingProvider</code> is known.
+ *
+ * @author reto
+ */
+public abstract class UnsupportedFormatException extends RuntimeException {
+
+    public UnsupportedFormatException(String message) {
+        super(message);
+    }
+
+
+    
+
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java
new file mode 100644
index 0000000..51fafc9
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.representation;
+
+/**
+ *
+ * @author reto
+ */
+public class UnsupportedParsingFormatException extends UnsupportedFormatException {
+    /**
+     * Creates an instance for a specified unsupported format.
+     * 
+     * @param formatIdentifier the unsupported format
+     */
+    public UnsupportedParsingFormatException(String formatIdentifier) {
+        super("No parser available for "+formatIdentifier);
+    }
+
+}
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java
new file mode 100644
index 0000000..b2bf5cc
--- /dev/null
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.representation;
+
+/**
+ *
+ * @author reto
+ */
+public class UnsupportedSerializationFormatException extends UnsupportedFormatException {
+    /**
+     * Creates an instance for a specified unsupported format.
+     * 
+     * @param formatIdentifier the unsupported format
+     */
+    public UnsupportedSerializationFormatException(String formatIdentifier) {
+        super("No serializer available for "+formatIdentifier);
+    }
+
+}
diff --git a/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
new file mode 100644
index 0000000..97f6e69
--- /dev/null
+++ b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.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.clerezza.representation;
+
+import junit.framework.Assert;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+/**
+ *
+ * @author reto
+ */
+public class ParserTest {
+
+    private static boolean providerAInvoked;
+    private static boolean providerBInvoked;
+    private ParsingProvider parsingProviderA = new ParsingProviderA();
+    private ParsingProvider parsingProviderB = new ParsingProviderB();
+
+    @Test
+    public void registerOneProvider() {
+        Parser parser = new Parser(null);
+        parser.bindParsingProvider(parsingProviderA);
+        providerAInvoked = false;
+        parser.parse(null, "application/x-fantasy2+rdf");
+        Assert.assertTrue(providerAInvoked);
+    }
+    
+    @Test
+    public void registerAndUnregisterSecond() {
+        Parser parser = new Parser(null);
+        parser.bindParsingProvider(parsingProviderA);
+        parser.bindParsingProvider(parsingProviderB);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        parser.parse(null, "application/x-fantasy2+rdf");
+        Assert.assertFalse(providerAInvoked);
+        Assert.assertTrue(providerBInvoked);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        parser.parse(null, "application/x-fantasy1+rdf");
+        Assert.assertTrue(providerAInvoked);
+        Assert.assertFalse(providerBInvoked);
+        parser.unbindParsingProvider(parsingProviderB);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        parser.parse(null, "application/x-fantasy2+rdf");
+        Assert.assertTrue(providerAInvoked);
+        Assert.assertFalse(providerBInvoked);
+        
+    }
+
+    @SupportedFormat({"application/x-fantasy1+rdf", "application/x-fantasy2+rdf"})
+    static class ParsingProviderA implements ParsingProvider {
+
+        @Override
+        public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) {
+            providerAInvoked = true;
+        }
+    };
+    @SupportedFormat("application/x-fantasy2+rdf")
+    static class ParsingProviderB implements ParsingProvider {
+
+        @Override
+        public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) {
+            providerBInvoked = true;
+        }
+    };
+}
diff --git a/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
new file mode 100644
index 0000000..feae79a
--- /dev/null
+++ b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.representation;
+
+import junit.framework.Assert;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.junit.Test;
+
+import java.io.OutputStream;
+
+/**
+ *
+ * @author mir
+ */
+public class SerializerTest {
+
+    private static boolean providerAInvoked;
+    private static boolean providerBInvoked;
+    private SerializingProvider serializingProviderA = new SerializingProviderA();
+    private SerializingProvider serializingProviderB = new SerializingProviderB();
+
+    @Test
+    public void registerOneProvider() {
+        Serializer serializer = new Serializer(null);
+        serializer.bindSerializingProvider(serializingProviderA);
+        providerAInvoked = false;
+        serializer.serialize(null, null, "application/x-fantasy2+rdf");
+        Assert.assertTrue(providerAInvoked);
+    }
+    
+    @Test
+    public void registerAndUnregisterSecond() {
+        Serializer serializer = new Serializer(null);
+        serializer.bindSerializingProvider(serializingProviderA);
+        serializer.bindSerializingProvider(serializingProviderB);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        serializer.serialize(null, null, "application/x-fantasy2+rdf");
+        Assert.assertFalse(providerAInvoked);
+        Assert.assertTrue(providerBInvoked);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        serializer.serialize(null, null, "application/x-fantasy1+rdf");
+        Assert.assertTrue(providerAInvoked);
+        Assert.assertFalse(providerBInvoked);
+        serializer.unbindSerializingProvider(serializingProviderB);
+        providerAInvoked = false;
+        providerBInvoked = false;
+        serializer.serialize(null, null, "application/x-fantasy2+rdf");
+        Assert.assertTrue(providerAInvoked);
+        Assert.assertFalse(providerBInvoked);
+        
+    }
+
+    @SupportedFormat({"application/x-fantasy1+rdf", "application/x-fantasy2+rdf"})
+    static class SerializingProviderA implements SerializingProvider {
+
+        @Override
+        public void serialize(OutputStream serializedGraph, Graph tc, String formatIdentifier) {
+            providerAInvoked = true;
+        }
+    };
+    @SupportedFormat("application/x-fantasy2+rdf")
+    static class SerializingProviderB implements SerializingProvider {
+
+        @Override
+        public void serialize(OutputStream serializedGraph, Graph tc, String formatIdentifier) {
+            providerBInvoked = true;
+        }
+    };
+}
diff --git a/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
new file mode 100644
index 0000000..ec6fe9c
--- /dev/null
+++ b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
@@ -0,0 +1,50 @@
+/*
+ * 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.representation;
+
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+/**
+ * This class is listed in
+ * META-INF/services/org.apache.clerezza.serializedform.ParsingProvider
+ *
+ * @author reto
+ */
+@SupportedFormat("application/x-test+rdf")
+public class TestServiceManagedProvider implements ParsingProvider {
+
+    private static boolean parseInvoked;
+
+    @Override
+    public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) {
+        parseInvoked = true;
+    }
+    
+    @Test
+    public void registerOneProvider() {
+        Parser parser = Parser.getInstance();
+        parser.parse(null, "application/x-test+rdf");
+        Assert.assertTrue(parseInvoked);
+    }
+}
diff --git a/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider b/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider
new file mode 100644
index 0000000..16e04f4
--- /dev/null
+++ b/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider
@@ -0,0 +1,18 @@
+# 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.
+
+org.apache.clerezza.representation.TestServiceManagedProvider
\ No newline at end of file


[clerezza] 31/45: CLEREZZA-1026: Update api pom.xml to export package and reformat codes

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 820de2ca4ba4f35f3330985454fab7a1850f665a
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Feb 13 20:46:19 2019 +0100

    CLEREZZA-1026: Update api pom.xml to export package and reformat codes
---
 api/pom.xml                                        | 55 +++++++++-------
 api/src/main/assembly/bin.xml                      | 75 ----------------------
 api/src/main/assembly/src.xml                      | 45 -------------
 .../java/org/apache/clerezza/api/BlankNode.java    | 36 +++++------
 .../org/apache/clerezza/api/BlankNodeOrIRI.java    | 29 ++++-----
 .../main/java/org/apache/clerezza/api/Graph.java   | 49 +++++++-------
 api/src/main/java/org/apache/clerezza/api/IRI.java | 41 ++++++------
 .../org/apache/clerezza/api/ImmutableGraph.java    | 54 ++++++++--------
 .../java/org/apache/clerezza/api/Language.java     | 25 ++++----
 .../main/java/org/apache/clerezza/api/Literal.java | 64 +++++++++---------
 .../main/java/org/apache/clerezza/api/RDFTerm.java | 25 ++++----
 .../main/java/org/apache/clerezza/api/Triple.java  | 37 +++++------
 .../org/apache/clerezza/api/WatchableGraph.java    | 49 +++++++-------
 .../org/apache/clerezza/api/event/AddEvent.java    | 29 ++++-----
 .../apache/clerezza/api/event/FilterTriple.java    | 42 ++++++------
 .../org/apache/clerezza/api/event/GraphEvent.java  | 28 ++++----
 .../apache/clerezza/api/event/GraphListener.java   | 26 ++++----
 .../org/apache/clerezza/api/event/RemoveEvent.java | 27 ++++----
 .../java/org/apache/clerezza/api/package-info.java | 26 ++++----
 19 files changed, 315 insertions(+), 447 deletions(-)

diff --git a/api/pom.xml b/api/pom.xml
index 5c19e7d..8fbc4ac 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -1,33 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
+  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
 
-   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.
+    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.
 -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
         <version>8-SNAPSHOT</version>
-        <relativePath/>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
+    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>api</artifactId>
     <packaging>bundle</packaging>
@@ -42,7 +40,6 @@
         <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
     </issueManagement>
 
-    <inceptionYear>2015</inceptionYear>
     <scm>
         <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
         <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
@@ -58,4 +55,18 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.api.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/api/src/main/assembly/bin.xml b/api/src/main/assembly/bin.xml
deleted file mode 100644
index 3c114dd..0000000
--- a/api/src/main/assembly/bin.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<assembly
-  xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-    <id>bin</id>
-    <formats>
-        <format>tar.gz</format>
-        <format>zip</format>
-    </formats>
-    <fileSets>
-        <fileSet>
-            <includes>
-                <include>README*</include>
-                <include>LICENSE*</include>
-                <include>NOTICE*</include>
-                <include>RELEASE-NOTES.txt</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target</directory>
-            <outputDirectory></outputDirectory>
-            <includes>
-                <include>commons-net-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/site/apidocs</directory>
-            <outputDirectory>apidocs</outputDirectory>
-            <includes>
-                <include>**/*</include>
-            </includes>
-        </fileSet>
-        <!-- Include sources jar for IDEs -->
-        <fileSet>
-            <directory>target</directory>
-            <outputDirectory></outputDirectory>
-            <includes>
-                <include>commons-net-${project.version}-sources.jar</include>
-            </includes>
-        </fileSet>
-        <!-- Include examples as binary jar -->
-        <fileSet>
-            <directory>target</directory>
-            <outputDirectory></outputDirectory>
-            <includes>
-                <include>commons-net-examples-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <!-- Include example sources for developers -->
-        <fileSet>
-            <directory>src/main/java/examples</directory>
-            <outputDirectory>examples</outputDirectory>
-            <includes>
-                <include>**/*</include>
-            </includes>
-        </fileSet>
-    </fileSets>
-</assembly>
diff --git a/api/src/main/assembly/src.xml b/api/src/main/assembly/src.xml
deleted file mode 100644
index a5f8da1..0000000
--- a/api/src/main/assembly/src.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<assembly
-  xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-  <id>src</id>
-  <formats>
-    <format>tar.gz</format>
-    <format>zip</format>
-  </formats>
-  <baseDirectory>${artifactId}-${version}-src</baseDirectory>
-  <fileSets>
-    <fileSet>
-      <includes>
-        <include>README*</include>
-        <include>LICENSE*</include>
-        <include>NOTICE*</include>
-        <include>RELEASE-NOTES.txt</include>
-        <include>pom.xml</include>
-        <include>findbugs-exclude-filter.xml</include>
-        <include>checkstyle*.xml</include>
-      </includes>
-    </fileSet>
-    <fileSet>
-      <directory>src</directory>
-    </fileSet>
-  </fileSets>
-</assembly>
-
diff --git a/api/src/main/java/org/apache/clerezza/api/BlankNode.java b/api/src/main/java/org/apache/clerezza/api/BlankNode.java
index fab6270..9c4e2b3 100644
--- a/api/src/main/java/org/apache/clerezza/api/BlankNode.java
+++ b/api/src/main/java/org/apache/clerezza/api/BlankNode.java
@@ -1,38 +1,36 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 /**
- * 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. 
- *
+ * 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.
+ * <p>
  * 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>
- *
+ * <p>
  * 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>
  */
diff --git a/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java b/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
index 0cf66ac..9d62c8e 100644
--- a/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
+++ b/api/src/main/java/org/apache/clerezza/api/BlankNodeOrIRI.java
@@ -1,26 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 /**
- * Represents a <code>Resource</code> that is not a <code>Literal</code>. 
- * This is a marker interface implemented by <code>UriRef</code> 
+ * 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
diff --git a/api/src/main/java/org/apache/clerezza/api/Graph.java b/api/src/main/java/org/apache/clerezza/api/Graph.java
index 5c5648c..a4d620e 100644
--- a/api/src/main/java/org/apache/clerezza/api/Graph.java
+++ b/api/src/main/java/org/apache/clerezza/api/Graph.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -33,22 +32,22 @@ import java.util.concurrent.locks.ReadWriteLock;
  * @author reto
  */
 public interface Graph extends Collection<Triple> {
-    
+
     /**
-     * Filters triples given a pattern. 
+     * 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);
+    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. 
+     * 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.
@@ -60,14 +59,14 @@ public interface Graph extends Collection<Triple> {
     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 
+     * 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
@@ -75,9 +74,9 @@ public interface Graph extends Collection<Triple> {
      * 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 
+     * 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 
+     * which returned ReadLock and WriteLock instances of which the methods do
      * not do anything)
      *
      * @return the lock of this Graph
diff --git a/api/src/main/java/org/apache/clerezza/api/IRI.java b/api/src/main/java/org/apache/clerezza/api/IRI.java
index d17cc90..89d0f3e 100644
--- a/api/src/main/java/org/apache/clerezza/api/IRI.java
+++ b/api/src/main/java/org/apache/clerezza/api/IRI.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
@@ -22,13 +21,13 @@ import java.io.Serializable;
 
 /**
  * Represents an RDF URI Reference
- * 
+ * <p>
  * 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 
- * 
+ * <p>
+ * 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 {
@@ -39,7 +38,7 @@ public class IRI implements BlankNodeOrIRI, Serializable {
         this.unicodeString = unicodeString;
     }
 
-    /** 
+    /**
      * @return the unicode string that produces the URI
      */
     public String getUnicodeString() {
@@ -48,9 +47,9 @@ public class IRI implements BlankNodeOrIRI, Serializable {
 
     /**
      * Returns true iff <code>obj</code> == <code>UriRef</code>
-     * 
+     *
      * @param obj
-     * @return true if obj is an instanceof UriRef with 
+     * @return true if obj is an instanceof UriRef with
      * the same unicode-string, false otherwise
      */
     @Override
diff --git a/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java b/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
index efb7b49..f204480 100644
--- a/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
+++ b/api/src/main/java/org/apache/clerezza/api/ImmutableGraph.java
@@ -1,53 +1,51 @@
- /*
- * 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
+/*
+ * 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.
+ * 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;
 
 /**
  * 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) 
+ * 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 
+ * <p>
+ * Implementations MUST be immutable and throw respective exceptions, when
  * add/remove-methods are called.
- * 
- * @see org.apache.clerezza.rdf.core.impl.AbstractGraph
- * @author reto
  *
+ * @author reto
+ * @see org.apache.clerezza.rdf.core.impl.AbstractGraph
  */
 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. 
+    /**
+     * 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. 
-     * 
+     * Where the hash-fucntion return the hashCode of the argument
+     * for grounded arguments and 0 otherwise.
+     *
      * @return hash code
      */
     @Override
diff --git a/api/src/main/java/org/apache/clerezza/api/Language.java b/api/src/main/java/org/apache/clerezza/api/Language.java
index e5d24f4..d81b8d6 100644
--- a/api/src/main/java/org/apache/clerezza/api/Language.java
+++ b/api/src/main/java/org/apache/clerezza/api/Language.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
diff --git a/api/src/main/java/org/apache/clerezza/api/Literal.java b/api/src/main/java/org/apache/clerezza/api/Literal.java
index 641a64b..8e6c38a 100644
--- a/api/src/main/java/org/apache/clerezza/api/Literal.java
+++ b/api/src/main/java/org/apache/clerezza/api/Literal.java
@@ -1,35 +1,33 @@
 /*
- * 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
+ * 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.
+ * 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;
 
-
 /**
- * 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} 
+ * 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>.
@@ -51,7 +49,7 @@ public interface Literal extends RDFTerm {
      * 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"
@@ -69,24 +67,24 @@ public interface Literal extends RDFTerm {
      * Literal language tag</a>
      */
     public Language getLanguage();
-    
-    /** 
-     * Returns true if <code>obj</code> is an instance of 
+
+    /**
+     * 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 
+     * <p>
+     * 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. 
-     * 
+     * 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();
diff --git a/api/src/main/java/org/apache/clerezza/api/RDFTerm.java b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
index 58d3e4a..39aa7fe 100644
--- a/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
+++ b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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;
 
diff --git a/api/src/main/java/org/apache/clerezza/api/Triple.java b/api/src/main/java/org/apache/clerezza/api/Triple.java
index f0f6ed4..ff9d6f2 100644
--- a/api/src/main/java/org/apache/clerezza/api/Triple.java
+++ b/api/src/main/java/org/apache/clerezza/api/Triple.java
@@ -1,25 +1,24 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 /**
- * A structure containing a subject, a predicate, and an object. 
+ * A structure containing a subject, a predicate, and an object.
  * Also known as a statement.
  *
  * @author reto
@@ -33,7 +32,6 @@ public interface Triple {
     RDFTerm getObject();
 
     /**
-     * 
      * @param obj
      * @return true iff subject, predicate, and object of both triples are equal
      */
@@ -43,15 +41,14 @@ public interface Triple {
     /**
      * 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 
+     * <p>
+     * Note that the hash returned is computed including the hash of BNodes, so
      * it is not blank-node blind as in Graph.
-     * 
+     * <p>
      * This would have to change if triple should extend Graph
-     * 
+     *
      * @return hash code
      */
     @Override
     int hashCode();
-
 }
diff --git a/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
index d239d2a..fb5890c 100644
--- a/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
+++ b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
@@ -1,27 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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;
 
 import org.apache.clerezza.api.event.FilterTriple;
 import org.apache.clerezza.api.event.GraphListener;
 
-
 /**
  * An extension to the Graph interface that allows to add throws events
  * on modifications.
@@ -29,7 +27,7 @@ import org.apache.clerezza.api.event.GraphListener;
  * @author reto
  */
 public interface WatchableGraph extends Graph {
-   
+
 
     /**
      * Adds the specified <code>GraphListener</code> to the graph. This listener
@@ -41,27 +39,27 @@ public interface WatchableGraph extends Graph {
      * 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.
-     *
+     * <p>
      * All implementations support this method, immutable implementations will
      * typically provide an empty implementation, they shall not throw an
      * exception.
-     *
+     * <p>
      * 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.
-     *
+     * <p>
      * Implementations should keep weak references the listeners, so that the
      * listener can be garbage collected if its no longer referenced by another
      * object.
-     *
+     * <p>
      * 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.
+     * @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);
@@ -71,12 +69,12 @@ public interface WatchableGraph extends Graph {
      * 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.
-     *
+     * <p>
      * 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.
+     * @param filter   The triple filter with which triples are tested,
+     *                 that were part of the modification.
      */
     public void addGraphListener(GraphListener listener, FilterTriple filter);
 
@@ -87,5 +85,4 @@ public interface WatchableGraph extends Graph {
      * @param listener The listener to be removed.
      */
     public void removeGraphListener(GraphListener listener);
-  
 }
diff --git a/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
index bf64ef9..ca055b8 100644
--- a/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.event;
 
@@ -22,16 +21,14 @@ import org.apache.clerezza.api.Graph;
 import org.apache.clerezza.api.Triple;
 
 /**
- * This class represent a addition event that occured on a
+ * This class represent an addition event that occurred on a
  * <code>TripleCollection</code>.
  *
  * @author rbn
  */
 public class AddEvent extends GraphEvent {
 
-
     public AddEvent(Graph graph, Triple triple) {
         super(graph, triple);
     }
-
 }
diff --git a/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
index 153241c..d646613 100644
--- a/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
@@ -1,25 +1,24 @@
 /*
- * 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
+ * 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.
+ * 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.event;
 
-import org.apache.clerezza.api.IRI;
 import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.IRI;
 import org.apache.clerezza.api.RDFTerm;
 import org.apache.clerezza.api.Triple;
 
@@ -34,17 +33,17 @@ 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.
+     * @param subject   the subject.
+     * @param predicate the predicate.
+     * @param object    the object.
      */
-    public FilterTriple (BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+    public FilterTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
         this.subject = subject;
         this.predicate = predicate;
         this.object = object;
@@ -55,13 +54,14 @@ public class FilterTriple {
      * <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;            
+            subjectMatch = true;
         } else {
             subjectMatch = this.subject.equals(triple.getSubject());
         }
@@ -80,7 +80,7 @@ public class FilterTriple {
 
     @Override
     public String toString() {
-        return "FilterTriples: "+subject+" "+predicate+" "+object;
+        return "FilterTriples: " + subject + " " + predicate + " " + object;
     }
 
 }
diff --git a/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
index aeea21c..708fc57 100644
--- a/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.event;
 
@@ -42,15 +41,16 @@ public class GraphEvent {
 
     /**
      * 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() {
diff --git a/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
index ce7ce5d..6bb583f 100644
--- a/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.event;
 
@@ -37,6 +36,7 @@ public interface GraphListener {
      * 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);
diff --git a/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
index 8f0134f..2f08908 100644
--- a/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
+++ b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.event;
 
@@ -29,9 +28,7 @@ import org.apache.clerezza.api.Triple;
  */
 public class RemoveEvent extends GraphEvent {
 
-
     public RemoveEvent(Graph graph, Triple triple) {
         super(graph, triple);
     }
-
 }
diff --git a/api/src/main/java/org/apache/clerezza/api/package-info.java b/api/src/main/java/org/apache/clerezza/api/package-info.java
index 0998a56..3adc92a 100644
--- a/api/src/main/java/org/apache/clerezza/api/package-info.java
+++ b/api/src/main/java/org/apache/clerezza/api/package-info.java
@@ -1,21 +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
+ * 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
+ *   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.
+ * 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
+ * Apache Clerezza RDF API
  */
 package org.apache.clerezza.api;
\ No newline at end of file


[clerezza] 12/45: CLEREZZA-1026: Clean up rdf.core

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 1b65ea25c9a96f884425a9f7d2090bb2267e94e8
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 04:34:23 2018 +0100

    CLEREZZA-1026: Clean up rdf.core
---
 .../rdf/core/InvalidLiteralTypeException.java      |  40 --
 .../apache/clerezza/rdf/core/LiteralFactory.java   |  84 ----
 .../clerezza/rdf/core/NoConvertorException.java    |  41 --
 .../clerezza/rdf/core/impl/WriteBlockedGraph.java  | 123 -----
 .../apache/clerezza/rdf/core/impl/util/Base64.java | 120 -----
 .../rdf/core/impl/util/PrivilegedGraphWrapper.java | 261 -----------
 .../impl/util/PrivilegedImmuatbleGraphWrapper.java |  36 --
 .../rdf/core/impl/util/SimpleLiteralFactory.java   | 313 -------------
 .../clerezza/rdf/core/impl/util/W3CDateFormat.java | 196 --------
 .../rdf/core/sparql/NoQueryEngineException.java    |  42 --
 .../clerezza/rdf/core/sparql/QueryEngine.java      |  64 ---
 .../clerezza/rdf/core/sparql/QueryParser.java      |  70 ---
 .../apache/clerezza/rdf/core/sparql/ResultSet.java |  39 --
 .../clerezza/rdf/core/sparql/SolutionMapping.java  |  50 --
 .../clerezza/rdf/core/sparql/SparqlPreParser.java  | 168 -------
 .../rdf/core/sparql/StringQuerySerializer.java     |  94 ----
 .../rdf/core/sparql/query/AbstractOperation.java   |  41 --
 .../core/sparql/query/AlternativeGraphPattern.java |  38 --
 .../clerezza/rdf/core/sparql/query/AskQuery.java   |  29 --
 .../rdf/core/sparql/query/BasicGraphPattern.java   |  38 --
 .../rdf/core/sparql/query/BinaryOperation.java     |  46 --
 .../sparql/query/BinaryPropertyPathOperation.java  |  44 --
 .../rdf/core/sparql/query/BuiltInCall.java         |  47 --
 .../rdf/core/sparql/query/ConstructQuery.java      |  41 --
 .../clerezza/rdf/core/sparql/query/DataSet.java    |  46 --
 .../rdf/core/sparql/query/DescribeQuery.java       |  50 --
 .../clerezza/rdf/core/sparql/query/Expression.java |  42 --
 .../rdf/core/sparql/query/FunctionCall.java        |  48 --
 .../rdf/core/sparql/query/GraphGraphPattern.java   |  42 --
 .../rdf/core/sparql/query/GraphPattern.java        |  30 --
 .../rdf/core/sparql/query/GroupGraphPattern.java   |  69 ---
 .../clerezza/rdf/core/sparql/query/InlineData.java |  31 --
 .../rdf/core/sparql/query/LiteralExpression.java   |  40 --
 .../rdf/core/sparql/query/MinusGraphPattern.java   |  40 --
 .../core/sparql/query/OptionalGraphPattern.java    |  45 --
 .../rdf/core/sparql/query/OrderCondition.java      |  37 --
 .../query/PathSupportedBasicGraphPattern.java      |  43 --
 .../sparql/query/PatternExistenceCondition.java    |  66 ---
 .../rdf/core/sparql/query/PredicatePath.java       |  38 --
 .../core/sparql/query/PropertyPathExpression.java  |  29 --
 .../query/PropertyPathExpressionOrVariable.java    | 104 -----
 .../rdf/core/sparql/query/PropertyPathPattern.java |  46 --
 .../rdf/core/sparql/query/PropertySet.java         |  44 --
 .../clerezza/rdf/core/sparql/query/Query.java      |  59 ---
 .../sparql/query/QueryWithSolutionModifier.java    |  68 ---
 .../rdf/core/sparql/query/ResourceOrVariable.java  | 106 -----
 .../core/sparql/query/RhsListBinaryOperation.java  |  47 --
 .../rdf/core/sparql/query/SelectQuery.java         |  70 ---
 .../rdf/core/sparql/query/ServiceGraphPattern.java |  41 --
 .../clerezza/rdf/core/sparql/query/SparqlUnit.java |  51 ---
 .../rdf/core/sparql/query/TriplePattern.java       |  44 --
 .../rdf/core/sparql/query/UnaryOperation.java      |  38 --
 .../sparql/query/UnaryPropertyPathOperation.java   |  37 --
 .../rdf/core/sparql/query/UriRefExpression.java    |  39 --
 .../rdf/core/sparql/query/UriRefOrVariable.java    |  43 --
 .../clerezza/rdf/core/sparql/query/Variable.java   |  86 ----
 .../query/impl/SimpleAlternativeGraphPattern.java  |  59 ---
 .../rdf/core/sparql/query/impl/SimpleAskQuery.java |  33 --
 .../sparql/query/impl/SimpleBasicGraphPattern.java |  48 --
 .../sparql/query/impl/SimpleConstructQuery.java    |  50 --
 .../rdf/core/sparql/query/impl/SimpleDataSet.java  |  51 ---
 .../sparql/query/impl/SimpleDescribeQuery.java     |  60 ---
 .../sparql/query/impl/SimpleGraphGraphPattern.java |  55 ---
 .../sparql/query/impl/SimpleGroupGraphPattern.java | 236 ----------
 .../core/sparql/query/impl/SimpleInlineData.java   |  53 ---
 .../sparql/query/impl/SimpleMinusGraphPattern.java |  67 ---
 .../query/impl/SimpleOptionalGraphPattern.java     |  68 ---
 .../sparql/query/impl/SimpleOrderCondition.java    |  47 --
 .../impl/SimplePathSupportedBasicGraphPattern.java |  48 --
 .../query/impl/SimplePropertyPathPattern.java      | 136 ------
 .../rdf/core/sparql/query/impl/SimpleQuery.java    |  76 ----
 .../impl/SimpleQueryWithSolutionModifier.java      |  92 ----
 .../core/sparql/query/impl/SimpleSelectQuery.java  |  79 ----
 .../query/impl/SimpleServiceGraphPattern.java      |  66 ---
 .../core/sparql/query/impl/SimpleSparqlUnit.java   |  65 ---
 .../query/impl/SimpleStringQuerySerializer.java    | 315 -------------
 .../sparql/query/impl/SimpleTriplePattern.java     | 136 ------
 .../clerezza/rdf/core/sparql/update/Update.java    |  51 ---
 .../rdf/core/sparql/update/UpdateOperation.java    |  56 ---
 .../rdf/core/sparql/update/impl/AddOperation.java  |  29 --
 .../sparql/update/impl/BaseUpdateOperation.java    |  85 ----
 .../core/sparql/update/impl/ClearOperation.java    |  26 --
 .../sparql/update/impl/ClearOrDropOperation.java   |  60 ---
 .../rdf/core/sparql/update/impl/CopyOperation.java |  26 --
 .../core/sparql/update/impl/CreateOperation.java   |  55 ---
 .../sparql/update/impl/DeleteDataOperation.java    |  26 --
 .../sparql/update/impl/DeleteWhereOperation.java   |  26 --
 .../rdf/core/sparql/update/impl/DropOperation.java |  26 --
 .../sparql/update/impl/InsertDataOperation.java    |  26 --
 .../rdf/core/sparql/update/impl/LoadOperation.java |  41 --
 .../core/sparql/update/impl/ModifyOperation.java   | 111 -----
 .../rdf/core/sparql/update/impl/MoveOperation.java |  26 --
 .../clerezza/rdf/core/sparql/update/impl/Quad.java |  42 --
 .../rdf/core/sparql/update/impl/SimpleUpdate.java  |  51 ---
 .../sparql/update/impl/SimpleUpdateOperation.java  |  76 ----
 .../update/impl/UpdateOperationWithQuads.java      |  78 ----
 .../QueryParserSerializerCombinationTest.java      | 140 ------
 .../clerezza/rdf/core/sparql/QueryParserTest.java  | 383 ----------------
 .../rdf/core/sparql/QuerySerializerTest.java       | 318 -------------
 .../rdf/core/sparql/SparqlPreParserTest.java       | 505 ---------------------
 100 files changed, 7787 deletions(-)

diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/InvalidLiteralTypeException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/InvalidLiteralTypeException.java
deleted file mode 100644
index 923ea6b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/InvalidLiteralTypeException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Thrown when a literal is of the wrong type for conversion to a java-type
- *
- * @author reto
- */
-public class InvalidLiteralTypeException extends RuntimeException {
-    
-    /**
-     * Constructs the exception to be thrown when a literal cannot be 
-     * converted to an instance of the specified class
-     *
-     * @param javaType the <code>Class</code> to convert to
-     * @param literalType the literalType which can't be converted
-     */
-    public InvalidLiteralTypeException(Class<?> javaType, IRI literalType) {
-        super("Cannot create a "+javaType+" from a literal of type "+literalType);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/LiteralFactory.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/LiteralFactory.java
deleted file mode 100644
index 2baa1c1..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/LiteralFactory.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-import org.apache.clerezza.rdf.core.impl.util.SimpleLiteralFactory;
-import org.apache.clerezza.commons.rdf.Literal;
-
-/**
- * This class provides methods to convert java objects to typed literals and
- * vice versa. While the default implementation will provide literal objects
- * storing the data's lexical form in memory, other implementations may
- * create literal optimized for processing within the store.
- *
- * Note: this class uses the notion of "Convertor" (in the Exception naming), 
- * but does not currently provide a mechanism to register such
- * <code>Convertor</code>s. An implementation is said to provide
- * <code>Convertor</code>s for the types it supports.
- *
- * @since 0.3
- * @author reto
- */
-public abstract class LiteralFactory {
-
-    private static LiteralFactory instance = new SimpleLiteralFactory();
-
-    /**
-     * Get a <code>LiteralFactory</code>. If this has not been set using
-     * setInstance it returns an instance of
-     * {@link org.apache.clerezza.model.impl.SimpleLiteralFactory}.
-     *
-     * @return a concrete <code>LiteralFactory</code>
-     */
-    public static LiteralFactory getInstance() {
-        return instance;
-    }
-
-    /**
-     * Set the instance returned by <code>getInstance</code>.
-     *
-     * @param instance the new default <code>LiteralFactory</code>
-     */
-    public static void setInstance(LiteralFactory instance) {
-        LiteralFactory.instance = instance;
-    }
-
-    /**
-     * Create a typed literal for the specified object
-     *
-     * @param value the value of the literal to be created
-     * @return a TypedLiteral representing the value
-     * @throws NoConvertorException thrown if <code>value</code> is of an invalid type
-     */
-    public abstract Literal createTypedLiteral(Object value)
-            throws NoConvertorException;
-
-    /**
-     * Converts a literal to an instance of the specified class
-     *
-     * @param <T>
-     * @param type the <code>Class</code> of the returned object
-     * @param literal the literal to be converted
-     * @return a java object representing the value of the literal
-     * @throws NoConvertorException thrown if <code>type</code> is unsupported
-     * @throws InvalidLiteralTypeException if the literal type doesn't match the requested java type
-     */
-    public abstract <T> T createObject(Class<T> type, Literal literal)
-            throws NoConvertorException, InvalidLiteralTypeException;
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/NoConvertorException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/NoConvertorException.java
deleted file mode 100644
index 768ecb2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/NoConvertorException.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.clerezza.rdf.core;
-
-import java.lang.reflect.Type;
-
-/**
- * This exception is thrown when no convertor is available to do a required
- * java-object to literal or literal to java-object conversion.
- *
- * @since 0.3
- * @author reto
- */
-public class NoConvertorException extends RuntimeException {
-
-    /**
-     * Create an instance of <code>NoConvertorException</code>
-     * indicating that no convertor is available for the type.
-     *
-     * @param type the type for which no convertor is available
-     */
-    public NoConvertorException(Type type) {
-        super("No convertor available for type "+type);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedGraph.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedGraph.java
deleted file mode 100644
index 542215d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedGraph.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.impl;
-
-import java.util.AbstractCollection;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.ReadOnlyException;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-import org.apache.clerezza.commons.rdf.impl.utils.AbstractGraph;
-
-/**
- *
- * This is a wrapper object for <code>Graph</code>. If <code>SecurityManger</code> 
- * is not <code>null</code> <code>TcManager</code> checks the <code>TcPermission</code>. 
- * If read-only permissions are set this wrapper is used instead of <code>Graph</code> 
- * and throws exceptions when add or remove methods are called.
- *
- * @author tsuy
- */
-public class WriteBlockedGraph extends AbstractGraph
-        implements Graph {
-
-    private Graph triples;
-
-    public WriteBlockedGraph(Graph triples) {
-        this.triples = triples;
-    }
-
-    @Override
-    protected int performSize() {
-        return triples.size();
-    }
-
-    @Override
-    protected Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        final Iterator<Triple> baseIter = triples.filter(subject, predicate, object);
-        return new Iterator<Triple>() {
-            
-            @Override
-            public boolean hasNext() {
-                return baseIter.hasNext();
-            }
-
-            @Override
-            public Triple next() {
-                return baseIter.next();
-            }
-
-            @Override
-            public void remove() {
-                throw new ReadOnlyException("remove");
-            }
-
-            
-        };
-    }
-
-    @Override
-    public boolean add(Triple e) {
-        throw new ReadOnlyException("add");
-    }
-
-    @Override
-    public boolean addAll(Collection<? extends Triple> c) {
-        throw new ReadOnlyException("add all");
-    }
-
-    @Override
-    public void clear() {
-        throw new ReadOnlyException("clear");
-    }
-
-    @Override
-    public boolean remove(Object o) {
-        throw new ReadOnlyException("remove");
-    }
-
-    @Override
-    public boolean removeAll(Collection<?> c) {
-        throw new ReadOnlyException("remove all");
-    }
-    
-    @Override
-    public boolean retainAll(Collection<?> c) {
-        throw new ReadOnlyException("retain all");
-    }
-
-    @Override
-    public Iterator iterator() {
-        return filter(null, null, null);
-    }
-    
-    @Override
-    public ImmutableGraph getImmutableGraph() {
-        return this.triples.getImmutableGraph();
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/Base64.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/Base64.java
deleted file mode 100644
index 1c3db17..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/Base64.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Taken from the book:
- * Jonathan Knudsen, "Java Cryptography", O'Reilly Media, Inc., 1998
- */
-package org.apache.clerezza.rdf.core.impl.util;
-/*
- *
- * 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.
- *
-*/
-
-
-public class Base64 {
-
-    public static String encode(byte[] raw) {
-        StringBuffer encoded = new StringBuffer();
-        for (int i = 0; i < raw.length; i += 3) {
-            encoded.append(encodeBlock(raw, i));
-        }
-        return encoded.toString();
-    }
-
-    protected static char[] encodeBlock(byte[] raw, int offset) {
-        int block = 0;
-        int slack = raw.length - offset - 1;
-        int end = (slack >= 2) ? 2 : slack;
-        for (int i = 0; i <= end; i++) {
-            byte b = raw[offset + i];
-            int neuter = (b < 0) ? b + 256 : b;
-            block += neuter << (8 * (2 - i));
-        }
-        char[] base64 = new char[4];
-        for (int i = 0; i < 4; i++) {
-            int sixbit = (block >>> (6 * (3 - i))) & 0x3f;
-            base64[i] = getChar(sixbit);
-        }
-        if (slack < 1) {
-            base64[2] = '=';
-        }
-        if (slack < 2) {
-            base64[3] = '=';
-        }
-        return base64;
-    }
-
-    protected static char getChar(int sixBit) {
-        if (sixBit >= 0 && sixBit <= 25) {
-            return (char) ('A' + sixBit);
-        }
-        if (sixBit >= 26 && sixBit <= 51) {
-            return (char) ('a' + (sixBit - 26));
-        }
-        if (sixBit >= 52 && sixBit <= 61) {
-            return (char) ('0' + (sixBit - 52));
-        }
-        if (sixBit == 62) {
-            return '+';
-        }
-        if (sixBit == 63) {
-            return '/';
-        }
-        return '?';
-    }
-
-    public static byte[] decode(String base64) {
-        int pad = 0;
-        for (int i = base64.length() - 1; base64.charAt(i) == '='; i--) {
-            pad++;
-        }
-        int length = base64.length() * 6 / 8 - pad;
-        byte[] raw = new byte[length];
-        int rawIndex = 0;
-        for (int i = 0; i < base64.length(); i += 4) {
-            int block = (getValue(base64.charAt(i)) << 18) + (getValue(base64.charAt(i + 1)) << 12) + (getValue(base64.charAt(i + 2)) << 6) + (getValue(base64.charAt(i + 3)));
-            for (int j = 0; j < 3 && rawIndex + j < raw.length; j++) {
-                raw[rawIndex + j] = (byte) ((block >> (8 * (2 - j))) & 0xff);
-            }
-            rawIndex += 3;
-        }
-        return raw;
-    }
-
-    protected static int getValue(char c) {
-        if (c >= 'A' && c <= 'Z') {
-            return c - 'A';
-        }
-        if (c >= 'a' && c <= 'z') {
-            return c - 'a' + 26;
-        }
-        if (c >= '0' && c <= '9') {
-            return c - '0' + 52;
-        }
-        if (c == '+') {
-            return 62;
-        }
-        if (c == '/') {
-            return 63;
-        }
-        if (c == '=') {
-            return 0;
-        }
-        return -1;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
deleted file mode 100644
index 72e42cd..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.impl.util;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-
-/**
- * Calls the methods of the wrapped <code>Graph</code> as privileged
- * code, because they may need permissions like writing to disk or accessing       
- * network.
- *
- * @author mir
- */
-public class PrivilegedGraphWrapper implements Graph {
-
-    private Graph graph;
-
-    public PrivilegedGraphWrapper(Graph Graph) {
-        this.graph = Graph;
-    }
-
-    @Override
-    public Iterator<Triple> filter(final BlankNodeOrIRI subject, final IRI predicate,
-            final RDFTerm object) {
-        return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
-
-            @Override
-            public Iterator<Triple> run() {
-                return graph.filter(subject, predicate, object);
-            }
-        });
-    }
-
-    @Override
-    public int size() {
-        return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
-
-            @Override
-            public Integer run() {
-                return graph.size();
-            }
-        });
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.isEmpty();
-            }
-        });
-    }
-
-    @Override
-    public boolean contains(final Object o) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.contains(o);
-            }
-        });
-    }
-
-    @Override
-    public Iterator<Triple> iterator() {
-        return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
-
-            @Override
-            public Iterator<Triple> run() {
-                return graph.iterator();
-            }
-        });
-    }
-
-    @Override
-    public Object[] toArray() {
-        return AccessController.doPrivileged(new PrivilegedAction<Object[]>() {
-
-            @Override
-            public Object[] run() {
-                return graph.toArray();
-            }
-        });
-    }
-
-    @Override
-    public <T> T[] toArray(final T[] a) {
-        return AccessController.doPrivileged(new PrivilegedAction<T[]>() {
-
-            @Override
-            public T[] run() {
-                return graph.toArray(a);
-            }
-        });
-    }
-
-    @Override
-    public boolean add(final Triple triple) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.add(triple);
-            }
-        });
-    }
-
-    @Override
-    public boolean remove(final Object o) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.remove(o);
-            }
-        });
-    }
-
-    @Override
-    public boolean containsAll(final Collection<?> c) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.containsAll(c);
-            }
-        });
-    }
-
-    @Override
-    public boolean addAll(final Collection<? extends Triple> c) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.addAll(c);
-            }
-        });
-    }
-
-    @Override
-    public boolean removeAll(final Collection<?> c) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.removeAll(c);
-            }
-        });
-    }
-
-    @Override
-    public boolean retainAll(final Collection<?> c) {
-        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-            @Override
-            public Boolean run() {
-                return graph.retainAll(c);
-            }
-        });
-    }
-
-    @Override
-    public void clear() {
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-
-            @Override
-            public Object run() {
-                graph.clear();
-                return null;
-            }
-        });
-    }
-
-    @Override
-    public ReadWriteLock getLock() {
-        return graph.getLock();
-    }
-
-    private static class PriviledgedTripleIterator implements Iterator<Triple> {
-
-        private final Iterator<Triple> wrappedIterator;
-
-        public PriviledgedTripleIterator(Iterator<Triple> wrappedIterator) {
-            this.wrappedIterator = wrappedIterator;
-        }
-
-        @Override
-        public boolean hasNext() {
-            return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
-
-                @Override
-                public Boolean run() {
-                    return wrappedIterator.hasNext();
-                }
-            });
-        }
-
-        @Override
-        public Triple next() {
-            return AccessController.doPrivileged(new PrivilegedAction<Triple>() {
-
-                @Override
-                public Triple run() {
-                    return wrappedIterator.next();
-                }
-            });
-        }
-
-        @Override
-        public void remove() {
-            AccessController.doPrivileged(new PrivilegedAction<Object>() {
-
-                @Override
-                public Object run() {
-                    wrappedIterator.remove();
-                    return null;
-                }
-            });
-        }
-    }
-    
-    
-
-    @Override
-    public ImmutableGraph getImmutableGraph() {
-        return new SimpleImmutableGraph(this);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedImmuatbleGraphWrapper.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedImmuatbleGraphWrapper.java
deleted file mode 100644
index edc3a14..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedImmuatbleGraphWrapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.impl.util;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-
-/**
- * Calls the methods of the wrapped <code>ImmutableGraph</code> as privileged
- * code, because they may need permissions like writing to disk or accessing       
- * network.
- * 
- * @author mir
- */
-public class PrivilegedImmuatbleGraphWrapper extends PrivilegedGraphWrapper
-        implements ImmutableGraph {
-
-    public PrivilegedImmuatbleGraphWrapper(ImmutableGraph ImmutableGraph) {
-        super(ImmutableGraph);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/SimpleLiteralFactory.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/SimpleLiteralFactory.java
deleted file mode 100644
index c96207a..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/SimpleLiteralFactory.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.impl.util;
-
-import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
-import java.math.BigInteger;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.InvalidLiteralTypeException;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.NoConvertorException;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.impl.util.Base64;
-import org.apache.clerezza.rdf.core.impl.util.W3CDateFormat;
-import org.apache.clerezza.commons.rdf.Literal;
-
-/**
- * An implementation of literal factory currently supporting only
- * byte[]/base64Binary and Java.util.Date/date
- * 
- * @author reto
- */
-
-public class SimpleLiteralFactory extends LiteralFactory {
-
-    private static final String XSD = "http://www.w3.org/2001/XMLSchema#";
-    final private static IRI xsdInteger = xsd("integer");
-    final private static IRI xsdInt = xsd("int");
-    final private static IRI xsdShort = xsd("short");
-    final private static IRI xsdByte = xsd("byte");
-    final private static IRI xsdLong = xsd("long");
-    
-
-    final private static Set<IRI> decimalTypes = new HashSet<IRI>();
-
-    final private static Map<Class<?>, TypeConverter<?>> typeConverterMap = new HashMap<Class<?>, TypeConverter<?>>();
-    final static Class<? extends byte[]> byteArrayType;
-
-    static {
-        Collections.addAll(decimalTypes, xsdInteger, xsdInt, xsdByte, xsdShort, xsdLong );
-
-        byte[] byteArray = new byte[0];
-        byteArrayType = byteArray.getClass();
-        typeConverterMap.put(byteArrayType, new ByteArrayConverter());
-        typeConverterMap.put(Date.class, new DateConverter());
-        typeConverterMap.put(Boolean.class, new BooleanConverter());
-        typeConverterMap.put(String.class, new StringConverter());
-        typeConverterMap.put(Integer.class, new IntegerConverter());
-        typeConverterMap.put(BigInteger.class, new BigIntegerConverter());
-        typeConverterMap.put(Long.class, new LongConverter());
-        typeConverterMap.put(Double.class, new DoubleConverter());
-        typeConverterMap.put(Float.class, new FloatConverter());
-        typeConverterMap.put(IRI.class, new UriRefConverter());
-    }
-
-    final private static IRI xsdDouble =xsd("double");
-    final private static IRI xsdFloat =xsd("float");
-    final private static IRI xsdAnyURI =xsd("anyURI");
-
-    final private static IRI xsd(String name) {
-       return new IRI(XSD+name);
-    }
-
-    private static interface TypeConverter<T> {
-        Literal createLiteral(T value);
-        T createObject(Literal literal);        
-    }
-
-    private static class  ByteArrayConverter implements TypeConverter<byte[]> {
-
-        private static final IRI base64Uri =xsd("base64Binary");
-
-        @Override
-        public Literal createLiteral(byte[] value) {
-            return new TypedLiteralImpl(Base64.encode((byte[]) value), base64Uri);
-        }
-
-        @Override
-        public byte[] createObject(Literal literal) {
-            if (!literal.getDataType().equals(base64Uri)) {
-                throw new InvalidLiteralTypeException(byteArrayType, literal.getDataType());
-            }
-            return (byte[])Base64.decode(literal.getLexicalForm());
-        }
-
-        
-    }
-    private static class  DateConverter implements TypeConverter<Date> {
-
-        private static final IRI dateTimeUri =xsd("dateTime");
-        private static final DateFormat DATE_FORMAT = new W3CDateFormat();
-
-        @Override
-        public Literal createLiteral(Date value) {
-            return new TypedLiteralImpl(DATE_FORMAT.format(value), dateTimeUri);
-        }
-
-        @Override
-        public Date createObject(Literal literal) {
-            if (!literal.getDataType().equals(dateTimeUri)) {
-                throw new InvalidLiteralTypeException(Date.class, literal.getDataType());
-            }
-            try {
-                return DATE_FORMAT.parse(literal.getLexicalForm());
-            } catch (ParseException ex) {
-                throw new RuntimeException("Exception parsing literal as date", ex);
-            }
-        }
-
-
-    }
-
-    private static class BooleanConverter implements TypeConverter<Boolean> {
-
-        private static final IRI booleanUri =xsd("boolean");
-        public static final TypedLiteralImpl TRUE = new TypedLiteralImpl("true", booleanUri);
-        public static final TypedLiteralImpl FALSE = new TypedLiteralImpl("false", booleanUri);
-
-        @Override
-        public Literal createLiteral(Boolean value) {
-            if (value) return TRUE;
-            else return FALSE;
-        }
-
-        @Override
-        public Boolean createObject(Literal literal) {
-            if (literal == TRUE) return true;
-            else if (literal == FALSE) return false;
-            else if (!literal.getDataType().equals(booleanUri)) {
-                throw new InvalidLiteralTypeException(Boolean.class, literal.getDataType());
-            }
-            return Boolean.valueOf(literal.getLexicalForm());
-        }
-    }
-
-    private static class StringConverter implements TypeConverter<String> {
-
-        private static final IRI stringUri =xsd("string");
-
-        @Override
-        public Literal createLiteral(String value) {
-            return new TypedLiteralImpl(value, stringUri);
-        }
-
-        @Override
-        public String createObject(Literal literal) {
-            if (!literal.getDataType().equals(stringUri)) {
-                throw new InvalidLiteralTypeException(String.class, literal.getDataType());
-            }
-            return literal.getLexicalForm();
-        }
-    }
-
-    private static class IntegerConverter implements TypeConverter<Integer> {
-
-
-        @Override
-        public Literal createLiteral(Integer value) {
-            return new TypedLiteralImpl(value.toString(), xsdInt);
-        }
-
-        @Override
-        public Integer createObject(Literal literal) {
-            if (!decimalTypes.contains(literal.getDataType())) {
-                throw new InvalidLiteralTypeException(Integer.class, literal.getDataType());
-            }
-            return new Integer(literal.getLexicalForm());
-        }
-    }
-
-    private static class LongConverter implements TypeConverter<Long> {
-
-        
-
-        @Override
-        public Literal createLiteral(Long value) {
-            return new TypedLiteralImpl(value.toString(), xsdLong);
-        }
-
-        @Override
-        public Long createObject(Literal literal) {
-            if (!decimalTypes.contains(literal.getDataType())) {
-                throw new InvalidLiteralTypeException(Long.class, literal.getDataType());
-            }
-            return new Long(literal.getLexicalForm());
-        }
-    }
-
-
-    private static class FloatConverter implements TypeConverter<Float> {
-
-        @Override
-        public Literal createLiteral(Float value) {
-            return new TypedLiteralImpl(value.toString(), xsdFloat);
-        }
-
-        @Override
-        public Float createObject(Literal literal) {
-            if (!literal.getDataType().equals(xsdFloat)) {
-                throw new InvalidLiteralTypeException(Float.class, literal.getDataType());
-            }
-            return Float.valueOf(literal.getLexicalForm());
-        }
-    }
-    
-    private static class DoubleConverter implements TypeConverter<Double> {
-
-
-
-        @Override
-        public Literal createLiteral(Double value) {
-            return new TypedLiteralImpl(value.toString(), xsdDouble);
-        }
-
-        @Override
-        public Double createObject(Literal literal) {
-            if (!literal.getDataType().equals(xsdDouble)) {
-                throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
-            }
-            return new Double(literal.getLexicalForm());
-        }
-    }
-
-    private static class BigIntegerConverter implements TypeConverter<BigInteger> {
-
-
-
-        @Override
-        public Literal createLiteral(BigInteger value) {
-            return new TypedLiteralImpl(value.toString(), xsdInteger);
-        }
-
-        @Override
-        public BigInteger createObject(Literal literal) {
-            if (!literal.getDataType().equals(xsdInteger)) {
-                throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
-            }
-            return new BigInteger(literal.getLexicalForm());
-        }
-    }
-    
-    private static class UriRefConverter implements TypeConverter<IRI> {
-
-
-
-        @Override
-        public Literal createLiteral(IRI value) {
-            return new TypedLiteralImpl(value.getUnicodeString(), xsdAnyURI);
-        }
-
-        @Override
-        public IRI createObject(Literal literal) {
-            if (!literal.getDataType().equals(xsdAnyURI)) {
-                throw new InvalidLiteralTypeException(IRI.class, literal.getDataType());
-            }
-            return new IRI(literal.getLexicalForm());
-        }
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public Literal createTypedLiteral(Object value) throws NoConvertorException {
-        TypeConverter converter = getConverterFor(value.getClass());
-        return converter.createLiteral(value);
-    }
-
-    
-    
-    @Override
-    public <T> T createObject(Class<T> type, Literal literal)
-            throws NoConvertorException, InvalidLiteralTypeException {
-        final TypeConverter<T> converter = getConverterFor(type);
-        return converter.createObject(literal);
-        
-    }
-
-    @SuppressWarnings("unchecked")
-    private <T> TypeConverter<T> getConverterFor(Class<T> type) throws NoConvertorException {
-        TypeConverter<T> convertor = (TypeConverter<T>) typeConverterMap.get(type);
-        if (convertor != null) {
-            return convertor;
-        }
-        for (Map.Entry<Class<?>, TypeConverter<?>> converterEntry : typeConverterMap.entrySet()) {
-            if (type.isAssignableFrom(converterEntry.getKey())) {
-                return (TypeConverter<T>) converterEntry.getValue();
-            }
-        }
-        throw new NoConvertorException(type);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/W3CDateFormat.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/W3CDateFormat.java
deleted file mode 100644
index 6de2906..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/impl/util/W3CDateFormat.java
+++ /dev/null
@@ -1,196 +0,0 @@
-//taken from GVS MillisDateFormat.java, modified to support different precision
-
-/*
- (c) Copyright 2005, 2006, Hewlett-Packard Development Company, LP
- [See end of file]
- $Id: W3CDateFormat.java,v 1.6 2007/05/07 18:45:22 rebach Exp $
- */
-package org.apache.clerezza.rdf.core.impl.util;
-/*
- *
- * 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 java.text.DateFormat;
-import java.text.FieldPosition;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
-
-/**
- * @author reto implements http://www.w3.org/TR/NOTE-datetime with the
- *         limitation that it expects exactly a three digits decimal fraction of
- *         seconds. if a time zone designator other than 'Z' is present it must
- *         contain a column
- */
-public class W3CDateFormat extends DateFormat {
-    /**
-     * An instance of this class
-     */
-    public static final W3CDateFormat instance = new W3CDateFormat();
-
-    private static final SimpleDateFormat dateFormatWithMillis = new SimpleDateFormat(
-            "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
-    private static final SimpleDateFormat dateFormatNoMillis = new SimpleDateFormat(
-            "yyyy-MM-dd'T'HH:mm:ssZ");
-
-    private static final long serialVersionUID = 3258407344076372025L;
-
-    private static final TimeZone utcTZ = new SimpleTimeZone(0, "UTC");
-
-    static {
-        dateFormatWithMillis.setTimeZone(utcTZ);
-        dateFormatNoMillis.setTimeZone(utcTZ);
-    }
-
-    @Override
-    public void setTimeZone(TimeZone zone) {
-        super.setTimeZone(zone);
-    }
-
-
-    /**
-     * @see java.text.DateFormat#format(java.util.Date, java.lang.StringBuffer,
-     *      java.text.FieldPosition)
-     */
-    @Override
-    public StringBuffer format(Date date, StringBuffer toAppendTo,
-            FieldPosition fieldPosition) {
-
-        final DateFormat dateFormat = (date.getTime() % 1000) == 0 ?
-            dateFormatNoMillis : dateFormatWithMillis;
-        String string = dateFormat.format(date);
-        if (string.endsWith("0000")) {
-            StringBuffer result = new StringBuffer(string.substring(0, string.length()-5));
-            result.append('Z');
-            return result;
-        } else {
-            StringBuffer result = new StringBuffer(string);
-            result.insert(string.length() - 2, ':');
-            return result;
-        }
-    }
-
-    /**
-     * @see java.text.DateFormat#parse(java.lang.String,
-     *      java.text.ParsePosition)
-     */
-    public Date parse(String dateString, ParsePosition parsePos) {
-
-        int position = parsePos.getIndex();
-
-        int y1 = dateString.charAt(position++) - '0';
-        int y2 = dateString.charAt(position++) - '0';
-        int y3 = dateString.charAt(position++) - '0';
-        int y4 = dateString.charAt(position++) - '0';
-        int year = 1000 * y1 + 100 * y2 + 10 * y3 + y4;
-        position++; // skip '-'
-        int m1 = dateString.charAt(position++) - '0';
-        int m2 = dateString.charAt(position++) - '0';
-        int month = 10 * m1 + m2;
-        position++; // skip '-'
-        int d1 = dateString.charAt(position++) - '0';
-        int d2 = dateString.charAt(position++) - '0';
-        int day = 10 * d1 + d2;
-        position++; // skip 'T'
-        int h1 = dateString.charAt(position++) - '0';
-        int h2 = dateString.charAt(position++) - '0';
-        int hour = 10 * h1 + h2;
-        position++; // skip ':'
-        int min1 = dateString.charAt(position++) - '0';
-        int min2 = dateString.charAt(position++) - '0';
-        int minutes = 10 * min1 + min2;
-        position++; // skip ':'
-        int s1 = dateString.charAt(position++) - '0';
-        int s2 = dateString.charAt(position++) - '0';
-        int secs = 10 * s1 + s2;
-        Calendar resultCalendar = new GregorianCalendar(year, month - 1, day,
-                hour, minutes, secs);
-        resultCalendar.setTimeZone(utcTZ);
-        char afterSecChar = dateString.charAt(position++);
-        int msecs = 0;
-        char tzd1;
-        if (afterSecChar == '.') {
-            int startPos = position;
-            //read decimal part, this is till there is a 'Z', a '+' or a '-'
-            char nextChar = dateString.charAt(position++);
-            while ((nextChar != 'Z') && (nextChar != '-') && (nextChar != '+')) {
-                msecs += (nextChar - '0')*Math.pow(10, 3+startPos-position);
-                nextChar = dateString.charAt(position++);
-            }
-            tzd1 = nextChar;
-        } else {
-            tzd1 = afterSecChar;
-        }
-        long timeInMillis = resultCalendar.getTimeInMillis() + msecs;
-        if (tzd1 != 'Z') {
-            int htz1 = dateString.charAt(position++) - '0';
-            int htz2 = dateString.charAt(position++) - '0';
-            int hourtz = 10 * htz1 + htz2;
-            position++; // skip ':'
-            int mintz1 = dateString.charAt(position++) - '0';
-            int mintz2 = dateString.charAt(position++) - '0';
-            int minutestz = 10 * mintz1 + mintz2;
-            int offSetInMillis = (hourtz * 60 + minutestz) * 60000;
-            if (tzd1 == '+') {
-                timeInMillis -= offSetInMillis;
-            } else {
-                timeInMillis += offSetInMillis;
-            }
-        }
-        parsePos.setIndex(position);
-        return new Date(timeInMillis);
-
-    }
-}
-
-/*
- * (c) Copyright 2005, 2006 Hewlett-Packard Development Company, LP All rights
- * reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/NoQueryEngineException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/NoQueryEngineException.java
deleted file mode 100644
index f75676d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/NoQueryEngineException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-/**
- * Indicates that there is no available query engine for resolving a query.
- *
- * @author rbn
- */
-public class NoQueryEngineException extends RuntimeException {
-
-    /**
-     * Creates a new instance of <code>NoQueryEngineException</code> without detail message.
-     */
-    public NoQueryEngineException() {
-    }
-
-
-    /**
-     * Constructs an instance of <code>NoQueryEngineException</code> with the specified detail message.
-     * @param msg the detail message.
-     */
-    public NoQueryEngineException(String msg) {
-        super(msg);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
deleted file mode 100644
index 0fb56bf..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-
-/**
- * A QueryEngine can process SPARQL queries against an arbitrary set of graphs.
- * 
- * @author rbn
- */
-public interface QueryEngine {
-
-	/**
-	 * Executes any sparql query. The type of the result object will vary
-	 * depending on the type of the query.
-	 * 
-	 * @param tcManager
-	 *            where the query originates.
-	 * @param defaultGraph
-	 *            the default ImmutableGraph against which to execute the query if no
-	 *            FROM clause is present
-	 * @param query
-	 *            Query object to be executed
-	 * @return the resulting ResultSet, ImmutableGraph or Boolean value
-	 */
-    @Deprecated
-	public Object execute(TcManager tcManager, Graph defaultGraph,
-			Query query);
-
-	/**
-	 * Executes any sparql query. The type of the result object will vary
-	 * depending on the type of the query.
-	 * 
-	 * @param tcManager
-	 *            where the query originates.
-	 * @param defaultGraph
-	 *            the default ImmutableGraph against which to execute the query if no
-	 *            FROM clause is present
-	 * @param query
-	 *            string to be executed.
-	 * @return the resulting ResultSet, ImmutableGraph or Boolean value
-	 */
-	public Object execute(TcManager tcManager, Graph defaultGraph,
-			String query);
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryParser.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryParser.java
deleted file mode 100644
index 8d76c48..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryParser.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.io.StringReader;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.osgi.service.component.annotations.Component;
-
-/**
- * This class implements an OSGi service to provide a method to parse a
- * SPARQL query and generate a {@link Query} object.
- *
- * @author hasan
- */
-
-@Component(service = QueryParser.class)
-public class QueryParser {
-
-    private static volatile QueryParser instance;
-    public QueryParser() {
-        QueryParser.instance = this;
-    }
-
-    /**
-     * Returns an instance of this class.
-     * This method is provided due to backward compatibility.
-     */
-    public static QueryParser getInstance() {
-        if (instance == null) {
-            synchronized (QueryParser.class) {
-                if (instance == null) {
-                    new QueryParser();
-                }
-            }
-        }
-        return instance;
-    }
-
-    /**
-     * Parses a SPARQL query string into a {@link Query} object.
-     *
-     * @param queryString
-     *        SPARQL query string
-     * @return
-     *        {@link Query} object corresponding to the specified query string
-     *
-     * @throws org.apache.clerezza.rdf.core.sparql.ParseException
-     */
-    public Query parse(final String queryString) throws ParseException {
-        JavaCCGeneratedQueryParser parser = new JavaCCGeneratedQueryParser(
-                new StringReader(queryString));
-        return parser.parse();
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/ResultSet.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/ResultSet.java
deleted file mode 100644
index 1d2e377..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/ResultSet.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The reult of a sparql SELECT-query. This corresponds to a Solution Sequence
- * as per section 12.1.6 of http://www.w3.org/TR/rdf-sparql-query/.
- *
- * Note that the scope of blank nodes is the reult set and not the
- * Graph from where they originate.
- *
- * @author rbn
- */
-public interface ResultSet extends Iterator<SolutionMapping> {
-
-    /** Iterate over the variable names (strings) in this QuerySolution.
-     * @return Iterator of strings
-     */ 
-    public List<String> getResultVars() ;
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
deleted file mode 100644
index 60d1805..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import java.util.Map;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-
-/**
- * A set of mapping from variable names to solutions.
- *
- * a variable name has the form: ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9]
- * | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
- * where PN_CHARS_U =      [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6]
- * | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D]
- * | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
- * | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] | '_'
- *
- *
- * @author rbn
- */
-public interface SolutionMapping extends Map<Variable, RDFTerm> {
-
-    /**
-     * Should be the equivalent to this:
-     * public Resource get(String name) {
-     *    return get(new Variable(name));
-     * }
-     *
-     * @param name
-     * @return
-     */
-    public RDFTerm get(String name);
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java
deleted file mode 100644
index c856ea8..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.io.StringReader;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.DataSet;
-import org.apache.clerezza.rdf.core.sparql.query.GraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.MinusGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OptionalGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SparqlUnit;
-import org.apache.clerezza.rdf.core.sparql.update.Update;
-
-/**
- * This class implements an OSGi service to provide a method to obtain referred Graphs in a SPARQL Query or Update.
- *
- * @author hasan
- */
-
-
-public class SparqlPreParser {
-
-    TcProvider tcProvider;
-
-    public SparqlPreParser() {
-    }
-
-    public SparqlPreParser(TcProvider tcProvider) {
-        this.tcProvider = tcProvider;
-    }
-
-    /**
-     * This returns the graphs targeted by the queryString. These are the 
-     * triple collections explicitly referred in FROM and FROM NAMED clauses, 
-     * and if the queryString contains no FROM clause the defaultGraph.
-     * 
-     * For queries that are not limited to a specified set of graphs, null is returned.
-     * 
-     * @param queryString
-     * @param defaultGraph
-     * @return 
-     * @throws ParseException 
-     */
-    public Set<IRI> getReferredGraphs(String queryString, IRI defaultGraph) throws ParseException {
-        Set<IRI> referredGraphs;
-        JavaCCGeneratedSparqlPreParser parser = new JavaCCGeneratedSparqlPreParser(new StringReader(queryString));
-        SparqlUnit sparqlUnit;
-        sparqlUnit = parser.parse();
-        boolean referringVariableNamedGraph = false;
-        if (sparqlUnit.isQuery()) {
-            Query q = sparqlUnit.getQuery();
-            DataSet dataSet = q.getDataSet();
-            if (dataSet != null) {
-                referredGraphs = dataSet.getDefaultGraphs();
-                referredGraphs.addAll(dataSet.getNamedGraphs());
-            } else {
-                referredGraphs = new HashSet<IRI>();
-            }
-            GroupGraphPattern queryPattern = q.getQueryPattern();
-            if (queryPattern != null) {
-                Set<GraphPattern> graphPatterns = queryPattern.getGraphPatterns();
-                for (GraphPattern graphPattern : graphPatterns) {
-                }
-            }
-//            referringVariableNamedGraph = q.referringVariableNamedGraph();
-            referringVariableNamedGraph = referringVariableNamedGraph(q);
-        } else {
-            Update u = sparqlUnit.getUpdate();
-            referredGraphs = u.getReferredGraphs(defaultGraph, tcProvider);
-        }
-        if (referredGraphs.isEmpty()) {
-            if (referringVariableNamedGraph) {
-                return null;
-            }
-            referredGraphs.add(defaultGraph);
-        }
-        return referredGraphs;
-    }
-
-    private boolean referringVariableNamedGraph(Query query) {
-        GroupGraphPattern queryPattern = query.getQueryPattern();
-        if (queryPattern == null) {
-            return false;
-        }
-        Set<GraphPattern> graphPatterns = queryPattern.getGraphPatterns();
-        return referringVariableNamedGraph(graphPatterns);
-    }
-
-    private boolean referringVariableNamedGraph(Set<GraphPattern> graphPatterns) {
-        boolean referringVariableNamedGraph = false;
-        for (GraphPattern graphPattern : graphPatterns) {
-            if (referringVariableNamedGraph(graphPattern)) {
-                referringVariableNamedGraph = true;
-                break;
-            }
-        }
-        return referringVariableNamedGraph;
-    }
-
-    private boolean referringVariableNamedGraph(GraphPattern graphPattern) {
-        if (graphPattern instanceof GraphGraphPattern) {
-            return ((GraphGraphPattern) graphPattern).getGraph().isVariable();
-        }
-        if (graphPattern instanceof AlternativeGraphPattern) {
-            List<GroupGraphPattern> alternativeGraphPatterns =
-                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
-            boolean referringVariableNamedGraph = false;
-            for (GroupGraphPattern groupGraphPattern : alternativeGraphPatterns) {
-                if (referringVariableNamedGraph(groupGraphPattern)) {
-                    referringVariableNamedGraph = true;
-                    break;
-                }
-            }
-            return referringVariableNamedGraph;
-        }
-        if (graphPattern instanceof OptionalGraphPattern) {
-            GraphPattern mainGraphPattern = ((OptionalGraphPattern) graphPattern).getMainGraphPattern();
-            if (referringVariableNamedGraph(mainGraphPattern)) {
-                return true;
-            }
-            GroupGraphPattern optionalGraphPattern = ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern();
-            return referringVariableNamedGraph(optionalGraphPattern);
-        }
-        if (graphPattern instanceof MinusGraphPattern) {
-            GraphPattern minuendGraphPattern = ((MinusGraphPattern) graphPattern).getMinuendGraphPattern();
-            if (referringVariableNamedGraph(minuendGraphPattern)) {
-                return true;
-            }
-            GroupGraphPattern subtrahendGraphPattern = ((MinusGraphPattern) graphPattern).getSubtrahendGraphPattern();
-            return referringVariableNamedGraph(subtrahendGraphPattern);
-        }
-        if (graphPattern instanceof GroupGraphPattern) {
-            GroupGraphPattern groupGraphPattern = (GroupGraphPattern) graphPattern;
-            if (groupGraphPattern.isSubSelect()) {
-                Query query = ((GroupGraphPattern) graphPattern).getSubSelect();
-                return referringVariableNamedGraph(query);
-            } else {
-                Set<GraphPattern> graphPatterns = ((GroupGraphPattern) graphPattern).getGraphPatterns();
-                return referringVariableNamedGraph(graphPatterns);
-            }
-        }
-        return false;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/StringQuerySerializer.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/StringQuerySerializer.java
deleted file mode 100644
index c48100b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/StringQuerySerializer.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.clerezza.rdf.core.sparql;
-
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-
-/**
- * This abstract class provides a method to generate a {@link String}
- * representation of a {@link Query}.
- *
- * @author hasan
- */
-public abstract class StringQuerySerializer {
-
-    /**
-     * Serializes a {@link Query} object to a {@link String}.
-     *
-     * @param query
-     *        the Query object to be serialized
-     * @return
-     *        a String representation of the specified Query object.
-     */
-    public String serialize(Query query) {
-        if (query instanceof SelectQuery) {
-            return serialize((SelectQuery) query);
-        } else if (query instanceof ConstructQuery) {
-            return serialize((ConstructQuery) query);
-        } else if (query instanceof DescribeQuery) {
-            return serialize((DescribeQuery) query);
-        } else {
-            return serialize((AskQuery) query);
-        }
-    }
-
-    /**
-     * Serializes a {@link SelectQuery} object to a {@link String}.
-     *
-     * @param selectQuery
-     *        the SelectQuery object to be serialized
-     * @return
-     *        a String representation of the specified SelectQuery object.
-     */
-    public abstract String serialize(SelectQuery selectQuery);
-
-    /**
-     * Serializes a {@link ConstructQuery} object to a {@link String}.
-     *
-     * @param constructQuery
-     *        the ConstructQuery object to be serialized
-     * @return
-     *        a String representation of the specified ConstructQuery object.
-     */
-    public abstract String serialize(ConstructQuery constructQuery);
-
-    /**
-     * Serializes a {@link DescribeQuery} object to a {@link String}.
-     *
-     * @param describeQuery
-     *        the DescribeQuery object to be serialized
-     * @return
-     *        a String representation of the specified DescribeQuery object.
-     */
-    public abstract String serialize(DescribeQuery describeQuery);
-
-    /**
-     * Serializes an {@link AskQuery} object to a {@link String}.
-     *
-     * @param askQuery
-     *        the AskQuery object to be serialized
-     * @return
-     *        a String representation of the specified AskQuery object.
-     */
-    public abstract String serialize(AskQuery askQuery);
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AbstractOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AbstractOperation.java
deleted file mode 100644
index fe90f16..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AbstractOperation.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.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines an operation in an {@link Expression}. An operation has an operator
- * and one or more operands.
- *
- * @author hasan
- */
-public abstract class AbstractOperation implements Expression {
-    private String operator;
-
-    public AbstractOperation(String operator) {
-        this.operator = operator;
-    }
-
-    /**
-     * A string representation of the operator
-     * @return The operator as a string
-     */
-    public String getOperatorString() {
-        return operator;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AlternativeGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AlternativeGraphPattern.java
deleted file mode 100644
index 1e1424d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AlternativeGraphPattern.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * Defines alternative ImmutableGraph patterns.
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#alternatives">
- * SPARQL Query Language: 7 Matching Alternatives</a>
- *
- * @author hasan
- */
-public interface AlternativeGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return
-     *        a list of alternative {@link GroupGraphPattern}s
-     */
-    public List<GroupGraphPattern> getAlternativeGraphPatterns();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AskQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AskQuery.java
deleted file mode 100644
index 66ce9ce..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/AskQuery.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * <p>This interface represents a SPARQL ASK query.</p>
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#ask">
- * SPARQL Query Language: 10.3 ASK</a>
- *
- * @author hasan
- */
-public interface AskQuery extends Query {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BasicGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BasicGraphPattern.java
deleted file mode 100644
index c3ea802..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BasicGraphPattern.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.Set;
-
-/**
- * Defines a basic ImmutableGraph pattern.
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#BasicGraphPatterns">
- * SPARQL Query Language: 5.1 Basic ImmutableGraph Patterns</a>
- *
- * @author hasan
- */
-public interface BasicGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return a set of all triple patterns to match.
-     */
-    public Set<TriplePattern> getTriplePatterns();
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryOperation.java
deleted file mode 100644
index bd6b0df..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryOperation.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines an operation with two operands: a left hand side and a right hand side
- * operand.
- *
- * @author hasan
- */
-public class BinaryOperation extends AbstractOperation {
-
-    private Expression lhsOperand;
-    private Expression rhsOperand;
-
-    public BinaryOperation(String operator,
-            Expression lhsOperand, Expression rhsOperand) {
-        super(operator);
-        this.lhsOperand = lhsOperand;
-        this.rhsOperand = rhsOperand;
-    }
-
-    public Expression getLhsOperand() {
-        return lhsOperand;
-    }
-
-    public Expression getRhsOperand() {
-        return rhsOperand;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryPropertyPathOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryPropertyPathOperation.java
deleted file mode 100644
index 966b66c..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BinaryPropertyPathOperation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- *
- * @author hasan
- */
-public class BinaryPropertyPathOperation implements PropertyPathExpression {
-    private String operator;
-    private PropertyPathExpression lhsOperand;
-    private PropertyPathExpression rhsOperand;
-
-    public BinaryPropertyPathOperation(String operator, PropertyPathExpression lhsOperand, PropertyPathExpression rhsOperand) {
-        this.operator = operator;
-        this.lhsOperand = lhsOperand;
-        this.rhsOperand = rhsOperand;
-    }
-
-    public PropertyPathExpression getLhsOperand() {
-        return lhsOperand;
-    }
-
-    public PropertyPathExpression getRhsOperand() {
-        return rhsOperand;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BuiltInCall.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BuiltInCall.java
deleted file mode 100644
index 0a66c0b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/BuiltInCall.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * Defines a built-in call which is one form of {@link Expression}.
- * A built-in call has a name of type String and a list of arguments,
- * where each argument is an {@link Expression}.
- *
- * @author hasan
- */
-public class BuiltInCall implements Expression {
-
-    protected String name;
-    private final List<Expression> arguments;
-
-    public BuiltInCall(String name, List<Expression> arguments) {
-        this.name = name;
-        this.arguments = arguments;
-    }
-
-    public String getName() {
-        return name;
-    };
-
-    public List<Expression> getArguements() {
-        return arguments;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ConstructQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ConstructQuery.java
deleted file mode 100644
index dcded73..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ConstructQuery.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.clerezza.rdf.core.sparql.query;
-
-import java.util.Set;
-
-/**
- * <p>This interface represents a SPARQL CONSTRUCT query.</p>
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">
- * SPARQL Query Language: 10.2 CONSTRUCT</a>
- *
- * @author hasan
- */
-public interface ConstructQuery extends QueryWithSolutionModifier {
-
-    /**
-     * <p>Gets the template for constructing triples in a CONSTRUCT query.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">
-     * SPARQL Query Language: 10.2 CONSTRUCT</a>
-     * @return a template as a set of triple patterns for constructing
-     *         new triples.
-     */
-    public Set<TriplePattern> getConstructTemplate();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DataSet.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DataSet.java
deleted file mode 100644
index 649b883..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DataSet.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * This interface definition is not yet stable and may change in future.
- * 
- * @author hasan
- */
-public interface DataSet {
-
-    /**
-     * 
-     * @return
-     *        an empty set if no default ImmutableGraph is specified,
-     *        otherwise a set of their UriRefs
-     */
-    public Set<IRI> getDefaultGraphs();
-
-    /**
-     *
-     * @return
-     *        an empty set if no named ImmutableGraph is specified,
-     *        otherwise a set of their UriRefs
-     */
-    public Set<IRI> getNamedGraphs();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DescribeQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DescribeQuery.java
deleted file mode 100644
index a5fbbb2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/DescribeQuery.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * <p>This interface represents a SPARQL SELECT query.</p>
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
- * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
- *
- * @author hasan
- */
-public interface DescribeQuery extends QueryWithSolutionModifier {
-
-    /**
-     * <p>Tests if all variables in the query should be described.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
-     * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
-     * @return <code>true</code> if the query should return all variables.
-     */
-    public boolean isDescribeAll();
-
-    /**
-     * <p>Gets the list of {@link ResourceOrVariable}s to describe.
-     * If {@link #isDescribeAll()} returns <code>true</code> then
-     * this list contains all the variables from the query.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
-     * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
-     * @return A list of {@link ResourceOrVariable}s to describe.
-     */
-    public List<ResourceOrVariable> getResourcesToDescribe();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Expression.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Expression.java
deleted file mode 100644
index 97510dc..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Expression.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.io.Serializable;
-
-/**
- * This interface models logical, relational, and numeric expression.
- * This includes terms and factors in mathematical formulas which can contain
- * variables, literals, and function calls.
- * In a SPARQL query, expressions can occur in an ORDER BY clause or
- * a FILTER constraint.
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
- * SPARQL Query Language: 9.1 ORDER BY</a>
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#termConstraint">
- * SPARQL Query Language: 3 RDF Term Constraints (Informative)</a>
- * 
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#evaluation">
- * SPARQL Query Language: 11.2 Filter Evaluation</a>
- *
- * @author hasan
- */
-public interface Expression extends Serializable {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/FunctionCall.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/FunctionCall.java
deleted file mode 100644
index 39e2161..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/FunctionCall.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Defines a function call which is one form of {@link Expression}.
- * A function call has a name of type {@link IRI} and a list of arguments,
- * where each argument is an {@link Expression}.
- *
- * @author hasan
- */
-public class FunctionCall implements Expression {
-
-    private final IRI name;
-    private final List<Expression> arguments;
-
-    public FunctionCall(IRI name, List<Expression> arguments) {
-        this.name = name;
-        this.arguments = arguments;
-    }
-
-    public IRI getName() {
-        return name;
-    };
-
-    public List<Expression> getArguements() {
-        return arguments;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphGraphPattern.java
deleted file mode 100644
index 0a4844d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphGraphPattern.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines a ImmutableGraph ImmutableGraph pattern.
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#queryDataset">
- * SPARQL Query Language: 8.3 Querying the Dataset</a>
- *
- * @author hasan
- */
-public interface GraphGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return a {@link UriRefOrVariable} which specifies the ImmutableGraph
-     *        against which the pattern should match.
-     */
-    public UriRefOrVariable getGraph();
-
-    /**
-     * 
-     * @return the pattern to match.
-     */
-    public GroupGraphPattern getGroupGraphPattern();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphPattern.java
deleted file mode 100644
index eca02f2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GraphPattern.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.clerezza.rdf.core.sparql.query;
-
-/**
- * This is the generic interface for all types of ImmutableGraph patterns:
- * {@link BasicGraphPattern}, {@link PathSupportedBasicGraphPattern}, {@link GroupGraphPattern},
- * {@link GraphGraphPattern}, {@link AlternativeGraphPattern}, and
- * {@link OptionalGraphPattern}
- *
- * @author hasan
- */
-public interface GraphPattern {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GroupGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GroupGraphPattern.java
deleted file mode 100644
index da13f13..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/GroupGraphPattern.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Defines a group ImmutableGraph pattern.
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#GroupPatterns">
- * SPARQL Query Language: 5.2 Group ImmutableGraph Patterns</a>
- *
- * @author hasan
- */
-public interface GroupGraphPattern extends GraphPattern {
-
-	/**
-	 *
-	 * @return 
-     *      true if it wraps a {@link SelectQuery}, false otherwise.
-	 */
-	public boolean isSubSelect();
-
-	/**
-	 *
-	 * @return 
-     *      the wrapped subselect if it wraps a {@link SelectQuery}, null otherwise.
-	 */
-	public SelectQuery getSubSelect();
-
-	/**
-	 *
-	 * @return
-     *      null if it wraps a {@link SelectQuery}, otherwise
-     *      a set of all patterns, ANDed together.
-	 */
-	public Set<GraphPattern> getGraphPatterns();
-
-    /**
-     * 
-     * @return
-     *      all graphs referred in this ImmutableGraph pattern.
-     */
-    public Set<IRI> getReferredGraphs();
-
-    /**
-	 * @return 
-     *      null if it wraps a {@link SelectQuery}, otherwise
-	 *		a list of filter expressions for all patterns in the group if any.
-	 */
-	public List<Expression> getFilter();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/InlineData.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/InlineData.java
deleted file mode 100644
index 3040813..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/InlineData.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-
-/**
- *
- * @author hasan
- */
-public interface InlineData extends GraphPattern {
-    public List<Variable> getVariables();
-    public List<List<RDFTerm>> getValues();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/LiteralExpression.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/LiteralExpression.java
deleted file mode 100644
index c564b09..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/LiteralExpression.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.commons.rdf.Literal;
-
-/**
- * Wraps a {@link Literal} in an {@link Expression}.
- *
- * @author hasan
- */
-public class LiteralExpression implements Expression {
-
-    private final Literal literal;
-
-    public LiteralExpression(Literal literal) {
-        this.literal = literal;
-    }
-
-    public Literal getLiteral() {
-        return literal;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/MinusGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/MinusGraphPattern.java
deleted file mode 100644
index 73a27f5..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/MinusGraphPattern.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * 
- * @author hasan
- */
-public interface MinusGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return
-     *        the minuend ImmutableGraph pattern to match
-     */
-    public GraphPattern getMinuendGraphPattern();
-
-    /**
-     *
-     * @return
-     *        the subtrahend ImmutableGraph pattern to match
-     */
-    public GroupGraphPattern getSubtrahendGraphPattern();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OptionalGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OptionalGraphPattern.java
deleted file mode 100644
index 0bca8aa..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OptionalGraphPattern.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Specifying an optional ImmutableGraph pattern implies the existence of a main ImmutableGraph
- * pattern.
- * The main ImmutableGraph pattern is an empty group pattern if it is not specified.
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#optionals">
- * SPARQL Query Language: 6 Including Optional Values</a>
- * 
- * @author hasan
- */
-public interface OptionalGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return
-     *        the main ImmutableGraph pattern to match
-     */
-    public GraphPattern getMainGraphPattern();
-
-    /**
-     *
-     * @return
-     *        the optional ImmutableGraph pattern to match
-     */
-    public GroupGraphPattern getOptionalGraphPattern();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OrderCondition.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OrderCondition.java
deleted file mode 100644
index 5fd062f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/OrderCondition.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.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines an order condition in an ORDER BY clause.
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
- * SPARQL Query Language: 9.1 ORDER BY</a>
- *
- * @author hasan
- */
-public interface OrderCondition {
-
-    public Expression getExpression();
-
-    /**
-     * @return <code>true</code> if ascending, <code>false</code> if descending
-     */
-    public boolean isAscending();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PathSupportedBasicGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PathSupportedBasicGraphPattern.java
deleted file mode 100644
index f71b10d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PathSupportedBasicGraphPattern.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.clerezza.rdf.core.sparql.query;
-
-import java.util.Set;
-
-/**
- * Defines a basic ImmutableGraph pattern that supports property path expressions.
- * A {@link PathSupportedBasicGraphPattern} is a set of {@link PropertyPathPattern}s.
- * A {@link PropertyPathPattern} is a generalization of a {@link TriplePattern} to include
- * a {@link PropertyPathExpression} in the property position.
- * Therefore, a {@link PathSupportedBasicGraphPattern} can be seen as a generalization of a {@link BasicGraphPattern}
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlBasicGraphPatterns">
- * SPARQL 1.1 Query Language: 18.1.6 Basic ImmutableGraph Patterns</a>
- * and <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlPropertyPaths">
- * SPARQL 1.1 Query Language: 18.1.7 Property Path Patterns</a>
- *
- * @author hasan
- */
-public interface PathSupportedBasicGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return a set of all property path patterns to match.
-     */
-    public Set<PropertyPathPattern> getPropertyPathPatterns();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PatternExistenceCondition.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PatternExistenceCondition.java
deleted file mode 100644
index 34e66bd..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PatternExistenceCondition.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This expression is intended to be used as a filter expression to test whether a ImmutableGraph pattern matches 
- * the dataset or not, given the values of variables in the group ImmutableGraph pattern in which the filter occurs.
- * It does not generate any additional bindings.
- * 
- * @see <a href="http://www.w3.org/TR/sparql11-query/#neg-pattern">SPARQL 1.1 Query Language: 8.1 Filtering Using ImmutableGraph Patterns</a>
- * 
- * @author hasan
- */
-public class PatternExistenceCondition extends BuiltInCall {
-    private boolean negated = false;
-    private GroupGraphPattern pattern;
-
-    public PatternExistenceCondition() {
-        super("EXISTS", new ArrayList<Expression>());
-    }
-
-    public PatternExistenceCondition(String name, List<Expression> arguments) {
-        super(name, new ArrayList<Expression>());
-        if (!(name.equalsIgnoreCase("EXISTS") || name.equalsIgnoreCase("NOT EXISTS"))) {
-            throw new RuntimeException("Unsupported name: " + name);
-        } else {
-            this.negated = name.equalsIgnoreCase("NOT EXISTS");
-        }
-    }
-
-    public boolean isExistenceTest() {
-        return !negated;
-    }
-
-    public GroupGraphPattern getPattern() {
-        return pattern;
-    }
-
-    public void setExistenceTest(boolean existenceTest) {
-        this.negated = !existenceTest;
-        this.name = existenceTest ? "EXISTS" : "NOT EXISTS";
-    }
-
-    public void setPattern(GroupGraphPattern pattern) {
-        this.pattern = pattern;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PredicatePath.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PredicatePath.java
deleted file mode 100644
index 9b926d1..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PredicatePath.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- *
- * @author hasan
- */
-public class PredicatePath implements PropertyPathExpression {
-    private IRI predicatePath;
-
-    public PredicatePath(IRI predicatePath) {
-        this.predicatePath = predicatePath;
-    }
-
-    public IRI getPredicatePath() {
-        return predicatePath;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpression.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpression.java
deleted file mode 100644
index abbf87d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpression.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * This interface models property path expressions.
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#propertypaths">
- * SPARQL 1.1 Query Language: 9 Property Paths</a>
- * 
- * @author hasan
- */
-public interface PropertyPathExpression {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpressionOrVariable.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpressionOrVariable.java
deleted file mode 100644
index 821450c..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathExpressionOrVariable.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Wraps either a {@link PropertyPathExpression} or a {@link Variable}
- *
- * @author hasan
- */
-public class PropertyPathExpressionOrVariable {
-
-    private final PropertyPathExpression propertyPathExpression;
-    private final Variable variable;
-
-    public PropertyPathExpressionOrVariable(PropertyPathExpression propertyPathExpression) {
-        if (propertyPathExpression == null) {
-            throw new IllegalArgumentException("Invalid propertyPathExpression: null");
-        }
-        this.propertyPathExpression = propertyPathExpression;
-        variable = null;
-    }
-
-    public PropertyPathExpressionOrVariable(Variable variable) {
-        if (variable == null) {
-            throw new IllegalArgumentException("Invalid variable: null");
-        }
-        this.variable = variable;
-        propertyPathExpression = null;
-    }
-
-    /**
-     *
-     * @return
-     *        true if it is a {@link Variable}, false if it is a {@link PropertyPathExpression}
-     */
-    public boolean isVariable() {
-        return propertyPathExpression == null;
-    }
-
-    /**
-     * 
-     * @return
-     *        the wrapped PropertyPathExpression if it is a PropertyPathExpression, null otherwise
-     */
-    public PropertyPathExpression getPropertyPathExpression() {
-        return propertyPathExpression;
-    }
-    
-    /**
-     * 
-     * @return
-     *        the wrapped Variable if it is a Variable, null otherwise
-     */
-    public Variable getVariable() {
-        return variable;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof PropertyPathExpressionOrVariable)) {
-            return false;
-        }
-        final PropertyPathExpressionOrVariable other = (PropertyPathExpressionOrVariable) obj;
-        if (this.isVariable() != other.isVariable()) {
-            return false;
-        }
-        if (this.isVariable()) {
-            if (!this.getVariable().equals(other.getVariable())) {
-                return false;
-            }
-        } else {
-            if (!this.getPropertyPathExpression().equals(other.getPropertyPathExpression())) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return (isVariable()
-                ? 13 * getVariable().hashCode() + 17
-                : 13 * getPropertyPathExpression().hashCode() + 17);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathPattern.java
deleted file mode 100644
index 915a0e2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertyPathPattern.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines a property path pattern consisting of a subject, a property path expression, and an object.
- * The subject and object are of type {@link ResourceOrVariable}, whereas
- * the predicate is of type {@link PropertyPathExpressionOrVariable}.
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlPropertyPaths">
- * SPARQL 1.1 Query Language: 18.1.7 Property Path Patterns</a>
- *
- * @author hasan
- */
-public interface PropertyPathPattern {
-
-    /**
-     * @return the subject
-     */
-    public ResourceOrVariable getSubject();
-
-    /**
-     * @return the property path expression
-     */
-    public PropertyPathExpressionOrVariable getPropertyPathExpression();
-
-    /**
-     * @return the object
-     */
-    public ResourceOrVariable getObject();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertySet.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertySet.java
deleted file mode 100644
index fe1ce20..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/PropertySet.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * A property set is intended to store only predicate paths and inverse predicate paths.
- *
- * @author hasan
- */
-public class PropertySet implements PropertyPathExpression {
-    private Set<PropertyPathExpression> propertySet = new HashSet<PropertyPathExpression>();
-
-    /**
-     * 
-     * @param propertyPathExpression expected value is a predicate path or an inverse predicate path
-     */
-    public void addElement(PropertyPathExpression propertyPathExpression) {
-        this.propertySet.add(propertyPathExpression);
-    }
-
-    public Set<PropertyPathExpression> getPropertySet() {
-        return propertySet;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Query.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Query.java
deleted file mode 100644
index 6f4909d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Query.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.clerezza.rdf.core.sparql.query;
-
-/**
- * <p>This interface represents a SPARQL query.</p>
- * <p>There are four types of SPARQL queries: {@link SelectQuery},
- * {@link ConstructQuery}, {@link DescribeQuery}, and {@link AskQuery}.</p>
- *
- * @author hasan
- */
-public interface Query {
-
-    /**
-     * <p>Gets {@link DataSet} containing the specification of the default
-     * ImmutableGraph and named graphs, if any.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#specifyingDataset">
-     * SPARQL Query Language: 8.2 Specifying RDF Datasets</a>
-     * @return
-     *        null if no data set is specified, indicating the use of
-     *        system default ImmutableGraph. Otherwise a {@link DataSet} object is returned.
-     */
-    public DataSet getDataSet();
-
-    /**
-     * <p>Gets the query pattern of the WHERE clause for the query.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#GraphPattern">
-     * SPARQL Query Language: 5 ImmutableGraph Patterns</a>
-     * @return
-     *        the {@link GroupGraphPattern} of the WHERE clause for this query.
-     *        If the WHERE clause is not specified, null is returned.
-     */
-    public GroupGraphPattern getQueryPattern();
-    
-    public InlineData getInlineData();
-
-    /**
-     * 
-     * @return A valid String representation of the query.
-     */
-    @Override
-    public abstract String toString();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/QueryWithSolutionModifier.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/QueryWithSolutionModifier.java
deleted file mode 100644
index 6a6399b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/QueryWithSolutionModifier.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * <p>This interface represents a SPARQL query which contains a specification
- * of solution modifiers: GROUP BY, HAVING, ORDER BY, OFFSET, and LIMIT.</p>
- *
- * @see <a href="http://www.w3.org/TR/sparql11-query/#aggregates">
- * SPARQL 1.1 Query Language: 11 Aggregates</a>
- * and
- * @see <a href="http://www.w3.org/TR/sparql11-query/#solutionModifiers">
- * SPARQL 1.1 Query Language: 15 Solution Sequences and Modifiers</a>
- *
- * @author hasan
- */
-public interface QueryWithSolutionModifier extends Query {
-
-    public List<Expression> getGroupConditions();
-
-    public List<Expression> getHavingConditions();
-
-    /**
-     * <p>Gets the list of required ordering conditions in decreasing ordering
-     * priority.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
-     * SPARQL Query Language: 9.1 ORDER BY</a>
-     * @return A list of {@link OrderCondition}s, in order of priority.
-     */
-    public List<OrderCondition> getOrderConditions();
-
-    /**
-     * <p>Gets the numeric offset of the first row to be returned by the query. 
-     * The default offset is 0, meaning to start at the beginning.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOffset">
-     * SPARQL Query Language: 9.4 OFFSET</a>
-     * @return The number of rows to skip in the result.
-     */
-    public int getOffset();
-
-    /**
-     * <p>Gets the maximum number of results to be returned by the query. 
-     * A limit of -1 means no limit (return all results).
-     * A limit of 0 means that no results should be returned.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modResultLimit">
-     * SPARQL Query Language: 9.5 LIMIT</a>
-     * @return The maximum number of rows to returned by the query.
-     */
-    public int getLimit();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ResourceOrVariable.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ResourceOrVariable.java
deleted file mode 100644
index 0f00bc9..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ResourceOrVariable.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.commons.rdf.RDFTerm;
-
-/**
- * Wraps either a {@link RDFTerm} or a {@link Variable}
- *
- * @author hasan
- */
-public class ResourceOrVariable {
-
-    private final RDFTerm resource;
-    private final Variable variable;
-
-    public ResourceOrVariable(RDFTerm resource) {
-        if (resource == null) {
-            throw new IllegalArgumentException("Invalid resource: null");
-        }
-        this.resource = resource;
-        variable = null;
-    }
-
-    public ResourceOrVariable(Variable variable) {
-        if (variable == null) {
-            throw new IllegalArgumentException("Invalid variable: null");
-        }
-        this.variable = variable;
-        resource = null;
-    }
-
-    /**
-     *
-     * @return
-     *        true if it is a {@link Variable}, false if it is a {@link RDFTerm}
-     */
-    public boolean isVariable() {
-        return resource == null;
-    }
-
-    /**
-     * 
-     * @return
-     *        the wrapped Resource if it is a Resource, null otherwise
-     */
-    public RDFTerm getResource() {
-        return resource;
-    }
-    
-    /**
-     * 
-     * @return
-     *        the wrapped Variable if it is a Variable, null otherwise
-     */
-    public Variable getVariable() {
-        return variable;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof ResourceOrVariable)) {
-            return false;
-        }
-        final ResourceOrVariable other = (ResourceOrVariable) obj;
-        if (this.isVariable() != other.isVariable()) {
-            return false;
-        }
-        if (this.isVariable()) {
-            if (!this.getVariable().equals(other.getVariable())) {
-                return false;
-            }
-        } else {
-            if (!this.getResource().equals(other.getResource())) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return (isVariable()
-                ? 13 * getVariable().hashCode() + 7
-                : 13 * getResource().hashCode() + 7);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/RhsListBinaryOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/RhsListBinaryOperation.java
deleted file mode 100644
index 2e22ed4..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/RhsListBinaryOperation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * Defines an operation with two operands: a left hand side and a right hand side operand
- * where the right hand side operand is a list.
- *
- * @author hasan
- */
-public class RhsListBinaryOperation extends AbstractOperation {
-
-	private Expression lhsOperand;
-    private List<Expression> rhsOperand;
-
-	public RhsListBinaryOperation(String operator, Expression lhsOperand, List<Expression> rhsOperand) {
-		super(operator);
-		this.lhsOperand = lhsOperand;
-		this.rhsOperand = rhsOperand;
-	}
-
-	public Expression getLhsOperand() {
-		return lhsOperand;
-	}
-
-	public List<Expression> getRhsOperand() {
-		return rhsOperand;
-	}
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SelectQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SelectQuery.java
deleted file mode 100644
index 6985a8b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SelectQuery.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import java.util.List;
-
-/**
- * <p>This interface represents a SPARQL SELECT query.</p>
- *
- * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#select">
- * SPARQL Query Language: 10.1 SELECT</a>
- *
- * @author hasan
- */
-public interface SelectQuery extends QueryWithSolutionModifier {
-
-    /**
-     * <p>Tests if this query should return distinct results.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modDistinct">
-     * SPARQL Query Language: 9.3.1 DISTINCT</a>
-     * @return <code>true</code> if the query should return distinct results.
-     */
-    public boolean isDistinct();
-
-    /**
-     * <p>Tests if this query should return reduced results.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modReduced">
-     * SPARQL Query Language: 9.3.2 REDUCED</a>
-     * @return <code>true</code> if the query should return reduced results.
-     */
-    public boolean isReduced();
-
-    /**
-     * <p>Tests if this query returns all its variables, and not a projected subset.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#solutionModifiers">
-     * SPARQL Query Language: 9 Solution Sequences and Modifiers</a>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modProjection">
-     * SPARQL Query Language: 9.2 Projection</a>
-     * @return <code>true</code> if the query should return all variables.
-     */
-    public boolean isSelectAll();
-
-    /**
-     * <p>Gets the list of {@link Variable}s to project the solution to.
-     * If {@link #isSelectAll()} returns <code>true</code> then
-     * this list contains all the variables from the query.</p>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#select">
-     * SPARQL Query Language: 10.1 SELECT</a>
-     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modProjection">
-     * SPARQL Query Language: 9.2 Projection</a>
-     * @return A list of {@link Variable}s to return from the query.
-     */
-    public List<Variable> getSelection();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ServiceGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ServiceGraphPattern.java
deleted file mode 100644
index 9ae6f1a..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/ServiceGraphPattern.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.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines a service ImmutableGraph pattern.
- * @see <a href="http://www.w3.org/TR/sparql11-federated-query/">
- * SPARQL 1.1 Federated Query</a>
- *
- * @author hasan
- */
-public interface ServiceGraphPattern extends GraphPattern {
-
-    /**
-     *
-     * @return a {@link UriRefOrVariable} which specifies the service endpoint.
-     */
-    public UriRefOrVariable getService();
-
-    /**
-     * 
-     * @return the pattern to match.
-     */
-    public GroupGraphPattern getGroupGraphPattern();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SparqlUnit.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SparqlUnit.java
deleted file mode 100644
index 05234f7..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/SparqlUnit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.rdf.core.sparql.update.Update;
-
-/**
- * <p>This interface represents a SPARQL Query or Update.</p>
- *
- * @author hasan
- */
-public interface SparqlUnit {
-
-    /**
-     * 
-	 * @return
-	 *		true if it is a {@link Query}, false if it is an {@link Update}
-     */
-    public boolean isQuery();
-
-    /**
-     * 
-	 * @return
-	 *		the wrapped Query if it is a {@link Query}, null otherwise
-     */
-	public Query getQuery();
-
-    /**
-     * 
-	 * @return
-	 *		the wrapped Update if it is an {@link Update}, null otherwise
-     */
-	public Update getUpdate();
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/TriplePattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/TriplePattern.java
deleted file mode 100644
index 6d1bfe0..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/TriplePattern.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines a triple pattern consisting of a subject, a predicate, and an object.
- * The subject and object are of type {@link ResourceOrVariable}, whereas
- * the predicate is of type {@link UriRefOrVariable}.
- *
- * @author hasan
- */
-public interface TriplePattern {
-
-    /**
-     * @return the subject
-     */
-    public ResourceOrVariable getSubject();
-
-    /**
-     * @return the predicate
-     */
-    public UriRefOrVariable getPredicate();
-
-    /**
-     * @return the object
-     */
-    public ResourceOrVariable getObject();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryOperation.java
deleted file mode 100644
index 397729e..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryOperation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-/**
- * Defines an operation with a single operand.
- *
- * @author hasan
- */
-public class UnaryOperation extends AbstractOperation {
-
-    private Expression operand;
-
-    public UnaryOperation(String operator, Expression operand) {
-        super(operator);
-        this.operand = operand;
-    }
-
-    public Expression getOperand() {
-        return operand;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryPropertyPathOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryPropertyPathOperation.java
deleted file mode 100644
index 9912c03..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UnaryPropertyPathOperation.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.clerezza.rdf.core.sparql.query;
-
-/**
- *
- * @author hasan
- */
-public class UnaryPropertyPathOperation implements PropertyPathExpression {
-    private String operator;
-    private PropertyPathExpression operand;
-
-    public UnaryPropertyPathOperation(String operator, PropertyPathExpression operand) {
-        this.operator = operator;
-        this.operand = operand;
-    }
-
-    public PropertyPathExpression getOperand() {
-        return operand;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefExpression.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefExpression.java
deleted file mode 100644
index 5910ac2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefExpression.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Wraps a {@link IRI} in an {@link Expression}.
- *
- * @author hasan
- */
-public class UriRefExpression implements Expression {
-
-    private final IRI uriRef;
-
-    public UriRefExpression(IRI uriRef) {
-        this.uriRef = uriRef;
-    }
-
-    public IRI getUriRef() {
-        return uriRef;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefOrVariable.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefOrVariable.java
deleted file mode 100644
index 803c1bc..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/UriRefOrVariable.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.clerezza.rdf.core.sparql.query;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Wraps either a {@link IRI} or a {@link Variable}.
- *
- * @author rbn
- */
-public class UriRefOrVariable extends ResourceOrVariable {
-
-    public UriRefOrVariable(Variable variable) {
-        super(variable);
-    }
-
-    public UriRefOrVariable(IRI resource) {
-        super(resource);
-    }
-
-    @Override
-    public IRI getResource() {
-        return (IRI)super.getResource();
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Variable.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Variable.java
deleted file mode 100644
index fd4b63f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/Variable.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.clerezza.rdf.core.sparql.query;
-
-import java.util.UUID;
-
-/**
- * Defines a Variable. A Variable can occur in an {@link Expression} and is
- * itself an {@link Expression}.
- * 
- * @author hasan
- */
-public class Variable implements Expression {
-
-	private String name;
-	private Expression boundExpression;
-
-	public Variable() {
-		this.name = UUID.randomUUID().toString();
-	}
-
-	/**
-	 * Creates a variable with the specified name
-	 *
-	 * @param name
-	 */
-	public Variable(String name) {
-		if (name == null) {
-			throw new IllegalArgumentException("name may not be null");
-		}
-		this.name = name;
-	}
-
-	public Variable(String name, Expression boundExpression) {
-		this.name = name;
-		this.boundExpression = boundExpression;
-	}
-
-	/**
-	 * @return the name
-	 */
-	public String getName() {
-		return name;
-	}
-
-	public Expression getBoundExpression() {
-		return boundExpression;
-	}
-
-	public void setBoundExpression(Expression boundExpression) {
-		this.boundExpression = boundExpression;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj == null) {
-			return false;
-		}
-		if (getClass() != obj.getClass()) {
-			return false;
-		}
-		final Variable other = (Variable) obj;
-		return name.equals(other.name);
-	}
-
-	@Override
-	public int hashCode() {
-		return name.hashCode();
-	}
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAlternativeGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAlternativeGraphPattern.java
deleted file mode 100644
index e8ad4ed..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAlternativeGraphPattern.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.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-
-/**
- *
- * @author hasan
- */
-public class SimpleAlternativeGraphPattern implements AlternativeGraphPattern {
-
-    private List<GroupGraphPattern> alternativeGraphPatterns;
-
-    public SimpleAlternativeGraphPattern(
-            List<GroupGraphPattern> alternativeGraphPatterns) {
-        this.alternativeGraphPatterns = (alternativeGraphPatterns == null)
-                ? new ArrayList<GroupGraphPattern>()
-                : alternativeGraphPatterns;
-
-        this.alternativeGraphPatterns = alternativeGraphPatterns;
-    }
-
-    public SimpleAlternativeGraphPattern(GroupGraphPattern... groupGraphPatterns) {
-        alternativeGraphPatterns = new ArrayList<GroupGraphPattern>();
-        GroupGraphPattern[] g = groupGraphPatterns;
-        for (int i = 0; i < g.length; i++) {
-            alternativeGraphPatterns.add(g[i]);
-        }
-    }
-
-    @Override
-    public List<GroupGraphPattern> getAlternativeGraphPatterns() {
-        return alternativeGraphPatterns;
-    }
-
-    public void addAlternativeGraphPattern(GroupGraphPattern groupGraphPattern) {
-        alternativeGraphPatterns.add(groupGraphPattern);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAskQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAskQuery.java
deleted file mode 100644
index b99fdae..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleAskQuery.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-
-/**
- *
- * @author hasan
- */
-public class SimpleAskQuery extends SimpleQueryWithSolutionModifier implements AskQuery {
-
-    @Override
-    public String toString() {
-        return (new SimpleStringQuerySerializer()).serialize(this);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleBasicGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleBasicGraphPattern.java
deleted file mode 100644
index 6b8916b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleBasicGraphPattern.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.sparql.query.BasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-
-/**
- *
- * @author hasan
- */
-public class SimpleBasicGraphPattern implements BasicGraphPattern {
-
-    private Set<TriplePattern> triplePatterns;
-
-    public SimpleBasicGraphPattern(Set<TriplePattern> triplePatterns) {
-        this.triplePatterns = (triplePatterns == null)
-                ? new LinkedHashSet<TriplePattern>()
-                : triplePatterns;
-    }
-
-    @Override
-    public Set<TriplePattern> getTriplePatterns() {
-        return triplePatterns;
-    }
-
-    public void addTriplePatterns(Set<TriplePattern> triplePatterns) {
-        this.triplePatterns.addAll(triplePatterns);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleConstructQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleConstructQuery.java
deleted file mode 100644
index 19ef5aa..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleConstructQuery.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-
-/**
- *
- * @author hasan
- */
-public class SimpleConstructQuery extends SimpleQueryWithSolutionModifier
-        implements ConstructQuery {
-
-    private Set<TriplePattern> triplePatterns;
-
-    public SimpleConstructQuery(Set<TriplePattern> triplePatterns) {
-        this.triplePatterns = (triplePatterns == null)
-                ? new LinkedHashSet<TriplePattern>()
-                : triplePatterns;
-    }
-
-    @Override
-    public Set<TriplePattern> getConstructTemplate() {
-        return triplePatterns;
-    }
-
-    @Override
-    public String toString() {
-        return (new SimpleStringQuerySerializer()).serialize(this);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDataSet.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDataSet.java
deleted file mode 100644
index 354f5b0..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDataSet.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.DataSet;
-
-/**
- *
- * @author hasan
- */
-public class SimpleDataSet implements DataSet {
-    private Set<IRI> defaultGraphs = new HashSet<IRI>();
-    private Set<IRI> namedGraphs = new HashSet<IRI>();
-
-    @Override
-    public Set<IRI> getDefaultGraphs() {
-        return defaultGraphs;
-    }
-
-    @Override
-    public Set<IRI> getNamedGraphs() {
-        return namedGraphs;
-    }
-
-    public void addDefaultGraph(IRI defaultGraph) {
-        defaultGraphs.add(defaultGraph);
-    }
-
-    public void addNamedGraph(IRI namedGraph) {
-        namedGraphs.add(namedGraph);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDescribeQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDescribeQuery.java
deleted file mode 100644
index 9faba61..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleDescribeQuery.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleDescribeQuery extends SimpleQueryWithSolutionModifier
-        implements DescribeQuery {
-
-    private boolean describeAll;
-    private List<ResourceOrVariable> resourcesToDescribe =
-            new ArrayList<ResourceOrVariable>();
-
-    @Override
-    public boolean isDescribeAll() {
-        return describeAll;
-    }
-
-    @Override
-    public List<ResourceOrVariable> getResourcesToDescribe() {
-        return resourcesToDescribe;
-    }
-
-    public void setDescribeAll() {
-        assert resourcesToDescribe.isEmpty();
-        describeAll = true;
-    }
-
-    public void addResourceToDescribe(ResourceOrVariable node) {
-        resourcesToDescribe.add(node);
-    }
-
-    @Override
-    public String toString() {
-        return (new SimpleStringQuerySerializer()).serialize(this);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGraphGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGraphGraphPattern.java
deleted file mode 100644
index 45badaa..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGraphGraphPattern.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.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.GraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleGraphGraphPattern implements GraphGraphPattern {
-
-    private UriRefOrVariable ImmutableGraph;
-    private GroupGraphPattern groupGraphPattern;
-
-    public SimpleGraphGraphPattern(UriRefOrVariable ImmutableGraph,
-            GroupGraphPattern groupGraphPattern) {
-        if (ImmutableGraph == null) {
-            throw new IllegalArgumentException("ImmutableGraph may not be null");
-        }
-        if (groupGraphPattern == null) {
-            throw new IllegalArgumentException("Group ImmutableGraph Pattern may not be null");
-        }
-        this.ImmutableGraph = ImmutableGraph;
-        this.groupGraphPattern = groupGraphPattern;
-    }
-
-    @Override
-    public UriRefOrVariable getGraph() {
-        return ImmutableGraph;
-    }
-
-    @Override
-    public GroupGraphPattern getGroupGraphPattern() {
-        return groupGraphPattern;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGroupGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGroupGraphPattern.java
deleted file mode 100644
index cd893d2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleGroupGraphPattern.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.GraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.MinusGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OptionalGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.PathSupportedBasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathPattern;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-
-/**
- * This class implements {@link GroupGraphPattern}.
- *
- * @author hasan
- */
-public class SimpleGroupGraphPattern implements GroupGraphPattern {
-
-	private List<Expression> constraints = new ArrayList<Expression>();
-	private List<GraphPattern> graphPatterns = new ArrayList<GraphPattern>();
-    private SelectQuery subSelect = null;
-    private boolean lastBasicGraphPatternIsComplete = true;
-
-    @Override
-    public boolean isSubSelect() {
-        return subSelect != null;
-    }
-
-    @Override
-    public SelectQuery getSubSelect() {
-        return subSelect;
-    }
-
-    @Override
-	public Set<GraphPattern> getGraphPatterns() {
-		return subSelect == null ? new LinkedHashSet(graphPatterns) : null;
-	}
-
-	@Override
-	public List<Expression> getFilter() {
-		return subSelect == null ? constraints : null;
-	}
-
-    public void setSubSelect(SelectQuery subSelect) {
-        this.subSelect = subSelect;
-    }
-
-    /**
-	 * Adds a {@link GraphPattern} to the group.
-	 *
-	 * @param graphPattern
-	 *		the GraphPattern to be added.
-	 */
-	public void addGraphPattern(GraphPattern graphPattern) {
-        subSelect = null;
-        graphPatterns.add(graphPattern);
-        lastBasicGraphPatternIsComplete =
-                !(graphPattern instanceof BasicGraphPattern || graphPattern instanceof PathSupportedBasicGraphPattern);
-	}
-
-	/**
-	 * Adds a constraint to the {@link GroupGraphPattern}.
-	 *
-	 * @param constraint
-	 *		an {@link Expression} as the constraint to be added.
-	 */
-	public void addConstraint(Expression constraint) {
-        subSelect = null;
-		constraints.add(constraint);
-	}
-
-    public void endLastBasicGraphPattern() {
-        lastBasicGraphPatternIsComplete = true;
-    }
-
-    /**
-	 * If the last {@link GraphPattern} added to the group is not a 
-	 * {@link SimplePathSupportedBasicGraphPattern}, then creates one containing the 
-	 * specified {@link PropertyPathPattern}s and adds it to the group.
-	 * Otherwise, adds the specified {@link PropertyPathPattern}s to the last
-	 * added {@link SimplePathSupportedBasicGraphPattern} in the group.
-	 * 
-	 * @param propertyPathPatterns
-	 *		a set of {@link PropertyPathPattern}s to be added into a 
-	 *		{@link SimplePathSupportedBasicGraphPattern} of the group.
-	 */
-	public void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns) {
-        subSelect = null;
-        if (lastBasicGraphPatternIsComplete) {
-            graphPatterns.add(new SimplePathSupportedBasicGraphPattern(propertyPathPatterns));
-            lastBasicGraphPatternIsComplete = false;
-        } else {
-            GraphPattern prevGraphPattern;
-        	int size = graphPatterns.size();
-			prevGraphPattern = graphPatterns.get(size-1);
-            if (prevGraphPattern instanceof SimplePathSupportedBasicGraphPattern) {
-                ((SimplePathSupportedBasicGraphPattern) prevGraphPattern).addPropertyPathPatterns(propertyPathPatterns);
-            }
-        }
-	}
-
-	/**
-	 * If the last {@link GraphPattern} added to the group is not a 
-	 * {@link SimpleBasicGraphPattern}, then creates one containing the 
-	 * specified {@link TriplePattern}s and adds it to the group.
-	 * Otherwise, adds the specified {@link TriplePattern}s to the last
-	 * added {@link SimpleBasicGraphPattern} in the group.
-	 * 
-	 * @param triplePatterns
-	 *		a set of {@link TriplePattern}s to be added into a 
-	 *		{@link SimpleBasicGraphPattern} of the group.
-	 */
-	public void addTriplePatterns(Set<TriplePattern> triplePatterns) {
-        subSelect = null;
-        GraphPattern prevGraphPattern;
-		int size = graphPatterns.size();
-		if (!lastBasicGraphPatternIsComplete && (size > 0)) {
-			prevGraphPattern = graphPatterns.get(size-1);
-			if (prevGraphPattern instanceof SimpleBasicGraphPattern) {
-				((SimpleBasicGraphPattern) prevGraphPattern)
-						.addTriplePatterns(triplePatterns);
-				return;
-			}
-		}
-		graphPatterns.add(new SimpleBasicGraphPattern(triplePatterns));
-        lastBasicGraphPatternIsComplete = false;
-	}
-
-	/**
-	 * Adds an {@link OptionalGraphPattern} to the group consisting of
-	 * a main ImmutableGraph pattern and the specified {@link GroupGraphPattern} as
-	 * the optional pattern.
-	 * The main ImmutableGraph pattern is taken from the last added {@link GraphPattern}
-	 * in the group, if it exists. Otherwise, the main ImmutableGraph pattern is null.
-	 *
-	 * @param optional
-	 *		a {@link GroupGraphPattern} as the optional pattern of
-	 *		an {@link OptionalGraphPattern}.
-	 */
-	public void addOptionalGraphPattern(GroupGraphPattern optional) {
-        subSelect = null;
-		GraphPattern prevGraphPattern = null;
-		int size = graphPatterns.size();
-		if (size > 0) {
-			prevGraphPattern = graphPatterns.remove(size-1);
-		}
-		graphPatterns.add(new SimpleOptionalGraphPattern(prevGraphPattern, optional));
-        lastBasicGraphPatternIsComplete = true;
-	}
-
-    public void addMinusGraphPattern(GroupGraphPattern subtrahend) {
-        subSelect = null;
-		GraphPattern prevGraphPattern = null;
-		int size = graphPatterns.size();
-		if (size > 0) {
-			prevGraphPattern = graphPatterns.remove(size-1);
-		}
-		graphPatterns.add(new SimpleMinusGraphPattern(prevGraphPattern, subtrahend));
-        lastBasicGraphPatternIsComplete = true;
-	}
-
-    @Override
-    public Set<IRI> getReferredGraphs() {
-        Set<IRI> referredGraphs = new HashSet<IRI>();
-        if (subSelect != null) {
-            GroupGraphPattern queryPattern = subSelect.getQueryPattern();
-            referredGraphs.addAll(queryPattern.getReferredGraphs());
-        } else {
-            for (GraphPattern graphPattern : graphPatterns) {
-                referredGraphs.addAll(getReferredGraphs(graphPattern));
-            }
-        }
-        return referredGraphs;
-    }
-
-    private Set<IRI> getReferredGraphs(GraphPattern graphPattern) {
-        Set<IRI> referredGraphs = new HashSet<IRI>();
-        if (graphPattern instanceof GraphGraphPattern) {
-            GraphGraphPattern graphGraphPattern = (GraphGraphPattern) graphPattern;
-            UriRefOrVariable ImmutableGraph = graphGraphPattern.getGraph();
-            if (!ImmutableGraph.isVariable()) {
-                referredGraphs.add(ImmutableGraph.getResource());
-            }
-            referredGraphs.addAll(graphGraphPattern.getGroupGraphPattern().getReferredGraphs());
-        } else if (graphPattern instanceof AlternativeGraphPattern) {
-            List<GroupGraphPattern> alternativeGraphPatterns =
-                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
-            for (GroupGraphPattern groupGraphPattern : alternativeGraphPatterns) {
-                referredGraphs.addAll(groupGraphPattern.getReferredGraphs());
-            }
-        } else if (graphPattern instanceof OptionalGraphPattern) {
-            GraphPattern mainGraphPattern = ((OptionalGraphPattern) graphPattern).getMainGraphPattern();
-            referredGraphs.addAll(getReferredGraphs(mainGraphPattern));
-            GroupGraphPattern optionalGraphPattern = ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern();
-            referredGraphs.addAll(optionalGraphPattern.getReferredGraphs());
-        } else if (graphPattern instanceof MinusGraphPattern) {
-            GraphPattern minuendGraphPattern = ((MinusGraphPattern) graphPattern).getMinuendGraphPattern();
-            referredGraphs.addAll(getReferredGraphs(minuendGraphPattern));
-            GroupGraphPattern subtrahendGraphPattern = ((MinusGraphPattern) graphPattern).getSubtrahendGraphPattern();
-            referredGraphs.addAll(subtrahendGraphPattern.getReferredGraphs());
-        } else if (graphPattern instanceof GroupGraphPattern) {
-            GroupGraphPattern groupGraphPattern = (GroupGraphPattern) graphPattern;
-            referredGraphs.addAll(groupGraphPattern.getReferredGraphs());
-        }
-        return referredGraphs;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleInlineData.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleInlineData.java
deleted file mode 100644
index 3b49f02..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleInlineData.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.rdf.core.sparql.query.InlineData;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleInlineData implements InlineData {
-
-    private List<Variable> variables = new ArrayList<Variable>();
-    private List<List<RDFTerm>> values = new ArrayList<List<RDFTerm>>();
-
-    @Override
-    public List<Variable> getVariables() {
-        return variables;
-    }
-
-    @Override
-    public List<List<RDFTerm>> getValues() {
-        return values;
-    }
-
-    public void addVariable(Variable variable) {
-        variables.add(variable);
-    }
-
-    public void addValues(List<RDFTerm> values) {
-        this.values.add(values);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleMinusGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleMinusGraphPattern.java
deleted file mode 100644
index 951b9ec..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleMinusGraphPattern.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.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.MinusGraphPattern;
-
-/**
- * This class implements {@link MinusGraphPattern}.
- *
- * @author hasan
- */
-public class SimpleMinusGraphPattern implements MinusGraphPattern {
-
-    private GraphPattern minuendGraphPattern;
-    private GroupGraphPattern subtrahendGraphPattern;
-
-    /**
-     * Constructs a {@link MinusGraphPattern} out of a {@link GraphPattern}
-     * as the minuend ImmutableGraph pattern and a {@link GroupGraphPattern} as the 
-     * subtrahend pattern.
-     * 
-     * @param minuendGraphPattern
-     *        a {@link GraphPattern} specifying the minuend pattern.
-     * @param subtrahendGraphPattern
-     *        a {@link GroupGraphPattern} specifying the subtrahend pattern.
-     */
-    public SimpleMinusGraphPattern(GraphPattern minuendGraphPattern, GroupGraphPattern subtrahendGraphPattern) {
-        if (subtrahendGraphPattern == null) {
-            throw new IllegalArgumentException("Subtrahend ImmutableGraph pattern may not be null");
-        }
-        if (minuendGraphPattern == null) {
-            this.minuendGraphPattern = new SimpleGroupGraphPattern();
-        } else {
-            this.minuendGraphPattern = minuendGraphPattern;
-        }
-        this.subtrahendGraphPattern = subtrahendGraphPattern;
-    }
-
-    @Override
-    public GraphPattern getMinuendGraphPattern() {
-        return minuendGraphPattern;
-    }
-
-    @Override
-    public GroupGraphPattern getSubtrahendGraphPattern() {
-        return subtrahendGraphPattern;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOptionalGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOptionalGraphPattern.java
deleted file mode 100644
index 64abd73..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOptionalGraphPattern.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OptionalGraphPattern;
-
-/**
- * This class implements {@link OptionalGraphPattern}.
- *
- * @author hasan
- */
-public class SimpleOptionalGraphPattern implements OptionalGraphPattern {
-
-    private GraphPattern mainGraphPattern;
-    private GroupGraphPattern optionalGraphPattern;
-
-    /**
-     * Constructs an {@link OptionalGraphPattern} out of a {@link GraphPattern}
-     * as the main ImmutableGraph pattern and a {@link GroupGraphPattern} as the 
-     * optional pattern.
-     * 
-     * @param mainGraphPattern
-     *        a {@link GraphPattern} specifying the main pattern.
-     * @param optionalGraphPattern
-     *        a {@link GroupGraphPattern} specifying the optional pattern.
-     */
-    public SimpleOptionalGraphPattern(GraphPattern mainGraphPattern,
-            GroupGraphPattern optionalGraphPattern) {
-        if (optionalGraphPattern == null) {
-            throw new IllegalArgumentException("Optional ImmutableGraph pattern may not be null");
-        }
-        if (mainGraphPattern == null) {
-            this.mainGraphPattern = new SimpleGroupGraphPattern();
-        } else {
-            this.mainGraphPattern = mainGraphPattern;
-        }
-        this.optionalGraphPattern = optionalGraphPattern;
-    }
-
-    @Override
-    public GraphPattern getMainGraphPattern() {
-        return mainGraphPattern;
-    }
-
-    @Override
-    public GroupGraphPattern getOptionalGraphPattern() {
-        return optionalGraphPattern;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOrderCondition.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOrderCondition.java
deleted file mode 100644
index c6b5fba..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleOrderCondition.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.OrderCondition;
-
-/**
- *
- * @author hasan
- */
-public class SimpleOrderCondition implements OrderCondition {
-    private Expression expression;
-    private boolean ascending;
-
-    public SimpleOrderCondition(Expression expression, boolean ascending) {
-        this.expression = expression;
-        this.ascending = ascending;
-    }
-
-    @Override
-    public Expression getExpression() {
-        return expression;
-    }
-
-    @Override
-    public boolean isAscending() {
-        return ascending;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java
deleted file mode 100644
index 37711d6..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.sparql.query.PathSupportedBasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathPattern;
-
-/**
- *
- * @author hasan
- */
-public class SimplePathSupportedBasicGraphPattern implements PathSupportedBasicGraphPattern {
-
-    private Set<PropertyPathPattern> propertyPathPatterns;
-
-    public SimplePathSupportedBasicGraphPattern(Set<PropertyPathPattern> propertyPathPatterns) {
-        this.propertyPathPatterns = (propertyPathPatterns == null)
-                ? new LinkedHashSet<PropertyPathPattern>()
-                : propertyPathPatterns;
-    }
-
-    @Override
-    public Set<PropertyPathPattern> getPropertyPathPatterns() {
-        return propertyPathPatterns;
-    }
-
-    public void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns) {
-        this.propertyPathPatterns.addAll(propertyPathPatterns);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePropertyPathPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePropertyPathPattern.java
deleted file mode 100644
index 36ed721..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimplePropertyPathPattern.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathExpression;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathExpressionOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathPattern;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-
-/**
- *
- * @author hasan
- */
-public class SimplePropertyPathPattern implements PropertyPathPattern {
-
-    private ResourceOrVariable subject;
-    private PropertyPathExpressionOrVariable propertyPathExpression;
-    private ResourceOrVariable object;
-
-    public SimplePropertyPathPattern(ResourceOrVariable subject,
-            PropertyPathExpressionOrVariable propertyPathExpression,
-            ResourceOrVariable object) {
-        if (subject == null) {
-            throw new IllegalArgumentException("Invalid subject: null");
-        }
-        if (propertyPathExpression == null) {
-            throw new IllegalArgumentException("Invalid property path expression: null");
-        }
-        if (object == null) {
-            throw new IllegalArgumentException("Invalid object: null");
-        }
-        this.subject = subject;
-        this.propertyPathExpression = propertyPathExpression;
-        this.object = object;
-    }
-
-    public SimplePropertyPathPattern(Variable subject, Variable propertyPathExpression, Variable object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(BlankNodeOrIRI subject, Variable propertyPathExpression, Variable object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(Variable subject, Variable propertyPathExpression, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(BlankNodeOrIRI subject, Variable propertyPathExpression, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(Variable subject, PropertyPathExpression propertyPathExpression, Variable object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(BlankNodeOrIRI subject, PropertyPathExpression propertyPathExpression, Variable object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(Variable subject, PropertyPathExpression propertyPathExpression, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    public SimplePropertyPathPattern(BlankNodeOrIRI subject, PropertyPathExpression propertyPathExpression, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
-                new ResourceOrVariable(object));
-    }
-
-    @Override
-    public ResourceOrVariable getSubject() {
-        return subject;
-    }
-
-    @Override
-    public PropertyPathExpressionOrVariable getPropertyPathExpression() {
-        return propertyPathExpression;
-    }
-
-    @Override
-    public ResourceOrVariable getObject() {
-        return object;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof PropertyPathPattern)) {
-            return false;
-        }
-        final PropertyPathPattern other = (PropertyPathPattern) obj;
-        if (!this.subject.equals(other.getSubject())) {
-            return false;
-        }
-        if (!this.propertyPathExpression.equals(other.getPropertyPathExpression())) {
-            return false;
-        }
-        if (!this.object.equals(other.getObject())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return (subject.hashCode() >> 1) ^ propertyPathExpression.hashCode() ^ (object.hashCode() << 1);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQuery.java
deleted file mode 100644
index 7f8407b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQuery.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.DataSet;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.InlineData;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-
-/**
- *
- * @author hasan
- */
-public abstract class SimpleQuery implements Query {
-
-    private SimpleDataSet dataSet = null;
-    private GroupGraphPattern queryPattern = null;
-    private InlineData inlineData = null;
-
-    @Override
-    public DataSet getDataSet() {
-        return dataSet;
-    }
-
-    @Override
-    public GroupGraphPattern getQueryPattern() {
-        return queryPattern;
-    }
-
-    @Override
-    public InlineData getInlineData() {
-        return inlineData;
-    }
-
-    public void addDefaultGraph(IRI defaultGraph) {
-        if (dataSet == null) {
-            dataSet = new SimpleDataSet();
-        }
-        dataSet.addDefaultGraph(defaultGraph);
-    }
-
-    public void addNamedGraph(IRI namedGraph) {
-        if (dataSet == null) {
-            dataSet = new SimpleDataSet();
-        }
-        dataSet.addNamedGraph(namedGraph);
-    }
-
-    public void setQueryPattern(GroupGraphPattern queryPattern) {
-        this.queryPattern = queryPattern;
-    }
-
-    public void setInlineData(InlineData inlineData) {
-        this.inlineData = inlineData;
-    }
-
-    @Override
-    public abstract String toString();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQueryWithSolutionModifier.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQueryWithSolutionModifier.java
deleted file mode 100644
index eeb758f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleQueryWithSolutionModifier.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.OrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.QueryWithSolutionModifier;
-
-/**
- *
- * @author hasan
- */
-public abstract class SimpleQueryWithSolutionModifier extends SimpleQuery
-        implements QueryWithSolutionModifier {
-
-    private List<Expression> groupConditions = new ArrayList<Expression>();
-    private List<Expression> havingConditions = new ArrayList<Expression>();
-    private List<OrderCondition> orderConditions = new ArrayList<OrderCondition>();
-
-    /**
-     * Result offset. 0 means no offset.
-     */
-    private int offset = 0;
-
-    /**
-     * Result limit. -1 means no limit.
-     */
-    private int limit = -1;
-
-    @Override
-    public List<Expression> getGroupConditions() {
-        return groupConditions;
-    }
-
-    @Override
-    public List<Expression> getHavingConditions() {
-        return havingConditions;
-    }
-
-    @Override
-    public List<OrderCondition> getOrderConditions() {
-        return orderConditions;
-    }
-
-    @Override
-    public int getOffset() {
-        return offset;
-    }
-
-    @Override
-    public int getLimit() {
-        return limit;
-    }
-
-    public void addGroupCondition(Expression groupCondition) {
-        groupConditions.add(groupCondition);
-    }
-
-    public void addHavingCondition(Expression havingCondition) {
-        havingConditions.add(havingCondition);
-    }
-
-    public void addOrderCondition(OrderCondition orderCondition) {
-        orderConditions.add(orderCondition);
-    }
-
-    public void setOffset(int offset) {
-        this.offset = offset;
-    }
-
-    public void setLimit(int limit) {
-        this.limit = limit;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSelectQuery.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSelectQuery.java
deleted file mode 100644
index f71e1a8..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSelectQuery.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleSelectQuery extends SimpleQueryWithSolutionModifier
-        implements SelectQuery {
-
-    private boolean distinct;
-    private boolean reduced;
-    private boolean selectAll;
-    private List<Variable> variables = new ArrayList<Variable>();
-
-    @Override
-    public boolean isDistinct() {
-        return distinct;
-    }
-
-    @Override
-    public boolean isReduced() {
-        return reduced;
-    }
-
-    @Override
-    public boolean isSelectAll() {
-        return selectAll;
-    }
-
-    @Override
-    public List<Variable> getSelection() {
-        return variables;
-    }
-
-    public void setDistinct() {
-        distinct = true;
-    }
-
-    public void setReduced() {
-        reduced = true;
-    }
-
-    public void setSelectAll() {
-        assert variables.isEmpty();
-        selectAll = true;
-    }
-
-    public void addSelection(Variable var) {
-        variables.add(var);
-    }
-
-    @Override
-    public String toString() {
-        return (new SimpleStringQuerySerializer()).serialize(this);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleServiceGraphPattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleServiceGraphPattern.java
deleted file mode 100644
index 24d6797..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleServiceGraphPattern.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.ServiceGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleServiceGraphPattern implements ServiceGraphPattern {
-
-    private UriRefOrVariable service;
-    private GroupGraphPattern groupGraphPattern;
-    private boolean silent;
-
-    public SimpleServiceGraphPattern(UriRefOrVariable service,
-            GroupGraphPattern groupGraphPattern) {
-        if (service == null) {
-            throw new IllegalArgumentException("Service endpoint may not be null");
-        }
-        if (groupGraphPattern == null) {
-            throw new IllegalArgumentException("Group ImmutableGraph Pattern may not be null");
-        }
-        this.service = service;
-        this.groupGraphPattern = groupGraphPattern;
-        this.silent = false;
-    }
-
-    @Override
-    public UriRefOrVariable getService() {
-        return service;
-    }
-
-    @Override
-    public GroupGraphPattern getGroupGraphPattern() {
-        return groupGraphPattern;
-    }
-
-    public void setSilent(boolean silent) {
-        this.silent = silent;
-    }
-
-    public boolean isSilent() {
-        return silent;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSparqlUnit.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSparqlUnit.java
deleted file mode 100644
index 60e88c4..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleSparqlUnit.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SparqlUnit;
-import org.apache.clerezza.rdf.core.sparql.update.Update;
-
-/**
- *
- * @author hasan
- */
-public class SimpleSparqlUnit implements SparqlUnit {
-
-    private final Query query;
-	private final Update update;
-
-	public SimpleSparqlUnit(Query query) {
-		if (query == null) {
-			throw new IllegalArgumentException("Invalid query: null");
-		}
-		this.query = query;
-		update = null;
-	}
-
-	public SimpleSparqlUnit(Update update) {
-		if (update == null) {
-			throw new IllegalArgumentException("Invalid update: null");
-		}
-		this.update = update;
-		query = null;
-	}
-
-
-    @Override
-    public boolean isQuery() {
-        return update == null;
-    }
-
-    @Override
-    public Query getQuery() {
-        return query;
-    }
-
-    @Override
-    public Update getUpdate() {
-        return update;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleStringQuerySerializer.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleStringQuerySerializer.java
deleted file mode 100644
index 18266f6..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleStringQuerySerializer.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.StringQuerySerializer;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.BasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BinaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.BuiltInCall;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.DataSet;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.FunctionCall;
-import org.apache.clerezza.rdf.core.sparql.query.GraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.LiteralExpression;
-import org.apache.clerezza.rdf.core.sparql.query.OptionalGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UnaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefExpression;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class implements abstract methods of {@link StringQuerySerializer}
- * to serialize specific {@link Query} types.
- *
- * @author hasan
- */
-public class SimpleStringQuerySerializer extends StringQuerySerializer {
-
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    @Override
-    public String serialize(SelectQuery selectQuery) {
-        StringBuffer s = new StringBuffer("SELECT ");
-        if (selectQuery.isDistinct()) {
-            s.append("DISTINCT\n");
-        }
-        if (selectQuery.isReduced()) {
-            s.append("REDUCED\n");
-        }
-        if (selectQuery.isSelectAll()) {
-            s.append("*");
-        } else {
-            for (Variable v : selectQuery.getSelection()) {
-                appendVariable(s, v);
-                s.append(" ");
-            }
-        }
-        s.append("\n");
-
-        appendDataSet(s, (SimpleQuery) selectQuery);
-        appendWhere(s, (SimpleQuery) selectQuery);
-        appendModifier(s, (SimpleQueryWithSolutionModifier) selectQuery);
-
-        return s.toString();
-    }
-
-    private void appendVariable(StringBuffer s, Variable v) {
-        s.append("?").append(v.getName());
-    }
-
-    private void appendDataSet(StringBuffer s, SimpleQuery q) {
-        DataSet dataSet = q.getDataSet();
-        if (dataSet != null) {
-            for (IRI dg : dataSet.getDefaultGraphs()) {
-                s.append("FROM ").append(dg.toString()).append("\n");
-            }
-            for (IRI ng : dataSet.getNamedGraphs()) {
-                s.append("FROM NAMED ").append(ng.toString()).append("\n");
-            }
-        }
-    }
-
-    private void appendWhere(StringBuffer s, SimpleQuery q) {
-        GroupGraphPattern queryPattern = q.getQueryPattern();
-        if (queryPattern == null) {
-            return;
-        }
-        s.append("WHERE\n");
-        appendGroupGraphPattern(s, q.getQueryPattern());
-    }
-
-    private void appendGroupGraphPattern(StringBuffer s,
-            GroupGraphPattern groupGraphPattern) {
-
-        s.append("{ ");
-        for (GraphPattern graphPattern : groupGraphPattern.getGraphPatterns()) {
-            appendGraphPattern(s, graphPattern);
-        }
-        for (Expression e : groupGraphPattern.getFilter()) {
-            boolean brackettedExpr = !((e instanceof BuiltInCall)
-                    || (e instanceof FunctionCall));
-            s.append("FILTER ");
-            if (brackettedExpr) {
-                s.append("(");
-            }
-            appendExpression(s, e);
-            if (brackettedExpr) {
-                s.append(")");
-            }
-            s.append("\n");
-        }
-        s.append("} ");
-    }
-
-    private void appendGraphPattern(StringBuffer s, GraphPattern graphPattern) {
-        if (graphPattern instanceof BasicGraphPattern) {
-            appendTriplePatterns(s,
-                    ((BasicGraphPattern) graphPattern).getTriplePatterns());
-        } else if (graphPattern instanceof GroupGraphPattern) {
-            appendGroupGraphPattern(s, (GroupGraphPattern) graphPattern);
-        } else if (graphPattern instanceof OptionalGraphPattern) {
-            appendGraphPattern(s,
-                    ((OptionalGraphPattern) graphPattern).getMainGraphPattern());
-            s.append(" OPTIONAL ");
-            appendGroupGraphPattern(s,
-                    ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern());
-        } else if (graphPattern instanceof AlternativeGraphPattern) {
-            List<GroupGraphPattern> alternativeGraphPatterns =
-                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
-            if ((alternativeGraphPatterns != null) &&
-                    (!alternativeGraphPatterns.isEmpty())) {
-                appendGroupGraphPattern(s, alternativeGraphPatterns.get(0));
-                int size = alternativeGraphPatterns.size();
-                int i = 1;
-                while (i < size) {
-                    s.append(" UNION ");
-                    appendGroupGraphPattern(s, alternativeGraphPatterns.get(i));
-                    i++;
-                }
-            }
-        } else if (graphPattern instanceof GraphGraphPattern) {
-            s.append("ImmutableGraph ");
-            appendResourceOrVariable(s, ((GraphGraphPattern) graphPattern).getGraph());
-            s.append(" ");
-            appendGroupGraphPattern(s, ((GraphGraphPattern) graphPattern).getGroupGraphPattern());
-        } else {
-            logger.warn("Unsupported GraphPattern {}", graphPattern.getClass());
-        }
-    }
-
-    private void appendTriplePatterns(StringBuffer s,
-            Set<TriplePattern> triplePatterns) {
-
-        for (TriplePattern p : triplePatterns) {
-            appendResourceOrVariable(s, p.getSubject());
-            s.append(" ");
-            appendResourceOrVariable(s, p.getPredicate());
-            s.append(" ");
-            appendResourceOrVariable(s, p.getObject());
-            s.append(" .\n");
-        }
-    }
-
-    private void appendResourceOrVariable(StringBuffer s, ResourceOrVariable n) {
-        if (n.isVariable()) {
-            appendVariable(s, n.getVariable());
-        } else {
-            RDFTerm r = n.getResource();
-            if (r instanceof BlankNode) {
-                s.append("_:").append(r.toString().replace("@", "."));
-            } else {
-                s.append(r.toString());
-            }
-        }
-    }
-
-    private void appendExpression(StringBuffer s, Expression e) {
-        if (e instanceof Variable) {
-            appendVariable(s, (Variable) e);
-        } else if (e instanceof BinaryOperation) {
-            BinaryOperation bo = (BinaryOperation) e;
-            s.append("(");
-            appendExpression(s, bo.getLhsOperand());
-            s.append(") ").append(bo.getOperatorString()).append(" (");
-            appendExpression(s, bo.getRhsOperand());
-            s.append(")");
-        } else if (e instanceof UnaryOperation) {
-            UnaryOperation uo = (UnaryOperation) e;
-            s.append(uo.getOperatorString()).append(" (");
-            appendExpression(s, uo.getOperand());
-            s.append(")");
-        } else if (e instanceof BuiltInCall) {
-            BuiltInCall b = (BuiltInCall) e;
-            appendCall(s, b.getName(), b.getArguements());
-        } else if (e instanceof FunctionCall) {
-            FunctionCall f = (FunctionCall) e;
-            appendCall(s, f.getName().getUnicodeString(), f.getArguements());
-        } else if (e instanceof LiteralExpression) {
-            appendLiteralExpression(s, (LiteralExpression) e);
-        } else if (e instanceof UriRefExpression) {
-            s.append(((UriRefExpression) e).getUriRef().toString());
-        }
-    }
-
-    private void appendCall(StringBuffer s, String name, List<Expression> expr) {
-        s.append(name).append("(");
-        for (Expression e : expr) {
-            appendExpression(s, e);
-            s.append(",");
-        }
-        if (expr.isEmpty()) {
-            s.append(")");
-        } else {
-            s.setCharAt(s.length()-1, ')');
-        }
-    }
-
-    private void appendLiteralExpression(StringBuffer s, LiteralExpression le) {
-        s.append(le.getLiteral().toString());
-    }
-
-    private void appendModifier(StringBuffer s, SimpleQueryWithSolutionModifier q) {
-        List<OrderCondition> orderConditions = q.getOrderConditions();
-        if ((orderConditions != null) && (!orderConditions.isEmpty())) {
-            s.append("ORDER BY ");
-            for (OrderCondition oc : orderConditions) {
-                appendOrderCondition(s, oc);
-                s.append("\n");
-            }
-        }
-        if (q.getOffset() > 0) {
-            s.append("OFFSET ").append(q.getOffset()).append("\n");
-        }
-        if (q.getLimit() >= 0) {
-            s.append("LIMIT ").append(q.getLimit()).append("\n");
-        }
-    }
-
-    private void appendOrderCondition(StringBuffer s, OrderCondition oc) {
-        if (!oc.isAscending()) {
-            s.append("DESC(");
-        }
-        appendExpression(s, oc.getExpression());
-        if (!oc.isAscending()) {
-            s.append(")");
-        }
-        s.append(" ");
-    }
-
-    @Override
-    public String serialize(ConstructQuery constructQuery) {
-        StringBuffer s = new StringBuffer("CONSTRUCT\n");
-        Set<TriplePattern> triplePatterns = constructQuery.getConstructTemplate();
-        s.append("{ ");
-        if (triplePatterns != null && !triplePatterns.isEmpty()) {
-            appendTriplePatterns(s, triplePatterns);
-        }
-        s.append("}\n");
-
-        appendDataSet(s, (SimpleQuery) constructQuery);
-        appendWhere(s, (SimpleQuery) constructQuery);
-        appendModifier(s, (SimpleQueryWithSolutionModifier) constructQuery);
-
-        return s.toString();
-    }
-
-    @Override
-    public String serialize(DescribeQuery describeQuery) {
-        StringBuffer s = new StringBuffer("DESCRIBE\n");
-
-        if (describeQuery.isDescribeAll()) {
-            s.append("*");
-        } else {
-            for (ResourceOrVariable n : describeQuery.getResourcesToDescribe()) {
-                appendResourceOrVariable(s, n);
-                s.append(" ");
-            }
-        }
-        appendDataSet(s, (SimpleQuery) describeQuery);
-        appendWhere(s, (SimpleQuery) describeQuery);
-        appendModifier(s, (SimpleQueryWithSolutionModifier) describeQuery);
-
-        return s.toString();
-    }
-
-    @Override
-    public String serialize(AskQuery askQuery) {
-        StringBuffer s = new StringBuffer("ASK\n");
-        appendDataSet(s, (SimpleQuery) askQuery);
-        appendWhere(s, (SimpleQuery) askQuery);
-
-        return s.toString();
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleTriplePattern.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleTriplePattern.java
deleted file mode 100644
index adad648..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/query/impl/SimpleTriplePattern.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.query.impl;
-
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-
-/**
- *
- * @author hasan
- */
-public class SimpleTriplePattern implements TriplePattern {
-
-    private ResourceOrVariable subject;
-    private UriRefOrVariable predicate;
-    private ResourceOrVariable object;
-
-    public SimpleTriplePattern(ResourceOrVariable subject,
-            UriRefOrVariable predicate,
-            ResourceOrVariable object) {
-        if (subject == null) {
-            throw new IllegalArgumentException("Invalid subject: null");
-        }
-        if (predicate == null) {
-            throw new IllegalArgumentException("Invalid predicate: null");
-        }
-        if (object == null) {
-            throw new IllegalArgumentException("Invalid object: null");
-        }
-        this.subject = subject;
-        this.predicate = predicate;
-        this.object = object;
-    }
-
-    public SimpleTriplePattern(Variable subject, Variable predicate, Variable object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(BlankNodeOrIRI subject, Variable predicate, Variable object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(Variable subject, IRI predicate, Variable object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(BlankNodeOrIRI subject, IRI predicate, Variable object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(Variable subject, Variable predicate, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(BlankNodeOrIRI subject, Variable predicate, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(Variable subject, IRI predicate, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    public SimpleTriplePattern(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
-                new ResourceOrVariable(object));
-    }
-
-    @Override
-    public ResourceOrVariable getSubject() {
-        return subject;
-    }
-
-    @Override
-    public UriRefOrVariable getPredicate() {
-        return predicate;
-    }
-
-    @Override
-    public ResourceOrVariable getObject() {
-        return object;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof TriplePattern)) {
-            return false;
-        }
-        final TriplePattern other = (TriplePattern) obj;
-        if (!this.subject.equals(other.getSubject())) {
-            return false;
-        }
-        if (!this.predicate.equals(other.getPredicate())) {
-            return false;
-        }
-        if (!this.object.equals(other.getObject())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return (subject.hashCode() >> 1) ^ subject.hashCode() ^ (subject.hashCode() << 1);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/Update.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/Update.java
deleted file mode 100644
index 944f3b9..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/Update.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-
-/**
- * <p>This interface represents a SPARQL Update.</p>
- *
- * @author hasan
- */
-public interface Update {
-
-    /**
-     * 
-     * @param defaultGraph
-     *      if default graph is referred either implicitly or explicitly in a SPARQL {@link Update}
-     *      the specified defaultGraph should be returned in the resulting set.
-     * @param tcProvider
-     *      the specified tcProvider is used to get the named graphs referred in the SPARQL {@link Update}.
-     * @return a set of graphs referred in the {@link Update}.
-     */
-    public Set<IRI> getReferredGraphs(IRI defaultGraph, TcProvider tcProvider);
-
-    public void addOperation(UpdateOperation updateOperation);
-
-    /**
-     *
-     * @return A valid String representation of the {@link Update}.
-     */
-    @Override
-    public abstract String toString();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/UpdateOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/UpdateOperation.java
deleted file mode 100644
index b09d305..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/UpdateOperation.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-
-/**
- * SPARQL Update Operation
- *
- * @author hasan
- */
-public interface UpdateOperation {
-    public enum GraphSpec {
-        GRAPH, DEFAULT, NAMED, ALL
-    }
-
-    /**
-     * 
-     * @param defaultGraph
-     *      if default graph is referred either implicitly or explicitly as an input graph in this operation
-     *      the specified defaultGraph should be returned in the resulting set.
-     * @param tcProvider
-     *      the specified tcProvider is used to get the named graphs referred as input graphs in this operation.
-     * @return a set of graphs referred as input graphs in this operation.
-     */
-    public Set<IRI> getInputGraphs(IRI defaultGraph, TcProvider tcProvider);
-
-    /**
-     * 
-     * @param defaultGraph
-     *      if default graph is referred either implicitly or explicitly as a destination graph in this operation
-     *      the specified defaultGraph should be returned in the resulting set.
-     * @param tcProvider
-     *      the specified tcProvider is used to get the named graphs referred as destination graphs in this operation.
-     * @return a set of graphs referred as destination graphs in this operation.
-     */
-    public Set<IRI> getDestinationGraphs(IRI defaultGraph, TcProvider tcProvider);
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/AddOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/AddOperation.java
deleted file mode 100644
index 36344b6..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/AddOperation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- * The ADD operation is a shortcut for inserting all data from an input ImmutableGraph into a destination ImmutableGraph. 
- * Data from the input ImmutableGraph is not affected, and initial data from the destination ImmutableGraph, if any, is kept intact.
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#add">SPARQL 1.1 Update: 3.2.5 ADD</a>
- * 
- * @author hasan
- */
-public class AddOperation extends SimpleUpdateOperation {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/BaseUpdateOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/BaseUpdateOperation.java
deleted file mode 100644
index bc12710..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/BaseUpdateOperation.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- *
- * @author hasan
- */
-public abstract class BaseUpdateOperation implements UpdateOperation {
-
-    protected Set<IRI> inputGraphs = new HashSet<IRI>();
-    protected Set<IRI> destinationGraphs = new HashSet<IRI>();
-    protected GraphSpec inputGraphSpec = GraphSpec.GRAPH;
-    protected GraphSpec destinationGraphSpec = GraphSpec.GRAPH;
-
-    public void setInputGraphSpec(GraphSpec inputGraphSpec) {
-        this.inputGraphSpec = inputGraphSpec;
-    }
-
-    public GraphSpec getInputGraphSpec() {
-        return inputGraphSpec;
-    }
-
-    public void setDestinationGraphSpec(GraphSpec destinationGraphSpec) {
-        this.destinationGraphSpec = destinationGraphSpec;
-    }
-
-    public GraphSpec getDestinationGraphSpec() {
-        return destinationGraphSpec;
-    }
-
-    @Override
-    public Set<IRI> getInputGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        return getGraphs(defaultGraph, tcProvider, inputGraphSpec, inputGraphs);
-    }
-
-    private Set<IRI> getGraphs(IRI defaultGraph, TcProvider tcProvider, GraphSpec graphSpec, Set<IRI> graphs) {
-        switch (graphSpec) {
-            case DEFAULT:
-                Set<IRI> result = new HashSet<IRI>();
-                result.add(defaultGraph);
-                return result;
-            case NAMED:
-            case ALL:
-                return tcProvider.listGraphs();
-            default:
-                return graphs;
-        }
-    }
-
-    @Override
-    public Set<IRI> getDestinationGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        return getGraphs(defaultGraph, tcProvider, destinationGraphSpec, destinationGraphs);
-    }
-
-    public void addInputGraph(IRI ImmutableGraph) {
-        inputGraphs.add(ImmutableGraph);
-    }
-
-    public void addDestinationGraph(IRI ImmutableGraph) {
-        destinationGraphs.add(ImmutableGraph);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOperation.java
deleted file mode 100644
index 9fdfe95..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class ClearOperation extends ClearOrDropOperation {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOrDropOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOrDropOperation.java
deleted file mode 100644
index 2b356af..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ClearOrDropOperation.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- *
- * @author hasan
- */
-public class ClearOrDropOperation extends BaseUpdateOperation {
-    private boolean silent;
-
-    public ClearOrDropOperation() {
-        this.silent = false;
-        destinationGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
-    }
-
-    public void setSilent(boolean silent) {
-        this.silent = silent;
-    }
-
-    public boolean isSilent() {
-        return silent;
-    }
-
-    public void setDestinationGraph(IRI destination) {
-        destinationGraphSpec = UpdateOperation.GraphSpec.GRAPH;
-        destinationGraphs.clear();
-        destinationGraphs.add(destination);
-    }
-
-    public IRI getDestinationGraph(IRI defaultGraph, TcProvider tcProvider) {
-        Set<IRI> result = getDestinationGraphs(defaultGraph, tcProvider);
-        if (result.isEmpty()) {
-            return null;
-        } else {
-            return result.iterator().next();
-        }
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CopyOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CopyOperation.java
deleted file mode 100644
index 6e9aa40..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CopyOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class CopyOperation extends SimpleUpdateOperation {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CreateOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CreateOperation.java
deleted file mode 100644
index 090f423..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/CreateOperation.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.clerezza.rdf.core.sparql.update.impl;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- *
- * @author hasan
- */
-public class CreateOperation extends BaseUpdateOperation {
-
-    private boolean silent;
-
-    public CreateOperation() {
-        this.silent = false;
-    }
-
-    public void setSilent(boolean silent) {
-        this.silent = silent;
-    }
-
-    public boolean isSilent() {
-        return silent;
-    }
-
-    public void setDestinationGraph(IRI destination) {
-        destinationGraphs.clear();
-        destinationGraphs.add(destination);
-    }
-
-    public IRI getDestinationGraph() {
-        if (destinationGraphs.isEmpty()) {
-            return null;
-        } else {
-            return destinationGraphs.iterator().next();
-        }
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteDataOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteDataOperation.java
deleted file mode 100644
index c2318c6..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteDataOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class DeleteDataOperation extends UpdateOperationWithQuads {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteWhereOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteWhereOperation.java
deleted file mode 100644
index 6704775..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DeleteWhereOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class DeleteWhereOperation extends UpdateOperationWithQuads {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DropOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DropOperation.java
deleted file mode 100644
index e70a93f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/DropOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class DropOperation extends ClearOrDropOperation {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/InsertDataOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/InsertDataOperation.java
deleted file mode 100644
index 2c985d9..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/InsertDataOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class InsertDataOperation extends UpdateOperationWithQuads {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/LoadOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/LoadOperation.java
deleted file mode 100644
index 8dfc69f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/LoadOperation.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.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- * The LOAD operation reads an RDF document from a IRI and inserts its triples into the specified ImmutableGraph in the ImmutableGraph Store. 
- * If the destination ImmutableGraph already exists, then no data in that ImmutableGraph will be removed.
- * If no destination ImmutableGraph IRI is provided to load the triples into, then the data will be loaded into the default ImmutableGraph.
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#load">SPARQL 1.1 Update: 3.1.4 LOAD</a>
- * @author hasan
- */
-public class LoadOperation extends SimpleUpdateOperation {
-
-    public void setSource(IRI source) {
-        setInputGraph(source);
-    }
-
-    public IRI getSource() {
-        return getInputGraph(null);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ModifyOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ModifyOperation.java
deleted file mode 100644
index 97ce39b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/ModifyOperation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleDataSet;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- * This ModifyOperation is a DELETE/INSERT operation.
- * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#deleteInsert">SPARQL 1.1 Update: 3.1.3 DELETE/INSERT</a>
- * 
- * The DELETE/INSERT operation can be used to remove or add triples from/to the ImmutableGraph Store based on bindings 
- * for a query pattern specified in a WHERE clause.
- * 
- * @author hasan
- */
-public class ModifyOperation implements UpdateOperation {
-    private IRI fallbackGraph = null;
-    private UpdateOperationWithQuads deleteOperation = null;
-    private UpdateOperationWithQuads insertOperation = null;
-    private SimpleDataSet dataSet = null;
-    private GroupGraphPattern queryPattern = null;
-
-    public void setFallbackGraph(IRI fallbackGraph) {
-        this.fallbackGraph = fallbackGraph;
-    }
-
-    public void setDeleteOperation(UpdateOperationWithQuads deleteOperation) {
-        this.deleteOperation = deleteOperation;
-    }
-
-    public void setInsertOperation(UpdateOperationWithQuads insertOperation) {
-        this.insertOperation = insertOperation;
-    }
-
-    public void setDataSet(SimpleDataSet dataSet) {
-        this.dataSet = dataSet;
-    }
-
-    public void addGraphToDataSet(IRI ImmutableGraph) {
-        if (dataSet == null) {
-            dataSet = new SimpleDataSet();
-        }
-        dataSet.addDefaultGraph(ImmutableGraph);
-    }
-
-    public void addNamedGraphToDataSet(IRI namedGraph) {
-        if (dataSet == null) {
-            dataSet = new SimpleDataSet();
-        }
-        dataSet.addNamedGraph(namedGraph);
-    }
-
-    public void setQueryPattern(GroupGraphPattern queryPattern) {
-        this.queryPattern = queryPattern;
-    }
-
-    @Override
-    public Set<IRI> getInputGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        Set<IRI> graphs = new HashSet<IRI>();
-        if (dataSet != null) {
-            graphs.addAll(dataSet.getDefaultGraphs());
-            graphs.addAll(dataSet.getNamedGraphs());
-        } else {
-            if (fallbackGraph != null) {
-                graphs.add(fallbackGraph);
-            }
-        }
-        if (graphs.isEmpty()) {
-            graphs.add(defaultGraph);
-        }
-        if (queryPattern != null) {
-            graphs.addAll(queryPattern.getReferredGraphs());
-        }
-        return graphs;
-    }
-
-    @Override
-    public Set<IRI> getDestinationGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        Set<IRI> graphs = new HashSet<IRI>();
-        IRI dfltGraph = (fallbackGraph != null) ? fallbackGraph : defaultGraph;
-        if (deleteOperation != null) {
-            graphs.addAll(deleteOperation.getDestinationGraphs(dfltGraph, tcProvider));
-        }
-        if (insertOperation != null) {
-            graphs.addAll(insertOperation.getDestinationGraphs(dfltGraph, tcProvider));
-        }
-        return graphs;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/MoveOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/MoveOperation.java
deleted file mode 100644
index 84bc569..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/MoveOperation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-/**
- *
- * @author hasan
- */
-public class MoveOperation extends SimpleUpdateOperation {
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/Quad.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/Quad.java
deleted file mode 100644
index ff26de0..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/Quad.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.Set;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleBasicGraphPattern;
-
-/**
- *
- * @author hasan
- */
-public class Quad extends SimpleBasicGraphPattern {
-
-    private UriRefOrVariable ImmutableGraph = null;
-
-    public Quad(UriRefOrVariable ImmutableGraph, Set<TriplePattern> triplePatterns) {
-        super(triplePatterns);
-        this.ImmutableGraph = ImmutableGraph;
-    }
-
-    public UriRefOrVariable getGraph() {
-        return this.ImmutableGraph;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdate.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdate.java
deleted file mode 100644
index c91ee95..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.update.Update;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- *
- * @author hasan
- */
-public class SimpleUpdate implements Update {
-    protected List<UpdateOperation> operations = new ArrayList<UpdateOperation>();
-
-    @Override
-    public Set<IRI> getReferredGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        Set<IRI> referredGraphs = new HashSet<IRI>();
-        for (UpdateOperation operation : operations) {
-            referredGraphs.addAll(operation.getInputGraphs(defaultGraph, tcProvider));
-            referredGraphs.addAll(operation.getDestinationGraphs(defaultGraph, tcProvider));
-        }
-        return referredGraphs;
-    }
-
-    @Override
-    public void addOperation(UpdateOperation updateOperation) {
-        operations.add(updateOperation);
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdateOperation.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdateOperation.java
deleted file mode 100644
index 6042536..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/SimpleUpdateOperation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- *
- * @author hasan
- */
-public class SimpleUpdateOperation extends BaseUpdateOperation {
-
-    private boolean silent;
-
-    public SimpleUpdateOperation() {
-        this.silent = false;
-        inputGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
-        destinationGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
-    }
-
-    public void setSilent(boolean silent) {
-        this.silent = silent;
-    }
-
-    public boolean isSilent() {
-        return silent;
-    }
-
-    public void setInputGraph(IRI source) {
-        inputGraphSpec = UpdateOperation.GraphSpec.GRAPH;
-        inputGraphs.clear();
-        inputGraphs.add(source);
-    }
-
-    public IRI getInputGraph(IRI defaultGraph) {
-        Set<IRI> result = getInputGraphs(defaultGraph, null);
-        if (result.isEmpty()) {
-            return null;
-        } else {
-            return result.iterator().next();
-        }
-    }
-
-    public void setDestinationGraph(IRI destination) {
-        destinationGraphSpec = UpdateOperation.GraphSpec.GRAPH;
-        destinationGraphs.clear();
-        destinationGraphs.add(destination);
-    }
-
-    public IRI getDestinationGraph(IRI defaultGraph) {
-        Set<IRI> result = getDestinationGraphs(defaultGraph, null);
-        if (result.isEmpty()) {
-            return null;
-        } else {
-            return result.iterator().next();
-        }
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/UpdateOperationWithQuads.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/UpdateOperationWithQuads.java
deleted file mode 100644
index 5b2ea57..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/sparql/update/impl/UpdateOperationWithQuads.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql.update.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-
-/**
- *
- * @author hasan
- */
-public class UpdateOperationWithQuads implements UpdateOperation {
-
-    private Quad defaultQuad = null;
-    private List<Quad> quads = new ArrayList<Quad>();
-
-    public UpdateOperationWithQuads() {
-    }
-
-    public void addQuad(Set<TriplePattern> triplePatterns) {
-        if (defaultQuad == null) {
-            defaultQuad = new Quad(null, triplePatterns);
-        } else {
-            defaultQuad.addTriplePatterns(triplePatterns);
-        }
-    }
-
-    public void addQuad(UriRefOrVariable ImmutableGraph, Set<TriplePattern> triplePatterns) {
-        if (ImmutableGraph == null) {
-            addQuad(triplePatterns);
-        } else {
-            quads.add(new Quad(ImmutableGraph, triplePatterns));
-        }
-    }
-
-    @Override
-    public Set<IRI> getInputGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        return new HashSet<IRI>();
-    }
-
-    @Override
-    public Set<IRI> getDestinationGraphs(IRI defaultGraph, TcProvider tcProvider) {
-        Set<IRI> graphs = new HashSet<IRI>();
-        if (defaultQuad != null) {
-            graphs.add(defaultGraph);
-        }
-        for (Quad quad : quads) {
-            UriRefOrVariable ImmutableGraph = quad.getGraph();
-            if (!ImmutableGraph.isVariable()) {
-                graphs.add(ImmutableGraph.getResource());
-            }
-        }
-        return graphs;
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserSerializerCombinationTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserSerializerCombinationTest.java
deleted file mode 100644
index 50eeee5..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserSerializerCombinationTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- * @author hasan
- */
-public class QueryParserSerializerCombinationTest {
-    
-    public QueryParserSerializerCombinationTest() {
-    }
-    
-    @BeforeClass
-    public static void setUpClass() {
-    }
-    
-    @AfterClass
-    public static void tearDownClass() {
-    }
-    
-    @Before
-    public void setUp() {
-    }
-    
-    @After
-    public void tearDown() {
-    }
-
-    @Test
-    public void testPatternOrderPreservation() throws Exception {
-        String queryString =
-                "SELECT ?property ?range ?property_description ?subproperty ?subproperty_description \n"
-                + "WHERE\n"
-                + "{ ?property <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .\n"
-                + "{ { ?property <http://www.w3.org/2000/01/rdf-schema#domain> ?superclass .\n"
-                + "<http://example.org/ontologies/market_ontology.owl#Company> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superclass .\n"
-                + "}  UNION { ?property <http://www.w3.org/2000/01/rdf-schema#domain> ?dunion .\n"
-                + "?dunion <http://www.w3.org/2002/07/owl#unionOf> ?dlist .\n"
-                + "?dlist <http://jena.hpl.hp.com/ARQ/list#member> ?superclass .\n"
-                + "<http://example.org/ontologies/market_ontology.owl#Company> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superclass .\n"
-                + "} } { { ?property <http://www.w3.org/2000/01/rdf-schema#range> ?superrange .\n"
-                + "?range <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superrange .\n"
-                + "FILTER (! (isBLANK(?range)))\n"
-                + "}  UNION { ?property <http://www.w3.org/2000/01/rdf-schema#range> ?range .\n"
-                + "FILTER (! (isBLANK(?range)))\n"
-                + "} }  OPTIONAL { ?somesub <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?range .\n"
-                + "FILTER (((?somesub) != (<http://www.w3.org/2002/07/owl#Nothing>)) && ((?somesub) != (?range)))\n"
-                + "}  OPTIONAL { ?subproperty <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> ?property .\n"
-                 + " OPTIONAL { ?subproperty <http://purl.org/dc/elements/1.1/description> ?subproperty_description .\n"
-                + "} FILTER (((?subproperty) != (<http://www.w3.org/2002/07/owl#bottomObjectProperty>)) && ((?subproperty) != (?property)))\n"
-                + "}  OPTIONAL { ?property <http://purl.org/dc/elements/1.1/description> ?property_description .\n"
-                + "} FILTER ((?property) != (<http://www.w3.org/2002/07/owl#bottomObjectProperty>))\n"
-                + "FILTER ((?range) != (<http://www.w3.org/2002/07/owl#Nothing>))\n"
-                + "FILTER (! (BOUND(?somesub)))\n"
-                + "} \n";
-
-        Query query = QueryParser.getInstance().parse(queryString);
-        Assert.assertEquals(queryString.replaceAll("\\s", "").trim(), query.toString().replaceAll("\\s", "").trim());
-    }
-
-    @Test
-    public void testParsingAndSerializationStability() throws Exception {
-        String queryString =
-                "PREFIX mo: <http://example.org/ontologies/market_ontology.owl#>\n"
-                + "PREFIX list: <http://jena.hpl.hp.com/ARQ/list#>\n"
-                + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
-                + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
-                + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
-                + "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n"
-                + "SELECT ?property ?range ?property_description ?subproperty ?subproperty_description\n"
-                + "WHERE {\n"
-                + "    ?property a owl:ObjectProperty .\n"
-                + "    FILTER (?property != owl:bottomObjectProperty) .\n"
-                + "    {\n"
-                + "        {\n"
-                + "            ?property rdfs:domain ?superclass .\n"
-                + "            mo:Company rdfs:subClassOf ?superclass .\n"
-                + "        }\n"
-                + "        UNION\n"
-                + "        {\n"
-                + "            ?property rdfs:domain ?dunion .\n"
-                + "            ?dunion owl:unionOf ?dlist .\n"
-                + "            ?dlist list:member ?superclass .\n"
-                + "            mo:Company rdfs:subClassOf ?superclass .\n"
-                + "        }\n"
-                + "    }\n"
-                + "    {\n"
-                + "        {\n"
-                + "            ?property rdfs:range ?superrange .\n"
-                + "            ?range rdfs:subClassOf ?superrange .\n"
-                + "            FILTER (!isBlank(?range)) .\n"
-                + "        }\n"
-                + "        UNION\n"
-                + "        {\n"
-                + "            ?property rdfs:range ?range .\n"
-                + "            FILTER (!isBlank(?range)) .\n"
-                + "        }\n"
-                + "    } .\n"
-                + "    FILTER (?range != owl:Nothing) .\n"
-                + "    OPTIONAL { ?somesub rdfs:subClassOf ?range . FILTER(?somesub != owl:Nothing && ?somesub != ?range)}\n"
-                + "    FILTER (!bound(?somesub)) .\n"
-                + "    OPTIONAL {\n"
-                + "        ?subproperty rdfs:subPropertyOf ?property .\n"
-                + "        FILTER(?subproperty != owl:bottomObjectProperty && ?subproperty != ?property)\n"
-                + "        OPTIONAL { ?subproperty dc:description ?subproperty_description . }\n"
-                + "    }\n"
-                + "    OPTIONAL { ?property dc:description ?property_description . }\n"
-                + "} ";
-
-        Query query1 = QueryParser.getInstance().parse(queryString);
-        Thread.sleep(5000l);
-        Query query2 = QueryParser.getInstance().parse(queryString);
-        Assert.assertEquals(query1.toString(), query2.toString());
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserTest.java
deleted file mode 100644
index f39e338..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QueryParserTest.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.BasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BuiltInCall;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.GraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OptionalGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.OrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.QueryWithSolutionModifier;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UnaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleTriplePattern;
-
-/**
- *
- * @author hasan
- */
-public class QueryParserTest {
-
-    @Test
-    public void testSelectQuery() throws ParseException {
-
-// SELECT ?title FROM <http://example.org/library>
-// WHERE { <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title . }
-
-        final String variable = "title";
-        final String defaultGraph = "http://example.org/library";
-        final String subject = "http://example.org/book/book1";
-        final String predicate = "http://purl.org/dc/elements/1.1/title";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("SELECT ?").append(variable)
-                .append(" FROM <").append(defaultGraph)
-                .append("> WHERE { <").append(subject).append("> <")
-                .append(predicate).append("> ?").append(variable).append(" . }");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(SelectQuery.class.isAssignableFrom(q.getClass()));
-        SelectQuery selectQuery = (SelectQuery) q;
-        Assert.assertTrue(selectQuery.getSelection().get(0)
-                .equals(new Variable(variable)));
-        Assert.assertTrue(selectQuery.getDataSet().getDefaultGraphs().toArray()[0]
-                .equals(new IRI(defaultGraph)));
-
-        GraphPattern gp = (GraphPattern) selectQuery.getQueryPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) gp;
-
-        Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size()==1);
-
-        ResourceOrVariable s = new ResourceOrVariable(new IRI(subject));
-        UriRefOrVariable p = new UriRefOrVariable(new IRI(predicate));
-        ResourceOrVariable o = new ResourceOrVariable(new Variable(variable));
-
-        Assert.assertTrue(triplePatterns.contains(
-                new SimpleTriplePattern(s, p, o)));
-    }
-
-    @Test(expected=ParseException.class)
-    public void testInvalidQuery() throws ParseException {
-        Query q = QueryParser.getInstance().parse("Hello");
-    }
-
-    @Test
-    public void testSelectQuerySelection() throws ParseException {
-        SelectQuery q = (SelectQuery) QueryParser.getInstance().parse(
-                "SELECT ?a ?b WHERE {?a ?x ?b}");
-        Set<Variable> selectionSet = new HashSet<Variable>(
-                q.getSelection());
-        Set<Variable> expected = new HashSet<Variable>();
-        expected.add(new Variable("a"));
-        expected.add(new Variable("b"));
-        Assert.assertEquals(expected, selectionSet);
-        Assert.assertFalse(q.isSelectAll());
-
-    }
-
-    @Test
-    public void testSelectAll() throws ParseException {
-        SelectQuery q = (SelectQuery) QueryParser.getInstance().parse(
-                "SELECT * WHERE {?a ?x ?b}");
-        Set<Variable> selectionSet = new HashSet<Variable>(
-                q.getSelection());
-        Set<Variable> expected = new HashSet<Variable>();
-        expected.add(new Variable("a"));
-        expected.add(new Variable("b"));
-        expected.add(new Variable("x"));
-        Assert.assertEquals(expected, selectionSet);
-        Assert.assertTrue(q.isSelectAll());
-
-    }
-
-    @Test
-    public void testPlainLiteral() throws ParseException {
-        SelectQuery q = (SelectQuery) QueryParser.getInstance().parse(
-                "SELECT * WHERE {?a ?x 'tiger' . ?a ?x 'lion'@en . }");
-
-        GraphPattern gp = (GraphPattern) q.getQueryPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) gp;
-
-        Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size()==2);
-
-        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
-                new Variable("a"), new Variable("x"),
-                new PlainLiteralImpl("tiger"))));
-
-        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
-                new Variable("a"), new Variable("x"),
-                new PlainLiteralImpl("lion", new Language("en")))));
-    }
-
-    @Test
-    public void testOrderBy() throws ParseException {
-        SelectQuery q = (SelectQuery) QueryParser.getInstance().parse(
-                "SELECT * WHERE {?a ?x ?b} ORDER BY DESC(?b)");
-
-        List<OrderCondition> oc = ((QueryWithSolutionModifier) q).getOrderConditions();
-        Assert.assertTrue(oc.size()==1);
-        Assert.assertFalse(oc.get(0).isAscending());
-        Variable b = new Variable("b");
-        Assert.assertEquals(b, oc.get(0).getExpression());
-    }
-
-    @Test
-    public void testConstructQuery() throws ParseException {
-
-// CONSTRUCT { <http://example.org/person#Alice> <http://www.w3.org/2001/vcard-rdf/3.0#FN> ?name}
-// WHERE { ?x <http://xmlns.com/foaf/0.1/name> ?name}
-
-
-        final String variable1 = "name";
-        final String variable2 = "x";
-        final String subject1 = "http://example.org/person#Alice";
-        final String predicate1 = "http://www.w3.org/2001/vcard-rdf/3.0#FN";
-        final String predicate2 = "http://xmlns.com/foaf/0.1/name";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("CONSTRUCT { <").append(subject1).append("> <")
-                .append(predicate1).append("> ?").append(variable1)
-                .append("} WHERE { ?").append(variable2).append(" <")
-                .append(predicate2).append("> ?").append(variable1).append("}");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(ConstructQuery.class.isAssignableFrom(q.getClass()));
-        ConstructQuery constructQuery = (ConstructQuery) q;
-        Set<TriplePattern> triplePatterns = constructQuery
-                .getConstructTemplate();
-        Assert.assertTrue(triplePatterns.size()==1);
-
-        ResourceOrVariable s = new ResourceOrVariable(new IRI(subject1));
-        UriRefOrVariable p = new UriRefOrVariable(new IRI(predicate1));
-        ResourceOrVariable o = new ResourceOrVariable(new Variable(variable1));
-
-        Assert.assertTrue(triplePatterns.contains(
-                new SimpleTriplePattern(s, p, o)));
-
-        GraphPattern gp = (GraphPattern) constructQuery.getQueryPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) gp;
-        triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size()==1);
-
-        s = new ResourceOrVariable(new Variable(variable2));
-        p = new UriRefOrVariable(new IRI(predicate2));
-
-        Assert.assertTrue(triplePatterns.contains(
-                new SimpleTriplePattern(s, p, o)));
-    }
-
-    @Test
-    public void testDescribeQuery() throws ParseException {
-
-// DESCRIBE <http://example.org/book/book1>
-
-        final String resource = "http://example.org/book/book1";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("DESCRIBE <").append(resource).append(">");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(DescribeQuery.class.isAssignableFrom(q.getClass()));
-        DescribeQuery describeQuery = (DescribeQuery) q;
-        Assert.assertTrue(describeQuery.getResourcesToDescribe().get(0)
-                .getResource().equals(new IRI(resource)));
-    }
-
-    @Test
-    public void testAskQuery() throws ParseException {
-
-// ASK { ?x <http://xmlns.com/foaf/0.1/name> "Alice" }
-
-        final String variable = "x";
-        final String predicate = "http://xmlns.com/foaf/0.1/name";
-        final String object = "Alice";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("ASK { ?").append(variable).append(" <")
-                .append(predicate).append("> \"").append(object).append("\" }");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(AskQuery.class.isAssignableFrom(q.getClass()));
-        AskQuery askQuery = (AskQuery) q;
-
-        GraphPattern gp = (GraphPattern) askQuery.getQueryPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) gp;
-
-        Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size()==1);
-
-        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(new Variable(variable),
-                new IRI(predicate), new PlainLiteralImpl(object))));
-    }
-
-    @Test
-    public void testBaseAndPrefix() throws ParseException {
-
-// BASE    <http://example.org/book/>
-// PREFIX  dc: <http://purl.org/dc/elements/1.1/>
-//
-// SELECT  $title
-// WHERE   { <book1>  dc:title  ?title }
-
-        final String base = "http://example.org/book/";
-        final String prefix = "dc";
-        final String prefixUri = "http://purl.org/dc/elements/1.1/";
-        final String variable = "title";
-        final String subject = "book1";
-        final String predicate = "title";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("BASE <").append(base).append(">")
-                .append(" PREFIX ").append(prefix).append(": <")
-                .append(prefixUri).append("> SELECT $").append(variable)
-                .append(" WHERE { <").append(subject).append("> ")
-                .append(prefix).append(":").append(predicate).append(" ?")
-                .append(variable).append(" }");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(SelectQuery.class.isAssignableFrom(q.getClass()));
-        SelectQuery selectQuery = (SelectQuery) q;
-        Assert.assertTrue(selectQuery.getSelection().get(0)
-                .equals(new Variable(variable)));
-
-        GraphPattern gp = (GraphPattern) selectQuery.getQueryPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) gp;
-
-        Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size()==1);
-
-        ResourceOrVariable s = new ResourceOrVariable(new IRI(base+subject));
-        UriRefOrVariable p = new UriRefOrVariable(new IRI(prefixUri+predicate));
-        ResourceOrVariable o = new ResourceOrVariable(new Variable(variable));
-
-        Assert.assertTrue(triplePatterns.contains(
-                new SimpleTriplePattern(s, p, o)));
-    }
-
-    @Test
-    public void testOptionalAndFilter() throws ParseException {
-
-// PREFIX dc: <http://purl.org/dc/elements/1.1/>
-// PREFIX books: <http://example.org/book/>
-//
-// SELECT ?book ?title
-// WHERE
-//  { ?book dc:title ?title .
-//    OPTIONAL
-//     { ?book books:author ?author .}
-//     FILTER ( ! bound(?author) )
-//  }
-        final String prefix1 = "dc";
-        final String prefix1Uri = "http://purl.org/dc/elements/1.1/";
-        final String prefix2 = "books";
-        final String prefix2Uri = "http://example.org/book/";
-        final String variable1 = "book";
-        final String variable2 = "title";
-        final String variable3 = "author";
-        final String predicate1 = "title";
-        final String predicate2 = "author";
-
-        StringBuffer queryStrBuf = new StringBuffer();
-        queryStrBuf.append("PREFIX ").append(prefix1).append(": <").append(prefix1Uri)
-                .append("> PREFIX ").append(prefix2).append(": <").append(prefix2Uri)
-                .append("> SELECT ?").append(variable1).append(" ?").append(variable2)
-                .append(" WHERE { ?").append(variable1).append(" ")
-                .append(prefix1).append(":").append(predicate1)
-                .append(" ?").append(variable2).append(" . OPTIONAL { ?")
-                .append(variable1).append(" ").append(prefix2).append(":")
-                .append(predicate2).append(" ?").append(variable3)
-                .append(" .} FILTER ( ! bound(?").append(variable3).append(") ) }");
-
-        Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
-        Assert.assertTrue(SelectQuery.class.isAssignableFrom(q.getClass()));
-        SelectQuery selectQuery = (SelectQuery) q;
-        Assert.assertTrue(selectQuery.getSelection().size() == 2);
-        Set<Variable> vars = new HashSet<Variable>(2);
-        Variable var1 = new Variable(variable1);
-        Variable var2 = new Variable(variable2);
-        vars.add(var1);
-        vars.add(var2);
-        Assert.assertTrue(selectQuery.getSelection().containsAll(vars));
-
-        GroupGraphPattern ggp = selectQuery.getQueryPattern();
-        List<Expression> constraints = ggp.getFilter();
-        Assert.assertTrue(UnaryOperation.class.isAssignableFrom(constraints
-                .get(0).getClass()));
-        UnaryOperation uop = (UnaryOperation) constraints.get(0);
-        Assert.assertTrue(uop.getOperatorString().equals("!"));
-        Assert.assertTrue(BuiltInCall.class.isAssignableFrom(uop.getOperand()
-                .getClass()));
-        BuiltInCall bic = (BuiltInCall) uop.getOperand();
-        Assert.assertTrue(bic.getName().equals("BOUND"));
-        Variable var3 = new Variable(variable3);
-        Assert.assertTrue(bic.getArguements().get(0).equals(var3));
-
-        GraphPattern gp = (GraphPattern) ggp.getGraphPatterns().toArray()[0];
-        Assert.assertTrue(OptionalGraphPattern.class.isAssignableFrom(gp.getClass()));
-        OptionalGraphPattern ogp = (OptionalGraphPattern) gp;
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(
-                ogp.getMainGraphPattern().getClass()));
-        BasicGraphPattern bgp = (BasicGraphPattern) ogp.getMainGraphPattern();
-
-        Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size() == 1);
-        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(var1, new IRI(prefix1Uri + predicate1),
-                var2)));
-
-        GraphPattern gp2 = (GraphPattern) ogp.getOptionalGraphPattern()
-                .getGraphPatterns().toArray()[0];
-        Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp2.getClass()));
-        bgp = (BasicGraphPattern) gp2;
-
-        triplePatterns = bgp.getTriplePatterns();
-        Assert.assertTrue(triplePatterns.size() == 1);
-        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(var1, new IRI(prefix2Uri + predicate2),
-                var3)));
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QuerySerializerTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QuerySerializerTest.java
deleted file mode 100644
index eccf13f..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/QuerySerializerTest.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.BinaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.BuiltInCall;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.LiteralExpression;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefExpression;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleAskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleBasicGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleDescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleOptionalGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleOrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleSelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleTriplePattern;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- * @author hasan
- */
-public class QuerySerializerTest {
-
-    @Test
-    public void testSelectQuery() {
-
-        final String queryString = "SELECT ?title FROM <http://example.org/library>" +
-                " WHERE { <http://example.org/book/book1>" +
-                " <http://purl.org/dc/elements/1.1/title> ?title . }";
-
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        Variable variable = new Variable("title");
-        selectQuery.addSelection(variable);
-        IRI defaultGraph = new IRI("http://example.org/library");
-        selectQuery.addDefaultGraph(defaultGraph);
-        ResourceOrVariable subject = new ResourceOrVariable(
-                new IRI("http://example.org/book/book1"));
-        UriRefOrVariable predicate = new UriRefOrVariable(
-                new IRI("http://purl.org/dc/elements/1.1/title"));
-        ResourceOrVariable object = new ResourceOrVariable(variable);
-        TriplePattern triplePattern = new SimpleTriplePattern(subject, predicate, object);
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(triplePattern);
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        selectQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testConstructQuery() {
-
-        final String queryString = "CONSTRUCT { <http://example.org/person#Alice> " +
-                "<http://www.w3.org/2001/vcard-rdf/3.0#FN> ?name . } " +
-                "WHERE { ?x <http://xmlns.com/foaf/0.1/name> ?name . }";
-
-        ResourceOrVariable s = new ResourceOrVariable(
-                new IRI("http://example.org/person#Alice"));
-        UriRefOrVariable p = new UriRefOrVariable(
-                new IRI("http://www.w3.org/2001/vcard-rdf/3.0#FN"));
-        ResourceOrVariable o = new ResourceOrVariable(new Variable("name"));
-        Set<TriplePattern> constructTriplePatterns = new HashSet<TriplePattern>();
-        constructTriplePatterns.add(new SimpleTriplePattern(s, p, o));
-        SimpleConstructQuery constructQuery = new SimpleConstructQuery(constructTriplePatterns);
-
-        s = new ResourceOrVariable(new Variable("x"));
-        p = new UriRefOrVariable(new IRI("http://xmlns.com/foaf/0.1/name"));
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(s, p, o));
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        constructQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(constructQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testDescribeQuery() {
-
-        final String queryString = "DESCRIBE <http://example.org/book/book1>";
-
-        SimpleDescribeQuery describeQuery = new SimpleDescribeQuery();
-        describeQuery.addResourceToDescribe(new ResourceOrVariable(
-                new IRI("http://example.org/book/book1")));
-
-        Assert.assertTrue(describeQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testAskQuery() {
-
-        final String queryString = "ASK WHERE { ?x <http://xmlns.com/foaf/0.1/name> " +
-                "\"Alice\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
-
-        ResourceOrVariable s = new ResourceOrVariable(new Variable("x"));
-        UriRefOrVariable p = new UriRefOrVariable(
-                new IRI("http://xmlns.com/foaf/0.1/name"));
-        ResourceOrVariable o = new ResourceOrVariable(
-                LiteralFactory.getInstance().createTypedLiteral("Alice"));
-
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(s, p, o));
-        SimpleAskQuery askQuery = new SimpleAskQuery();
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        askQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(askQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    /**
-     * Ignoring: given that triplePatterns is a Set I don't see what is supposed 
-     * to guarantee the expected ordering.
-     */
-    @Ignore
-    @Test
-    public void testFilter() {
-
-        final String queryString = "SELECT ?title ?price WHERE { " +
-                "?x <http://purl.org/dc/elements/1.1/title> ?title . " +
-                "?x <http://example.org/ns#price> ?price . " +
-                "FILTER ((?price) < (\"30.5\"^^<http://www.w3.org/2001/XMLSchema#double>)) " +
-                "}";
-
-        Variable price = new Variable("price");
-        Variable title = new Variable("title");
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        selectQuery.addSelection(title);
-        selectQuery.addSelection(price);
-
-        Variable x = new Variable("x");
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(x,
-                new IRI("http://example.org/ns#price"), price));
-        triplePatterns.add(new SimpleTriplePattern(x,
-                new IRI("http://purl.org/dc/elements/1.1/title"), title));
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        BinaryOperation constraint = new BinaryOperation("<",
-                price, new LiteralExpression(LiteralFactory.getInstance().createTypedLiteral(30.5)));
-        queryPattern.addConstraint(constraint);
-        selectQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testUriRefExpression() {
-
-        final String queryString = "SELECT ?resource WHERE { " +
-                "?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?myType . " +
-                "FILTER ((?resource) = (<http://example.org/ontology#special>)) " +
-                "}";
-
-        Variable resource = new Variable("resource");
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        selectQuery.addSelection(resource);
-
-        Variable myType = new Variable("myType");
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(resource,
-                new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), myType));
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        BinaryOperation constraint = new BinaryOperation("=",
-                resource, new UriRefExpression(new IRI("http://example.org/ontology#special")));
-        queryPattern.addConstraint(constraint);
-        selectQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testOrderBy() {
-
-        final String queryString = "SELECT * WHERE { ?a ?b ?c . } ORDER BY DESC(?c)";
-
-        Variable a = new Variable("a");
-        Variable b = new Variable("b");
-        Variable c = new Variable("c");
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        selectQuery.setSelectAll();
-        selectQuery.addSelection(a);
-        selectQuery.addSelection(b);
-        selectQuery.addSelection(c);
-
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(a, b, c));
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-        selectQuery.setQueryPattern(queryPattern);
-        selectQuery.addOrderCondition(new SimpleOrderCondition(c, false));
-
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testOptional() {
-
-        final String queryString = "SELECT ?title ?price WHERE { " +
-                "?x <http://purl.org/dc/elements/1.1/title> ?title . " +
-                "OPTIONAL { ?x <http://example.org/ns#price> ?price . } " +
-                "}";
-
-        Variable title = new Variable("title");
-        Variable price = new Variable("price");
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        selectQuery.addSelection(title);
-        selectQuery.addSelection(price);
-
-        Variable x = new Variable("x");
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(x,
-                new IRI("http://purl.org/dc/elements/1.1/title"), title));
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-
-        Set<TriplePattern> triplePatternsOpt = new HashSet<TriplePattern>();
-        triplePatternsOpt.add(new SimpleTriplePattern(x,
-                new IRI("http://example.org/ns#price"), price));
-
-        SimpleBasicGraphPattern bgpOpt =
-                new SimpleBasicGraphPattern(triplePatternsOpt);
-
-        SimpleGroupGraphPattern ggpOpt = new SimpleGroupGraphPattern();
-        ggpOpt.addGraphPattern(bgpOpt);
-
-        SimpleOptionalGraphPattern ogp = new SimpleOptionalGraphPattern(bgp, ggpOpt);
-
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(ogp);
-        selectQuery.setQueryPattern(queryPattern);
-
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-
-    @Test
-    public void testRegex() {
-
-        final String queryString = "SELECT ?p WHERE { " +
-                "<http://localhost/testitem> ?p ?x . " +
-                "FILTER REGEX(?x,\".*uni.*\"^^<http://www.w3.org/2001/XMLSchema#string>) }";
-
-        Variable p = new Variable("p");
-        SimpleSelectQuery selectQuery = new SimpleSelectQuery();
-        selectQuery.addSelection(p);
-
-        Variable x = new Variable("x");
-        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
-        triplePatterns.add(new SimpleTriplePattern(
-                new IRI("http://localhost/testitem"), p, x));
-
-        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
-        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
-        queryPattern.addGraphPattern(bgp);
-
-        List<Expression> arguments = new ArrayList<Expression>();
-        arguments.add(x);
-        arguments.add(new LiteralExpression(LiteralFactory.getInstance().
-                createTypedLiteral(".*uni.*")));
-        BuiltInCall constraint = new BuiltInCall("REGEX", arguments);
-        queryPattern.addConstraint(constraint);
-        selectQuery.setQueryPattern(queryPattern);
-        Assert.assertTrue(selectQuery.toString()
-                .replaceAll("( |\n)+", " ").trim().equals(queryString));
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParserTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParserTest.java
deleted file mode 100644
index c56170c..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParserTest.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.access.TcManagerTest;
-import org.apache.clerezza.rdf.core.access.providers.WeightedA;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- * @author hasan
- */
-public class SparqlPreParserTest {
-
-    private TcManager graphAccess;
-    private final WeightedA weightedA = new WeightedA();
-    private final static IRI DEFAULT_GRAPH = new IRI("http://example.org/default.graph");
-    private final static IRI TEST_GRAPH = new IRI("http://example.org/test.graph");
-
-    @Before
-	public void setUp() {
-		graphAccess = TcManager.getInstance();
-		graphAccess.addWeightedTcProvider(weightedA);
-	}
-
-	@After
-	public void tearDown() {
-		graphAccess = TcManager.getInstance();
-		graphAccess.removeWeightedTcProvider(weightedA);
-	}
-
-    @Test
-    public void testDefaultGraphInSelectQuery() throws ParseException {
-
-        StringBuilder queryStrBuilder = new StringBuilder();
-        queryStrBuilder.append(
-                "PREFIX : <http://example.org/>\n" +
-                "SELECT ?x \n" +
-                "{\n" +
-                ":order :item/:price ?x\n" +
-                "}\n");
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStrBuilder.toString(), DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testAllGraphReferenceInSelectQuery() throws ParseException {
-
-        StringBuilder queryStrBuilder = new StringBuilder();
-        queryStrBuilder.append("SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } }\n");
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStrBuilder.toString(), DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs == null);
-    }
-
-    @Test
-    public void testSelectQuery() throws ParseException {
-
-        StringBuilder queryStrBuilder = new StringBuilder();
-        queryStrBuilder.append(
-                "PREFIX : <http://example.org/>\n" +
-                "SELECT ?x (foo(2*3, ?x < ?y) AS ?f) (GROUP_CONCAT(?x ; separator=\"|\") AS ?gc) (sum(distinct *) AS ?total)\n" +
-                "FROM " + TEST_GRAPH.toString() + "\n" +
-                "{\n" +
-                ":order :item/:price ?x\n" +
-                "}\n");
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStrBuilder.toString(), DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testSimpleDescribe() throws ParseException {
-
-        String queryStr = "DESCRIBE <http://example.org/>";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testLoadingToDefaultGraph() throws ParseException {
-
-        String queryStr = "LOAD SILENT <http://example.org/mydata>";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(new IRI("http://example.org/mydata"));
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testLoadingToGraph() throws ParseException {
-
-        String queryStr = "LOAD SILENT <http://example.org/mydata> INTO GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(TEST_GRAPH);
-        expected.add(new IRI("http://example.org/mydata"));
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testClearingDefaultGraph() throws ParseException {
-
-        String queryStr = "CLEAR SILENT DEFAULT";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testClearingNamedGraph() throws ParseException {
-
-        String queryStr = "CLEAR SILENT NAMED";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.contains(TcManagerTest.uriRefA));
-    }
-
-    @Test
-    public void testClearingGraph() throws ParseException {
-
-        String queryStr = "CLEAR SILENT GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testDroppingDefaultGraph() throws ParseException {
-
-        String queryStr = "DROP SILENT DEFAULT";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testDroppingNamedGraph() throws ParseException {
-
-        String queryStr = "DROP SILENT NAMED";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.contains(TcManagerTest.uriRefA));
-    }
-
-    @Test
-    public void testDroppingGraph() throws ParseException {
-
-        String queryStr = "DROP SILENT GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testCreatingGraph() throws ParseException {
-
-        String queryStr = "CREATE SILENT GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testAddingTriplesFromDefaultGraphToNamedGraph() throws ParseException {
-
-        String queryStr = "ADD SILENT DEFAULT TO GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testAddingTriplesFromNamedGraphToDefaultGraph() throws ParseException {
-
-        String queryStr = "ADD SILENT GRAPH " + TEST_GRAPH.toString() + " TO DEFAULT";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testMovingTriplesFromDefaultGraphToNamedGraph() throws ParseException {
-
-        String queryStr = "MOVE SILENT DEFAULT TO GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testMovingTriplesFromNamedGraphToDefaultGraph() throws ParseException {
-
-        String queryStr = "MOVE SILENT GRAPH " + TEST_GRAPH.toString() + " TO DEFAULT";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testCopyingTriplesFromDefaultGraphToNamedGraph() throws ParseException {
-
-        String queryStr = "COPY SILENT DEFAULT TO GRAPH " + TEST_GRAPH.toString();
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testCopyingTriplesFromNamedGraphToDefaultGraph() throws ParseException {
-
-        String queryStr = "COPY SILENT GRAPH " + TEST_GRAPH.toString() + " TO DEFAULT";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testInsertDataToDefaultGraph() throws ParseException {
-
-        String queryStr = "PREFIX dc: <http://purl.org/dc/elements/1.1/> INSERT DATA { \n" +
-                "<http://example/book1> dc:title \"A new book\" ; dc:creator \"A.N.Other\" . }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testInsertDataToNamedGraph() throws ParseException {
-
-        String queryStr = "PREFIX ns: <http://example.org/ns#>\n" +
-                "INSERT DATA { GRAPH " + TEST_GRAPH.toString() + " { <http://example/book1>  ns:price  42 } }";
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testDeleteDataInDefaultGraph() throws ParseException {
-
-        String queryStr = "PREFIX dc: <http://purl.org/dc/elements/1.1/> DELETE DATA { \n" +
-                "<http://example/book1> dc:title \"A new book\" ; dc:creator \"A.N.Other\" . }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testDeleteDataInNamedGraph() throws ParseException {
-
-        String queryStr = "PREFIX ns: <http://example.org/ns#>\n" +
-                "DELETE DATA { GRAPH " + TEST_GRAPH.toString() + " { <http://example/book1>  ns:price  42 } }";
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(TEST_GRAPH));
-    }
-
-    @Test
-    public void testInsertAndDeleteData() throws ParseException {
-
-        String queryStr = "PREFIX ns: <http://example.org/ns#> " +
-                "INSERT DATA { <http://example/book1>  ns:price  42 }; " +
-                "DELETE DATA { GRAPH " + TEST_GRAPH.toString() + " { <http://example/book1>  ns:price  42 } }";
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-
-        Set<IRI> expected = new HashSet<>();
-        expected.add(DEFAULT_GRAPH);
-        expected.add(TEST_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testDeleteWhereInDefaultGraph() throws ParseException {
-
-        String queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
-                "DELETE WHERE { ?person foaf:givenName 'Fred'; ?property ?value }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testDeleteWhereInNamedGraphs() throws ParseException {
-
-        String queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> DELETE WHERE " +
-                "{ GRAPH <http://example.com/names> { ?person foaf:givenName 'Fred' ; ?property1 ?value1 } " +
-                "  GRAPH <http://example.com/addresses> { ?person ?property2 ?value2 } }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-
-        Set<IRI> expected = new HashSet<>();
-        expected.add(new IRI("http://example.com/names"));
-        expected.add(new IRI("http://example.com/addresses"));
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testModifyOperationWithFallbackGraph() throws ParseException {
-        String queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> WITH " + TEST_GRAPH.toString() +
-                " DELETE { ?person foaf:givenName 'Bill' } INSERT { ?person foaf:givenName 'William' }" +
-                " WHERE { ?person foaf:givenName 'Bill' }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Set<IRI> expected = new HashSet<>();
-        expected.add(TEST_GRAPH);
-        expected.add(DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testDeleteOperationInDefaultGraph() throws ParseException {
-        String queryStr = "PREFIX dc:  <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " +
-                "DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date . " +
-                "FILTER ( ?date > \"1970-01-01T00:00:00-02:00\"^^xsd:dateTime ) ?book ?p ?v }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testInsertOperationToNamedGraph() throws ParseException {
-        String queryStr = "PREFIX dc:  <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " +
-                "INSERT { GRAPH <http://example/bookStore2> { ?book ?p ?v } } " +
-                "WHERE { GRAPH <http://example/bookStore> { ?book dc:date ?date . " +
-                "FILTER ( ?date > \"1970-01-01T00:00:00-02:00\"^^xsd:dateTime ) ?book ?p ?v } }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-
-        Set<IRI> expected = new HashSet<>();
-        expected.add(new IRI("http://example/bookStore2"));
-        expected.add(new IRI("http://example/bookStore"));
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testInsertAndDeleteWithCommonPrefix() throws ParseException {
-        String queryStr = "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" +
-                "PREFIX dcmitype: <http://purl.org/dc/dcmitype/>\n" +
-                "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n" +
-                "INSERT\n" +
-                "  { GRAPH <http://example/bookStore2> { ?book ?p ?v } }\n" +
-                "WHERE\n" +
-                "  { GRAPH <http://example/bookStore>\n" +
-                "    { ?book dc:date ?date . \n" +
-                "      FILTER ( ?date < \"2000-01-01T00:00:00-02:00\"^^xsd:dateTime )\n" +
-                "      ?book ?p ?v\n" +
-                "    }\n" +
-                "  } ;\n\n" +
-                "WITH <http://example/bookStore>\n" +
-                "DELETE\n" +
-                " { ?book ?p ?v }\n" +
-                "WHERE\n" +
-                "  { ?book dc:date ?date ;\n" +
-                "          dc:type dcmitype:PhysicalObject .\n" +
-                "    FILTER ( ?date < \"2000-01-01T00:00:00-02:00\"^^xsd:dateTime ) \n" +
-                "    ?book ?p ?v\n" +
-                "  }";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-
-        Set<IRI> expected = new HashSet<>();
-        expected.add(new IRI("http://example/bookStore2"));
-        expected.add(new IRI("http://example/bookStore"));
-        Assert.assertTrue(referredGraphs.containsAll(expected));
-    }
-
-    @Test
-    public void testExistsFunction() throws ParseException {
-        String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" +
-                "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n\n" +
-                "SELECT ?person\n" +
-                "WHERE \n" +
-                "{\n" +
-                "  ?person rdf:type foaf:Person .\n" +
-                "  FILTER EXISTS { ?person foaf:name ?name }\n" +
-                "}";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-
-    @Test
-    public void testNotExistsFunction() throws ParseException {
-        String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" +
-                "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n\n" +
-                "SELECT ?person\n" +
-                "WHERE \n" +
-                "{\n" +
-                "  ?person rdf:type foaf:Person .\n" +
-                "  FILTER NOT EXISTS { ?person foaf:name ?name }\n" +
-                "}";
-
-        SparqlPreParser parser;
-        parser = new SparqlPreParser(TcManager.getInstance());
-        Set<IRI> referredGraphs = parser.getReferredGraphs(queryStr, DEFAULT_GRAPH);
-        Assert.assertTrue(referredGraphs.toArray()[0].equals(DEFAULT_GRAPH));
-    }
-}


[clerezza] 42/45: Falling back to Serializer.getInstance() instead of null

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit cc057c75fccae0c68463d65e2167e5ed5f3db124
Author: Reto Gmür <re...@factsmission.com>
AuthorDate: Mon Mar 11 10:13:19 2019 +0100

    Falling back to Serializer.getInstance() instead of null
---
 .../java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
index a9842f3..76add08 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
@@ -42,7 +42,7 @@ import java.util.Objects;
         SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class GraphWriter implements MessageBodyWriter<Graph> {
 
-    private Serializer serializer;
+    private Serializer serializer = Serializer.getInstance();
 
     @Reference
     public synchronized void setSerializer(Serializer serializer) {
@@ -51,7 +51,7 @@ public class GraphWriter implements MessageBodyWriter<Graph> {
 
     public synchronized void unsetSerializer(Serializer serializer) {
         if (Objects.equals(this.serializer, serializer)) {
-            this.serializer = null;
+            this.serializer = Serializer.getInstance();
         }
     }
 


[clerezza] 30/45: CLEREZZA-1032: Add ontology class XSD to ontologies module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit bff642b57d1e140025f161a1c366424465a3612d
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 21:54:57 2019 +0100

    CLEREZZA-1032: Add ontology class XSD to ontologies module
---
 .../java/org/apache/clerezza/ontologies/XSD.java   | 222 +++++++++++++++++++++
 1 file changed, 222 insertions(+)

diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/XSD.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/XSD.java
new file mode 100644
index 0000000..b00cb04
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/XSD.java
@@ -0,0 +1,222 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class XSD {
+	// Classes
+
+	/**
+	 * comment: NCName represents XML "non-colonized" Names. The ·value space· of NCName is the set of all strings which ·match· the NCName production of [Namespaces in XML]. The ·lexical space· of NCName is the set of all strings which ·match· the NCName production of [Namespaces in XML]. The ·base type· of NCName is Name.
+
+	 */
+	public static final IRI NCName = new IRI("http://www.w3.org/2001/XMLSchema#NCName");
+
+	/**
+	 * comment: NMTOKEN represents the NMTOKEN attribute type from [XML 1.0 (Second Edition)]. The ·value space· of NMTOKEN is the set of tokens that ·match· the Nmtoken production in [XML 1.0 (Second Edition)]. The ·lexical space· of NMTOKEN is the set of strings that ·match· the Nmtoken production in [XML 1.0 (Second Edition)]. The ·base type· of NMTOKEN is token.
+
+	 */
+	public static final IRI NMTOKEN = new IRI("http://www.w3.org/2001/XMLSchema#NMTOKEN");
+
+	/**
+	 * comment: Name represents XML Names. The ·value space· of Name is the set of all strings which ·match· the Name production of [XML 1.0 (Second Edition)]. The ·lexical space· of Name is the set of all strings which ·match· the Name production of [XML 1.0 (Second Edition)]. The ·base type· of Name is token.
+
+	 */
+	public static final IRI Name = new IRI("http://www.w3.org/2001/XMLSchema#Name");
+
+	/**
+	 * comment: anyURI represents a Uniform Resource Identifier Reference (URI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be a URI Reference). This type should be used to specify the intention that the value fulfills the role of a URI as defined by [RFC 2396], as amended by [RFC 2732].
+
+	 */
+	public static final IRI anyURI = new IRI("http://www.w3.org/2001/XMLSchema#anyURI");
+
+	/**
+	 * comment:  base64Binary represents Base64-encoded arbitrary binary data. The ·value space· of base64Binary is the set of finite-length sequences of binary octets. For base64Binary data the entire binary stream is encoded using the Base64 Content-Transfer-Encoding defined in Section 6.8 of [RFC 2045].
+
+	 */
+	public static final IRI base64Binary = new IRI("http://www.w3.org/2001/XMLSchema#base64Binary");
+
+	/**
+	 * comment: boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}.
+
+	 */
+	public static final IRI boolean_ = new IRI("http://www.w3.org/2001/XMLSchema#boolean");
+
+	/**
+	 * comment:  byte is ·derived· from short by setting the value of ·maxInclusive· to be 127 and ·minInclusive· to be -128. The ·base type· of byte is short.
+
+	 */
+	public static final IRI byte_ = new IRI("http://www.w3.org/2001/XMLSchema#byte");
+
+	/**
+	 * comment: date represents a calendar date. The ·value space· of date is the set of Gregorian calendar dates as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-day long, non-periodic instances e.g. lexical 1999-10-26 to represent the calendar date 1999-10-26, independent of how many hours this day has.
+
+	 */
+	public static final IRI date = new IRI("http://www.w3.org/2001/XMLSchema#date");
+
+	/**
+	 * comment: dateTime represents a specific instant of time. The ·value space· of dateTime is the space of Combinations of date and time of day values as defined in § 5.4 of [ISO 8601].
+
+	 */
+	public static final IRI dateTime = new IRI("http://www.w3.org/2001/XMLSchema#dateTime");
+
+	/**
+	 * comment: decimal represents arbitrary precision decimal numbers. The ·value space· of decimal is the set of the values i × 10^-n, where i and n are integers such that n >= 0. The ·order-relation· on decimal is: x < y iff y - x is positive.
+
+[Definition:]   The ·value space· of types derived from decimal with a value for ·totalDigits· of p is the set of values i × 10^-n, where n and i are integers such that p >= n >= 0 and the number of significant decimal digits in i is less than or equal to p.
+
+[Definition:]   The ·value space· of types derived from decimal with a value for ·fractionDigits· of s is the set of values i × 10^-n, where i and n are integers such that 0 <= n <= s.
+
+	 */
+	public static final IRI decimal = new IRI("http://www.w3.org/2001/XMLSchema#decimal");
+
+	/**
+	 * comment: The double datatype corresponds to IEEE double-precision 64-bit floating point type [IEEE 754-1985]. The basic ·value space· of double consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^53, and e is an integer between -1075 and 970, inclusive. In addition to the basic ·value space· described above, the ·value space· of double also contains the following special values: positive and negative zero, positive and negative infinity and not-a [...]
+
+	 */
+	public static final IRI double_ = new IRI("http://www.w3.org/2001/XMLSchema#double");
+
+	/**
+	 * comment: float corresponds to the IEEE single-precision 32-bit floating point type [IEEE 754-1985]. The basic ·value space· of float consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^24, and e is an integer between -149 and 104, inclusive. In addition to the basic ·value space· described above, the ·value space· of float also contains the following special values: positive and negative zero, positive and negative infinity and not-a-number. The  [...]
+
+	 */
+	public static final IRI float_ = new IRI("http://www.w3.org/2001/XMLSchema#float");
+
+	/**
+	 * comment: gDay is a gregorian day that recurs, specifically a day of the month such as the 5th of the month. Arbitrary recurring days are not supported by this datatype. The ·value space· of gDay is the space of a set of calendar dates as defined in § 3 of [ISO 8601]. Specifically, it is a set of one-day long, monthly periodic instances.
+
+	 */
+	public static final IRI gDay = new IRI("http://www.w3.org/2001/XMLSchema#gDay");
+
+	/**
+	 * comment:  gMonth is a gregorian month that recurs every year. The ·value space· of gMonth is the space of a set of calendar months as defined in § 3 of [ISO 8601]. Specifically, it is a set of one-month long, yearly periodic instances.
+
+	 */
+	public static final IRI gMonth = new IRI("http://www.w3.org/2001/XMLSchema#gMonth");
+
+	/**
+	 * comment: gMonthDay is a gregorian date that recurs, specifically a day of the year such as the third of May. Arbitrary recurring dates are not supported by this datatype. The ·value space· of gMonthDay is the set of calendar dates, as defined in § 3 of [ISO 8601]. Specifically, it is a set of one-day long, annually periodic instances.
+
+	 */
+	public static final IRI gMonthDay = new IRI("http://www.w3.org/2001/XMLSchema#gMonthDay");
+
+	/**
+	 * comment: gYearMonth represents a specific gregorian month in a specific gregorian year. The ·value space· of gYearMonth is the set of Gregorian calendar months as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-month long, non-periodic instances e.g. 1999-10 to represent the whole month of 1999-10, independent of how many days this month has.
+
+	 */
+	public static final IRI gYearMonth = new IRI("http://www.w3.org/2001/XMLSchema#gYearMonth");
+
+	/**
+	 * comment: hexBinary represents arbitrary hex-encoded binary data. The ·value space· of hexBinary is the set of finite-length sequences of binary octets.
+
+	 */
+	public static final IRI hexBinary = new IRI("http://www.w3.org/2001/XMLSchema#hexBinary");
+
+	/**
+	 * comment: int is ·derived· from long by setting the value of ·maxInclusive· to be 2147483647 and ·minInclusive· to be -2147483648. The ·base type· of int is long.
+
+	 */
+	public static final IRI int_ = new IRI("http://www.w3.org/2001/XMLSchema#int");
+
+	/**
+	 * comment: integer is ·derived· from decimal by fixing the value of ·fractionDigits· to be 0. This results in the standard mathematical concept of the integer numbers. The ·value space· of integer is the infinite set {...,-2,-1,0,1,2,...}. The ·base type· of integer is decimal.
+
+	 */
+	public static final IRI integer = new IRI("http://www.w3.org/2001/XMLSchema#integer");
+
+	/**
+	 * comment: anguage represents natural language identifiers as defined by [RFC 1766]. The ·value space· of language is the set of all strings that are valid language identifiers as defined in the language identification section of [XML 1.0 (Second Edition)]. The ·lexical space· of language is the set of all strings that are valid language identifiers as defined in the language identification section of [XML 1.0 (Second Edition)]. The ·base type· of language is token.
+
+	 */
+	public static final IRI language = new IRI("http://www.w3.org/2001/XMLSchema#language");
+
+	/**
+	 * comment: long is ·derived· from integer by setting the value of ·maxInclusive· to be 9223372036854775807 and ·minInclusive· to be -9223372036854775808. The ·base type· of long is integer.
+
+	 */
+	public static final IRI long_ = new IRI("http://www.w3.org/2001/XMLSchema#long");
+
+	/**
+	 * comment: negativeInteger is ·derived· from nonPositiveInteger by setting the value of ·maxInclusive· to be -1. This results in the standard mathematical concept of the negative integers. The ·value space· of negativeInteger is the infinite set {...,-2,-1}. The ·base type· of negativeInteger is nonPositiveInteger.
+
+	 */
+	public static final IRI negativeInteger = new IRI("http://www.w3.org/2001/XMLSchema#negativeInteger");
+
+	/**
+	 * comment: nonNegativeInteger is ·derived· from integer by setting the value of ·minInclusive· to be 0. This results in the standard mathematical concept of the non-negative integers. The ·value space· of nonNegativeInteger is the infinite set {0,1,2,...}. The ·base type· of nonNegativeInteger is integer.
+
+	 */
+	public static final IRI nonNegativeInteger = new IRI("http://www.w3.org/2001/XMLSchema#nonNegativeInteger");
+
+	/**
+	 * comment: nonPositiveInteger is ·derived· from integer by setting the value of ·maxInclusive· to be 0. This results in the standard mathematical concept of the non-positive integers. The ·value space· of nonPositiveInteger is the infinite set {...,-2,-1,0}. The ·base type· of nonPositiveInteger is integer.
+
+	 */
+	public static final IRI nonPositiveInteger = new IRI("http://www.w3.org/2001/XMLSchema#nonPositiveInteger");
+
+	/**
+	 * comment: normalizedString represents white space normalized strings. The ·value space· of normalizedString is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters. The ·lexical space· of normalizedString is the set of strings that do not contain the carriage return (#xD) nor tab (#x9) characters. The ·base type· of normalizedString is string.  
+
+	 */
+	public static final IRI normalizedString = new IRI("http://www.w3.org/2001/XMLSchema#normalizedString");
+
+	/**
+	 * comment: positiveInteger is ·derived· from nonNegativeInteger by setting the value of ·minInclusive· to be 1. This results in the standard mathematical concept of the positive integer numbers. The ·value space· of positiveInteger is the infinite set {1,2,...}. The ·base type· of positiveInteger is nonNegativeInteger.
+
+	 */
+	public static final IRI positiveInteger = new IRI("http://www.w3.org/2001/XMLSchema#positiveInteger");
+
+	/**
+	 * comment: short is ·derived· from int by setting the value of ·maxInclusive· to be 32767 and ·minInclusive· to be -32768. The ·base type· of short is int.
+
+	 */
+	public static final IRI short_ = new IRI("http://www.w3.org/2001/XMLSchema#short");
+
+	/**
+	 * comment: The string datatype represents character strings in XML. The ·value space· of string is the set of finite-length sequences of characters (as defined in [XML 1.0 (Second Edition)]) that ·match· the Char production from [XML 1.0 (Second Edition)]. A character is an atomic unit of communication; it is not further specified except to note that every character has a corresponding Universal Character Set code point, which is an integer.
+
+	 */
+	public static final IRI string = new IRI("http://www.w3.org/2001/XMLSchema#string");
+
+	/**
+	 * comment:   time represents an instant of time that recurs every day. The ·value space· of time is the space of time of day values as defined in § 5.3 of [ISO 8601]. Specifically, it is a set of zero-duration daily time instances.
+
+	 */
+	public static final IRI time = new IRI("http://www.w3.org/2001/XMLSchema#time");
+
+	/**
+	 * comment:  token represents tokenized strings. The ·value space· of token is the set of strings that do not contain the line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The ·lexical space· of token is the set of strings that do not contain the line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces [...]
+
+	 */
+	public static final IRI token = new IRI("http://www.w3.org/2001/XMLSchema#token");
+
+	/**
+	 * comment: unsignedByte is ·derived· from unsignedShort by setting the value of ·maxInclusive· to be 255. The ·base type· of unsignedByte is unsignedShort.
+
+	 */
+	public static final IRI unsignedByte = new IRI("http://www.w3.org/2001/XMLSchema#unsignedByte");
+
+	/**
+	 * comment:  unsignedInt is ·derived· from unsignedLong by setting the value of ·maxInclusive· to be 4294967295. The ·base type· of unsignedInt is unsignedLong.
+
+	 */
+	public static final IRI unsignedInt = new IRI("http://www.w3.org/2001/XMLSchema#unsignedInt");
+
+	/**
+	 * comment: unsignedLong is ·derived· from nonNegativeInteger by setting the value of ·maxInclusive· to be 18446744073709551615. The ·base type· of unsignedLong is nonNegativeInteger.
+
+	 */
+	public static final IRI unsignedLong = new IRI("http://www.w3.org/2001/XMLSchema#unsignedLong");
+
+	/**
+	 * comment: unsignedShort is ·derived· from unsignedInt by setting the value of ·maxInclusive· to be 65535. The ·base type· of unsignedShort is unsignedInt.
+
+	 */
+	public static final IRI unsignedShort = new IRI("http://www.w3.org/2001/XMLSchema#unsignedShort");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI XMLSchema = new IRI("http://www.w3.org/2001/XMLSchema");
+}


[clerezza] 43/45: supportingnon-DS parser/serializer as discussed on list

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit c65d7a627076c8dd5f07f111db1b9c9caf2bee3a
Author: Reto Gmür <re...@factsmission.com>
AuthorDate: Mon Mar 25 13:07:42 2019 +0100

    supportingnon-DS parser/serializer as discussed on list
---
 .../org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java     | 5 +++--
 .../java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
index 27f5f7b..61f82fa 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
@@ -66,9 +66,10 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
     public static final String OBJ_EXP_PARAM = "xPropObj";
     public static final String SUBJ_EXP_PARAM = "xPropSubj";
 
-    private Serializer serializer;
     private UriInfo uriInfo;
 
+    private Serializer serializer = Serializer.getInstance();
+
     @Reference
     public synchronized void setSerializer(Serializer serializer) {
         this.serializer = serializer;
@@ -76,7 +77,7 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
 
     public synchronized void unsetSerializer(Serializer serializer) {
         if (Objects.equals(this.serializer, serializer)) {
-            this.serializer = null;
+            this.serializer = Serializer.getInstance();
         }
     }
 
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
index dcf58bc..fb00f6e 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
@@ -43,7 +43,7 @@ import java.util.Objects;
         SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class GraphReader implements MessageBodyReader<Graph> {
 
-    private Parser parser;
+    private Parser parser = Parser.getInstance();
 
     @Reference
     public synchronized void setParser(Parser parser) {
@@ -52,7 +52,7 @@ public class GraphReader implements MessageBodyReader<Graph> {
 
     public synchronized void unsetParser(Parser parser) {
         if (Objects.equals(this.parser, parser)) {
-            this.parser = null;
+            this.parser = Parser.getInstance();
         }
     }
 


[clerezza] 35/45: CLEREZZA-1033: Delete rdf module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 2980b6ba55ea8fa3d97b0f01143a3976b39fc97a
Author: Hasan <ha...@apache.org>
AuthorDate: Thu Feb 14 22:32:43 2019 +0100

    CLEREZZA-1033: Delete rdf module
---
 rdf/core.test/LICENSE                              |  201 ---
 rdf/core.test/pom.xml                              |   51 -
 .../apache/clerezza/rdf/core/test/GraphTest.java   |  573 ---------
 .../clerezza/rdf/core/test/GraphWrapper.java       |  126 --
 .../apache/clerezza/rdf/core/test/LockChecker.java |   39 -
 .../core/test/LockableMGraphWrapperForTesting.java |   75 --
 .../rdf/core/test/LockingIteratorForTesting.java   |   79 --
 .../apache/clerezza/rdf/core/test/RandomGraph.java |  237 ----
 .../clerezza/rdf/core/test/TcProviderTest.java     |  484 --------
 rdf/core/LICENSE                                   |  201 ---
 rdf/core/nbactions.xml                             |   11 -
 rdf/core/pom.xml                                   |  136 --
 .../src/main/appended-resources/META-INF/NOTICE    |    7 -
 .../core/access/EntityAlreadyExistsException.java  |   50 -
 .../core/access/EntityUndeletableException.java    |   50 -
 .../core/access/ImmutableGraphServiceFactory.java  |   58 -
 .../rdf/core/access/MGraphServiceFactory.java      |   54 -
 .../rdf/core/access/NoSuchEntityException.java     |   51 -
 .../rdf/core/access/QueryableTcProvider.java       |   43 -
 .../rdf/core/access/ReadOnlyException.java         |   50 -
 .../clerezza/rdf/core/access/SecuredGraph.java     |  198 ---
 .../apache/clerezza/rdf/core/access/TcManager.java |  626 ----------
 .../clerezza/rdf/core/access/TcProvider.java       |  151 ---
 .../rdf/core/access/TcProviderMultiplexer.java     |  457 -------
 .../core/access/WeightedProviderComparator.java    |   41 -
 .../rdf/core/access/WeightedTcProvider.java        |   36 -
 .../apache/clerezza/rdf/core/access/package.html   |   56 -
 .../core/access/security/TcAccessController.java   |  354 ------
 .../rdf/core/access/security/TcPermission.java     |  149 ---
 .../clerezza/rdf/core/serializedform/Parser.java   |  328 -----
 .../rdf/core/serializedform/ParsingProvider.java   |   49 -
 .../rdf/core/serializedform/Serializer.java        |  270 ----
 .../core/serializedform/SerializingProvider.java   |   49 -
 .../rdf/core/serializedform/SupportedFormat.java   |   61 -
 .../serializedform/UnsupportedFormatException.java |   37 -
 .../UnsupportedParsingFormatException.java         |   35 -
 .../UnsupportedSerializationFormatException.java   |   35 -
 .../src/main/resources/META-INF/documentation.nt   |  286 -----
 .../documentation/images/scb_architecture.png      |  Bin 1791422 -> 0 bytes
 .../documentation/scb-triaxrs-tutorial/LICENSE     |  201 ---
 .../documentation/scb-triaxrs-tutorial/pom.xml     |   59 -
 .../clerezza/combined/tutorial/TutorialApp.java    |  131 --
 .../apache/clerezza/combined/tutorial/data.turtle  |   32 -
 .../clerezza/combined/tutorial/tutorial.xhtml      |   47 -
 .../documentation/style/documentation.css          |   34 -
 .../site/resources/documentation/style/style.css   |  421 -------
 .../site/resources/documentation/tutorial1/LICENSE |  201 ---
 .../site/resources/documentation/tutorial1/pom.xml |  106 --
 .../clerezza/scb/tutorial1/Tutorial1App.java       |  305 -----
 rdf/core/src/site/resources/images/clerezza.png    |  Bin 7113 -> 0 bytes
 rdf/core/src/site/site.xml                         |   32 -
 rdf/core/src/site/xsite/content/overview.xhtml     |  216 ----
 .../site/xsite/content/scb-triaxrs-tutorial.xhtml  |  384 ------
 rdf/core/src/site/xsite/content/sitemap.xml        |   31 -
 rdf/core/src/site/xsite/content/tutorial_1.xhtml   |  491 --------
 rdf/core/src/site/xsite/templates/skin.html        |   71 --
 .../clerezza/rdf/core/access/SecurityTest.java     |  180 ---
 .../clerezza/rdf/core/access/TcManagerTest.java    |  302 -----
 .../rdf/core/access/providers/WeightedA.java       |  103 --
 .../rdf/core/access/providers/WeightedA1.java      |  104 --
 .../rdf/core/access/providers/WeightedAHeavy.java  |  103 --
 .../rdf/core/access/providers/WeightedBlight.java  |  107 --
 .../rdf/core/access/providers/WeightedDummy.java   |  156 ---
 .../core/impl/util/SimpleLiteralFactoryTest.java   |   63 -
 .../rdf/core/impl/util/W3CDateFormatTest.java      |   71 --
 .../rdf/core/serializedform/ParserTest.java        |   89 --
 .../rdf/core/serializedform/SerializerTest.java    |   89 --
 .../serializedform/TestServiceManagedProvider.java |   49 -
 ...che.clerezza.rdf.core.access.WeightedTcProvider |   18 -
 ...lerezza.rdf.core.serializedform.ParsingProvider |   18 -
 rdf/ontologies/LICENSE                             |  201 ---
 rdf/ontologies/pom.xml                             |   78 --
 .../org/apache/clerezza/rdf/ontologies/SKOS.java   |   27 -
 .../clerezza/rdf/ontologies/contentprototype.rdf   |   51 -
 .../org/apache/clerezza/rdf/ontologies/dap.rdf     |   61 -
 .../org/apache/clerezza/rdf/ontologies/dc.rdf      |  204 ---
 .../org/apache/clerezza/rdf/ontologies/dcterms.rdf | 1086 ----------------
 .../apache/clerezza/rdf/ontologies/discobits.rdf   |  144 ---
 .../clerezza/rdf/ontologies/documentation.rdf      |  154 ---
 .../org/apache/clerezza/rdf/ontologies/exif.rdf    | 1311 --------------------
 .../org/apache/clerezza/rdf/ontologies/foaf.rdf    |  604 ---------
 .../apache/clerezza/rdf/ontologies/hierarchy.rdf   |   68 -
 .../org/apache/clerezza/rdf/ontologies/lingvoj.rdf |  273 ----
 .../org/apache/clerezza/rdf/ontologies/list.rdf    |  126 --
 .../org/apache/clerezza/rdf/ontologies/menu.rdf    |   42 -
 .../org/apache/clerezza/rdf/ontologies/osgi.rdf    |   99 --
 .../org/apache/clerezza/rdf/ontologies/owl.rdf     |  288 -----
 .../apache/clerezza/rdf/ontologies/permission.rdf  |  157 ---
 .../apache/clerezza/rdf/ontologies/platform.rdf    |  145 ---
 .../org/apache/clerezza/rdf/ontologies/rdf.rdf     |  131 --
 .../org/apache/clerezza/rdf/ontologies/rdfs.rdf    |  130 --
 .../org/apache/clerezza/rdf/ontologies/script.rdf  |  106 --
 .../org/apache/clerezza/rdf/ontologies/sioc.rdf    |  806 ------------
 .../org/apache/clerezza/rdf/ontologies/skos04.rdf  |  468 -------
 .../org/apache/clerezza/rdf/ontologies/skos08.rdf  |  565 ---------
 .../apache/clerezza/rdf/ontologies/tcprovider.rdf  |   71 --
 .../org/apache/clerezza/rdf/ontologies/vcard.rdf   | 1059 ----------------
 .../org/apache/clerezza/rdf/ontologies/xsd.n3      |  117 --
 rdf/pom.xml                                        |   56 -
 rdf/scala.utils/LICENSE                            |  201 ---
 rdf/scala.utils/pom.xml                            |  131 --
 .../clerezza/rdf/scala/utils/CollectedIter.scala   |  133 --
 .../clerezza/rdf/scala/utils/EzLiteral.scala       |   81 --
 .../apache/clerezza/rdf/scala/utils/EzMGraph.scala |   88 --
 .../clerezza/rdf/scala/utils/NameSpace.scala       |   37 -
 .../apache/clerezza/rdf/scala/utils/Preamble.scala |  123 --
 .../clerezza/rdf/scala/utils/RichGraphNode.scala   |  244 ----
 .../clerezza/rdf/scala/utils/EzMGraphTest.scala    |  161 ---
 .../rdf/scala/utils/RichGraphNodeTest.scala        |  174 ---
 .../rdf/scala/utils/TypeConversionTest.scala       |   74 --
 rdf/schemagen/main/LICENSE                         |  201 ---
 rdf/schemagen/main/pom.xml                         |   99 --
 rdf/schemagen/main/src/assembly/dist.xml           |   48 -
 .../apache/clerezza/rdf/schemagen/SchemaGen.java   |  486 --------
 .../clerezza/rdf/schemagen/SchemaGenArguments.java |   49 -
 rdf/schemagen/maven-plugin/LICENSE                 |  201 ---
 rdf/schemagen/maven-plugin/pom.xml                 |   60 -
 .../OntologyJavaClassCreatorMojo.java              |  203 ---
 rdf/simple.storage/LICENSE                         |  201 ---
 rdf/simple.storage/pom.xml                         |   75 --
 .../rdf/simple/storage/SimpleTcProvider.java       |  172 ---
 ...che.clerezza.rdf.core.access.WeightedTcProvider |    1 -
 .../rdf/simple/storage/AccessViaTcManager.java     |   37 -
 .../rdf/simple/storage/GenericTcProviderTest.java  |   43 -
 .../rdf/simple/storage/SimpleGraphGenericTest.java |   37 -
 rdf/utils/LICENSE                                  |  201 ---
 rdf/utils/pom.xml                                  |   69 --
 .../org/apache/clerezza/rdf/utils/GraphNode.java   |  720 -----------
 .../org/apache/clerezza/rdf/utils/GraphUtils.java  |  163 ---
 .../org/apache/clerezza/rdf/utils/IRIUtil.java     |   63 -
 .../org/apache/clerezza/rdf/utils/RdfList.java     |  358 ------
 .../apache/clerezza/rdf/utils/SeeAlsoExpander.java |  113 --
 .../org/apache/clerezza/rdf/utils/Smusher.java     |   61 -
 .../org/apache/clerezza/rdf/utils/UnionGraph.java  |  286 -----
 .../clerezza/rdf/utils/UnionWatchableGraph.java    |   54 -
 .../clerezza/rdf/utils/UriMutatingGraph.java       |  223 ----
 .../utils/graphnodeprovider/GraphNodeProvider.java |   51 -
 .../clerezza/rdf/utils/smushing/BaseSmusher.java   |  135 --
 .../clerezza/rdf/utils/smushing/IfpSmusher.java    |  174 ---
 .../clerezza/rdf/utils/smushing/SameAsSmusher.java |  113 --
 .../apache/clerezza/rdf/utils/GraphUtilsTest.java  |  104 --
 .../apache/clerezza/rdf/utils/IfpSmushTest.java    |  115 --
 .../org/apache/clerezza/rdf/utils/RdfListTest.java |  183 ---
 .../apache/clerezza/rdf/utils/SameAsSmushTest.java |   78 --
 .../apache/clerezza/rdf/utils/TestGraphNode.java   |  271 ----
 .../apache/clerezza/rdf/utils/UnionGraphTest.java  |   78 --
 .../rdf/utils/smushing/SameAsSmushTest.java        |   92 --
 147 files changed, 25701 deletions(-)

diff --git a/rdf/core.test/LICENSE b/rdf/core.test/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf/core.test/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/rdf/core.test/pom.xml b/rdf/core.test/pom.xml
deleted file mode 100644
index 125c01d..0000000
--- a/rdf/core.test/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- 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.
-
--->
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>clerezza</artifactId>
-        <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
-        <relativePath>../../parent</relativePath>
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.core.test</artifactId>
-    <packaging>jar</packaging>
-    <version>1.0.1-SNAPSHOT</version>
-    <name>Clerezza - RDF - Core Testsuite</name>
-    <description>Utilities to test Clerezza rdf.core implementations</description>
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphTest.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphTest.java
deleted file mode 100644
index f110041..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphTest.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.junit.Test;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
-import org.junit.Assert;
-
-
-
-/**
- * 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));
-    }
-    
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphWrapper.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphWrapper.java
deleted file mode 100644
index 5b84df0..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/GraphWrapper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-
-
-/**
- *
- * @author mir
- */
-class GraphWrapper implements Graph {
-
-    protected Graph wrapped;
-
-    public GraphWrapper(Graph tc) {
-        this.wrapped = tc;
-    }
-
-    @Override
-    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        return wrapped.filter(subject, predicate, object);
-    }
-
-    
-    @Override
-    public int size() {
-        return wrapped.size();
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return wrapped.isEmpty();
-    }
-
-    @Override
-    public boolean contains(Object o) {
-        return wrapped.contains(o);
-    }
-
-    @Override
-    public Iterator<Triple> iterator() {
-        return wrapped.iterator();
-    }
-
-    @Override
-    public Object[] toArray() {
-        return wrapped.toArray();
-    }
-
-    @Override
-    public <T> T[] toArray(T[] a) {
-        return wrapped.toArray(a);
-    }
-
-    @Override
-    public boolean add(Triple e) {
-        return wrapped.add(e);
-    }
-
-    @Override
-    public boolean remove(Object o) {
-        return wrapped.remove(o);
-    }
-
-    @Override
-    public boolean containsAll(Collection<?> c) {
-        return wrapped.containsAll(c);
-    }
-
-    @Override
-    public boolean addAll(Collection<? extends Triple> c) {
-        return wrapped.addAll(c);
-    }
-
-    @Override
-    public boolean removeAll(Collection<?> c) {
-        return wrapped.removeAll(c);
-    }
-
-    @Override
-    public boolean retainAll(Collection<?> c) {
-        return wrapped.retainAll(c);
-    }
-
-    @Override
-    public void clear() {
-        wrapped.clear();
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph() {
-        return wrapped.getImmutableGraph();
-    }
-
-    @Override
-    public ReadWriteLock getLock() {
-        return wrapped.getLock();
-    }
-
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockChecker.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockChecker.java
deleted file mode 100644
index d1784b4..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockChecker.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Copyright 2010 mir.
- * 
- *  Licensed 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.
- *  under the License.
- */
-
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-/**
- *
- * @author mir
- */
-class LockChecker {
-
-    public static void checkIfReadLocked(ReentrantReadWriteLock lock) {
-        if (lock.getReadLockCount() == 0 && !lock.isWriteLockedByCurrentThread()) {
-            throw new RuntimeException("Neither read- nor write-locked");
-        }
-    }
-
-    public static void checkIfWriteLocked(ReentrantReadWriteLock lock) {
-        if (!lock.isWriteLockedByCurrentThread()) {
-            throw new RuntimeException("Not write-locked");
-        }
-    }
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockableMGraphWrapperForTesting.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockableMGraphWrapperForTesting.java
deleted file mode 100644
index 980f6d2..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockableMGraphWrapperForTesting.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.Iterator;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * Wrappes an Graph as a LockableGraph. If a method is called that reads
- * or modifies the wrapped graph and the appropriate lock is not set, then a
- * RuntimeException is thrown.
- *
- * @author rbn, mir
- */
-public class LockableMGraphWrapperForTesting extends GraphWrapper {
-
-    private final ReentrantReadWriteLock lock = (ReentrantReadWriteLock) getLock();
-    private final Lock readLock = lock.readLock();
-    private final Graph wrapped;
-
-    /**
-     * Constructs a LocalbleGraph for an Graph.
-     *
-     * @param providedGraph a non-lockable mgraph
-     */
-    public LockableMGraphWrapperForTesting(final Graph providedGraph) {
-        super(providedGraph);
-        this.wrapped = providedGraph;
-    }
-
-    @Override
-    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        LockChecker.checkIfReadLocked(lock);
-        readLock.lock();
-        try {
-            return new LockingIteratorForTesting(wrapped.filter(subject, predicate, object), lock);
-        } finally {
-            readLock.unlock();
-        }
-    }
-
-    @Override
-    public Iterator<Triple> iterator() {
-        LockChecker.checkIfReadLocked(lock);
-        readLock.lock();
-        try {
-            return new LockingIteratorForTesting(wrapped.iterator(), lock);
-        } finally {
-            readLock.unlock();
-        }
-    }
-
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockingIteratorForTesting.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockingIteratorForTesting.java
deleted file mode 100644
index 4c434ec..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/LockingIteratorForTesting.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.Iterator;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.clerezza.commons.rdf.Triple;
-
-/**
- * Wrapps an iterator<Triple> reading all elements to a cache on construction
- * and returning them from that cache.
- * @author reto
- */
-class LockingIteratorForTesting implements Iterator<Triple> {
-
-    private Iterator<Triple> base;
-    private Lock readLock;
-    private Lock writeLock;
-    private ReentrantReadWriteLock lock;
-
-    public LockingIteratorForTesting(Iterator<Triple> iterator, ReentrantReadWriteLock lock) {
-        base = iterator;
-        readLock = lock.readLock();
-        writeLock = lock.writeLock();
-        this.lock = lock;
-    }
-
-    @Override
-    public boolean hasNext() {
-        LockChecker.checkIfReadLocked(lock);
-        readLock.lock();
-        try {
-            return base.hasNext();
-        } finally {
-            readLock.unlock();
-        }
-    }
-
-    @Override
-    public Triple next() {
-        LockChecker.checkIfReadLocked(lock);
-        readLock.lock();
-        try {
-            return base.next();
-        } finally {
-            readLock.unlock();
-        }
-    }
-
-    @Override
-    public void remove() {
-        LockChecker.checkIfWriteLocked(lock);
-        writeLock.lock();
-        try {
-            base.remove();
-        } finally {
-            writeLock.unlock();
-        }
-    }
-
-
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/RandomGraph.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/RandomGraph.java
deleted file mode 100644
index 70cab4d..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/RandomGraph.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.Iterator;
-import java.util.UUID;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.commons.lang.RandomStringUtils;
-
-/**
- * A <code>Graph</code> wrapper that allows growing and shrinking of
- * the wrapped mgraph.
- *
- * @author mir
- */
-public class RandomGraph extends GraphWrapper {
-    
-    private int interconnectivity = 2;
-
-    public RandomGraph(Graph mGraph, int interconnectivity) {
-        super(mGraph);
-        this.interconnectivity = interconnectivity;
-    }
-
-    /**
-     * Creates a new random mutual graph.
-     *
-     * @param initialSize Determines the initial size of the content graph
-     * @param interconnectivity Determines the probability of using already existing
-     *        resource when creating a new triple. The probability of using an existing
-     *        resource over creating a new resouce is 1-(1/interconnectivity).
-     * @param mGraph
-     */
-    public RandomGraph(int initialSize, int interconnectivity, Graph mGraph) {
-        super(mGraph);
-        if (interconnectivity <= 0) {
-            throw new IllegalArgumentException("growth speed and the interconnectivity "
-                    + "value have to be equals or highter one");
-        }
-        this.interconnectivity = interconnectivity;
-
-        setupInitialSize(initialSize);
-    }
-
-    /**
-     * Add or removes randomly a triple.
-     *
-     * @return the triple that was added or removed.
-     */
-    public Triple evolve() {
-        Triple triple;
-        int random = rollDice(2);
-        if (random == 0 && size() != 0) {
-            triple = getRandomTriple();
-            remove(triple);
-        } else {
-            triple = createRandomTriple();
-            add(triple);
-        }
-        return triple;
-    }
-
-    /**
-     * Removes a random triple.
-     *
-     * @return the triple that was removed.
-     */
-    public Triple removeRandomTriple() {
-        Triple randomTriple = getRandomTriple();
-        remove(randomTriple);
-        return randomTriple;
-    }
-
-    /**
-     * Adds a random triple.
-     *
-     * @return the triple that was added.
-     */
-    public Triple addRandomTriple() {
-        Triple randomTriple;
-        do {
-         randomTriple = createRandomTriple();
-        } while(contains(randomTriple));
-        
-        add(randomTriple);
-        return randomTriple;
-    }
-    
-    private Triple createRandomTriple() {
-        return new TripleImpl(getSubject(), getPredicate(), getObject());
-    }
-
-    private BlankNodeOrIRI getSubject() {
-        int random = rollDice(interconnectivity);
-        if (size() == 0) {
-            random = 0;
-        }
-        switch (random) {
-            case 0: // create new BlankNodeOrIRI
-                RDFTerm newRDFTerm;
-                do {
-                    newRDFTerm = createRandomRDFTerm();
-                } while (!(newRDFTerm instanceof BlankNodeOrIRI));
-                return (BlankNodeOrIRI) newRDFTerm;
-            default: // get existing BlankNodeOrIRI
-                RDFTerm existingRDFTerm;
-                do {
-                    existingRDFTerm = getExistingRDFTerm();
-                    if (existingRDFTerm == null) {
-                        random = 0;
-                    }
-                } while (!(existingRDFTerm instanceof BlankNodeOrIRI));
-
-                return (BlankNodeOrIRI) existingRDFTerm;
-        }
-    }
-
-    private IRI getPredicate() {
-        int random = rollDice(interconnectivity);
-        if (size() == 0) {
-            random = 0;
-        }
-        switch (random) {
-            case 0: // create new IRI
-                return createRandomIRI();
-            default: // get existing IRI
-                RDFTerm existingRDFTerm;
-                do {
-                    existingRDFTerm = getExistingRDFTerm();
-                    if (existingRDFTerm == null) {
-                        random = 0;
-                    }
-                } while (!(existingRDFTerm instanceof IRI));
-                return (IRI) existingRDFTerm;
-        }
-    }
-
-    private RDFTerm getObject() {
-        int random = rollDice(interconnectivity);
-        if (size() == 0) {
-            random = 0;
-        }        
-        switch (random) {
-            case 0: // create new resource
-                return createRandomRDFTerm();
-            default: // get existing resource
-                RDFTerm existingRDFTerm = getExistingRDFTerm();
-                if (existingRDFTerm == null) {
-                    random = 0;
-                }
-                return existingRDFTerm;
-        }
-    }
-
-    private static int rollDice(int faces) {
-        return (int) (Math.random() * faces);
-    }
-
-    private RDFTerm createRandomRDFTerm() {
-        switch (rollDice(3)) {
-            case 0:
-                return new BlankNode();
-            case 1:
-                return createRandomIRI();
-            case 2:
-                return new PlainLiteralImpl(RandomStringUtils.random(rollDice(100) + 1));
-        }
-        throw new RuntimeException("in createRandomRDFTerm()");
-    }
-
-    private RDFTerm getExistingRDFTerm() {
-        Triple triple = getRandomTriple();
-        if (triple == null) {
-            return null;
-        }
-        switch (rollDice(3)) {
-            case 0:
-                return triple.getSubject();
-            case 1:
-                return triple.getPredicate();
-            case 2:
-                return triple.getObject();
-        }
-        return null;
-    }
-
-    private IRI createRandomIRI() {
-        return new IRI("http://" + UUID.randomUUID().toString());
-    }
-
-    /**
-     * Returns a random triple contained in the Graph.
-     */
-    public Triple getRandomTriple() {
-        int size = this.size();
-        if (size == 0) {
-            return null;
-        }
-        Iterator<Triple> triples = iterator();
-        while (triples.hasNext()) {
-            Triple triple = triples.next();
-            if (rollDice(this.size()) == 0) {
-                return triple;
-            }
-        }
-        return getRandomTriple();
-    }
-
-    private void setupInitialSize(int initialSize) {
-        for (int i = 0; i < initialSize; i++) {
-            addRandomTriple();
-        }
-    }
-}
diff --git a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java b/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
deleted file mode 100644
index bea479d..0000000
--- a/rdf/core.test/src/main/java/org/apache/clerezza/rdf/core/test/TcProviderTest.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.test;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-import java.util.Set;
-import org.junit.Test;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import static org.junit.Assert.*;
-
-/**
- * 
- * @author mir,rbn
- */
-public abstract class TcProviderTest {
-
-    protected final IRI uriRefA = generateUri("a");
-    protected final IRI uriRefA1 = generateUri("a1");
-    protected final IRI uriRefB = generateUri("b");
-    protected final IRI uriRefB1 = generateUri("b1");
-    protected final IRI uriRefC = generateUri("c");
-
-    protected final IRI graphIRI = generateUri("myGraph");
-    protected final IRI otherGraphIRI = new IRI(graphIRI.getUnicodeString());
-
-    @Test
-    public void testCreateImmutableGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-
-        ImmutableGraph createdGraph = simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-
-        Iterator<Triple> iteratorInput = mGraph.iterator();
-        Iterator<Triple> iteratorCreated = createdGraph.iterator();
-        assertEquals(iteratorInput.next(), iteratorCreated.next());
-        assertFalse(iteratorCreated.hasNext());
-
-        try {
-            simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-            assertTrue(false);
-        } catch (EntityAlreadyExistsException e) {
-            assertTrue(true);
-        }
-        simpleTcmProvider.deleteGraph(uriRefA);
-    }
-
-    @Test
-    public void testCreateGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
-        assertTrue(mGraph.isEmpty());
-
-        try {
-            simpleTcmProvider.createGraph(uriRefA);
-            assertTrue(false);
-        } catch (EntityAlreadyExistsException e) {
-            assertTrue(true);
-        }
-        simpleTcmProvider.deleteGraph(uriRefA);
-    }
-
-    @Test
-    public void testGetImmutableGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        simpleTcmProvider.createImmutableGraph(uriRefA1, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-        simpleTcmProvider.createImmutableGraph(uriRefB1, mGraph);
-
-        ImmutableGraph bGraph = simpleTcmProvider.getImmutableGraph(uriRefB);
-        Iterator<Triple> iterator = bGraph.iterator();
-        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-    }
-
-    @Test
-    public void testGetGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        mGraph = simpleTcmProvider.createGraph(uriRefA1);
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        mGraph = simpleTcmProvider.createGraph(uriRefB);
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
-        assertEquals(1, mGraph.size());
-        mGraph = simpleTcmProvider.createGraph(uriRefB1);
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-
-        Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
-        Iterator<Triple> iterator = bGraph.iterator();
-        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-        
-    }
-
-    @Test
-    public void testGetTriples() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
-        // add Graphs
-        mGraph = simpleTcmProvider.createGraph(uriRefA1);
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        mGraph = simpleTcmProvider.createGraph(uriRefB1);
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-
-        // get a ImmutableGraph
-        Graph tripleCollection = simpleTcmProvider.getGraph(uriRefA);
-        // get a Graph
-        Graph tripleCollection2 = simpleTcmProvider.getGraph(uriRefB1);
-
-        Iterator<Triple> iterator = tripleCollection.iterator();
-        assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
-        assertFalse(iterator.hasNext());
-
-        iterator = tripleCollection2.iterator();
-        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-    }
-
-    @Test
-    public void testDeleteEntity() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        ImmutableGraph graph = mGraph.getImmutableGraph();
-        simpleTcmProvider.createImmutableGraph(uriRefA, graph);
-        simpleTcmProvider.createImmutableGraph(uriRefC, graph);
-
-        simpleTcmProvider.deleteGraph(uriRefA);
-        try {
-            simpleTcmProvider.getGraph(uriRefA);
-            assertTrue(false);
-        } catch (NoSuchEntityException e) {
-            assertTrue(true);
-        }
-
-        // Check that graph is still available under uriRefC
-        ImmutableGraph cGraph = simpleTcmProvider.getImmutableGraph(uriRefC);
-        assertNotNull(cGraph);
-        simpleTcmProvider.deleteGraph(uriRefC);
-    }
-
-    /**
-     * Subclasses implement this method to provide implementation instances of
-     * <code>TcProvider</code>. The first call within a test method has to
-     * return a empty TcProvider. Subsequent calls within the test method
-     * should instantiate a new provider, but load the previously added data from
-     * its "persistent" store.
-     *
-     * @return a TcProvider of the implementation to be tested.
-     */
-    protected abstract TcProvider getInstance();
-
-//    @Test
-//    public void testGetNames() {
-//        Graph mGraph = new SimpleGraph();
-//        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-//        simpleTcmProvider.createGraph(uriRefB, mGraph.getGraph());
-//        
-//        mGraph = new SimpleGraph();
-//        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-//        ImmutableGraph graph = mGraph.getGraph();
-//        simpleTcmProvider.createGraph(uriRefA, graph);
-//        simpleTcmProvider.createGraph(uriRefC, graph);
-//
-//        Set<IRI> names = simpleTcmProvider.getNames(graph);
-//
-//        assertTrue(names.contains(uriRefA));
-//        assertTrue(names.contains(uriRefC));
-//        assertEquals(2, names.size());
-//
-//        assertFalse(names.contains(uriRefB));
-//    }
-
-    @Test
-    public void testCreateGraphExtended() throws Exception {
-
-        TcProvider provider = getInstance();
-        Graph graph = provider.createGraph(graphIRI);
-        assertNotNull(graph);
-        //get a new provider and check that graph is there
-        provider = getInstance();
-        graph = provider.getGraph(graphIRI);
-        assertNotNull(graph);
-        //check that there is no such graph, but only the mgraph
-        boolean expThrown = false;
-        try {
-            ImmutableGraph g = provider.getImmutableGraph(graphIRI);
-        } catch(NoSuchEntityException e) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateImmutableGraphExtended() throws Exception {
-
-        TcProvider provider = getInstance();
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
-
-        assertNotNull(graph);
-
-        //get a new provider and check that graph is there
-        provider = getInstance();
-        graph = provider.getImmutableGraph(graphIRI);
-        assertNotNull(graph);
-
-        //check that there is no such mgraph, but only the graph
-        boolean expThrown = false;
-
-        try {
-            Graph g = provider.getMGraph(graphIRI);
-        } catch(NoSuchEntityException e) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphNoDuplicateNames() throws Exception {
-
-        TcProvider provider = getInstance();
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
-        assertNotNull(graph);
-        boolean expThrown = false;
-        try {
-            ImmutableGraph other = provider.createImmutableGraph(otherGraphIRI, null);
-        } catch(EntityAlreadyExistsException eaee) {
-            expThrown = true;
-        }
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphNoDuplicateNames2() throws Exception {
-
-        TcProvider provider = getInstance();
-        Graph graph = provider.createGraph(graphIRI);
-        assertNotNull(graph);
-        boolean expThrown = false;
-        try {
-            Graph other = provider.createGraph(otherGraphIRI);
-        } catch(EntityAlreadyExistsException eaee) {
-            expThrown = true;
-        }
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphWithInitialCollection() throws Exception {
-
-        Triple t1 = createTestTriple();
-
-        TcProvider provider = getInstance();
-
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
-
-        assertEquals(1, graph.size());
-        assertTrue(graph.contains(t1));
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testGraphIsNotMutable() throws Exception {
-
-        Triple t1 = createTestTriple();
-        Set<Triple> t = new HashSet<Triple>();
-        t.add(t1);
-
-        TcProvider provider = getInstance();
-
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
-
-        boolean expThrown = false;
-
-        try {
-            graph.add(t1);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        expThrown = false;
-
-        try {
-            graph.remove(t1);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        expThrown = false;
-
-        try {
-            graph.addAll(t);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-
-        expThrown = false;
-
-        try {
-            graph.clear();
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-
-        expThrown = false;
-
-        try {
-            graph.removeAll(t);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-//    This tests can not pass, because equals in AbstractGraph is not implemented
-//    yet.
-//    @Test
-//    public void testGraphHasName() throws Exception {
-//
-//        TcProvider provider = getInstance();
-//
-//        Graph triples = createTestTripleCollection(createTestTriple());
-//        ImmutableGraph graph = provider.createGraph(graphIRI, triples);
-//
-//        provider = getInstance();
-//        Set<IRI> names = provider.getNames(graph);
-//        assertTrue(names.contains(graphIRI));
-//    }
-//
-//    @Test
-//    public void testCreateSameGraphWithDifferentNames() throws Exception {
-//
-//        Graph triples = createTestTripleCollection(createTestTriple());
-//
-//        TcProvider provider = getInstance();
-//        IRI name1 = new IRI("http://myGraph1");
-//        ImmutableGraph graph = provider.createGraph(name1, triples);
-//
-//        IRI name2 = new IRI("http://myGraph2");
-//        ImmutableGraph secondGraph = provider.createGraph(name2, triples);
-//
-//        Set<IRI> names = provider.getNames(graph);
-//        assertNotNull(names);
-//        assertEquals(2, names.size());
-//    }
-
-    @Test
-    public void testGraphDeletion() throws Exception {
-
-        Graph triples = createTestTripleCollection(createTestTriple());
-
-        TcProvider provider = getInstance();
-        IRI name1 = new IRI("http://myGraph1");
-        ImmutableGraph graph = provider.createImmutableGraph(name1, triples);
-
-        IRI name2 = new IRI("http://myGraph2");
-        ImmutableGraph secondGraph = provider.createImmutableGraph(name2, triples);
-
-        //if we delete graph with name1, the second graph should still be there
-        provider.deleteGraph(name1);
-
-        provider = getInstance();
-        ImmutableGraph firstGraph = provider.getImmutableGraph(name2);
-        assertNotNull(firstGraph);
-
-        //check second name is not there
-        boolean expThrown = false;
-
-        try {
-            ImmutableGraph g = provider.getImmutableGraph(name1);
-        } catch(NoSuchEntityException nses) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(name2);
-    }
-
-
-
-    @Test
-    public void testGetTriplesGraph() throws Exception {
-        TcProvider provider = getInstance();
-
-        Graph graph = provider.createGraph(graphIRI);
-
-        Graph tc = provider.getGraph(graphIRI);
-        assertNotNull(tc);
-        provider.deleteGraph(graphIRI);
-    }
-
-    private Triple createTestTriple() {
-        BlankNodeOrIRI subject = new BlankNode() {};
-        IRI predicate = new IRI("http://test.com/");
-        BlankNodeOrIRI object = new IRI("http://test.com/myObject");
-        return new TripleImpl(subject, predicate, object);
-    }
-
-    private Graph createTestTripleCollection(Triple t) {
-        Set<Triple> ts = new HashSet<Triple>();
-        ts.add(t);
-        return new SimpleGraph(ts);
-    }
-
-    protected IRI generateUri(String name) {
-        return new IRI("http://example.org/" + name);
-    }
-    
-}
diff --git a/rdf/core/LICENSE b/rdf/core/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf/core/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/rdf/core/nbactions.xml b/rdf/core/nbactions.xml
deleted file mode 100644
index 49e8307..0000000
--- a/rdf/core/nbactions.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
-    <action>
-        <actionName>CUSTOM-deploy to localhost:8080</actionName>
-        <displayName>deploy to localhost:8080</displayName>
-        <goals>
-            <goal>install</goal>
-            <goal>org.apache.sling:maven-sling-plugin:install</goal>
-        </goals>
-    </action>
-</actions>
diff --git a/rdf/core/pom.xml b/rdf/core/pom.xml
deleted file mode 100644
index e41cb2c..0000000
--- a/rdf/core/pom.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
-
- 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.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>clerezza</artifactId>
-        <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
-        <relativePath>../../parent</relativePath>
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.core</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.0.2-SNAPSHOT</version>
-    <name>Clerezza - RDF - Core</name>
-    <description>Interfaces and utilities to access RDF Graphs</description>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.clerezza.commons-rdf</groupId>
-            <artifactId>commons-rdf-api</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza.commons-rdf</groupId>
-            <artifactId>commons-rdf-impl-utils</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.scr.annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
-            <version>1.2.8</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>utils</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-		    <dependency>
-			      <groupId>org.mockito</groupId>
-			      <artifactId>mockito-core</artifactId>
-			      <version>1.9.5</version>
-			      <scope>test</scope>
-		    </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>javacc-maven-plugin</artifactId>
-                <version>2.5</version>
-                <executions>
-                    <execution>
-                        <id>javacc</id>
-                        <goals>
-                            <goal>javacc</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.xsite</groupId>
-                <artifactId>xsite-maven-plugin</artifactId>
-                <configuration>
-                    <sourceDirectoryPath>${basedir}/src/site/xsite</sourceDirectoryPath>
-                    <sitemapPath>content/sitemap.xml</sitemapPath>
-                    <skinPath>templates/skin.html</skinPath>
-                    <outputDirectoryPath>${basedir}/target/site/documentation</outputDirectoryPath>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>site</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Export-Package>org.apache.clerezza.rdf.core.*</Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>generate-scr-scrdescriptor</id>
-                        <goals>
-                            <goal>scr</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
diff --git a/rdf/core/src/main/appended-resources/META-INF/NOTICE b/rdf/core/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 8963829..0000000
--- a/rdf/core/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-Contains code from the following book:
-Jonathan Knudsen, "Java Cryptography", O'Reilly Media, Inc., 1998
-
-Contains code from mulgara project for sparql query parsing
-
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityAlreadyExistsException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityAlreadyExistsException.java
deleted file mode 100644
index 3057789..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityAlreadyExistsException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * is thrown on an attempt to create an entity with a name which already exists
- *
- * @author hasan
- */
-public class EntityAlreadyExistsException extends RuntimeException {
-
-    private IRI entityName;
-
-    /**
-     * creates an exception indicating that an entity with the specified name
-     * already exists.
-     * 
-     * @param entityName the name of the entity which already exists
-     */
-    public EntityAlreadyExistsException(IRI entityName) {
-        super("An entity with this name already exists: "+entityName);
-        this.entityName = entityName;
-    }
-
-    /**
-     * 
-     * @return the name of the entity which already exists
-     */
-    public IRI getEntityName() {
-        return entityName;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityUndeletableException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityUndeletableException.java
deleted file mode 100644
index f11742b..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/EntityUndeletableException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * is thrown on an attempt to delete an entity with a provider that
- * supports the delete operation when the specified entity cannot be deleted
- *
- * @author reto
- */
-public class EntityUndeletableException extends RuntimeException {
-    private IRI entityName;
-
-    /**
-     * creates an exception indicating that the entity with the specified name
-     * cannot be deleted
-     * 
-     * @param entityName the name of the entity which is undeletable
-     */
-    public EntityUndeletableException(IRI entityName) {
-        super("This entity is undeletable: "+entityName);
-        this.entityName = entityName;
-    }
-
-    /**
-     * 
-     * @return the name of the entity which is undeletable
-     */
-    public IRI getEntityName() {
-        return entityName;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ImmutableGraphServiceFactory.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ImmutableGraphServiceFactory.java
deleted file mode 100644
index 35ef2f9..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ImmutableGraphServiceFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.security.TcAccessController;
-
-/**
- * @see <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceFactory.html">
- * Interface ServiceFactory</a>
- *
- * @author mir
- */
-public class ImmutableGraphServiceFactory implements ServiceFactory {
-    
-    private final TcManager tcManager;
-    private final IRI name;
-    private final TcAccessController tcAccessController;
-
-    ImmutableGraphServiceFactory(TcManager tcManager, IRI name,
-            TcAccessController tcAccessController) {
-        this.tcManager = tcManager;
-        this.name = name;
-        this.tcAccessController = tcAccessController;
-    }
-
-    @Override
-    public Object getService(Bundle arg0, ServiceRegistration arg1) {
-        Graph tc = 
-                new SecuredGraph(tcManager.getImmutableGraph(name), name,
-                tcAccessController);
-        return tc.getImmutableGraph();
-    }
-
-    @Override
-    public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/MGraphServiceFactory.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/MGraphServiceFactory.java
deleted file mode 100644
index 5253201..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/MGraphServiceFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.security.TcAccessController;
-
-/**
- * @see <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceFactory.html">
- * Interface ServiceFactory</a>
- *
- * @author mir
- */
-public class MGraphServiceFactory implements ServiceFactory {
-    
-    private TcManager tcManager;
-    private IRI name;
-    private final TcAccessController tcAccessController;
-
-    MGraphServiceFactory(TcManager tcManager, IRI name,
-            TcAccessController tcAccessController) {
-        this.tcManager = tcManager;
-        this.name = name;
-        this.tcAccessController = tcAccessController;
-    }
-
-    @Override
-    public Object getService(Bundle arg0, ServiceRegistration arg1) {
-        return new SecuredGraph(tcManager.getMGraph(name), name, tcAccessController);
-    }
-
-    @Override
-    public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/NoSuchEntityException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/NoSuchEntityException.java
deleted file mode 100644
index a39c63f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/NoSuchEntityException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * is thrown on an attempt to perform an operation on an entity (i.e. a
- * <code>ImmutableGraph</code> or <code>Graph</code> that does not exist.
- *
- * @author reto
- */
-public class NoSuchEntityException extends RuntimeException {
-    private IRI entityName;
-
-    /**
-     * creates an exception indicating that the entity with the specified name
-     * does not exist.
-     * 
-     * @param entityName the name for which no entity exists
-     */
-    public NoSuchEntityException(IRI entityName) {
-        super("No such entity: "+entityName);
-        this.entityName = entityName;
-    }
-
-    /**
-     * the name for which no entity exists.
-     * 
-     * @return the name of the entity that doesn't exist
-     */
-    public IRI getEntityName() {
-        return entityName;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/QueryableTcProvider.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/QueryableTcProvider.java
deleted file mode 100644
index 0f38bee..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/QueryableTcProvider.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.clerezza.rdf.core.access;
-
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-
-/**
- * Extends the TcProvider interface for providers that support sparql queries.
- */
-public interface QueryableTcProvider extends TcProvider {
-
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query.
-     * 
-     * @param query
-     *            the sparql query to execute
-     * @param defaultGraph
-     *            the default ImmutableGraph against which to execute the query if not
-     *            FROM clause is present
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     */
-    public Object executeSparqlQuery(String query, IRI defaultGraphUri);
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ReadOnlyException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ReadOnlyException.java
deleted file mode 100644
index 4991dc4..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/ReadOnlyException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.security.AccessControlException;
-
-/**
- * is thrown on an attempt to add or remove triples to a 
- * read-only mutable ImmutableGraph 
- *
- * @author tsuy
- */
-public class ReadOnlyException extends AccessControlException {
-
-    private String action;
-
-    /**
-     * creates an exception indicating that the mutable ImmutableGraph is read-only
-     * 
-     * @param action
-     */
-    public ReadOnlyException(String action) {
-        super("read only mutable ImmutableGraph, not allowed to "+action);
-        this.action = action;
-    }
-
-    /**
-     * 
-     * @return the name of the action
-     */
-    public String getAction() {
-        return action;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredGraph.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredGraph.java
deleted file mode 100644
index 9cf5be7..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredGraph.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.security.AccessControlException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.security.TcAccessController;
-import org.apache.clerezza.rdf.core.impl.WriteBlockedGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.WatchableGraph;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-
-/**
- * A Secured triple collection wraps a triple collection checking each access
- * for the rights on a the ImmutableGraph for which the uri is passed to the 
- * constructor.
- *
- * @author mir, hasan
- */
-public class SecuredGraph implements Graph {
-
-    private final Graph wrapped;
-    private final IRI name;
-    private final TcAccessController tcAccessController;
-
-    public SecuredGraph(Graph wrapped, IRI name,
-            TcAccessController tcAccessController) {
-        this.wrapped = wrapped;
-        this.name = name;
-        this.tcAccessController = tcAccessController;
-    }
-
-    @Override
-    public Iterator<Triple> filter(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) {
-        final Iterator<Triple> baseIter = wrapped.filter(subject, predicate, object);
-        return new Iterator<Triple>() {
-
-            @Override
-            public boolean hasNext() {
-                checkRead();
-                return baseIter.hasNext();
-            }
-
-            @Override
-            public Triple next() {
-                checkRead();
-                return baseIter.next();
-            }
-
-            @Override
-            public void remove() {
-                checkWrite();
-                baseIter.remove();
-            }
-        };
-    }
-
-    @Override
-    public int size() {
-        checkRead();
-        return wrapped.size();
-    }
-
-    @Override
-    public boolean isEmpty() {
-        checkRead();
-        return wrapped.isEmpty();
-    }
-
-    @Override
-    public Object[] toArray() {
-        checkRead();
-        return wrapped.toArray();
-    }
-
-    @Override
-    public <T> T[] toArray(T[] a) {
-        checkRead();
-        return wrapped.toArray(a);
-    }
-
-    @Override
-    public boolean add(Triple e) {
-        checkWrite();
-        return wrapped.add(e);
-    }
-
-    @Override
-    public boolean remove(Object o) {
-        checkWrite();
-        return wrapped.remove(o);
-    }
-
-    @Override
-    public boolean addAll(Collection<? extends Triple> c) {
-        checkWrite();
-        return wrapped.addAll(c);
-    }
-
-    @Override
-    public boolean removeAll(Collection<?> c) {
-        checkWrite();
-        return wrapped.removeAll(c);
-    }
-
-    @Override
-    public boolean retainAll(Collection<?> c) {
-        checkWrite();
-        return wrapped.retainAll(c);
-    }
-
-    @Override
-    public void clear() {
-        checkWrite();
-        wrapped.clear();
-    }
-
-    void checkRead() {
-        tcAccessController.checkReadPermission(name);
-    }
-
-    void checkWrite() {
-        tcAccessController.checkReadWritePermission(name);
-    }
-
-    @Override
-    public boolean contains(Object o) {
-        checkRead();
-        return wrapped.contains((Triple) o);
-    }
-
-
-    @Override
-    public Iterator<Triple> iterator() {
-        return filter(null, null, null);
-    }
-
-    @Override
-    public boolean containsAll(Collection<?> c) {
-        checkRead();
-        return wrapped.containsAll(c);
-    }
-    
-    @Override
-    public ImmutableGraph getImmutableGraph() {
-        return new SimpleImmutableGraph(this);
-    }
-
-    @Override
-    public ReadWriteLock getLock() {
-        return wrapped.getLock();
-    }
-    
-    /**
-     * Returns the wrapped Graph if the caller has all access rights.
-     * If the caller has only the read access right, then a write-blocked
-     * Graph is returned. If the caller has neither the read nor the write
-     * access right then an AccessControlException is thrown.
-     *
-     * @return the wrapped Graph or a write-block Graph depending
-     *        on the access rights of the caller.
-     */
-    public Graph getUnsecuredGraph() {
-        try {
-            checkWrite();
-            return wrapped;
-        } catch (AccessControlException ex) {
-            checkRead();
-            return new WriteBlockedGraph(wrapped);
-        }
-        
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
deleted file mode 100644
index cc398dd..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.security.AccessControlException;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.security.TcAccessController;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.impl.WriteBlockedGraph;
-import org.apache.clerezza.rdf.core.sparql.NoQueryEngineException;
-import org.apache.clerezza.rdf.core.sparql.ParseException;
-import org.apache.clerezza.rdf.core.sparql.QueryEngine;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SparqlPreParser;
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-
-/**
- * This class implements
- * <code>TcManager</code>, delegating the actual provision and creation of
- * Graphs or MGraphs to registered
- * <code>TcProvider</code>s. The class attempts to satisfy the request using the
- * register
- * <code>WeightedTcProvider</code> in decreasing order of weight. If multiple
- * providers have the same weight the lexicographical order of the fully
- * qualified class name determines which one is used, namely the one that occurs
- * earlier. If a call to a registered provider causes an
- * <code>IllegalArgumentException</code>,
- * <code>NoSuchEntityException</code> or
- * <code>UnsupportedOperationException</code> then the call is delegated to the
- * next provider.
- *
- * Only one instance of this class should exist in a system, the public no
- * argument constructor is meant for initialization by dependency injection
- * systems such as OSGi-DS. Applications should use the static
- * <code>getInstance()</code> method if they aren't using a framework that
- * injects them the instance.
- *
- * This class returns
- * <code>Graph</code>s a subtype of
- * <code>Graph</code> that allows read/write locks.
- *
- * This class also registers all Graphs as services with the property
- * 'name' indicating there name.
- *
- * Security checks are done when a Graph is retrieved. The returned
- * Graph will do no further security checks. Because of this it
- * should not be passed to a context where different access control applies. If
- * an Graph is retrieved without having write permission the returned graph
- * will be read-only.
- *
- * If a Graphs needs to passed around across different security
- * contexts the one retrieved from the OSGi service whiteboard should be used as
- * this performs access control on every access.
- *
- * @author reto, mir, hasan
- *
- */
-//immedia is set to true as this should register the ImmutableGraph services (even if manager service is not required)
-@Component(service = TcManager.class, immediate = true,
-        property={
-            "graph.cache.enabled=true",
-            "Graph.services.enabled=true"})
-public class TcManager extends TcProviderMultiplexer {
-
-    public final static String GENERAL_PURPOSE_TC = "general.purpose.tc";
-    public final static String Graph_SERVICES_ENABLED = "Graph.services.enabled";
-    public final static String MGRAPH_CACHE_ENABLED = "graph.cache.enabled";
-
-    private static volatile TcManager instance;
-    private TcAccessController tcAccessController = new TcAccessController() {
-
-        @Override
-        protected TcManager getTcManager() {
-            return TcManager.this;
-        }
-            
-    };
-    private Map<IRI, ServiceRegistration> serviceRegistrations = Collections
-            .synchronizedMap(new HashMap<IRI, ServiceRegistration>());
-    
-    protected QueryEngine queryEngine;
-    private boolean isActivated = false;
-    private boolean isTcServicesEnabled = true;
-
-    private ComponentContext componentContext;
-    protected SortedSet<WeightedTcProvider> tempProviderList = new TreeSet<WeightedTcProvider>(
-            new WeightedProviderComparator());
-
-    /**
-     * the constructor sets the singleton instance to allow instantiation by
-     * OSGi-DS. This constructor should not be called except by OSGi-DS,
-     * otherwise the static
-     * <code>getInstance</code> method should be used.
-     */
-    public TcManager() {
-        TcManager.instance = this;
-    }
-
-    /**
-     * This returns the singleton instance. If an instance has been previously
-     * created (e.g. by OSGi declarative services) this instance is returned,
-     * otherwise a new instance is created and providers are injected using the
-     * service provider interface (META-INF/services/)
-     *
-     * @return the singleton instance
-     */
-    public static TcManager getInstance() {
-        if (instance == null) {
-            synchronized (TcManager.class) {
-                if (instance == null) {
-                    instance = new TcManager();
-                    instance.isActivated = true;
-                    Iterator<WeightedTcProvider> weightedProviders = ServiceLoader
-                            .load(WeightedTcProvider.class).iterator();
-                    while (weightedProviders.hasNext()) {
-                        WeightedTcProvider weightedProvider = weightedProviders
-                                .next();
-                        instance
-                                .bindWeightedTcProvider(weightedProvider);
-                    }
-                    Iterator<QueryEngine> queryEngines = ServiceLoader.load(
-                            QueryEngine.class).iterator();
-                    System.out.println("looking for QE");
-                    if (queryEngines.hasNext()) {
-                        instance.queryEngine = queryEngines.next();
-                        System.out.println("QE: "
-                                + instance.queryEngine.getClass());
-                    }
-                }
-            }
-        }
-        return instance;
-    }
-    
-    protected void activate(final ComponentContext componentContext) {
-        this.componentContext = componentContext;
-        
-        // Read configuration
-		isTcServicesEnabled = true;
-		Object configTcServicesEnabled = componentContext.getProperties().get(Graph_SERVICES_ENABLED);
-		if ( configTcServicesEnabled != null && configTcServicesEnabled instanceof String ) {
-			isTcServicesEnabled = Boolean.valueOf((String)configTcServicesEnabled);				
-		}
-		Object configCacheEnabled = componentContext.getProperties().get(MGRAPH_CACHE_ENABLED);
-		if ( configCacheEnabled != null && configCacheEnabled instanceof String ) {
-			setCachingEnabled(Boolean.valueOf((String)configCacheEnabled));				
-		}
-		isActivated = true;
-		
-        for (WeightedTcProvider provider : tempProviderList) {
-        	addWeightedTcProvider(provider);
-        }
-        tempProviderList.clear();
-    }
-
-    protected void deactivate(final ComponentContext componentContext) {
-        for (ServiceRegistration registration : serviceRegistrations.values()) {
-            registration.unregister();
-        }
-        serviceRegistrations.clear();
-        this.componentContext = null;
-		isActivated = false;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        tcAccessController.checkReadPermission(name);
-        return super.getImmutableGraph(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name) {
-        try {
-            tcAccessController.checkReadWritePermission(name);
-        } catch (AccessControlException e) {
-            tcAccessController.checkReadPermission(name);
-            return new WriteBlockedGraph(super.getMGraph(name));
-        }
-        return super.getMGraph(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name) {
-        try {
-            tcAccessController.checkReadWritePermission(name);
-        } catch (AccessControlException e) {
-            tcAccessController.checkReadPermission(name);
-            return new WriteBlockedGraph(
-                    super.getGraph(name));
-        }
-        return super.getGraph(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name)
-            throws UnsupportedOperationException {
-        tcAccessController.checkReadWritePermission(name);
-        return super.createGraph(name);
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        tcAccessController.checkReadWritePermission(name);
-        return super.createImmutableGraph(name, triples);
-    }
-
-    @Override
-    public void deleteGraph(IRI name) {
-        tcAccessController.checkReadWritePermission(name);
-        super.deleteGraph(name);
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        return super.getNames(ImmutableGraph);
-    }
-
-    @Override
-    public Set<IRI> listGraphs() {
-        Set<IRI> result = super.listGraphs();
-        return excludeNonReadable(result);
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        Set<IRI> result = super.listMGraphs();
-        return excludeNonReadable(result);
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        Set<IRI> result = super.listImmutableGraphs();
-        return excludeNonReadable(result);
-    }
-
-    private Set<IRI> excludeNonReadable(Set<IRI> tcNames) {
-        SecurityManager security = System.getSecurityManager();
-        if (security == null) {
-            return tcNames;
-        }
-        Set<IRI> result = new HashSet<IRI>();
-        for (IRI name : tcNames) {
-            try {
-                tcAccessController.checkReadPermission(name);
-            } catch (AccessControlException e) {
-                continue;
-            }
-            result.add(name);
-        }
-        return result;
-    }
-
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query. If the defaultGraph is available
-     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
-     *
-     * @param query the sparql query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if no FROM clause is present
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     */
-    public Object executeSparqlQuery(String query, Graph defaultGraph) throws ParseException {
-        TcProvider singleTargetTcProvider = null;
-
-        final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
-        final SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
-        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
-            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
-        }
-        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
-            return ((QueryableTcProvider) singleTargetTcProvider).executeSparqlQuery(query, null);
-        }
-        final QueryEngine queryEngine = this.queryEngine;
-        if (queryEngine != null) {
-            return queryEngine.execute(this, defaultGraph, query);
-        } else {
-            throw new NoQueryEngineException();
-        }
-    }
-
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query. Note that this method only works for
-     * queries that do not need a default ImmutableGraph.
-     *
-     * @param query the sparql query to execute
-     * @param forceFastlane indicate whether to force fastlane usage.
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     */
-    public Object executeSparqlQuery(String query, boolean forceFastlane) throws ParseException {
-        TcProvider singleTargetTcProvider = null;
-    	if (forceFastlane) {
-            singleTargetTcProvider = getSingleTargetTcProvider(Collections.EMPTY_SET);
-    	} else {    	
-	        final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
-	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-	        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
-	        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
-	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
-	        }
-    	}
-    	
-        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
-            return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, null);
-        }
-        final QueryEngine queryEngine = this.queryEngine;
-        if (queryEngine != null) {
-            return queryEngine.execute(this, new SimpleGraph(), query);
-        } else {
-            throw new NoQueryEngineException();
-        }
-    }
-    
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query. If the defaultGraph is available
-     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
-     *
-     * @param query the sparql query to execute
-     * @param defaultGraphName the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     */
-    public Object executeSparqlQuery(String query, IRI defaultGraphName) throws ParseException {
-      return executeSparqlQuery(query, defaultGraphName, false);
-    }
-
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query. If the defaultGraph is available
-     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
-     *
-     * @param query the sparql query to execute
-     * @param defaultGraph the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
-     * @param forceFastlane indicate whether to force fastlane usage.
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     */
-    public Object executeSparqlQuery(String query, IRI defaultGraphName, boolean forceFastlane) throws ParseException {
-        TcProvider singleTargetTcProvider = null;
-    	if (forceFastlane) {
-            singleTargetTcProvider = getSingleTargetTcProvider(Collections.singleton(defaultGraphName));
-    	} else {    	
-	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-	        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
-	        if ((referencedGraphs != null)) {
-	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
-	        }
-    	}
-        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
-            return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, defaultGraphName);
-        }
-        final QueryEngine queryEngine = this.queryEngine;
-        if (queryEngine != null) {
-            return queryEngine.execute(this, this.getGraph(defaultGraphName), query);
-        } else {
-            throw new NoQueryEngineException();
-        }
-    }
-
-    /**
-     * Executes any sparql query. The type of the result object will vary
-     * depending on the type of the query.
-     *
-     * @param query the sparql query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if no FROM clause is present
-     * @return the resulting ResultSet, ImmutableGraph or Boolean value
-     *
-     * @deprecated Query is discontinued
-     */
-    @Deprecated
-    public Object executeSparqlQuery(Query query, Graph defaultGraph) {
-        final QueryEngine queryEngine = this.queryEngine;
-        if (queryEngine != null) {
-            return queryEngine.execute(this, defaultGraph, query);
-        } else {
-            throw new NoQueryEngineException();
-        }
-    }
-
-    /**
-     * Executes a sparql SELECT query.
-     *
-     * @param query the sparql SELECT query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if not FROM clause is present
-     * @return the resulting ResultSet
-     * @deprecated Query is discontinued
-     */
-    @Deprecated
-    public ResultSet executeSparqlQuery(SelectQuery query,
-            Graph defaultGraph) {
-        return (ResultSet) executeSparqlQuery((Query) query, defaultGraph);
-    }
-
-    /**
-     * Executes a sparql ASK query.
-     *
-     * @param query the sparql ASK query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if not FROM clause is present
-     * @return the boolean value this query evaluates to
-     * @deprecated Query is discontinued
-     */
-    @Deprecated
-    public boolean executeSparqlQuery(AskQuery query,
-            Graph defaultGraph) {
-        return (Boolean) executeSparqlQuery((Query) query, defaultGraph);
-    }
-
-    /**
-     * Executes a sparql DESCRIBE query.
-     *
-     * @param query the sparql DESCRIBE query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if not FROM clause is present
-     * @return the resulting ImmutableGraph
-     * @deprecated Query is discontinued
-     */
-    @Deprecated
-    public ImmutableGraph executeSparqlQuery(DescribeQuery query,
-            Graph defaultGraph) {
-        return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
-    }
-
-    /**
-     * Executes a sparql CONSTRUCT query.
-     *
-     * @param query the sparql CONSTRUCT query to execute
-     * @param defaultGraph the default ImmutableGraph against which to execute the query
-     * if not FROM clause is present
-     * @return the resulting ImmutableGraph
-     * @deprecated Query is discontinued
-     */
-    @Deprecated
-    public ImmutableGraph executeSparqlQuery(ConstructQuery query,
-            Graph defaultGraph) {
-        return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
-    }
-
-    /**
-     * @return the TcAccessController that can be used to set the permissions
-     * needed to access a Triple Collection
-     */
-    public TcAccessController getTcAccessController() {
-        return tcAccessController;
-    }
-
-    /**
-     * Registers a provider
-     *
-     * @param provider the provider to be registered
-     */
-    @Reference(policy = ReferencePolicy.DYNAMIC, 
-            cardinality = ReferenceCardinality.MULTIPLE)
-    protected void bindWeightedTcProvider(WeightedTcProvider provider) {
-    	if (isActivated) {
-    		addWeightedTcProvider(provider);
-    	} else {
-    		tempProviderList.add(provider);  		
-    	}
-    }
-
-    /**
-     * Unregister a provider
-     *
-     * @param provider the provider to be deregistered
-     */
-    protected void unbindWeightedTcProvider(
-            WeightedTcProvider provider) {
-        removeWeightedTcProvider(provider);
-    }
-    
-    /**
-     * Registers a provider
-     *
-     * @param provider the provider to be registered
-     */
-    @Reference(policy = ReferencePolicy.DYNAMIC, 
-            cardinality = ReferenceCardinality.AT_LEAST_ONE,
-            target = "("+TcManager.GENERAL_PURPOSE_TC+"=true)")
-    protected void bindGpWeightedTcProvider(WeightedTcProvider provider) {
-    	if (isActivated) {
-    		addWeightedTcProvider(provider);
-    	} else {
-    		tempProviderList.add(provider);  		
-    	}
-    }
-
-    /**
-     * Unregister a provider
-     *
-     * @param provider the provider to be deregistered
-     */
-    protected void unbindGpWeightedTcProvider(
-            WeightedTcProvider provider) {
-        removeWeightedTcProvider(provider);
-    }
-    
-    @Reference(policy = ReferencePolicy.DYNAMIC,
-            cardinality = ReferenceCardinality.OPTIONAL)
-    protected void bindQueryEngine(QueryEngine queryEngine) {
-        this.queryEngine = queryEngine;
-    }
-    
-    protected void unbindQueryEngine(QueryEngine queryEngine) {
-        this.queryEngine = null;
-    }
-
-    @Override
-    protected void mGraphAppears(IRI name) {
-    	if (isTcServicesEnabled()) {
-    		// Only create the service when activated. When not activated
-    		// creating will be delayed till after activation.
-	        if (componentContext != null) {
-	            registerGraphAsService(name, true);
-	        }
-    	}
-    }
-
-    @Override
-    protected void graphAppears(IRI name) {
-    	if (isTcServicesEnabled()) {
-    		// Only create the service when activated. When not activated
-    		// creating will be delayed till after activation.
-	        if (componentContext != null) {
-	            registerGraphAsService(name, false);
-	        }
-    	}
-    }
-
-    private void registerGraphAsService(IRI name, boolean isMGraph) {
-        Dictionary<String,Object> props = new Hashtable<String, Object>();
-        props.put("name", name.getUnicodeString());
-        String[] interfaceNames;
-        Object service;
-        if (isMGraph) {
-            interfaceNames = new String[]{
-                Graph.class.getName(),
-                Graph.class.getName()
-            };
-            service = new MGraphServiceFactory(this, name, tcAccessController);
-        } else {
-            interfaceNames = new String[]{ImmutableGraph.class.getName()};
-            service = new ImmutableGraphServiceFactory(this, name, tcAccessController);
-        }
-        final int bundleState = componentContext.getBundleContext().getBundle().getState();
-        if ((bundleState == Bundle.ACTIVE) || (bundleState == Bundle.STARTING)) {
-            ServiceRegistration serviceReg = componentContext.getBundleContext()
-                    .registerService(interfaceNames, service, props);
-            serviceRegistrations.put(name, serviceReg);
-        }
-    }
-
-    @Override
-    protected void tcDisappears(IRI name) {
-        ServiceRegistration reg = serviceRegistrations.get(name);
-        if (reg != null) {
-            reg.unregister();
-            serviceRegistrations.remove(name);
-        }
-    }
-
-    private TcProvider getSingleTargetTcProvider(final Set<IRI> referencedGraphs) {
-        TcProvider singleTargetTcProvider = null;
-        for (WeightedTcProvider provider : providerList) {
-            final Set<IRI> providerGraphs = provider.listGraphs();
-            if (providerGraphs.containsAll(referencedGraphs)) {
-               singleTargetTcProvider = provider;
-               break; //success
-            }
-            for (IRI graphName : referencedGraphs) {
-                if (providerGraphs.contains(graphName)) {
-                    break; //failure
-                }
-            }      
-        }
-        return singleTargetTcProvider;
-    }
-
-    public boolean isTcServicesEnabled() {
-		return isTcServicesEnabled;
-	}
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProvider.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProvider.java
deleted file mode 100644
index 31b8fe7..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProvider.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * A TC (Graph) Provider allows access to and optionally 
- * creation of named {@link ImmutableGraph}s and {@link Graph}s (mutable graphs)
- *
- * @author reto
- */
-public interface TcProvider {
-
-    /**
-     * Get a <code>ImmutableGraph</code> by its name
-     *
-     * @param name the name of the ImmutableGraph
-     * @return the <code>ImmutableGraph</code> with the specified name
-     * @throws NoSuchEntityException if there is no <code>ImmutableGraph</code>
-     *         with the specified name
-     */
-    ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException;
-
-    /**
-     * Get an <code>Graph</code> taht is not <code>ImmutableGrah</code>. The instances
-     * returned in different invocations are <code>equals</code>.
-     *
-     * @param the name of the <code>Graph</code>
-     * @return name the <code>Graph</code> with the specified name
-     * @throws NoSuchEntityException if there is no <code>Graph</code>
-     *         with the specified name
-     */
-    Graph getMGraph(IRI name) throws NoSuchEntityException;
-    
-    /**
-     * This method is used to get a <code>Graph</code> indifferently
-     * whether it's a ImmutableGraph or not. If the <code>name</code> names an 
-     * <code>Graph</code> the result is the same as when invoking 
-     * <code>getMGraph</code> with that argument, analogously for 
-     * <code>ImmutableGraph</code>S the method returns an instance equals to what 
-     * <code>getImmutableGraph</code> would return. 
-     * 
-     * @param name the name of the <Code>ImmutableGraph</code> or <code>Graph</code>
-     * @return the <Code>ImmutableGraph</code> or <code>Graph</code>
-     * @throws NoSuchEntityException if there is no <code>ImmutableGraph</code>
-     *         or <code>Graph</code> with the specified name
-     */
-    Graph getGraph(IRI name) throws NoSuchEntityException;
-
-    /**
-     * Lists the name of the <Code>ImmutableGraph</code>s available through this
-     * <code>TcProvider</code>, implementations may take into account the
-     * security context and omit <Code>ImmutableGraph</code>s for which access is not
-     * allowed.
-     *
-     * @return the list of <Code>ImmutableGraph</code>s
-     */
-    Set<IRI> listImmutableGraphs();
-
-    /**
-     * Lists the name of the <Code>Graph</code>s available through this
-     * <code>TcProvider</code> that are not <Code>ImmutableGraph</code>, implementations may take into account the
-     * security context and omit <Code>Graph</code>s for which access is not
-     * allowed.
-     *
-     * @return the list of <Code>Graph</code>s
-     */
-    Set<IRI> listMGraphs();
-
-    /**
-     * Lists the name of the <Code>Graph</code>s available through this
-     * <code>TcProvider</code> indifferently whether they are mutables or 
-     * immutables, implementations may take into account the security context and
-     * omit <Code>Graph</code>s for which access is not allowed.
-     *
-     * @return the list of <Code>Graph</code>s
-     */
-    Set<IRI> listGraphs();
-
-    /**
-     * Creates an initially empty <code>Graph</code> with a specified name
-     *
-     * @param name names the new <code>Graph</code>
-     * @return the newly created <code>Graph</code>
-     * @throws UnsupportedOperationException if this provider doesn't support
-     *         creating <code>Graph</code>S
-     * @throws EntityAlreadyExistsException if an Graph with the specified name
-     *         already exists
-     */
-    Graph createGraph(IRI name) throws UnsupportedOperationException, 
-            EntityAlreadyExistsException;
-
-    /**
-     * Creates a <code>ImmutableGraph</code> with a specified name
-     *
-     * @param name the name of the <code>ImmutableGraph</code> to be created
-     * @param triples the triples of the new <code>ImmutableGraph</code>
-     * @return the newly created <code>ImmutableGraph</code>
-     * @throws UnsupportedOperationException if this provider doesn't support
-     *         creating <code>ImmutableGraph</code>S
-     * @throws EntityAlreadyExistsException if a ImmutableGraph with the specified name
-     *         already exists
-     */
-    ImmutableGraph createImmutableGraph(IRI name, Graph triples) 
-            throws UnsupportedOperationException, EntityAlreadyExistsException;
-    
-    /**
-     * Deletes the <code>ImmutableGraph</code> or <code>Graph</code> of a specified name.
-     * If <code>name</code> references a ImmutableGraph and the ImmutableGraph has other names, it
-     * will still be available with those other names.
-     * 
-     * @param name the entity to be removed
-     * @throws UnsupportedOperationException if this provider doesn't support
-     *         entities deletion.
-     * @throws NoSuchEntityException if <code>name</code> doesn't refer to a 
-     *           <code>ImmutableGraph</code> or an <code>Graph</code>.
-     * @throws EntityUndeletableException if the specified ImmutableGraph is undeletable
-     */
-    void deleteGraph(IRI name) throws UnsupportedOperationException,
-            NoSuchEntityException, EntityUndeletableException;
-
-    /**
-     * get a set of the names of a <code>ImmutableGraph</code>
-     *
-     * @param ImmutableGraph
-     * @return the set names of <code>ImmutableGraph</code>, the set is empty if
-     *         <code>ImmutableGraph</code> is unknown
-     */
-    Set<IRI> getNames(ImmutableGraph immutableGraph);
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProviderMultiplexer.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProviderMultiplexer.java
deleted file mode 100644
index 094238d..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/TcProviderMultiplexer.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.lang.ref.WeakReference;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.QueryEngine;
-
-/**
- * This makes a set of WeightedTcProvider appear as one TcProvider. It delegates
- * requests to the WeightedTcProvider with the highest Weight
- *
- * @author reto
- */
-public class TcProviderMultiplexer implements TcProvider {
-
-    protected SortedSet<WeightedTcProvider> providerList = new TreeSet<WeightedTcProvider>(
-            new WeightedProviderComparator());
-    /**
-     * Mapping to Graph's and ServiceRegistration using their URI's as key.
-     * Makes sure that per URI only one instance of the Graph is used,
-     * otherwise the locks in the <code>Graph</code>s would have no effect
-     * between different instances and concurrency issues could occur.
-     */
-    private Map<IRI, MGraphHolder> mGraphCache = Collections.synchronizedMap(new HashMap<IRI, MGraphHolder>());
-
-	/**
-	 * Flag to indicate whether mgraphs should be cached for faster access. By
-	 * default caching is enabled for backward compatibility.
-	 */
-	private boolean isCachingEnabled = true;
-
-    /**
-     * Registers a provider
-     *
-     * @param provider
-     *            the provider to be registered
-     */
-    public void addWeightedTcProvider(WeightedTcProvider provider) {
-        providerList.add(provider);
-        updateGraphCache(provider, true);
-    }
-
-    /**
-     * Unregister a provider
-     *
-     * @param provider
-     *            the provider to be deregistered
-     */
-    public void removeWeightedTcProvider(
-            WeightedTcProvider provider) {
-        providerList.remove(provider);
-        updateGraphCache(provider, false);
-    }
-
-    /**
-     * subclasses overwrite this method to be notified when a new
-     * ImmutableGraph is available (either because it has been created or being
-     * provided by a newly added WeightedTcProvider). The default implementation
-     * does nothing.
-     *
-     * @param name
-     */
-    protected void graphAppears(IRI name) {
-    }
-
-    /**
-     * subclasses overwrite this method to be notified when a new
-     * Graph is available (either because it has been created or being
-     * provided by a newly added WeightedTcProvider). The default implementation
-     * does nothing.
-     *
-     * @param name
-     */
-    protected void mGraphAppears(IRI name) {
-    }
-
-    /**
-     * subclasses overwrite this method to be notified whenGraph is 
-     * no longer available (either because it has been deleted or bacause its
-     * WeightedTcProvider was removed). The default implementation does nothing.
-     *
-     * for implementational reasons even for name of Graph not
-     * previously registered.
-     *
-     * @param name
-     */
-    protected void tcDisappears(IRI name) {
-    }
-
-    /**
-     * Updates the lockableMGraphCache AFTER a new <code>provider</code> was
-     * bound or unbound.
-     * This method also takes care of registering and unregistering
-     * provided triple collections as services based on the weight of
-     * all affected providers.
-     *
-     * @param provider
-     *            the provider that was added or removed
-     * @param providerAdded
-     *            <code>boolean</code> that should be set as <code>true</code>
-     *            if <code>provider</code> was added to
-     *            <code>org.apache.clerezza.rdf.core.TcManager.providerList</code>
-     *            otherwise <code>false</code>
-     */
-    private void updateGraphCache(WeightedTcProvider provider,
-            boolean providerAdded) {
-        Set<IRI> uriSet = provider.listGraphs();
-        if (!(uriSet == null || uriSet.isEmpty())) {
-            if (providerAdded) {
-                weightedProviderAdded(provider, uriSet);
-            } else {
-                weightedProviderRemoved(provider, uriSet);
-            }
-        }
-    }
-
-    private void weightedProviderAdded(WeightedTcProvider newProvider,
-            Set<IRI> newProvidedUris) {
-        Set<WeightedTcProvider> lowerWeightedProviderList = getLowerWeightedProvider(newProvider);
-    	if (isCachingEnabled()) {
-	        for (IRI name : newProvidedUris) {
-	            final MGraphHolder holder = mGraphCache.get(name);
-	            if ((holder != null) && (holder.getWeightedTcProvider() != null)) {
-	                if (lowerWeightedProviderList.contains(holder.getWeightedTcProvider())) {
-	                    tcDisappears(name);
-	                    mGraphCache.remove(name);
-	                } else {
-	                    continue;
-	                }
-	            }
-	            Graph triples = newProvider.getGraph(name);
-	            if (triples instanceof Graph) {
-	           		mGraphCache.put(name, new MGraphHolder(newProvider, ensureLockable((Graph)triples)));
-	                mGraphAppears(name);
-	            } else {
-	                graphAppears(name);
-	            }
-	    	}
-        }
-    }
-
-    
-
-    private Set<WeightedTcProvider> getLowerWeightedProvider(
-            WeightedTcProvider newProvider) {
-        boolean referenceProviderPassed = false;
-        Set<WeightedTcProvider> lowerWeightedProviderList = new HashSet<WeightedTcProvider>();
-        for (WeightedTcProvider weightedProvider : providerList) {
-            if (referenceProviderPassed) {
-                lowerWeightedProviderList.add(weightedProvider);
-            } else if (newProvider.equals(weightedProvider)) {
-                referenceProviderPassed = true;
-            }
-        }
-        return lowerWeightedProviderList;
-    }
-
-    private void weightedProviderRemoved(WeightedTcProvider oldProvider,
-            Set<IRI> oldProvidedUris) {
-        for (IRI name : oldProvidedUris) {
-            final MGraphHolder holder = mGraphCache.get(name);
-            if ((holder != null) && (holder.getWeightedTcProvider() != null)
-                    && holder.getWeightedTcProvider().equals(oldProvider)) {
-                tcDisappears(name);
-                mGraphCache.remove(name);
-
-            	if (isCachingEnabled()) {
-	                // check if another WeightedTcProvider has the Graph.
-	                // And if so register as service.
-	                for (WeightedTcProvider provider : providerList) {
-	                    try {
-	                        Graph triples = provider.getGraph(name);
-	                        if (triples instanceof Graph) {
-	                       		mGraphCache.put(name, new MGraphHolder(provider, ensureLockable((Graph)triples)));
-	                            mGraphAppears(name);
-	                        } else {
-	                            graphAppears(name);
-	                        }
-	                        break;
-	                    } catch (NoSuchEntityException e) {
-	                        // continue;
-	                    }
-	                }
-            	}
-            }
-        }
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        for (TcProvider provider : providerList) {
-            try {
-                return provider.getImmutableGraph(name);
-            } catch (NoSuchEntityException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name)
-            throws NoSuchEntityException {
-        Graph result = getMGraphFromCache(name);
-        if (result == null) {
-            synchronized (this) {
-                result = getMGraphFromCache(name);
-                if (result == null) {
-                    result = getUnsecuredMGraphAndAddToCache(name);
-                }
-            }
-        }
-        return result;
-    }
-
-    private Graph getMGraphFromCache(IRI name) {
-        MGraphHolder holder = mGraphCache.get(name);
-        if (holder == null) {
-            return null;
-        }
-        return holder.getMGraph();
-    }
-
-    private Graph getUnsecuredMGraphAndAddToCache(IRI name)
-            throws NoSuchEntityException {
-        for (WeightedTcProvider provider : providerList) {
-            try {
-                Graph providedMGraph = provider.getMGraph(name);
-                Graph result = ensureLockable(providedMGraph);
-
-                if (isCachingEnabled()) {
-	                mGraphCache.put(name, new MGraphHolder(
-	                        provider, result));
-                }
-                return result;
-            } catch (NoSuchEntityException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name)
-            throws NoSuchEntityException {
-        Graph result;
-        for (WeightedTcProvider provider : providerList) {
-            try {
-                result = provider.getGraph(name);
-                if (result instanceof ImmutableGraph) {
-                    return result;
-                } else {
-                    // This is to ensure the Graph gets added to the cache
-                    return getMGraph(name);
-                }
-            } catch (NoSuchEntityException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name)
-            throws UnsupportedOperationException {
-
-        for (WeightedTcProvider provider : providerList) {
-            try {
-                Graph result = provider.createGraph(name);
-                // unregisters a possible ImmutableGraph or Graph service under this name
-                // provided by a WeightedTcProvider with a lower weight.
-                tcDisappears(name);
-                if (isCachingEnabled()) {
-                	mGraphCache.put(name, new MGraphHolder(provider, null));
-                }
-                mGraphAppears(name);
-                return result;
-            } catch (UnsupportedOperationException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        throw new UnsupportedOperationException(
-                "No provider could create Graph.");
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        for (WeightedTcProvider provider : providerList) {
-            try {
-                ImmutableGraph result = provider.createImmutableGraph(name, triples);
-
-                // unregisters a possible ImmutableGraph or Graph service under this name
-                // provided by a WeightedTcProvider with a lower weight.
-                tcDisappears(name);
-                if (isCachingEnabled()) {
-                	mGraphCache.put(name, new MGraphHolder(provider, null));
-                }
-                graphAppears(name);
-                return result;
-            } catch (UnsupportedOperationException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        throw new UnsupportedOperationException(
-                "No provider could create ImmutableGraph.");
-    }
-
-    @Override
-    public void deleteGraph(IRI name) {
-        for (TcProvider provider : providerList) {
-            try {
-                provider.deleteGraph(name);
-                final MGraphHolder holder = mGraphCache.get(name);
-                if ((holder != null)
-                        && (holder.getWeightedTcProvider() != null)
-                        && holder.getWeightedTcProvider().equals(provider)) {
-                    tcDisappears(name);
-                    mGraphCache.remove(name);
-                }
-                return;
-            } catch (UnsupportedOperationException e) {
-                // we do nothing and try our luck with the next provider
-            } catch (NoSuchEntityException e) {
-                //we do nothing and try our luck with the next provider
-            } catch (IllegalArgumentException e) {
-                //we do nothing and try our luck with the next provider
-            }
-        }
-        // this throws a NoSuchEntityException if the ImmutableGraph doesn't exist
-        getGraph(name);
-        // the entity exists but cannot be deleted
-        throw new UnsupportedOperationException(
-                "No provider could delete the entity.");
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        Set<IRI> result = new HashSet<IRI>();
-        for (TcProvider provider : providerList) {
-            result.addAll(provider.getNames(ImmutableGraph));
-        }
-        return result;
-    }
-
-    @Override
-    public Set<IRI> listGraphs() {
-        Set<IRI> result = new HashSet<IRI>();
-        for (TcProvider provider : providerList) {
-            result.addAll(provider.listGraphs());
-        }
-        return result;
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        Set<IRI> result = new HashSet<IRI>();
-        for (TcProvider provider : providerList) {
-            result.addAll(provider.listMGraphs());
-        }
-        return result;
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        Set<IRI> result = new HashSet<IRI>();
-        for (TcProvider provider : providerList) {
-            result.addAll(provider.listImmutableGraphs());
-        }
-        return result;
-    }
-
-    private Graph ensureLockable(Graph providedMGraph) {
-        //Graphs are alway locable now
-        return providedMGraph;
-    }
-
-    /**
-     * Contains an unsecured Graph, a ServiceRegistration and
-     * the WeightedTcProvider that generated the ImmutableGraph
-     */
-    private static class MGraphHolder {
-
-        private WeightedTcProvider tcProvider;
-        private WeakReference<Graph> mGraphReference;
-
-        MGraphHolder(WeightedTcProvider tcProvider, Graph graph) {
-            this.tcProvider = tcProvider;
-            this.mGraphReference = new WeakReference<Graph>(graph);
-        }
-
-        Graph getMGraph() {
-            return this.mGraphReference.get();
-        }
-
-        WeightedTcProvider getWeightedTcProvider() {
-            return this.tcProvider;
-        }
-    }
-
-    //methods for debuging / monitoring
-    public SortedSet<WeightedTcProvider> getProviderList() {
-        return providerList;
-    }
-
-    public boolean isCachingEnabled() {
-		return isCachingEnabled;
-	}
-    
-    public void setCachingEnabled(boolean isCachingEnabled) {
-		this.isCachingEnabled = isCachingEnabled;
-		
-		if (!isCachingEnabled()) {
-			mGraphCache.clear();
-		}
-	}
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedProviderComparator.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedProviderComparator.java
deleted file mode 100644
index a3e2409..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedProviderComparator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.clerezza.rdf.core.access;
-/*
- *
- * 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 java.util.Comparator;
-
-/**
- * Compares the WeightedTcManagementProviders, descending for weight and
- * ascending by name
- */
-public class WeightedProviderComparator implements Comparator<WeightedTcProvider> {
-
-    @Override
-    public int compare(WeightedTcProvider o1, WeightedTcProvider o2) {
-        int o1Weight = o1.getWeight();
-        int o2Weight = o2.getWeight();
-        if (o1Weight != o2Weight) {
-            return o2Weight - o1Weight;
-        }
-        return o1.getClass().toString().compareTo(o2.getClass().toString());
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedTcProvider.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedTcProvider.java
deleted file mode 100644
index bc1e7f2..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/WeightedTcProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-/**
- * This interface is implemented by providers to which {@link TcManagerImpl}
- * delegates.
- *
- * @author reto
- */
-public interface WeightedTcProvider extends TcProvider {
-
-    /**
-     * Get the weight of this provider. {@link TcManager} will prioritize
-     * <code>TcProvider</code>s with greater weight.
-     * 
-     * @return a positive number indicating the weight of the provider
-     */
-    int getWeight();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/package.html b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/package.html
deleted file mode 100644
index 8098e02..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/package.html
+++ /dev/null
@@ -1,56 +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.
- */
--->
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-	<head>
-		<title>org.apache.clerezza.rdf.mopdel.access</title>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-	</head>
-	<body>
-		<p>This package provides access to named {@link
-			org.apache.clerezza.rdf.model.ImmutableGraph}S and {@link
-			org.apache.clerezza.rdf.model.Graph}S that may originate from various
-			implementations.</p>
-		<h3>Accessing</h3>
-		<p>
-			If running in a dependency injection system you should get an instance
-			of
-			<code>TcManager</code>
-			by the framework, otherwise use the static method
-			<code>TcManager.getInstance</code>
-			.
-		</p>
-		<h3>Adding a provider</h3>
-		<p>A provider implements {@link WeightedTcProvider}.</p>
-		<p>
-			To work outside a component injection framework it contains a file
-			<code>META-INF/services/org.apache.clerezza.rdf.model.access.WeightedTcProvider</code>
-			containing the name of the implementing class.
-		</p>
-		<p>
-			To work in a OSGi-DS context the provider register a component
-			exposing
-			<code>org.apache.clerezza.rdf.model.access.WeightedTcProvider</code>
-			as service interface.
-		</p>
-	</body>
-</html>
\ No newline at end of file
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
deleted file mode 100644
index 3f3551f..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.security;
-
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.utils.security.PermissionParser;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Literal;
-
-/**
- * Controls the permissions needed to access a triple collection provided by
- * <code>TcManager</code>.
- *
- * Clients with a ConfigureTcAcessPermission can set the permissions required to
- * access a Graph. These permissions are stored persistently in an
- * Graph named urn:x-localinstance:/graph-access.graph
- *
- * Clients should get an instance from TcManager.getTcAccessController()
- * 
- * @author reto
- */
-public abstract class TcAccessController {
-
-    private final TcManager tcManager;
-    private final IRI permissionGraphName = new IRI("urn:x-localinstance:/graph-access.graph");
-    //we can't rely on ontology plugin in rdf core
-    private String ontologyNamespace = "http://clerezza.apache.org/2010/07/10/graphpermssions#";
-    private final IRI readPermissionListProperty = new IRI(ontologyNamespace + "readPermissionList");
-    private final IRI readWritePermissionListProperty = new IRI(ontologyNamespace + "readWritePermissionList");
-    /**
-     * The first item in the subject RDF list.
-     */
-    public static final IRI first = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
-    /**
-     * The rest of the subject RDF list after the first item.
-     */
-    public static final IRI rest = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
-    public static final IRI rdfNil = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
-    private final Map<IRI, Collection<Permission>> readPermissionCache =
-            Collections.synchronizedMap(new HashMap<IRI, Collection<Permission>>());
-    private final Map<IRI, Collection<Permission>> readWritePermissionCache =
-            Collections.synchronizedMap(new HashMap<IRI, Collection<Permission>>());
-
-    /**
-     *
-     * @param tcManager the tcManager used to locate urn:x-localinstance:/graph-access.graph
-     */
-    public TcAccessController() {
-        this.tcManager = getTcManager();
-    }
-
-    public void checkReadPermission(IRI GraphUri) {
-        if (GraphUri.equals(permissionGraphName)) {
-            //This is world readable, as this prevents as from doingf things as
-            //priviledged during verfification
-            return;
-        }
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            //will AllPermissions the rest is obsolete
-            try {
-                AccessController.checkPermission(new AllPermission());
-            } catch (AccessControlException e) {
-                Collection<Permission> perms = getRequiredReadPermissions(GraphUri);
-                if (perms.size() > 0) {
-                    for (Permission permission : perms) {
-                        AccessController.checkPermission(permission);
-                    }
-                } else {
-                    AccessController.checkPermission(new TcPermission(
-                            GraphUri.getUnicodeString(), TcPermission.READ));
-                }
-            }
-        }
-    }
-
-    public void checkReadWritePermission(IRI GraphUri) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            //will AllPermissions the rest is obsolete
-            try {
-                AccessController.checkPermission(new AllPermission());
-            } catch (AccessControlException e) {
-                if (GraphUri.equals(permissionGraphName)) {
-                    AccessController.checkPermission(new TcPermission(
-                            GraphUri.getUnicodeString(), TcPermission.READWRITE));
-                } else {
-                    Collection<Permission> perms = getRequiredReadWritePermissions(GraphUri);
-                    if (perms.size() > 0) {
-                        for (Permission permission : perms) {
-                            AccessController.checkPermission(permission);
-                        }
-                    } else {
-                        AccessController.checkPermission(new TcPermission(
-                                GraphUri.getUnicodeString(), TcPermission.READWRITE));
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Set the set of permissions required for read access to a triple-collection, if
-     * the set is non-empty the default TCPermisson is no longer required.
-     *
-     * @param GraphUri
-     * @param permissionDescriptions
-     */
-    public void setRequiredReadPermissionStrings(IRI GraphUri,
-            Collection<String> permissionDescriptions) {
-        readPermissionCache.remove(GraphUri);
-        final Graph permissionMGraph = getOrCreatePermisionGraph();
-        Lock l = permissionMGraph.getLock().writeLock();
-        l.lock();
-        try {
-            removeExistingRequiredReadPermissions(GraphUri, permissionMGraph);
-            final BlankNodeOrIRI permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
-            permissionMGraph.add(new TripleImpl(GraphUri,
-                    readPermissionListProperty, permissionList));
-        } finally {
-            l.unlock();
-        }
-    }
-
-    /**
-     * Set the set of permissions required for read access to a triple-collection, if
-     * the set is non-empty the default TCPermisson is no longer required.
-     *
-     * @param GraphUri
-     * @param permissionDescriptions
-     */
-    public void setRequiredReadPermissions(IRI GraphUri,
-            Collection<Permission> permissions) {
-        Collection<String> permissionStrings = new ArrayList<String>();
-        for (Permission permission : permissions) {
-            permissionStrings.add(permission.toString());
-        }
-        setRequiredReadPermissionStrings(GraphUri, permissionStrings);
-    }
-
-    /**
-     * Set the set of permissions required for read-write access to a
-     * triple-collection, if
-     * the set is non-empty the default TCPermisson is no longer required.
-     *
-     * @param GraphUri
-     * @param permissionDescriptions
-     */
-    public void setRequiredReadWritePermissionStrings(IRI GraphUri,
-            Collection<String> permissionDescriptions) {
-        readWritePermissionCache.remove(GraphUri);
-        final Graph permissionMGraph = getOrCreatePermisionGraph();
-        Lock l = permissionMGraph.getLock().writeLock();
-        l.lock();
-        try {
-            removeExistingRequiredReadPermissions(GraphUri, permissionMGraph);
-            final BlankNodeOrIRI permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
-            permissionMGraph.add(new TripleImpl(GraphUri,
-                    readWritePermissionListProperty, permissionList));
-        } finally {
-            l.unlock();
-        }
-    }
-
-    /**
-     * Set the set of permissions required for read-write access to a
-     * triple-collection, if
-     * the set is non-empty the default TCPermisson is no longer required.
-     *
-     * @param GraphUri
-     * @param permissionDescriptions
-     */
-    public void setRequiredReadWritePermissions(IRI GraphUri,
-            Collection<Permission> permissions) {
-        Collection<String> permissionStrings = new ArrayList<String>();
-        for (Permission permission : permissions) {
-            permissionStrings.add(permission.toString());
-        }
-        setRequiredReadWritePermissionStrings(GraphUri, permissionStrings);
-    }
-
-    /**
-     * Get the set of permissions required for read access to the
-     * triple-collection, the set may be empty meaning that the default
-     * TCPermission is required.
-     *
-     * @param GraphUri
-     * @return the collection of permissions
-     */
-    public Collection<Permission> getRequiredReadPermissions(IRI GraphUri) {
-        Collection<Permission> result = readPermissionCache.get(GraphUri);
-        if (result == null) {
-            result = new ArrayList<Permission>();
-            Collection<String> permissionStrings = getRequiredReadPermissionStrings(GraphUri);
-            for (String string : permissionStrings) {
-                result.add(PermissionParser.getPermission(string, getClass().getClassLoader()));
-            }
-            readPermissionCache.put(GraphUri, result);
-        }
-        return result;
-    }
-
-    /**
-     * Get the set of permissions required for read-write access to the
-     * triple-collection, the set may be empty meaning that the default
-     * TCPermission is required.
-     *
-     * @param GraphUri
-     * @return the collection of permissions
-     */
-    public Collection<Permission> getRequiredReadWritePermissions(IRI GraphUri) {
-        Collection<Permission> result = readWritePermissionCache.get(GraphUri);
-        if (result == null) {
-            result = new ArrayList<Permission>();
-            Collection<String> permissionStrings = getRequiredReadWritePermissionStrings(GraphUri);
-            for (String string : permissionStrings) {
-                result.add(PermissionParser.getPermission(string, getClass().getClassLoader()));
-            }
-            readWritePermissionCache.put(GraphUri, result);
-        }
-        return result;
-    }
-
-    private BlankNodeOrIRI createList(Iterator<String> iterator, Graph permissionMGraph) {
-        if (!iterator.hasNext()) {
-            return rdfNil;
-        }
-        final BlankNode result = new BlankNode();
-        permissionMGraph.add(new TripleImpl(result, first,
-                LiteralFactory.getInstance().createTypedLiteral(iterator.next())));
-        permissionMGraph.add(new TripleImpl(result, rest,
-                createList(iterator, permissionMGraph)));
-        return result;
-
-    }
-
-    //called withiong write-lock
-    private void removeExistingRequiredReadPermissions(IRI GraphUri,
-            Graph permissionMGraph) {
-        try {
-            Triple t = permissionMGraph.filter(GraphUri, readPermissionListProperty, null).next();
-            RDFTerm list = t.getObject();
-            removeList((BlankNodeOrIRI) list, permissionMGraph);
-            permissionMGraph.remove(t);
-        } catch (NoSuchElementException e) {
-            //There was no existing to remove
-        }
-    }
-
-    private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) {
-        try {
-            Triple t = permissionMGraph.filter(list, rest, null).next();
-            RDFTerm restList = t.getObject();
-            removeList((BlankNodeOrIRI) restList, permissionMGraph);
-            permissionMGraph.remove(t);
-            Iterator<Triple> iter = permissionMGraph.filter(list, first, null);
-            iter.next();
-            iter.remove();
-        } catch (NoSuchElementException e) {
-            //if it has no rest its rdf:NIL and has no first
-        }
-    }
-
-    private Collection<String> getRequiredReadWritePermissionStrings(final IRI GraphUri) {
-        return getRequiredPermissionStrings(GraphUri, readWritePermissionListProperty);
-    }
-    private Collection<String> getRequiredReadPermissionStrings(final IRI GraphUri) {
-        return getRequiredPermissionStrings(GraphUri, readPermissionListProperty);
-    }
-    private Collection<String> getRequiredPermissionStrings(final IRI GraphUri, IRI property) {
-        try {
-            final Graph permissionMGraph = tcManager.getMGraph(permissionGraphName);
-            Lock l = permissionMGraph.getLock().readLock();
-            l.lock();
-            try {
-                Triple t = permissionMGraph.filter(GraphUri, property, null).next();
-                BlankNodeOrIRI list = (BlankNodeOrIRI) t.getObject();
-                LinkedList<String> result = new LinkedList<String>();
-                readList(list, permissionMGraph, result);
-                return result;
-            } catch (NoSuchElementException e) {
-                return new ArrayList<String>(0);
-            } finally {
-                l.unlock();
-            }
-        } catch (NoSuchEntityException e) {
-            return new ArrayList<String>(0);
-        }
-    }
-
-    private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) {
-        if (list.equals(rdfNil)) {
-            return;
-        }
-        Triple restTriple = permissionMGraph.filter(list, rest, null).next();
-        BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject();
-        readList(restList, permissionMGraph, target);
-        Triple firstTriple = permissionMGraph.filter(list, first, null).next();
-        Literal firstValue = (Literal) firstTriple.getObject();
-        String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
-        target.addFirst(value);
-    }
-
-    private Graph getOrCreatePermisionGraph() {
-        try {
-            return tcManager.getMGraph(permissionGraphName);
-        } catch (NoSuchEntityException e) {
-            return tcManager.createGraph(permissionGraphName);
-        }
-    }
-
-    /**
-     * Note that this will only be invoked once
-     * @return 
-     */
-    protected abstract TcManager getTcManager();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcPermission.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcPermission.java
deleted file mode 100644
index 1f16972..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcPermission.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.security;
-
-import java.security.Permission;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * A permission to access <code>Graph<code>s matching a specified 
- * name pattern. A pattern is matched if and only if the pattern is equals
- * to name of the <code>Graph<code> or the pattern ends with "/*" and
- * the name of the <code>Graph<code> starts with the characters
- * preceding the '*' in the pattern.
- *
- * @author reto, tsuy
- */
-public class TcPermission extends Permission {
-    public final static String READWRITE = "readwrite";
-    public final static String READ = "read";
-
-    private String tcNamePattern;
-    /**
-     * true if readwrite granted false if only read
-     */
-    private boolean allowReadWrite = false;
-
-    final static Pattern actionPattern = Pattern.compile(",( *)");
-    /**
-     * Conststructs a TcPermission for a specified name pattern and a list of
-     * actions.
-     *
-     * @param tcNamePattern see class description
-     * @param actions a comma separated list of the strings "read" and "readwrite",
-     *        the canonical form is just "read" or "readwrite" as "readwrite"
-     *        implies "read".
-     */
-    public TcPermission(String tcNamePattern, String actions)  {
-        super(tcNamePattern);
-        this.tcNamePattern = tcNamePattern;
-        //check and set actions
-        final Set actionSet = new HashSet(Arrays.asList(actionPattern.split(actions)));
-        if (actionSet.remove(READWRITE)) {
-            allowReadWrite = true;
-        } else {
-            if (!actionSet.contains(READ)) {
-                throw new IllegalArgumentException("actions must be either \"read\" or \"readwrite\"");
-            }
-        }
-        actionSet.remove(READ);
-        if (actionSet.size() > 0) {
-            throw new IllegalArgumentException("actions must only contain \"read\" and \"readwrite\"");
-        }
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        if (permission instanceof TcPermission) {
-            TcPermission other = (TcPermission) permission;
-            if (!patternImplies(other.tcNamePattern)) {
-                return false;
-            }
-            if (!actionsImplies(other.allowReadWrite)) {
-                return false;
-            }
-            return true;
-            
-            
-        }
-        return false;
-    }
-
-    private boolean actionsImplies(boolean readwriteOther) {
-        if (!readwriteOther) {
-            return true;
-        } else {
-            return allowReadWrite;
-        }
-        
-    }
-
-    private boolean patternImplies(String tcNamePatternOther) {
-        if (tcNamePattern.equals(tcNamePatternOther)) {
-            return true;
-        }
-        if (tcNamePattern.endsWith("/*")) {
-            return tcNamePatternOther.startsWith(
-                    tcNamePattern.substring(0, tcNamePattern.length()-1));
-        }
-        return false;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final TcPermission other = (TcPermission) obj;
-        if (this.tcNamePattern != other.tcNamePattern 
-                && (this.tcNamePattern == null
-                || !this.tcNamePattern.equals(other.tcNamePattern))) {
-            return false;
-        }
-        if (this.allowReadWrite != other.allowReadWrite) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int hash = 3;
-        hash = 97 * hash + (this.tcNamePattern != null ?
-            this.tcNamePattern.hashCode() : 0);
-        if (allowReadWrite) {
-            hash++;
-        }
-        return hash;
-    }
-
-    
-
-    @Override
-    public String getActions() {
-        return allowReadWrite ? READWRITE : READ;
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
deleted file mode 100644
index 5fe7341..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.logging.Level;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
-
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Modified;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This singleton class provides a method
- * <code>parse</code> to transform serialized RDF forms into {@link ImmutableGraph}s.
- *
- * Functionality is delegated to registered {@link ParsingProvider}s. Such
- * <code>ParsingProvider</code>s can be registered and unregistered, later
- * registered
- * <code>ParsingProvider</code>s shadow previously registered providers for the
- * same format.
- *
- * Note on synchronization:
- * <code>ParsingProvider</code>s must be able to handle concurrent requests.
- *
- * @author reto
- *
- */
-@Component(service = Parser.class)
-public class Parser {
-
-    private ConfigurationAdmin configurationAdmin;
-    /**
-     * The list of providers in the order of registration
-     */
-    private List<ParsingProvider> providerList = new ArrayList<ParsingProvider>();
-    /**
-     * A map to quickly locate a provider
-     */
-    private volatile Map<String, ParsingProvider> providerMap = new HashMap<String, ParsingProvider>();
-    /**
-     * The singleton instance
-     */
-    private volatile static Parser instance;
-    private boolean active;
-
-    private static final Logger log = LoggerFactory.getLogger(Parser.class);
-    /**
-     * the constructor sets the singleton instance to allow instantiation
-     * by OSGi-DS. This constructor should not be called except by OSGi-DS,
-     * otherwise the static <code>getInstance</code> method should be used.
-     */
-    public Parser() {
-        log.info("constructing Parser");
-        Parser.instance = this;
-    }
-
-    /**
-     * A constructor for tests, which doesn't set the singleton instance
-     *
-     * @param dummy an ignored argument to distinguish this from the other constructor
-     */
-    Parser(Object dummy) {
-        active = true;
-    }
-
-    /**
-     * This returns the singleton instance, if an instance has been previously
-     * created (e.g. by OSGi declarative services) this instance is returned,
-     * otherwise a new instance is created and providers are injected using 
-     * the service provider interface (META-INF/services/)
-     *
-     * @return the singleton Parser instance
-     */
-    public static Parser getInstance() {
-        if (instance == null) {
-            synchronized (Parser.class) {
-                if (instance == null) {
-                    new Parser();
-                    Iterator<ParsingProvider> parsingProviders =
-                            ServiceLoader.load(ParsingProvider.class).iterator();
-                    while (parsingProviders.hasNext()) {
-                        ParsingProvider parsingProvider = parsingProviders.next();
-                        instance.bindParsingProvider(parsingProvider);
-                    }
-                    instance.active = true;
-                    instance.refreshProviderMap();
-                }
-            }
-        }
-        return instance;
-
-    }
-
-    @Activate
-    protected void activate(final ComponentContext componentContext) {
-        active = true;
-        refreshProviderMap();
-        //changing the congiguration before this finshed activating causes a new instance to be created
-        /*(new Thread() {
-            @Override
-            public void run() {
-                try {
-                    Thread.sleep(100);
-                } catch (InterruptedException ex) {
-                    return;
-                }
-                refreshProviderMap();
-            }
-            
-            
-        }).start();*/
-    }
-
-    @Deactivate
-    protected void deactivate(final ComponentContext componentContext) {
-        active = false;
-    }
-    
-    @Modified
-    void modified(ComponentContext ctx) {
-        log.debug("modified");
-    }
-
-    /**
-     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
-     * processing to the provider registered for the specified format, if
-     * the formatIdentifier contains a ';'-character only the section before
-     * that character is used for choosing the provider.
-     *
-     * @param serializedGraph an inputstream with the serialization
-     * @param formatIdentifier a string identifying the format (usually the MIME-type)
-     * @return the ImmutableGraph read from the stream
-     * @throws UnsupportedFormatException
-     */
-    public ImmutableGraph parse(InputStream serializedGraph,
-            String formatIdentifier) throws UnsupportedFormatException {
-        return parse(serializedGraph, formatIdentifier, null);
-    }
-
-    /**
-     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
-     * processing to the provider registered for the specified format, if
-     * the formatIdentifier contains a ';'-character only the section before
-     * that character is used for choosing the provider.
-     *
-     * @param target the Graph to which the parsed triples are added
-     * @param serializedGraph an inputstream with the serialization
-     * @param formatIdentifier a string identifying the format (usually the MIME-type)
-     * @throws UnsupportedFormatException
-     */
-    public void parse(Graph target, InputStream serializedGraph,
-            String formatIdentifier) throws UnsupportedFormatException {
-        parse(target, serializedGraph, formatIdentifier, null);
-    }
-
-    /**
-     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
-     * processing to the provider registered for the specified format, if
-     * the formatIdentifier contains a ';'-character only the section before
-     * that character is used for choosing the provider.
-     *
-     * @param serializedGraph an inputstream with the serialization
-     * @param formatIdentifier a string identifying the format (usually the MIME-type)
-     * @param baseUri the uri against which relative uri-refs are evaluated
-     * @return the ImmutableGraph read from the stream
-     * @throws UnsupportedFormatException
-     */
-    public ImmutableGraph parse(InputStream serializedGraph,
-            String formatIdentifier, IRI baseUri) throws UnsupportedFormatException {
-        Graph graph = new SimpleMGraph();
-        parse(graph, serializedGraph, formatIdentifier, baseUri);
-        return graph.getImmutableGraph();
-    }
-
-    /**
-     * Parses a serialized ImmutableGraph from an InputStream. This delegates the
-     * processing to the provider registered for the specified format, if
-     * the formatIdentifier contains a ';'-character only the section before
-     * that character is used for choosing the provider.
-     *
-     * @param target the Graph to which the parsed triples are added
-     * @param serializedGraph an inputstream with the serialization
-     * @param formatIdentifier a string identifying the format (usually the MIME-type)
-     * @param baseUri the uri against which relative uri-refs are evaluated
-     * @throws UnsupportedFormatException
-     */
-    public void parse(Graph target, InputStream serializedGraph,
-            String formatIdentifier, IRI baseUri) throws UnsupportedFormatException {
-        String deParameterizedIdentifier;
-        int semicolonPos = formatIdentifier.indexOf(';');
-        if (semicolonPos > -1) {
-            deParameterizedIdentifier = formatIdentifier.substring(0, semicolonPos);
-        } else {
-            deParameterizedIdentifier = formatIdentifier;
-        }
-        ParsingProvider provider = providerMap.get(deParameterizedIdentifier);
-        if (provider == null) {
-            throw new UnsupportedParsingFormatException(formatIdentifier);
-        }
-        provider.parse(target, serializedGraph, formatIdentifier, baseUri);
-    }
-
-    /**
-     * Get a set of supported formats
-     *
-     * @return a set if stings identifying formats (usually the MIME-type)
-     */
-    public Set<String> getSupportedFormats() {
-        return Collections.unmodifiableSet(providerMap.keySet());
-    }
-
-    /**
-     * Registers a parsing provider
-     *
-     * @param provider the provider to be registered
-     */
-    @Reference(policy = ReferencePolicy.DYNAMIC,
-            cardinality = ReferenceCardinality.MULTIPLE)
-    public void bindParsingProvider(ParsingProvider provider) {
-        providerList.add(provider);
-        refreshProviderMap();
-    }
-
-    /**
-     * Unregister a parsing provider
-     *
-     * @param provider the provider to be deregistered
-     */
-    public void unbindParsingProvider(ParsingProvider provider) {
-        providerList.remove(provider);
-        refreshProviderMap();
-    }
-
-    /**
-     * Update providerMap with the providers in the providerList
-     *
-     */
-    private void refreshProviderMap() {
-        if (active) {
-            try {
-                final Map<String, ParsingProvider> newProviderMap = new HashMap<String, ParsingProvider>();
-                for (ParsingProvider provider : providerList) {
-                    String[] formatIdentifiers = getFormatIdentifiers(provider);
-                    for (String formatIdentifier : formatIdentifiers) {
-                        newProviderMap.put(formatIdentifier, provider);
-                    }
-                }
-                providerMap = newProviderMap;
-                if (configurationAdmin != null) { //i.e. when we are in an OSGi environment
-                    Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
-                    if (newConfig == null) {
-                        newConfig = new Hashtable<String, Object>();
-                    }
-                    Set<String> supportedFormats = getSupportedFormats();
-                    String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
-                    newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
-                    configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
-                }
-            } catch (IOException ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-    }
-
-    
-
-    /**
-     * Extract format identifiers for a parsing provider
-     *
-     * @param provider the provider to be registered
-     * @return formatIdentifiers
-     */
-    private String[] getFormatIdentifiers(ParsingProvider parsingProvider) {
-        Class<? extends ParsingProvider> clazz = parsingProvider.getClass();
-        SupportedFormat supportedFormatAnnotation = clazz.getAnnotation(SupportedFormat.class);
-        String[] formatIdentifiers = supportedFormatAnnotation.value();
-        return formatIdentifiers;
-    }
-
-    @Reference
-    protected void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
-        this.configurationAdmin = configurationAdmin;
-    }
-
-    protected void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
-        this.configurationAdmin = null;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
deleted file mode 100644
index 3998beb..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-import java.io.InputStream;
-
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * An instance of this class parses RDF-ImmutableGraph from one or more serialization
- * formats. The supported formats are indicated using the {@link SupportedFormat}
- * annotation.
- *
- * @author reto
- */
-public interface ParsingProvider {
-
-    /**
-     * Parses a stream as the specified RDF-format. This method will be invoked
-     * for a supported format, a format is considered as supported if the part
-     * before a ';'-character in the <code>formatIdentifier</code> matches
-     * a <code>SupportedFormat</code> annotation of the implementing class.
-     *
-     * @param target the mutable ImmutableGraph to which the read triples shall be added
-     * @param serializedGraph the stream from which the serialized ImmutableGraph is read
-     * @param formatIdentifier a String identifying the format
-     * @param baseUri the baseUri for interpreting relative uris, may be null
-     */
-    void parse(Graph target, InputStream serializedGraph,
-            String formatIdentifier, IRI baseUri);
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
deleted file mode 100644
index 48fa0b7..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.Graph;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
-
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Modified;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This singleton class provides a method <code>serialize</code> to transform a
- * {@link ImmutableGraph} into serialized RDF forms.
- * 
- * Functionality is delegated to registered {@link SerializingProvider}s. Such
- * <code>SerializingProvider</code>s can be registered and unregistered, later
- * registered <code>SerializingProvider</code>s shadow previously registered
- * providers for the same format.
- * 
- * Note on synchronization: <code>SerializingProvider</code>s must be able to
- * handle concurrent requests.
- * 
- * @author mir
- * 
- */
-@Component(service = Serializer.class)
-public class Serializer {
-    
-    private ConfigurationAdmin configurationAdmin;
-
-    /**
-     * The list of providers in the order of registration
-     */
-    private List<SerializingProvider> providerList = new ArrayList<SerializingProvider>();
-
-    /**
-     * A map to quickly locate a provider
-     */
-    private volatile Map<String, SerializingProvider> providerMap = new HashMap<String, SerializingProvider>();
-
-    /**
-     * The singleton instance
-     */
-    private volatile static Serializer instance;
-    
-    private static final Logger log = LoggerFactory.getLogger(Serializer.class);
-    
-    private boolean active;
-
-    /**
-     * the constructor sets the singleton instance to allow instantiation
-     * by OSGi-DS. This constructor should not be called except by OSGi-DS,
-     * otherwise the static <code>getInstance</code> method should be used.
-     */
-    public Serializer() {
-        Serializer.instance = this;
-    }
-
-    /**
-     * A constructor for tests, which doesn't set the singleton instance
-     * 
-     * @param dummy
-     *            an ignored argument to distinguish this from the other
-     *            constructor
-     */
-    Serializer(Object dummy) {
-        active = true;
-    }
-
-    /**
-     * This returns the singleton instance, if an instance has been previously
-     * created (e.g. by OSGi declarative services) this instance is returned,
-     * otherwise a new instance is created and providers are injected using the
-     * service provider interface (META-INF/services/)
-     * 
-     * @return the singleton Serializer instance
-     */
-    public static Serializer getInstance() {
-        if (instance == null) {
-            synchronized (Serializer.class) {
-                if (instance == null) {
-                    new Serializer();
-                    Iterator<SerializingProvider> SerializingProviders = ServiceLoader
-                            .load(SerializingProvider.class).iterator();
-                    while (SerializingProviders.hasNext()) {
-                        SerializingProvider SerializingProvider = SerializingProviders
-                                .next();
-                        instance.bindSerializingProvider(SerializingProvider);
-                    }
-                    instance.active = true;
-                    instance.refreshProviderMap();
-                }
-            }
-        }
-        return instance;
-
-    }
- 
-    @Activate
-    protected void activate(final ComponentContext componentContext) {
-        active = true;
-        refreshProviderMap();
-    }
-
-    @Deactivate
-    protected void deactivate(final ComponentContext componentContext) {
-        active = false;
-    }
-    
-    @Modified
-    void modified(ComponentContext ctx) {
-        log.debug("modified");
-    }
-
-    /**
-     * Serializes a ImmutableGraph into an OutputStream. This delegates the
-     * processing to the provider registered for the specified format, if
-     * the formatIdentifier contains a ';'-character only the section before
-     * that character is used for choosing the provider.
-     * 
-     * @param serializedGraph
-     *            an outputStream into which the ImmutableGraph will be serialized
-     * @param tc  the <code>Graph</code> to be serialized
-     * @param formatIdentifier
-     *            a string specifying the serialization format (usually the
-     *            MIME-type)
-     * @throws UnsupportedFormatException
-     */
-    public void serialize(OutputStream serializedGraph, Graph tc,
-            String formatIdentifier) throws UnsupportedFormatException {
-        String deParameterizedIdentifier;
-        int semicolonPos = formatIdentifier.indexOf(';');
-        if (semicolonPos > -1) {
-            deParameterizedIdentifier = formatIdentifier.substring(0, semicolonPos);
-        } else {
-            deParameterizedIdentifier = formatIdentifier;
-        }
-        SerializingProvider provider = providerMap.get(deParameterizedIdentifier);
-        if (provider == null) {
-            throw new UnsupportedSerializationFormatException(formatIdentifier);
-        }
-        provider.serialize(serializedGraph, tc, formatIdentifier);
-    }
-
-    /**
-     * Get a set of supported formats
-     *
-     * @return a set if stings identifying formats (usually the MIME-type)
-     */
-    public Set<String> getSupportedFormats() {
-        return Collections.unmodifiableSet(providerMap.keySet());
-    }
-    
-    /**
-     * Registers a Serializing provider
-     * 
-     * @param provider
-     *            the provider to be registered
-     */
-    @Reference(policy = ReferencePolicy.DYNAMIC, 
-            cardinality = ReferenceCardinality.MULTIPLE)
-    public void bindSerializingProvider(SerializingProvider provider) {
-        providerList.add(provider);
-        refreshProviderMap();
-
-    }
-
-    /**
-     * Unregister a Serializing provider
-     * 
-     * @param provider
-     *            the provider to be unregistered
-     */
-    public void unbindSerializingProvider(SerializingProvider provider) {
-        providerList.remove(provider);
-        refreshProviderMap();
-
-    }
-
-    private void refreshProviderMap() {
-        if (active) {
-            final Map<String, SerializingProvider> newProviderMap = new HashMap<String, SerializingProvider>();
-            //we want more generic providers first so they get overridden by more specific ones
-            Collections.sort(providerList, new Comparator<SerializingProvider>() {
-                @Override
-                public int compare(SerializingProvider s1, SerializingProvider s2) {
-                    return getFormatIdentifiers(s2).length - getFormatIdentifiers(s1).length;
-                }
-            });
-            for (SerializingProvider provider : providerList) {
-                String[] formatIdentifiers = getFormatIdentifiers(provider);
-                for (String formatIdentifier : formatIdentifiers) {
-                    newProviderMap.put(formatIdentifier, provider);
-                }
-            }
-            providerMap = newProviderMap;
-            if (configurationAdmin != null) { //we are in OSGi environment
-                try {
-                    Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
-                    if (newConfig == null) {
-                        newConfig = new Hashtable<String, Object>();
-                    }
-                    Set<String> supportedFormats = getSupportedFormats();
-                    String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
-                    newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
-                    configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
-                } catch (IOException ex) {
-                    throw new RuntimeException(ex);
-                }
-            }
-        }
-    }
-
-    private String[] getFormatIdentifiers(
-            SerializingProvider SerializingProvider) {
-        Class<? extends SerializingProvider> clazz = SerializingProvider
-                .getClass();
-        SupportedFormat supportedFormatAnnotation = clazz
-                .getAnnotation(SupportedFormat.class);
-        String[] formatIdentifiers = supportedFormatAnnotation.value();
-        return formatIdentifiers;
-    }
-    
-    @Reference
-    protected void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
-        this.configurationAdmin = configurationAdmin;
-    }
-
-    protected void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
-        this.configurationAdmin = null;
-    }
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
deleted file mode 100644
index ecf4ab8..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-import java.io.OutputStream;
-
-import org.apache.clerezza.commons.rdf.Graph;
-
-
-/**
- * An instance of this class serializes <code>Graph</code>s to a
- * specified serialization format. The supported formats are indicated using the
- * {@link SupportedFormat} annotation.
- *
- * @author mir
- */
-public interface SerializingProvider {
-    
-    /** Serializes a <code>Graph</code> to a specified
-     * <code>OutputStream</code> in the format identified by
-     * <code>formatIdentifier</code>. This method will be invoked
-     * for a supported format, a format is considered as supported if the part
-     * before a ';'-character in the <code>formatIdentifier</code> matches
-     * a <code>SupportedFormat</code> annotation of the implementing class.
-     * 
-     * @param outputStream
-     * @param tc
-     * @param formatIdentifier
-     */
-    public void serialize(OutputStream outputStream, Graph tc,
-            String formatIdentifier);
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SupportedFormat.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SupportedFormat.java
deleted file mode 100644
index 8174366..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SupportedFormat.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used to annotate {@link ParsingProvider}s to indicate
- * the format(s) they support.
- *
- * @author reto
- */
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface SupportedFormat {
-
-    /**
-     * used as a key for the OSGi service property
-     */
-    public static final String supportedFormat = "supportedFormat";
-    public static final String RDF_XML = "application/rdf+xml";
-    public static final String TURTLE = "text/turtle";
-    public static final String X_TURTLE = "application/x-turtle";
-    public static final String N_TRIPLE = "application/n-triples";
-    /**
-    * @deprecated: The mime-type for N Triples is "application/n-triples": http://www.w3.org/TR/n-triples/#sec-mediaReg-n-triples
-    */
-    @Deprecated
-    public static final String TEXT_RDF_NT = "text/rdf+nt";
-    public static final String N3 = "text/rdf+n3";
-    public static final String RDF_JSON = "application/rdf+json";
-    //both html and xhtml can be rdf formats with RDFa
-    public static final String XHTML = "application/xhtml+xml";
-    public static final String HTML = "text/html";
-
-    /**
-     * A list of format Identifiers (typically MIME-types) types without
-     * parameter (without ';'-character).
-     * E.g. {"application/rdf+xml","application/turtle"}
-     */
-    String[] value();
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedFormatException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedFormatException.java
deleted file mode 100644
index f4249f1..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedFormatException.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.clerezza.rdf.core.serializedform;
-
-/**
- *
- * This exception is thrown on an attempt to parse a format for which no 
- * <code>ParsingProvider</code> is known.
- *
- * @author reto
- */
-public abstract class UnsupportedFormatException extends RuntimeException {
-
-    public UnsupportedFormatException(String message) {
-        super(message);
-    }
-
-
-    
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedParsingFormatException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedParsingFormatException.java
deleted file mode 100644
index 6d64830..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedParsingFormatException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-/**
- *
- * @author reto
- */
-public class UnsupportedParsingFormatException extends UnsupportedFormatException {
-    /**
-     * Creates an instance for a specified unsupported format.
-     * 
-     * @param formatIdentifier the unsupported format
-     */
-    public UnsupportedParsingFormatException(String formatIdentifier) {
-        super("No parser available for "+formatIdentifier);
-    }
-
-}
diff --git a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedSerializationFormatException.java b/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedSerializationFormatException.java
deleted file mode 100644
index c1a4384..0000000
--- a/rdf/core/src/main/java/org/apache/clerezza/rdf/core/serializedform/UnsupportedSerializationFormatException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.serializedform;
-
-/**
- *
- * @author reto
- */
-public class UnsupportedSerializationFormatException extends UnsupportedFormatException {
-    /**
-     * Creates an instance for a specified unsupported format.
-     * 
-     * @param formatIdentifier the unsupported format
-     */
-    public UnsupportedSerializationFormatException(String formatIdentifier) {
-        super("No serializer available for "+formatIdentifier);
-    }
-
-}
diff --git a/rdf/core/src/main/resources/META-INF/documentation.nt b/rdf/core/src/main/resources/META-INF/documentation.nt
deleted file mode 100644
index 6bbe00e..0000000
--- a/rdf/core/src/main/resources/META-INF/documentation.nt
+++ /dev/null
@@ -1,286 +0,0 @@
-<bundle:///smart-content-binding-content-content-el/0-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tSmart Content Binding (SCB) is an open source framework developed by \n\t\t\tclerezza.org aiming primarily at providing a java implementation of the \n\t\t\tgraph data model specified by W3C RDF [<a href=\"#ref1\">1</a>] and \n\t\t\tfunctionalities to operate on that data model. SCB offers a service \n\t\t\tinterface to access multiple  [...]
-<bundle:///smart-content-binding-content-content-el/0-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/0-title> <http://discobits.org/ontology#infoBit> "Introduction"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/0-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/0> <http://discobits.org/ontology#infoBit> "<strong xmlns=\"http://www.w3.org/1999/xhtml\">Introduction</strong>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/1-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tSCB comprises the following architectural components as depicted in Fig. 1:\n\t\t</p>\n\t\t<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<li>Core</li>\n\t\t\t<li>Facades</li>\n\t\t\t<li>Utilities</li>\n\t\t\t<li>Storage Providers</li>\n\t\t\t<li>Parsing Providers</li>\n\t\t\t<li>Serializing Providers</li>\n\t\t\t<li>Ontologies Tool [...]
-<bundle:///smart-content-binding-content-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/1-title> <http://discobits.org/ontology#infoBit> "Architecture"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/1> <http://discobits.org/ontology#contains> _:6743c073a950bff61f67984d65c7ab521 . 
-<bundle:///smart-content-binding-content-content-el/1> <http://discobits.org/ontology#contains> _:abb823c3fd5a90d56aac8ef66bbc27a71 . 
-<bundle:///smart-content-binding-content-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/3-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tIf you want to build SCB from its sources, you need JDK version 1.6 to compile. \n\t\t\tMaven version 2.0.9 has been used to build SCB.\n\t\t</p>\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/3-title> <http://discobits.org/ontology#infoBit> "Building SCB"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/3> <http://discobits.org/ontology#contains> _:217ceb83017ea96671846d12e5d5c0b51 . 
-<bundle:///smart-content-binding-content-content-el/3> <http://discobits.org/ontology#contains> _:2bbf09528c25da145225e8b0980bf2d41 . 
-<bundle:///smart-content-binding-content-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/4-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tTo develop an application on top of SCB, you need to have the Core and optionally \n\t\t\tUtilities and Fa\u00E7ades.\n\t\t</p>\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/4-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/4-title> <http://discobits.org/ontology#infoBit> "Developing Applications using SCB"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/4-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/4> <http://discobits.org/ontology#contains> _:02da6ab7feb6eade48467f3e619fd0901 . 
-<bundle:///smart-content-binding-content-content-el/4> <http://discobits.org/ontology#contains> _:c30e92dcdbdf63d1674984e7ad74927f1 . 
-<bundle:///smart-content-binding-content-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/5-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tTo deploy an application which uses SCB, Java(TM) SE Runtime Environment 6 or \n\t\t\thigher is needed. If the application does not use OSGi, then the SCB Core, \n\t\t\tthe jars required for compilation, as well as the needed implementations \n\t\t\t(typically one provider for storage, serialization, and parsing) must be in \n\t\t\tthe  [...]
-<bundle:///smart-content-binding-content-content-el/5-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/5-title> <http://discobits.org/ontology#infoBit> "Deploying an Application Requiring SCB"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/5-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/5> <http://discobits.org/ontology#contains> _:49dbfd013a17670491793c2b6b146add1 . 
-<bundle:///smart-content-binding-content-content-el/5> <http://discobits.org/ontology#contains> _:654813a906187207ad3cc8cb41f681811 . 
-<bundle:///smart-content-binding-content-content-el/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/6-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tSince SCB applies a Service Oriented Architecture approach, following components \n\t\t\tcan be easily extended: Storage Providers, Parsing Providers, and Serializing \n\t\t\tProviders. Using OSGi, new bundles just need to implement the required service \n\t\t\tinterfaces. To be located outside an OSGi environment, they should also prov [...]
-<bundle:///smart-content-binding-content-content-el/6-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<bundle:///smart-content-binding-content-content-el/6-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/6-title> <http://discobits.org/ontology#infoBit> "Extending and Customizing SCB"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/6-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/6> <http://discobits.org/ontology#contains> _:a19b1dc6a786e1f624246fa77f26064b1 . 
-<bundle:///smart-content-binding-content-content-el/6> <http://discobits.org/ontology#contains> _:c114892cb40ca25cb7973c1a33bb5efa1 . 
-<bundle:///smart-content-binding-content-content-el/6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/7-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tSmart Content Binding (SCB) is an open source framework developed by \n\t\t\tclerezza.org aiming primarily at providing a java implementation of the \n\t\t\tgraph data model specified by W3C RDF  and \n\t\t\tfunctionalities to operate on that data model. SCB offers a service \n\t\t\tinterface to access multiple named graphs and it can u [...]
-<bundle:///smart-content-binding-content-content-el/7-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/7-title> <http://discobits.org/ontology#infoBit> "Introduction"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/7-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/7> <http://discobits.org/ontology#contains> _:06de11c8dbffa159dcc8a94c5824221f1 . 
-<bundle:///smart-content-binding-content-content-el/7> <http://discobits.org/ontology#contains> _:79600405cf779cbb275363842bdc1d601 . 
-<bundle:///smart-content-binding-content-content-el/7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content-el/8-title> <http://discobits.org/ontology#infoBit> "overview"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-content-el/8-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-content-el/8> <http://discobits.org/ontology#contains> _:09e6c68551c8fa17fa88596d397668df1 . 
-<bundle:///smart-content-binding-content-content-el/8> <http://discobits.org/ontology#contains> _:fb5472113832d5b923c18b82ba74ae891 . 
-<bundle:///smart-content-binding-content-content-el/8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:0442d4e015ee629beb8468bc68eaa1d81 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:3e039903e53ca66562cb0a7cbab3c7a31 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:4e93a664498f08b22be631968648c7af1 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:a8795ea2e02fe02590420a4d6fba3a491 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:e192088cac6ea25495e86e375b508d111 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:e491014d95c2d6dad89d8af9b607eb6c1 . 
-<bundle:///smart-content-binding-content-content> <http://discobits.org/ontology#contains> _:e4e071f0106e6ea3eba559cc5d12c05c1 . 
-<bundle:///smart-content-binding-content-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<bundle:///smart-content-binding-content-el/0> <http://discobits.org/ontology#infoBit> "Smart Content Binding is just the name for the RDFsupport in clerezza."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/0> <http://discobits.org/ontology#infoBit> "Once you have an overview over SCB the best resource is the javadoc API documentation. The following gives hints and describes best prectices on particular toopics."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/0> <http://discobits.org/ontology#infoBit> "The MGraphs returned by the TcManager are lockable. A LockableMGraph has a getLock()-Method returning a ReadWriteLock. Write-Locks can be used if the applications logic requires it, i.e. when it wants to ensure that the Graph isn't modified by another thread while some triples are being added or removed bading on the presence or absence of other triples (note that its a viola [...]
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/1> <http://discobits.org/ontology#infoBit> "Readlocks must be used when multiple threads access an Graph and a method returning an Iterator is used. In this case a read-lock must be obtained before calling the method on Graph and released only after the last usage of the returned iterator. Failing to do so may result in ConcurrentModification when another threads modifies the Graph while we are iterating over it."^^<ht [...]
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/2> <http://discobits.org/ontology#infoBit> "Currently (this might change infuture versions), it is also necessary to lock on the MGraphs against which a sparql select queries is directed. The lock on the MGraphs should be kept till iteration over the resultset is compleeted."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-content> <http://discobits.org/ontology#infoBit> "There is no such thing, if you try to get a write-lock withing a read-locked section you'll have a deadlock."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-title> <http://discobits.org/ontology#infoBit> "How I create I deadlocksafe Lock?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-title> <http://discobits.org/ontology#infoBit> "How do I create deadlock-safe locks?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3> <http://discobits.org/ontology#contains> _:8ab36b67bdc95792f2115eecc5162cd01 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3> <http://discobits.org/ontology#contains> _:cb3233d321cd250df6fe98812441b5051 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-content> <http://discobits.org/ontology#infoBit> "The service documentation should be clear about which MGarphs the service might be writing to, so the caller can make sure it holds no read-lock on one of these Graph."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-title> <http://discobits.org/ontology#infoBit> "What is the best way to Lock a ImmutableGraph in a service? (the developers, wich use the service know nothing about the lock and set own locks - so the service needs to check something) "^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4> <http://discobits.org/ontology#contains> _:02b191249bf7687b1462297ecaa885c81 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4> <http://discobits.org/ontology#contains> _:c46179c34632150d8e547e0bfa876b0f1 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-content> <http://discobits.org/ontology#infoBit> "See the documentation and tutorials for the java.util.concurrent.locks package."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-title> <http://discobits.org/ontology#infoBit> "Where do I find additional documenation and source-code examples?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5> <http://discobits.org/ontology#contains> _:18132129e31939d4cc3e69c31a3c3c1a1 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5> <http://discobits.org/ontology#contains> _:6f4f5466d9cdc098f1d7e39802eb10851 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:4e5af087b6558782e485c3ffb9eba0d91 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:5fd3833c38a90777881461cadbce10111 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:8396ce895fcfec9de970578cbee48c911 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:93d47b3987bcd1b86f7d7926e86bd9b71 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:c6114f4df500bc98732a3ec17c1ad02d1 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://discobits.org/ontology#contains> _:ee141109a4cf29d666728340f5c4b6d81 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-title> <http://discobits.org/ontology#infoBit> "When to use locks?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2-content-el/1> <http://discobits.org/ontology#contains> _:2295250078eb898f110a82ec86de6cbc1 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1> <http://discobits.org/ontology#contains> _:f0ef4ed5eeefc21737de5dfef0555aed1 . 
-<bundle:///smart-content-binding-content-el/2-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-el/2-content> <http://discobits.org/ontology#contains> _:80bdd3e0c8433cee78b26eada35a95ba1 . 
-<bundle:///smart-content-binding-content-el/2-content> <http://discobits.org/ontology#contains> _:a30340a3f45f8e94a36ad72f90fe25c21 . 
-<bundle:///smart-content-binding-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<bundle:///smart-content-binding-content-el/2-title> <http://discobits.org/ontology#infoBit> "Developing with SCB"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content-el/2> <http://discobits.org/ontology#contains> _:06e52455a4b6e2e77881aae4fe82e4781 . 
-<bundle:///smart-content-binding-content-el/2> <http://discobits.org/ontology#contains> _:f8b936b53d7909d068de07da0bb79fe91 . 
-<bundle:///smart-content-binding-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-content-title> <http://discobits.org/ontology#infoBit> "The RDF support in Apache Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-content-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-content> <http://discobits.org/ontology#contains> _:226e2277b6151cc848d901cbbff6de0e1 . 
-<bundle:///smart-content-binding-content> <http://discobits.org/ontology#contains> _:354985fd2ca28f9ec33cd306f6ec73c01 . 
-<bundle:///smart-content-binding-content> <http://discobits.org/ontology#contains> _:65d0078ce0a8051b5757de5c0cf094311 . 
-<bundle:///smart-content-binding-content> <http://discobits.org/ontology#contains> _:d021e7a7266f4497dca78f93e3d16a6a1 . 
-<bundle:///smart-content-binding-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<bundle:///smart-content-binding-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-overview-title> <http://discobits.org/ontology#infoBit> "Overview"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-overview-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-overview/artifacts-content> <http://discobits.org/ontology#infoBit> "\t\t<p xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\tEach architectural component described above comprises one or more artifacts as \n\t\t\tlisted in Table 1.\n\t\t\t<br></br><br></br><i>Table 1: Artifacts of each architectural components</i><br></br>\n\t\t</p>\n\t\t<table xmlns=\"http://www.w3.org/1999/xhtml\" border=\"1\" cellpadding=\"4\">\n\t\t\t<tr>\n\t\t\t\t<th>Architectural Comp [...]
-<bundle:///smart-content-binding-overview/artifacts-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-overview/artifacts-title> <http://discobits.org/ontology#infoBit> "Artifacts"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-overview/artifacts-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding-overview/artifacts> <http://discobits.org/ontology#contains> _:14f13331873e2ed9f8fb13631e01816e1 . 
-<bundle:///smart-content-binding-overview/artifacts> <http://discobits.org/ontology#contains> _:d3214ba35fe284e4752c4523427ca2581 . 
-<bundle:///smart-content-binding-overview/artifacts> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-overview> <http://discobits.org/ontology#contains> _:d71a4a887a9c40161afd887e4129b5401 . 
-<bundle:///smart-content-binding-overview> <http://discobits.org/ontology#contains> _:f72f730abe25ec009ab48cf11f823f161 . 
-<bundle:///smart-content-binding-overview> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///smart-content-binding-title> <http://discobits.org/ontology#infoBit> "Smart Content Binding"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///smart-content-binding-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///smart-content-binding> <http://discobits.org/ontology#contains> _:94dc8181a1adfa918b21fd3681840b5b1 . 
-<bundle:///smart-content-binding> <http://discobits.org/ontology#contains> _:f8f82fe3319239d3989c0f0c2a86c5551 . 
-<bundle:///smart-content-binding> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-_:02b191249bf7687b1462297ecaa885c81 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-title> . 
-_:02b191249bf7687b1462297ecaa885c81 <http://discobits.org/ontology#pos> "0" . 
-_:02b191249bf7687b1462297ecaa885c81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:02da6ab7feb6eade48467f3e619fd0901 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/4-content> . 
-_:02da6ab7feb6eade48467f3e619fd0901 <http://discobits.org/ontology#pos> "1" . 
-_:02da6ab7feb6eade48467f3e619fd0901 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:0442d4e015ee629beb8468bc68eaa1d81 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-overview/artifacts> . 
-_:0442d4e015ee629beb8468bc68eaa1d81 <http://discobits.org/ontology#pos> "2" . 
-_:0442d4e015ee629beb8468bc68eaa1d81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:06de11c8dbffa159dcc8a94c5824221f1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/7-content> . 
-_:06de11c8dbffa159dcc8a94c5824221f1 <http://discobits.org/ontology#pos> "1" . 
-_:06de11c8dbffa159dcc8a94c5824221f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:06e52455a4b6e2e77881aae4fe82e4781 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content> . 
-_:06e52455a4b6e2e77881aae4fe82e4781 <http://discobits.org/ontology#pos> "1" . 
-_:06e52455a4b6e2e77881aae4fe82e4781 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:09e6c68551c8fa17fa88596d397668df1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/7> . 
-_:09e6c68551c8fa17fa88596d397668df1 <http://discobits.org/ontology#pos> "1" . 
-_:09e6c68551c8fa17fa88596d397668df1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:14f13331873e2ed9f8fb13631e01816e1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-overview/artifacts-title> . 
-_:14f13331873e2ed9f8fb13631e01816e1 <http://discobits.org/ontology#pos> "0" . 
-_:14f13331873e2ed9f8fb13631e01816e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:18132129e31939d4cc3e69c31a3c3c1a1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-title> . 
-_:18132129e31939d4cc3e69c31a3c3c1a1 <http://discobits.org/ontology#pos> "0" . 
-_:18132129e31939d4cc3e69c31a3c3c1a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:217ceb83017ea96671846d12e5d5c0b51 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/3-title> . 
-_:217ceb83017ea96671846d12e5d5c0b51 <http://discobits.org/ontology#pos> "0" . 
-_:217ceb83017ea96671846d12e5d5c0b51 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:226e2277b6151cc848d901cbbff6de0e1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-title> . 
-_:226e2277b6151cc848d901cbbff6de0e1 <http://discobits.org/ontology#pos> "0" . 
-_:226e2277b6151cc848d901cbbff6de0e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2295250078eb898f110a82ec86de6cbc1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-title> . 
-_:2295250078eb898f110a82ec86de6cbc1 <http://discobits.org/ontology#pos> "0" . 
-_:2295250078eb898f110a82ec86de6cbc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2bbf09528c25da145225e8b0980bf2d41 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/3-content> . 
-_:2bbf09528c25da145225e8b0980bf2d41 <http://discobits.org/ontology#pos> "1" . 
-_:2bbf09528c25da145225e8b0980bf2d41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:354985fd2ca28f9ec33cd306f6ec73c01 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-overview> . 
-_:354985fd2ca28f9ec33cd306f6ec73c01 <http://discobits.org/ontology#pos> "1" . 
-_:354985fd2ca28f9ec33cd306f6ec73c01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:3e039903e53ca66562cb0a7cbab3c7a31 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/1> . 
-_:3e039903e53ca66562cb0a7cbab3c7a31 <http://discobits.org/ontology#pos> "1" . 
-_:3e039903e53ca66562cb0a7cbab3c7a31 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:49dbfd013a17670491793c2b6b146add1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/5-content> . 
-_:49dbfd013a17670491793c2b6b146add1 <http://discobits.org/ontology#pos> "1" . 
-_:49dbfd013a17670491793c2b6b146add1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:4e5af087b6558782e485c3ffb9eba0d91 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/1> . 
-_:4e5af087b6558782e485c3ffb9eba0d91 <http://discobits.org/ontology#pos> "1" . 
-_:4e5af087b6558782e485c3ffb9eba0d91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:4e93a664498f08b22be631968648c7af1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/7> . 
-_:4e93a664498f08b22be631968648c7af1 <http://discobits.org/ontology#pos> "0" . 
-_:4e93a664498f08b22be631968648c7af1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5fd3833c38a90777881461cadbce10111 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4> . 
-_:5fd3833c38a90777881461cadbce10111 <http://discobits.org/ontology#pos> "4" . 
-_:5fd3833c38a90777881461cadbce10111 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:654813a906187207ad3cc8cb41f681811 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/5-title> . 
-_:654813a906187207ad3cc8cb41f681811 <http://discobits.org/ontology#pos> "0" . 
-_:654813a906187207ad3cc8cb41f681811 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:65d0078ce0a8051b5757de5c0cf094311 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2> . 
-_:65d0078ce0a8051b5757de5c0cf094311 <http://discobits.org/ontology#pos> "2" . 
-_:65d0078ce0a8051b5757de5c0cf094311 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6743c073a950bff61f67984d65c7ab521 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/1-content> . 
-_:6743c073a950bff61f67984d65c7ab521 <http://discobits.org/ontology#pos> "1" . 
-_:6743c073a950bff61f67984d65c7ab521 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6f4f5466d9cdc098f1d7e39802eb10851 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5-content> . 
-_:6f4f5466d9cdc098f1d7e39802eb10851 <http://discobits.org/ontology#pos> "1" . 
-_:6f4f5466d9cdc098f1d7e39802eb10851 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:79600405cf779cbb275363842bdc1d601 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/7-title> . 
-_:79600405cf779cbb275363842bdc1d601 <http://discobits.org/ontology#pos> "0" . 
-_:79600405cf779cbb275363842bdc1d601 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:80bdd3e0c8433cee78b26eada35a95ba1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/0> . 
-_:80bdd3e0c8433cee78b26eada35a95ba1 <http://discobits.org/ontology#pos> "0" . 
-_:80bdd3e0c8433cee78b26eada35a95ba1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8396ce895fcfec9de970578cbee48c911 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/5> . 
-_:8396ce895fcfec9de970578cbee48c911 <http://discobits.org/ontology#pos> "5" . 
-_:8396ce895fcfec9de970578cbee48c911 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8ab36b67bdc95792f2115eecc5162cd01 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-title> . 
-_:8ab36b67bdc95792f2115eecc5162cd01 <http://discobits.org/ontology#pos> "0" . 
-_:8ab36b67bdc95792f2115eecc5162cd01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:93d47b3987bcd1b86f7d7926e86bd9b71 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3> . 
-_:93d47b3987bcd1b86f7d7926e86bd9b71 <http://discobits.org/ontology#pos> "3" . 
-_:93d47b3987bcd1b86f7d7926e86bd9b71 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:94dc8181a1adfa918b21fd3681840b5b1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-title> . 
-_:94dc8181a1adfa918b21fd3681840b5b1 <http://discobits.org/ontology#pos> "0" . 
-_:94dc8181a1adfa918b21fd3681840b5b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:a19b1dc6a786e1f624246fa77f26064b1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/6-title> . 
-_:a19b1dc6a786e1f624246fa77f26064b1 <http://discobits.org/ontology#pos> "0" . 
-_:a19b1dc6a786e1f624246fa77f26064b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:a30340a3f45f8e94a36ad72f90fe25c21 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1> . 
-_:a30340a3f45f8e94a36ad72f90fe25c21 <http://discobits.org/ontology#pos> "1" . 
-_:a30340a3f45f8e94a36ad72f90fe25c21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:a8795ea2e02fe02590420a4d6fba3a491 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/3> . 
-_:a8795ea2e02fe02590420a4d6fba3a491 <http://discobits.org/ontology#pos> "3" . 
-_:a8795ea2e02fe02590420a4d6fba3a491 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:abb823c3fd5a90d56aac8ef66bbc27a71 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/1-title> . 
-_:abb823c3fd5a90d56aac8ef66bbc27a71 <http://discobits.org/ontology#pos> "0" . 
-_:abb823c3fd5a90d56aac8ef66bbc27a71 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c114892cb40ca25cb7973c1a33bb5efa1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/6-content> . 
-_:c114892cb40ca25cb7973c1a33bb5efa1 <http://discobits.org/ontology#pos> "1" . 
-_:c114892cb40ca25cb7973c1a33bb5efa1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c30e92dcdbdf63d1674984e7ad74927f1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/4-title> . 
-_:c30e92dcdbdf63d1674984e7ad74927f1 <http://discobits.org/ontology#pos> "0" . 
-_:c30e92dcdbdf63d1674984e7ad74927f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c46179c34632150d8e547e0bfa876b0f1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/4-content> . 
-_:c46179c34632150d8e547e0bfa876b0f1 <http://discobits.org/ontology#pos> "1" . 
-_:c46179c34632150d8e547e0bfa876b0f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c6114f4df500bc98732a3ec17c1ad02d1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/2> . 
-_:c6114f4df500bc98732a3ec17c1ad02d1 <http://discobits.org/ontology#pos> "2" . 
-_:c6114f4df500bc98732a3ec17c1ad02d1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:cb3233d321cd250df6fe98812441b5051 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/3-content> . 
-_:cb3233d321cd250df6fe98812441b5051 <http://discobits.org/ontology#pos> "1" . 
-_:cb3233d321cd250df6fe98812441b5051 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d021e7a7266f4497dca78f93e3d16a6a1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/0> . 
-_:d021e7a7266f4497dca78f93e3d16a6a1 <http://discobits.org/ontology#pos> "0" . 
-_:d021e7a7266f4497dca78f93e3d16a6a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d3214ba35fe284e4752c4523427ca2581 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-overview/artifacts-content> . 
-_:d3214ba35fe284e4752c4523427ca2581 <http://discobits.org/ontology#pos> "1" . 
-_:d3214ba35fe284e4752c4523427ca2581 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d71a4a887a9c40161afd887e4129b5401 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-overview-title> . 
-_:d71a4a887a9c40161afd887e4129b5401 <http://discobits.org/ontology#pos> "0" . 
-_:d71a4a887a9c40161afd887e4129b5401 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e192088cac6ea25495e86e375b508d111 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/5> . 
-_:e192088cac6ea25495e86e375b508d111 <http://discobits.org/ontology#pos> "5" . 
-_:e192088cac6ea25495e86e375b508d111 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e491014d95c2d6dad89d8af9b607eb6c1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/6> . 
-_:e491014d95c2d6dad89d8af9b607eb6c1 <http://discobits.org/ontology#pos> "6" . 
-_:e491014d95c2d6dad89d8af9b607eb6c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e4e071f0106e6ea3eba559cc5d12c05c1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/4> . 
-_:e4e071f0106e6ea3eba559cc5d12c05c1 <http://discobits.org/ontology#pos> "4" . 
-_:e4e071f0106e6ea3eba559cc5d12c05c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:ee141109a4cf29d666728340f5c4b6d81 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content-el/0> . 
-_:ee141109a4cf29d666728340f5c4b6d81 <http://discobits.org/ontology#pos> "0" . 
-_:ee141109a4cf29d666728340f5c4b6d81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f0ef4ed5eeefc21737de5dfef0555aed1 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-content-el/1-content> . 
-_:f0ef4ed5eeefc21737de5dfef0555aed1 <http://discobits.org/ontology#pos> "1" . 
-_:f0ef4ed5eeefc21737de5dfef0555aed1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f72f730abe25ec009ab48cf11f823f161 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content> . 
-_:f72f730abe25ec009ab48cf11f823f161 <http://discobits.org/ontology#pos> "1" . 
-_:f72f730abe25ec009ab48cf11f823f161 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f8b936b53d7909d068de07da0bb79fe91 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-el/2-title> . 
-_:f8b936b53d7909d068de07da0bb79fe91 <http://discobits.org/ontology#pos> "0" . 
-_:f8b936b53d7909d068de07da0bb79fe91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f8f82fe3319239d3989c0f0c2a86c5551 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content> . 
-_:f8f82fe3319239d3989c0f0c2a86c5551 <http://discobits.org/ontology#pos> "1" . 
-_:f8f82fe3319239d3989c0f0c2a86c5551 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:fb5472113832d5b923c18b82ba74ae891 <http://discobits.org/ontology#holds> <bundle:///smart-content-binding-content-content-el/8-title> . 
-_:fb5472113832d5b923c18b82ba74ae891 <http://discobits.org/ontology#pos> "0" . 
-_:fb5472113832d5b923c18b82ba74ae891 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
diff --git a/rdf/core/src/site/resources/documentation/images/scb_architecture.png b/rdf/core/src/site/resources/documentation/images/scb_architecture.png
deleted file mode 100644
index 0d22a8a..0000000
Binary files a/rdf/core/src/site/resources/documentation/images/scb_architecture.png and /dev/null differ
diff --git a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/LICENSE b/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/pom.xml b/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/pom.xml
deleted file mode 100644
index c778c7f..0000000
--- a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
-
- 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.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.example.clerezza</groupId>
-    <artifactId>combined.tutorial</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.0-SNAPSHOT</version>
-    <name>SCB Jaxrs Tutorial</name>    
-    <parent>
-        <artifactId>clerezza</artifactId>
-        <groupId>org.apache.clerezza</groupId>
-        <version>0.11-SNAPSHOT</version>
-        <relativePath>../../../../../../../parent</relativePath>
-    </parent>
-    <repositories>
-        <repository>
-            <id>clerezza-release</id>
-            <name>clerezza.org distribution repository</name>
-            <url>http://repo.trialox.org/release</url>
-            <layout>default</layout>
-        </repository>
-        <repository>
-            <id>clerezza-snapshot</id>
-            <name>clerezza.org snapshot repository</name>
-            <url>http://repo.trialox.org/snapshot</url>
-            <layout>default</layout>
-        </repository>
-    </repositories>    
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>jaxrs.rdf.providers</artifactId>
-            <version>0.14-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.typerendering.seedsnipe</artifactId>
-            <version>0.7-SNAPSHOT</version>
-        </dependency>
-    </dependencies>    
-</project>
\ No newline at end of file
diff --git a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/java/org/example/apache/clerezza/combined/tutorial/TutorialApp.java b/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/java/org/example/apache/clerezza/combined/tutorial/TutorialApp.java
deleted file mode 100644
index 9a99d5d..0000000
--- a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/java/org/example/apache/clerezza/combined/tutorial/TutorialApp.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.example.clerezza.combined.tutorial;
-/*
- *
- * 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 java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-
-import org.osgi.service.component.ComponentContext;
-
-import org.apache.clerezza.platform.typerendering.seedsnipe.SeedsnipeRenderlet;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.rdf.ontologies.FOAF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.core.ImmutableGraph;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-
-/**
- * Get Persons by their email
- *
- * @scr.component
- * @scr.service interface="java.lang.Object"
- * @scr.property name="javax.ws.rs" type="Boolean" value="true"
- */
-
-@Path("/foaf")
-public class TutorialApp {
-    
-    /**
-     * @scr.reference
-     */
-    TcManager tcManager;
-    
-    /**
-     * @scr.reference
-     */
-    private RenderletManager renderletManager;
-    
-    private UriRef graphName = new UriRef("http://localhost.mygraph");
-
-    @GET
-    @Path("find")
-    @Produces("application/rdf+xml")
-    public ImmutableGraph getPersonRdf(@QueryParam("mbox") String mboxString) {
-        Graph graph = tcManager.getMGraph(graphName);
-        NonLiteral person = getPersonByMbox(mboxString, graph);
-        return new GraphNode(person, graph).getNodeContext();
-    }
-
-    @GET
-    @Path("find")
-    @Produces("application/xhtml+xml")
-    public GraphNode getPersonHtml(@QueryParam("mbox") String mboxString) {
-        Graph graph = tcManager.getMGraph(graphName);
-        NonLiteral person = getPersonByMbox(mboxString, graph);
-        return new GraphNode(person, graph);
-    }
-
-    private NonLiteral getPersonByMbox(String mboxString, Graph graph) {
-        Iterator<Triple> iter = graph.filter(null, FOAF.mbox, new UriRef(mboxString));
-        NonLiteral person = null;
-        while(iter.hasNext()) {
-            person = iter.next().getSubject();
-        }
-        return person;
-    }
-    
-    /**
-     * The activate method is called when SCR activates the component configuration.
-     * This method gets the system ImmutableGraph or create a new one if it doesn't exist.
-     * 
-     * @param componentContext
-     */
-    protected void activate(ComponentContext componentContext) {
-        
-        URL templateURL = getClass().getResource("tutorial.xhtml");    
-        try {
-            renderletManager.registerRenderlet(SeedsnipeRenderlet.class
-                    .getName(), new UriRef(templateURL.toURI().toString()),
-                    FOAF.Person, null, MediaType.APPLICATION_XHTML_XML_TYPE,
-                    true);
-        } catch (URISyntaxException ex) {
-            throw new WebApplicationException(ex);
-        }
-        Graph tc;
-        try {
-            tcManager.getMGraph(graphName);
-        } catch (NoSuchEntityException nsee) {
-            tc = tcManager.createMGraph(graphName);
-            InputStream fin = null;
-            fin = getClass().getResourceAsStream("data.turtle");
-            Parser parser = Parser.getInstance();
-            tc.addAll(parser.parse(fin, "text/turtle"));
-        }
-    }
-}
-
diff --git a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/data.turtle b/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/data.turtle
deleted file mode 100644
index 88005cd..0000000
--- a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/data.turtle
+++ /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.
-
-@prefix foaf: <http://xmlns.com/foaf/0.1/>.
-
-[	a foaf:Person;
-    foaf:title "Mr";
-    foaf:name "John Doe";
-    foaf:mbox <ma...@example.org>;
-	foaf:topic_interest <http://dbpedia.org/resource/Category:BBC_television_sitcoms>;
-    foaf:nick "jo" ] .
-
-[	a foaf:Person;
-    foaf:title "Mr";
-    foaf:name "Jane Bloggs";
-    foaf:mbox <ma...@example.org>;
-    foaf:openid <http://openid.example.org/jbloggs> ] .
-
diff --git a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/tutorial.xhtml b/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/tutorial.xhtml
deleted file mode 100644
index db7418c..0000000
--- a/rdf/core/src/site/resources/documentation/scb-triaxrs-tutorial/src/main/resources/org/example/apache/clerezza/combined/tutorial/tutorial.xhtml
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<!--
-
- 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.
-
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-	${ns:foaf=http://xmlns.com/foaf/0.1/}
-	${ns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#}
-	${ns:dc=http://purl.org/dc/elements/1.1/}
-	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-	<title>clerezza - Combined Tutorial</title>
-</head>
-<body>
-	<h1>clerezza - Combined Tutorial</h1>
-	<h2>FOAF Person:</h2>
-	<div>
-		<p>Name: ${foaf:title} ${foaf:name}</p>
-		<p>Email: ${foaf:mbox}</p>
-		${if foaf:nick}
-		<p>Nickname: ${foaf:nick}</p>
-		${/if}
-		<p>Topic interests: <br />
-		${loop}
-			${foaf:topic_interest}<br />
-		${/loop}
-		</p>
-	</div>
-</body>
-</html>
diff --git a/rdf/core/src/site/resources/documentation/style/documentation.css b/rdf/core/src/site/resources/documentation/style/documentation.css
deleted file mode 100644
index a7cbd81..0000000
--- a/rdf/core/src/site/resources/documentation/style/documentation.css
+++ /dev/null
@@ -1,34 +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.
- *
-*/
-
-.note {
-    background-color:  #f4e010;
-	margin-top: 1em;
-	margin-bottom: 1em;
-}
-
-blockcode {
-	white-space: pre;
-	display: block;
-	background-color:  #f4e0e0;
-	padding-left: 4em;
-	margin-bottom: 1em;
-}
diff --git a/rdf/core/src/site/resources/documentation/style/style.css b/rdf/core/src/site/resources/documentation/style/style.css
deleted file mode 100644
index ff49a4d..0000000
--- a/rdf/core/src/site/resources/documentation/style/style.css
+++ /dev/null
@@ -1,421 +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.
- *
-*/
-
-/*---------------------------------------------------------------------------
- *  Two- and three-column layout
- */
-
-#banner {
-    top: 0px;
-    left: 0px;
-    right: 0px;
-    height: 116px;
-}
-
-#left {
-    position: absolute;
-    z-index: 2;
-    left: 8px;
-    width: 184px;
-    top: 125px;
-    bottom: 8px;
-    margin: 0px;
-    padding: 0px;
-}
-
-#right {
-    position: absolute;
-    z-index: 1;
-    right: 8px;
-    width: 184px;
-    top: 125px;
-    bottom: 8px;
-    margin: 0px;
-    padding: 0px;
-}
-
-.Content3Column {
-    position: absolute;
-    top: 125px;
-    bottom: 8px;
-    left: 208px;
-    right: 216px;
-}
-
-.Content2Column {
-    position: absolute;
-    top: 125px;
-    bottom: 8px;
-    left: 208px;
-    right: 16px;
-}
-
-#center {
-    z-index: 3;
-    margin: 0px;
-    border: none;
-    padding-bottom: 8px;
-}
-
-
-/*---------------------------------------------------------------------------
- *  Default element styles
- */
-
-body {
-    padding: 0px;
-    margin: 0px;
-    border: 0px;
-
-    font-family: helvetica, arial, sans-serif;
-    font-size: 12px;
-
-    background-color: white;
-    color: black;
-}
-
-h1, h2, h3, h4, h5, h6 {
-    margin: 0px;
-    border: 0px;
-    padding: 0px;
-    font-weight: normal;
-}
-
-a:link { color: #008DA8; }
-a:active { color: #FE5400; }
-a:hover { color: #FE5400; }
-a:visited { color: black; }
-
-iframe {
-    width:100%;
-    height: 800px;
-    border: 0px;
-}
-
-img {
-    border: 0px;
-    padding: 0px;
-    margin: 0px;
-}
-
-p {
-    border: 0px;
-    padding: 0px;
-    margin: 0px;
-    margin-bottom: 10px;
-}
-
-blockquote {
-    margin-bottom: 10px;
-}
-
-td {
-    font-size: 12px;
-    padding: 2px;
-}
-
-tr.a {
-    background-color:  #e0e0e0;
-}
-tr.b {
-    background-color: #ffffff;
-}
-
-th {
-    font-size: 12px;
-    font-weight: bold;
-    white-space: nowrap;
-    padding: 2px;
-}
-
-th.Row {
-    text-align: left;
-    vertical-align: top;
-}
-
-ul, ol {
-    border: 0px;
-    padding: 0px;
-    margin-top: 0px;
-    margin-bottom: 12px;
-    margin-left: 20px;
-}
-
-
-/*---------------------------------------------------------------------------
- *  Page banner
- */
-
-#banner {
-    margin: 0px;
-    border: 0px;
-    border-bottom: 1px solid #008DA8;
-    padding: 0px;
-    background-color: #e0e0e0;
-    color: #008DA8;
-    vertical-align: bottom;
-}
-
-#banner a { text-decoration: none; }
-#banner a:visited { color: #008DA8; }
-#banner a:hover { color: #FE5400; }
-#banner a:active { color: #FE5400; }
-
-#logo {
-    position: absolute;
-    top: 5px;
-    left: 8px;
-}
-
-#versions {
-    position: absolute;
-    width: auto;
-    right: 0px;
-    top: 0px;
-    margin: 8px;
-    font-weight: normal;
-}
-
-/*---------------------------------------------------------------------------
- *  Page content
- */
-
-#content {
-    margin: 0px;
-    background-color: white;
-    color: black;
-    height: 100%;
-}
-
-#content h1 {
-    width: 100%;
-    font-size: 18px;
-    background-color: #008DA8;
-    color: white;
-    padding: 2px;
-    padding-left: 6px;
-    margin-top: 24px;
-    margin-bottom: 12px;
-}
-
-#content .FirstChild {  /* IE doesn't understand first-child pseudoelement */
-    margin-top: 0px;
-}
-
-#content a { text-decoration: underline; }
-#content a:link { color: #008DA8; }
-#content a:visited { color: #008DA8; }
-#content a:active { color: #FE5400; }
-#content a:hover { color: #FE5400; }
-
-#content h2 {
-    margin-top: 24px;
-    border-top: 1px solid #008DA8;
-    margin-bottom: 16px;
-    font-size: 15px;
-    font-weight: bold;
-    background-color:  #e0e0e0;;
-    padding: 2px;
-}
-
-#content li {
-    margin-bottom: 6px;
-}
-
-#content th {
-    background-color:  #e0e0e0;
-}
-
-#content td {
-    
-}
-
-.Source pre {
-    padding: 4px;
-    font-family: courier new, monospace;
-    font-size: 11px;
-    border: 1px solid #008DA8;
-    background-color:  #e0e0e0;
-    color: black;
-}
-
-.Source:before {
-    margin: 0px;
-    padding: 0px;
-    border: 0px;
-    font-size: inherit;
-    line-spacing: 100%;
-}
-
-.highlight {
-    background-color:  #e0e0e0;
-    border: 1px dotted #008DA8;
-    padding: 5px;
-}
-
-/* The following are for images, but can also apply to div's containing images. */
-
-#content .Float {
-    float: right;
-    margin-left: 8px;
-    margin-right: 0px;
-    margin-top: 8px;
-    margin-bottom: 8px;
-}
-
-#content .Diagram {
-    display: block;
-    margin-left: auto;
-    margin-right: auto;
-    margin-top: 8px;
-    margin-bottom: 8px;
-}
-
-
-#content .Inline {
-    display: inline;
-}
-
-.RuleOfThumb {
-    font-weight: bold;
-}
-
-/*---------------------------------------------------------------------------
- *  Side panels
- */
-
-.SidePanel {
-    background-color: white;
-    padding: 0px;
-    font-size: 11px;
-}
-
-.SidePanel h1 {
-    margin: 0px;
-    border: 0px;
-    padding: 4px;
-
-    color: #008DA8;
-
-    font-size: 12px;
-    font-weight: bold;
-}
-
-
-.SidePanel a { text-decoration: none; }
-.SidePanel a:link { color: #000000; }
-.SidePanel a:visited { color: #000000; }
-.SidePanel a:active { color: #FE5400; }
-.SidePanel a:hover { color: #FE5400; }
-
-/*---------------------------------------------------------------------------
- *  Menus
- */
-
-.MenuGroup {
-    border-left: 1px solid #A3DAE6;
-    border-top: 1px solid #A3DAE6;
-    border-bottom: 1px solid white; /* IE work-around */
-
-    margin-bottom: 8px;
-    background-color: white;
-    color: #008DA8;
-}
-
-.MenuGroup ul {
-    margin: 0px;
-    padding-left: 4px;
-    list-style-type: none;
-}
-
-.MenuGroup li {
-    padding: 2px;
-}
-
-.MenuGroup .currentLink {
-/*    background-color: #060;*/
-    background-color:  #e0e0e0;
-    color: #008DA8;
-}
-
-
-/*---------------------------------------------------------------------------
- *  News panel
- */
-
-.NewsGroup {
-    border-left: 1px solid #A3DAE6;
-    border-top: 1px solid #A3DAE6;
-    border-bottom: 1px solid white; /* IE workaround */
-    margin-bottom: 8px;
-
-    color: #008DA8;
-}
-
-.NewsItem {
-    margin: 4px;
-}
-
-.NewsDate {
-    font-weight: bold;
-    margin: 0px;
-    padding: 0px;
-}
-
-.NewsText {
-    padding: 0px;
-    margin: 0px;
-    margin-bottom: 8px;
-}
-
-.NewsText a { text-decoration: underline; }
-.NewsText a:link { color: #008DA8; }
-.NewsText a:visited { color: #008DA8; }
-.NewsText a:active { color: #FE5400; }
-.NewsText a:hover { color: #FE5400; }
-
-.NewsMore {
-    font-size: smaller;
-    margin: 4px;
-    margin-top: 8px;
-    text-align: left;
-}
-
-.NewsGroup td {
-    font-size: 12px;
-}
-
-/*---------------------------------------------------------------------------
- *  Document meta-information
- */
-
-.Meta {
-    margin-top: 64px;
-    font-size: smaller;
-    color: #008DA8;
-    text-align: right;
-}
-
-.Meta a { text-decoration: underline; }
-.Meta a:link { color: #008DA8; }
-.Meta a:visited { color: #008DA8; }
-.Meta a:active { color: #FE5400; }
-.Meta a:hover { color: #FE5400; }
diff --git a/rdf/core/src/site/resources/documentation/tutorial1/LICENSE b/rdf/core/src/site/resources/documentation/tutorial1/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf/core/src/site/resources/documentation/tutorial1/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/rdf/core/src/site/resources/documentation/tutorial1/pom.xml b/rdf/core/src/site/resources/documentation/tutorial1/pom.xml
deleted file mode 100644
index 25ce4a1..0000000
--- a/rdf/core/src/site/resources/documentation/tutorial1/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
-
- 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.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.example.clerezza.scb</groupId>
-    <artifactId>tutorial1</artifactId>
-    <packaging>jar</packaging>
-    <version>1.0-SNAPSHOT</version>
-    <name>tutorial1</name>
-    <url>http://maven.apache.org</url>
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>3.8.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>0.7-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.utils</artifactId>
-            <version>0.7-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.ontologies</artifactId>
-            <version>0.5-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.parser</artifactId>
-            <version>0.5-SNAPSHOT</version>
-    <!-- <scope>runtime</scope> -->
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.serializer</artifactId>
-            <version>0.4-SNAPSHOT</version>
-    <!-- <scope>runtime</scope> -->
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>1.5.5</version>
-    <!-- <scope>runtime</scope> -->
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.simple.storage</artifactId>
-            <version>0.2-SNAPSHOT</version>
-            <!-- <scope>runtime</scope> -->
-        </dependency>
-
-
-    </dependencies>
-    <repositories>
-        <repository>
-            <id>clerezza-release</id>
-            <name>clerezza.org distribution repository</name>
-            <url>http://repo.trialox.org/release</url>
-            <layout>default</layout>
-        </repository>
-        <repository>
-            <id>clerezza-snapshot</id>
-            <name>clerezza.org snapshot repository</name>
-            <url>http://repo.trialox.org/snapshot</url>
-            <layout>default</layout>
-        </repository>
-    </repositories>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-
-</project>
\ No newline at end of file
diff --git a/rdf/core/src/site/resources/documentation/tutorial1/src/main/java/org/example/apache/clerezza/scb/tutorial1/Tutorial1App.java b/rdf/core/src/site/resources/documentation/tutorial1/src/main/java/org/example/apache/clerezza/scb/tutorial1/Tutorial1App.java
deleted file mode 100644
index f0e2e8c..0000000
--- a/rdf/core/src/site/resources/documentation/tutorial1/src/main/java/org/example/apache/clerezza/scb/tutorial1/Tutorial1App.java
+++ /dev/null
@@ -1,305 +0,0 @@
-package org.example.clerezza.scb.tutorial1;
-/*
- *
- * 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 java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.table.AbstractTableModel;
-import org.apache.clerezza.rdf.core.ImmutableGraph;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-
-/**
- * A panel allowing browsing the context of resoures, a main method loads
- * the panel in a new windows.
- * @author rbn
- */
-
-public class Tutorial1App extends JPanel {
-
-    //where our knowledge is stored
-    private Graph graph;
-    //the URI for which the context is shown
-    private String selectedUri;
-    //These get notified when the selected URI changes
-    private Set<UriChangedListener> uriChangedListeners
-            = new HashSet<UriChangedListener>();
-    //these get notified when graph was modified
-    private Set<GraphChangedListener> graphChangedListeners
-            = new HashSet<GraphChangedListener>();
-
-    public static void main(String[] args) throws Exception {
-        javax.swing.SwingUtilities.invokeLater(new Runnable() {
-
-            public void run() {
-                //Create and set up the window.
-                JFrame frame = new JFrame("Triple GUI");
-                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-                final Tutorial1App tutorial1App = new Tutorial1App("http://dbpedia.org/resource/Category:BBC_television_sitcoms");
-                frame.getContentPane().add(tutorial1App);
-                //Display the window.
-                frame.pack();
-                frame.setVisible(true);
-            }
-        });
-    }
-
-    /**
-     * Constructs a Tutorial1App with an initially selected URI for which the
-     * describing triples are retrieved from the web.
-     *
-     * @param selectedUri the initial selected URI
-     */
-    public Tutorial1App(final String selectedUri) {
-        this.selectedUri = selectedUri;
-        //get the singleton instance of TcManager
-        final TcManager tcManager = TcManager.getInstance();
-        //the arbitrary name we use for our mutable ImmutableGraph
-        final UriRef mGraphName = new UriRef("http://tutorial.example.org/");
-        //the m-ImmutableGraph into which we'll put the triples we collect
-        graph = tcManager.createMGraph(mGraphName);
-        try {
-            loadContextFromWeb();
-        } catch (IOException ex) {
-            System.err.println("Error retrieving " + selectedUri);
-            ex.printStackTrace();
-        }
-
-        Iterator<Triple> typeTriples = graph.filter(new UriRef(selectedUri), RDF.type, null);
-        while (typeTriples.hasNext()) {
-            System.out.println(typeTriples.next());
-        }
-
-        setLayout(new BorderLayout());
-        add(createNavigation(), BorderLayout.PAGE_START);
-        add(createMainArea(), BorderLayout.CENTER);
-        add(createFooter(), BorderLayout.PAGE_END);
-    }
-
-    public String getSelectedUri() {
-        return selectedUri;
-    }
-
-    public void setSelectedUri(String selectedUri) {
-        this.selectedUri = selectedUri;
-        for (UriChangedListener uriChangedListener : uriChangedListeners) {
-            uriChangedListener.uriChanged();
-        }
-    }
-
-    public void addGraphChangedListeners(GraphChangedListener gcl) {
-        graphChangedListeners.add(gcl);
-    }
-
-    public void addUriChangedListeners(UriChangedListener ucl) {
-        uriChangedListeners.add(ucl);
-    }
-
-    /**
-     * 
-     * @return the context of the currently selected URI
-     */
-    public ImmutableGraph getCurrentContext() {
-        return new GraphNode(new UriRef(selectedUri), graph).getNodeContext();
-    }
-
-    /**
-     * Dereference the selected URI and add the retroieved triples to graph
-     *
-     * @throws java.io.IOException
-     */
-    private void loadContextFromWeb() throws IOException {
-        final URL url = new URL(selectedUri);
-        final URLConnection con = url.openConnection();
-        con.addRequestProperty("Accept", "application/rdf+xml");
-        final InputStream inputStream = con.getInputStream();
-
-        //get the singleton instance of Parser
-        final Parser parser = Parser.getInstance();
-        ImmutableGraph deserializedGraph = parser.parse(inputStream, "application/rdf+xml");
-
-        graph.addAll(deserializedGraph);
-        for (GraphChangedListener graphChangedListener : graphChangedListeners) {
-            graphChangedListener.graphChanged();
-        }
-    }
-
-    private JPanel createNavigation() {
-        JPanel navigation = new JPanel();
-        navigation.add(new JLabel("URI: "));
-        final JTextField selectedUriField = new JTextField(selectedUri, 80);
-        navigation.add(selectedUriField);
-        addUriChangedListeners(new UriChangedListener() {
-
-            @Override
-            public void uriChanged() {
-                selectedUriField.setText(selectedUri);
-            }
-        });
-        JButton showContextButton = new JButton("Show Context");
-        navigation.add(showContextButton);
-        JButton loadContextButton = new JButton("Load Context from Web");
-        navigation.add(loadContextButton);
-        loadContextButton.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                try {
-                    setSelectedUri(selectedUriField.getText());
-                    loadContextFromWeb();
-                    
-                } catch (IOException ex) {
-                    Logger.getLogger(Tutorial1App.class.getName()).log(Level.SEVERE, null, ex);
-                }
-            }
-        });
-        showContextButton.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                setSelectedUri(selectedUriField.getText());
-            }
-        });
-        return navigation;
-    }
-
-    private Component createMainArea() {
-        //main area with triple-table
-        final TripleDataTableModel dataModel = new TripleDataTableModel();
-        addUriChangedListeners(dataModel);
-        addGraphChangedListeners(dataModel);
-        final JTable table = new JTable(dataModel);
-        table.setCellSelectionEnabled(true);
-        table.addMouseListener(new MouseAdapter() {
-
-            @Override
-            public void mouseClicked(MouseEvent e) {
-                int col = table.getSelectedColumn();
-                if (col == 1) {
-                    return;
-                }
-                int row = table.getSelectedRow();
-                final Object cellValue = dataModel.getValueAt(row, col);
-                if (cellValue instanceof UriRef) {
-                    setSelectedUri(((UriRef) cellValue).getUnicodeString());
-                }
-            }
-        });
-        JScrollPane scrollpane = new JScrollPane(table);
-        return scrollpane;
-    }
-
-    private Component createFooter() {
-        JPanel footer = new JPanel();
-        footer.add(new JLabel("Size of local ImmutableGraph: "));
-        final JLabel sizeLabel = new JLabel(Integer.toString(graph.size()));
-        addGraphChangedListeners(new GraphChangedListener() {
-
-            @Override
-            public void graphChanged() {
-                sizeLabel.setText(Integer.toString(graph.size()));
-            }
-        });
-        sizeLabel.setText(Integer.toString(graph.size()));
-        footer.add(sizeLabel);
-        return footer;
-    }
-
-    class TripleDataTableModel extends AbstractTableModel implements UriChangedListener, GraphChangedListener {
-
-        private final List<Triple> tripleList = new ArrayList<Triple>();
-
-        public TripleDataTableModel() {
-            tripleList.addAll(getCurrentContext());
-        }
-
-        public int getColumnCount() {
-            return 3;
-        }
-
-        public int getRowCount() {
-            return tripleList.size();
-        }
-
-        public Object getValueAt(int row, int col) {
-            Triple triple = tripleList.get(row);
-            switch (col) {
-                case 0:
-                    return triple.getSubject();
-                case 1:
-                    return triple.getPredicate();
-                default:
-                    return triple.getObject();
-            }
-        }
-
-
-        @Override
-        public void uriChanged() {
-            tripleList.clear();
-            tripleList.addAll(getCurrentContext());
-            fireTableDataChanged();
-        }
-
-        @Override
-        public void graphChanged() {
-            tripleList.clear();
-            tripleList.addAll(getCurrentContext());
-            fireTableDataChanged();
-        }
-    }
-
-    public interface UriChangedListener {
-        void uriChanged();
-    }
-
-    public interface GraphChangedListener {
-        void graphChanged();
-    }
-}
diff --git a/rdf/core/src/site/resources/images/clerezza.png b/rdf/core/src/site/resources/images/clerezza.png
deleted file mode 100644
index cb0efb0..0000000
Binary files a/rdf/core/src/site/resources/images/clerezza.png and /dev/null differ
diff --git a/rdf/core/src/site/site.xml b/rdf/core/src/site/site.xml
deleted file mode 100644
index 3b68681..0000000
--- a/rdf/core/src/site/site.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-/*
- * 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.
- */
--->
-
-<project>
-    <body>
-        <menu name="Documentation">
-            <item name="SCB Overview" href="documentation/overview.xhtml"/>
-            <item name="Tutorial 1" href="documentation/tutorial_1.xhtml"/> 
-            <item name="Tutorial 2" href="documentation/scb-triaxrs-tutorial.xhtml"/>
-        </menu>
-    </body>
-</project>
diff --git a/rdf/core/src/site/xsite/content/overview.xhtml b/rdf/core/src/site/xsite/content/overview.xhtml
deleted file mode 100644
index 74da552..0000000
--- a/rdf/core/src/site/xsite/content/overview.xhtml
+++ /dev/null
@@ -1,216 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * 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.
- */
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
-	<head>
-		<title>Smart Content Binding: An Overview</title>
-	</head>
-	<body>
-		<h1>Smart Content Binding: An Overview</h1>
-		<p>Author: Hasan - clerezza.org</p>
-		<p>Date: November 10, 2008</p>
-		<p>Contributor: Reto Bachmann-Gmür - clerezza.org</p>
-		<h2>Introduction</h2>
-		<p>
-			Smart Content Binding (SCB) is an open source framework developed by
-			clerezza.org aiming primarily at providing a java implementation of the
-			ImmutableGraph data model specified by W3C RDF [<a href="#ref1">1</a>] and
-			functionalities to operate on that data model. SCB offers a service
-			interface to access multiple named graphs and it can use various
-			providers to manage RDF graphs in a technology specific manner, e.g.,
-			using Jena [<a href="#ref2">2</a>] (TBD) or Sesame [<a href="#ref3">3</a>].
-			It also provides façades that allow an application to use Jena or Sesame (TBD)
-			APIs to process RDF graphs (note that the choice of a façade is independent of
-                        the chosen backend; you can for example use the Jena façade to write
-                        your code against the Jena API while using the Sesame provider to store
-                        your data in a Sesame store).
-			Furthermore, SCB offers a serialization and a parsing service to convert
-			a ImmutableGraph into a certain representation (format) and vice versa. In order
-			to support ontologies usage, SCB provides a tool to convert ontologies
-			defined in various formats including RDF/XML into Java classes.
-		</p>
-
-		<h2>Architecture</h2>
-		<p>
-			SCB comprises the following architectural components as depicted in Fig. 1:
-		</p>
-		<ul>
-			<li>Core</li>
-			<li>Façades</li>
-			<li>Utilities</li>
-			<li>Storage Providers</li>
-			<li>Parsing Providers</li>
-			<li>Serializing Providers</li>
-			<li>Ontologies Tool</li>
-		</ul>
-		<p>
-			<img src="images/scb_architecture.png" alt="SCB Architecture"/>
-			<br/><i>Figure 1: SCB Architecture</i>
-		</p>
-		<p>
-			The Core contains interface definitions of the RDF ImmutableGraph data model and its
-			implementation. The three main classes are <code>ImmutableGraph</code>, <code>Graph</code>,
-			and <code>Graph</code>. The class <code>ImmutableGraph</code> represents an
-			immutable RDF ImmutableGraph, as such its identity criterion is defined in terms of
-			ImmutableGraph-isomorphism. The class <code>Graph</code> represents a mutable RDF ImmutableGraph,
-			which enables triples to be added to or removed from a ImmutableGraph. The class
-			<code>Graph</code> is the super class of both the class <code>ImmutableGraph</code>
-			and <code>Graph</code>.
-			SCB Core provides three services: <code>TcManager</code> [<a href="#ref4">4</a>] allows access to
-			the various <code>Graph</code>s, <code>Parser</code> [<a href="#ref5">5</a>] and
-			<code>Serializer</code> [<a href="#ref6">6</a>] to allow reading and writing graphs from and to
-			various formats. In an OSGi environment these services are accessed using the
-			service registry or injected using OSGi Declarative Services. In a non OSGi environment
-			static factory methods are used to return an instance.
-			The <code>TcManager</code> delegates actual processing tasks to a specific Storage Provider
-			chosen from a set of Storage Providers based on their priority number (weight).
-			Storage Providers can be dynamically bound to or unbound from the Core.
-			The functionality required by the Parser and Serializer is delegated to registered
-			Parsing and Serializing Providers respectively, according to their capability
-			(supported formats). Later registered providers shadow previous ones for the same format.
-		</p>
-		<p>
-			The current implementation of SCB includes a Jena Façade. The Jena Façade allows an
-			application to use Jena API to manipulate a TC.
-		</p>
-		<p>
-			In order to ease operations on a resource in a TC, the Utilities component provides
-			a class with a set of useful methods, e.g., to delete all triples (statements) with
-			the resource as subject and a specified predicate.
-		</p>
-		<p>
-			Finally, the Ontologies Tool contains a standalone application called SchemaGen to
-			generate the Java source code with constants from an ontology description.
-		</p>
-		<h2>Artifacts</h2>
-		<p>
-			Each architectural component described above comprises one or more artifacts as
-			listed in Table 1.
-			<br/><br/><i>Table 1: Artifacts of each architectural components</i><br/>
-		</p>
-		<table border="1" cellpadding="4">
-			<tr>
-				<th>Architectural Component</th>
-				<th>Artifact</th>
-				<th>Artifact Type</th>
-			</tr>
-			<tr>
-				<td rowspan="2">Core</td>
-				<td>org.clerezza.rdf.core</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>org.clerezza.rdf.core.test</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>Façades</td>
-				<td>org.clerezza.rdf.jena.facade</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>Utilities</td>
-				<td>org.clerezza.rdf.utils</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td rowspan="2">Storage Providers</td>
-				<td>org.clerezza.rdf.sesame.storage</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>org.clerezza.rdf.jena.storage</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>Parsing Providers</td>
-				<td>org.clerezza.rdf.jena.parser</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>Serializing Providers</td>
-				<td>org.clerezza.rdf.jena.serializer</td>
-				<td>Jar and OSGi bundle</td>
-			</tr>
-			<tr>
-				<td>Ontologies Tool</td>
-				<td>org.clerezza.rdf.tool.schemagen</td>
-				<td>Executable jar</td>
-			</tr>
-		</table>
-		<h2>Building SCB</h2>
-		<p>
-			If you want to build SCB from its sources, you need JDK version 1.6 to compile.
-			Maven version 2.0.9 has been used to build SCB.
-		</p>
-		<h2>Developing Applications using SCB</h2>
-		<p>
-			To develop an application on top of SCB, you need to have the Core and optionally
-			Utilities and Façades.
-		</p>
-		<h2>Deploying an Application Requiring SCB</h2>
-		<p>
-			To deploy an application which uses SCB, Java(TM) SE Runtime Environment 6 or
-			higher is needed. If the application does not use OSGi, then the SCB Core,
-			the jars required for compilation, as well as the needed implementations
-			(typically one provider for storage, serialization, and parsing) must be in
-			the classpath. If the application uses OSGi, these jars are loaded as bundles,
-			and to run in OSGi, Declarative Services must be enabled (see the documentation
-			of your OSGi container).
-		</p>
-		<p>
-			The use of SCB in an OSGi environment has been tested with Apache Felix [<a href="#ref7">7</a>]
-			and Eclipse Equinox [<a href="#ref8">8</a>].
-		</p>
-		<h2>Extending and Customizing SCB</h2>
-		<p>
-			Since SCB applies a Service Oriented Architecture approach, following components
-			can be easily extended: Storage Providers, Parsing Providers, and Serializing
-			Providers. Using OSGi, new bundles just need to implement the required service
-			interfaces. To be located outside an OSGi environment, they should also provide
-			files in "META-INF/services" for the services they expose. Consult the SCB JavaDoc
-			for more information [<a href="#ref9">9</a>].
-		</p>
-		<h2>References</h2>
-		<p id="ref1">[1] W3C: Resource Description Framework (RDF): Concepts and Abstract Syntax; 2004, <a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/</a>
-		</p>
-		<p id="ref2">[2] <a href="http://jena.sourceforge.net/">http://jena.sourceforge.net/</a>
-		</p>
-		<p id="ref3">[3] <a href="http://www.openrdf.org/">http://www.openrdf.org/</a>
-		</p>
-		<p id="ref4">[4] <a href="http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/index.html?org/clerezza/rdf/core/access/TcManager.html">
-			http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/index.html?org/clerezza/rdf/core/access/TcManager.html</a>
-		</p>
-		<p id="ref5">[5] <a href="http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/org/clerezza/rdf/core/serializedform/Parser.html">
-			http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/org/clerezza/rdf/core/serializedform/Parser.html</a>
-		</p>
-		<p id="ref6">[6] <a href="http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/org/clerezza/rdf/core/serializedform/Serializer.html">
-			http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/org/clerezza/rdf/core/serializedform/Serializer.html</a>
-		</p>
-		<p id="ref7">[7] <a href="http://felix.apache.org/site/index.html">http://felix.apache.org/site/index.html</a>
-		</p>
-		<p id="ref8">[8] <a href="http://www.eclipse.org/equinox/">http://www.eclipse.org/equinox/</a>
-		</p>
-		<p id="ref9">[9] <a href="http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/index.html">http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/index.html</a>
-		</p>
-	</body>
-</html>
\ No newline at end of file
diff --git a/rdf/core/src/site/xsite/content/scb-triaxrs-tutorial.xhtml b/rdf/core/src/site/xsite/content/scb-triaxrs-tutorial.xhtml
deleted file mode 100644
index 9389bad..0000000
--- a/rdf/core/src/site/xsite/content/scb-triaxrs-tutorial.xhtml
+++ /dev/null
@@ -1,384 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * 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.
- */
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
-	<head>
-		<title>Tutorial 2: Developing RDF backed RESTful applicationts</title>
-		<link rel="stylesheet" type="text/css" href="style/documentation.css"/>
-	</head>
-	<body>
-		<h1>Tutorial 2: Developing RDF backed RESTful applications</h1>
-		<p>Author: Reto Bachmann-Gmür and Tsuyoshi Ito - clerezza.org</p>
-		<p>Contributor: Hasan - clerezza.org</p>
-		<h2>Table of Contents</h2>
-		<p>
-			<a href="#introduction">1. Introduction</a>
-		</p>
-		<p>
-			<a href="#setting">2. Setting up the project</a>
-		</p>
-		<p>
-			<a href="#accessible">3. Creating an accessible service</a>
-		</p>
-		<p>
-			<a href="#build">4. Build</a>
-		</p>
-		<p>
-			<a href="#install">5. Installing the bundle</a>
-		</p>
-		<p>
-			<a href="#test">5. Test your bundle</a>
-		</p>
-		<p>
-			<a href="#references">6. References</a>
-		</p>
-		<h2 id="introduction">1. Introduction</h2>
-		<p>
-			REST [<a href="#ref1">1</a>] is a software architecture style
-			applicable to the World Wide Web. With the advent of the Semantic Web
-			this resource oriented design shows its strength. The web of documents
-			evolves seamlessly to a web of data and knowledge.
-		</p>
-		<p>
-			RESTful Web applications are designed based on a set of REST
-			principles. In this introductory tutorial you'll learn how to develop
-			a RESTful application that delivers human readable semantic content
-			which is stored in a triple store.
-		</p>
-		<p>
-			Therefore, you will learn about SCB [<a href="#ref2">2</a>] and Triaxrs
-			[<a href="#ref3">3</a>] and how to use them to develop an RDF-backed
-			RESTful Web application. The time it takes to go through this tutorial
-			is around 30 minutes.
-		</p>
-		<h2 id="setting">2. Setting up the project</h2>
-		<p>
-			Create a maven project with the following parent and dependencies
-			(see the Triaxrs Tutorial 1 (Developing a RESTful Web Application
-			for OSGi Runtime Environment) for more detail [<a href="#ref4">4</a>]):
-		</p>
-
-        <p>First configure the repositories as follows:</p>
-		<blockcode>
-&lt;repositories&gt;
-	 &lt;repository&gt;
-		 &lt;id&gt;clerezza-release&lt;/id&gt;
-		 &lt;name&gt;clerezza.org distribution repository&lt;/name&gt;
-		 &lt;url&gt;http://repo.trialox.org/release&lt;/url&gt;
-		 &lt;layout&gt;default&lt;/layout&gt;
-	 &lt;/repository&gt;
-	 &lt;repository&gt;
-		 &lt;id&gt;clerezza-snapshot&lt;/id&gt;
-		 &lt;name&gt;clerezza.org snapshot repository&lt;/name&gt;
-		 &lt;url&gt;http://repo.trialox.org/snapshot&lt;/url&gt;
-		 &lt;layout&gt;default&lt;/layout&gt;
-	 &lt;/repository&gt;
-&lt;/repositories&gt;
-		</blockcode>
-		<blockcode>
-&lt;parent&gt;
-	 &lt;artifactId&gt;org.clerezza.parent&lt;/artifactId&gt;
-	 &lt;groupId&gt;org.clerezza&lt;/groupId&gt;
-	 &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt; //check <a href="http://repo.trialox.org/release/org/clerezza/org.clerezza.parent/">here</a> for the newest release version or
-    <a href="http://repo.trialox.org/snapshot/org/clerezza/org.clerezza.parent/">here</a> for newest snapshot version&lt;/parent&gt; 		</blockcode>
-    <p>It in not necessary to define the <code>version</code> parameter of each dependency because they are specified in the parents pom file.</p>
-		<blockcode>
-&lt;dependency&gt;
- 	 &lt;groupId&gt;org.clerezza&lt;/groupId&gt;
- 	 &lt;artifactId&gt;org.clerezza.jaxrs.rdf.providers&lt;/artifactId&gt;
-&lt;/dependency&gt;
-&lt;dependency&gt;
-	 &lt;groupId&gt;org.clerezza&lt;/groupId&gt;
-	 &lt;artifactId&gt;org.clerezza.platform.typerendering.seedsnipe&lt;/artifactId&gt;
-&lt;/dependency&gt;
-&lt;dependency&gt;
-	 &lt;groupId&gt;org.clerezza&lt;/groupId&gt;
-	 &lt;artifactId&gt;org.clerezza.triaxrs&lt;/artifactId&gt;
-&lt;/dependency&gt;
-		</blockcode>
-		<p>Also set packaging to <code>bundle</code></p>
-		<p class="note">
-			By default the <code>maven-bundle-plugin</code> will export the
-			package named &lt;groupId>.&lt;artifactId> and its subpackages,
-			so the exposed components must be defined in a package named that way.
-			In our example we use <code>org.example.clerezza</code> as
-			groupId and <code>combined.tutorial</code> as artifactId.
-		</p>
-
-		<h2 id="accessible">3. Creating an accessible service</h2>
-		<p>
-			Like in the Triaxrs Tutorial 1 [<a href="#ref4">4</a>] we create a
-			JAX-RS class to get information about persons. To have some data to
-			play with, we will add an RDF file encoded in the Turtle format into
-			the resource tree of our project. Thus, we create the file
-			src/main/resources/org/example/clerezza/combined/tutorial/data.turtle
-			with the following content:</p>
-	<blockcode>
-@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;.
-
-[	a foaf:Person;
-    foaf:title "Mr";
-    foaf:name "John Doe";
-    foaf:mbox &lt;mailto:john@example.org&gt;;
-    foaf:topic_interest &lt;http://dbpedia.org/resource/Category:BBC_television_sitcoms&gt;;
-    foaf:nick "jo" ] .
-
-[	a foaf:Person;
-    foaf:title "Mrs";
-    foaf:name "Jane Bloggs";
-    foaf:mbox &lt;mailto:jane@example.org&gt;;
-    foaf:openid &lt;http://openid.example.org/jbloggs&gt; ] .
-		</blockcode>
-
-		<p>
-			The JAX-RS resource class mentioned above is called in this tutorial
-			<code>TutorialApp</code> and looks as follows:
-		</p>
-		<blockcode>
-package org.example.clerezza.combined.tutorial;
-
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-
-import org.osgi.service.component.ComponentContext;
-
-import org.clerezza.platform.typerendering.seedsnipe.SeedsnipeRenderlet;
-import org.clerezza.platform.typerendering.RenderletManager;
-import org.clerezza.rdf.ontologies.FOAF;
-import org.clerezza.rdf.utils.GraphNode;
-import org.clerezza.rdf.core.ImmutableGraph;
-import org.clerezza.rdf.core.Graph;
-import org.clerezza.rdf.core.NonLiteral;
-import org.clerezza.rdf.core.Triple;
-import org.clerezza.rdf.core.Graph;
-import org.clerezza.rdf.core.UriRef;
-import org.clerezza.rdf.core.access.NoSuchEntityException;
-import org.clerezza.rdf.core.access.TcManager;
-import org.clerezza.rdf.core.serializedform.Parser;
-
-/**
- * Get Persons by their email
- *
- * @scr.component
- * @scr.service interface="java.lang.Object"
- * @scr.property name="javax.ws.rs" type="Boolean" value="true"
- */
-
-@Path("/foaf")
-public class TutorialApp {
-
-	/**
-	 * @scr.reference
-	 */
-	TcManager tcManager;
-
-	/**
-	 * @scr.reference
-	 */
-	private RenderletManager renderletManager;
-
-	private UriRef graphName = new UriRef("http://localhost.mygraph");
-
-	@GET
-	@Path("find")
-	@Produces("application/rdf+xml")
-	public ImmutableGraph getPersonRdf(@QueryParam("mbox") String mboxString) {
-		Graph graph = tcManager.getMGraph(graphName);
-		NonLiteral person = getPersonByMbox(mboxString, graph);
-		return new GraphNode(person, graph).getNodeContext();
-	}
-
-	@GET
-	@Path("find")
-	@Produces("application/xhtml+xml")
-	public GraphNode getPersonHtml(@QueryParam("mbox") String mboxString) {
-		Graph graph = tcManager.getMGraph(graphName);
-		NonLiteral person = getPersonByMbox(mboxString, graph);
-		return new GraphNode(person, graph);
-	}
-
-	private NonLiteral getPersonByMbox(String mboxString, Graph graph) {
-		Iterator&lt;Triple&gt; iter = graph.filter(null, FOAF.mbox, new UriRef(mboxString));
-		NonLiteral person = null;
-		while(iter.hasNext()) {
-			person = iter.next().getSubject();
-		}
-		return person;
-	}
-
-	/**
-	 * The activate method is called when SCR activates the component configuration.
-	 * This method gets the system ImmutableGraph or create a new one if it doesn't exist.
-	 *
-	 * @param componentContext
-	 */
-	protected void activate(ComponentContext componentContext) {
-
-		URL templateURL = getClass().getResource("tutorial.xhtml");
-		try {
-			renderletManager.registerRenderlet(SeedsnipeRenderlet.class
-					.getName(), new UriRef(templateURL.toURI().toString()),
-					FOAF.Person, null, MediaType.APPLICATION_XHTML_XML_TYPE,
-					true);
-		} catch (URISyntaxException ex) {
-			throw new WebApplicationException(ex);
-		}
-		Graph tc;
-		try {
-			tcManager.getMGraph(graphName);
-		} catch (NoSuchEntityException nsee) {
-			tc = tcManager.createMGraph(graphName);
-			InputStream fin = null;
-			fin = getClass().getResourceAsStream("data.turtle");
-			Parser parser = Parser.getInstance();
-			tc.addAll(parser.parse(fin, "text/turtle"));
-		}
-	}
-}
-
-		</blockcode>
-		<p>
-			The resource class above provides two resource methods to process
-			GET requests specifying the path /foaf/find. The JAX-RS annotation
-			@Path on TutorialApp sets the path of the resource to “/foaf”,
-			while the JAX-RS annotation @Path on the resource methods
-			<code>getPersonRdf</code> and <code>getPersonHtml</code> defines
-			the subpath "find". Furthermore, the JAX-RS annotation @Produces
-			defines the list of media types that a Java type or a method
-			can produce. A media type corresponds with the representation of a
-			resource. In this tutorial <code>getPersonRdf</code> should produce
-			"application/rdf+xml", whereas <code>getPersonHtml</code> should
-			produce "application/xhtml+xml". Both methods accept a parameter,
-			whose value is obtained from the GET request parameter called mbox.
-			This is defined through the JAX-RS annotation @QueryParam.
-		</p>
-		<p>
-			A resource can have multiple representations. For example, a web page
-			can be represented as html, pdf, plain text, or other representations.
-			The HTTP defines a mechanism known as content negotiation to allow a
-			client (e.g., a web browser) to specify which representation it would
-			like to get from the server. Using JAX-RS we can define a
-			<code>MessageBodyWriter</code> which maps a Java type to a
-			representation. In this tutorial <code>getPersonRdf</code> returns
-			a ImmutableGraph, whereas <code>getPersonHtml</code> returns a GraphNode,
-			which represents a node in the context of a ImmutableGraph. The clerezza
-			platform provides for either resources ImmutableGraph and GraphNode a
-			corresponding <code>MessageBodyWriter</code>.
-		</p>
-		<p>
-			The clerezza platform's <code>TemplatingMessageBodyWriter</code>
-			produces a representation of the format "application/xhtml+xml"
-			from a <code>GraphNode</code>, whereas the <code>GraphWriter</code>
-			produces "application/rdf+xml" from a <code>ImmutableGraph</code>.
-			<code>GraphWriter</code> is implemented in the maven project
-			org.clerezza.jaxrs.rdf.providers.
-			The <code>TemplatingMessageBodyWriter</code> uses a templating engine
-			to render a <code>GraphNode</code> based on a predefined template file.
-			In order to allow a different <code>GraphNode</code> to be rendered
-			using a different template, each <code>GraphNode</code> and template
-			is bound to a specific RDF type.
-		</p>
-		<p>
-			For the purpose of registering a template, a
-			<code>RenderletManager</code> service is made available. In this tutorial,
-			a template (obtained from the file "tutorial.xhtml") is registered
-			for the RDF type FOAF.Person (http://xmlns.com/foaf/0.1/Person).
-			This is done in the <code>activate</code> method using the
-			<code>RenderletManager</code> service.
-		</p>
-		<p>
-			In the <code>activate</code> method we also use the <code>TcManager</code> to get
-			the <code>Graph</code> called "http://localhost.mygraph". If this
-			ImmutableGraph doesn't exist, a <code>NoSuchEntityException</code> is thrown.
-			In this latter case, we catch this exception and create an
-			<code>Graph</code>. Afterwards we add the triples from the file
-			mentioned above into the ImmutableGraph.
-		</p>
-
-		<p>
-			The following template renders a FOAF.Person. For easier readability
-			namespaces can be defined. Statements which should be interpreted by
-			the templating engine starts with the character <code>$</code>.
-			The templating language allows loops and conditions. More examples
-			are available on the project website of the templating engine
-			(<a href="http://clerezza.org/projects/org.clerezza.templating.seedsnipe/documentation/overview.xhtml" target="_blank" >http://clerezza.org/projects/org.clerezza.templating.seedsnipe/documentation/overview.xhtml</a>
-		</p>
-		<blockcode>
-&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
-&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
-&lt;head&gt;
-	${ns:foaf=http://xmlns.com/foaf/0.1/}
-	&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
-	&lt;title&gt;clerezza - Combined Tutorial&lt;/title&gt;
-&lt;/head&gt;
-&lt;body&gt;
-	&lt;h1&gt;clerezza - Combined Tutorial&lt;/h1&gt;
-	&lt;h2&gt;FOAF Person:&lt;/h2&gt;
-	&lt;div&gt;
-		&lt;p&gt;Name: ${foaf:title} ${foaf:name}&lt;/p&gt;
-		&lt;p&gt;Email: ${foaf:mbox}&lt;/p&gt;
-		${if foaf:nick}
-		&lt;p&gt;Nickname: ${foaf:nick}&lt;/p&gt;
-		${/if}
-		&lt;p&gt;Topic interests: &lt;br /&gt;
-		${loop}
-			${foaf:topic_interest}&lt;br /&gt;
-		${/loop}
-		&lt;/p&gt;
-	&lt;/div&gt;
-&lt;/body&gt;
-&lt;/html&gt;
-		</blockcode>
-		<h2 id="build">4. Build</h2>
-		<p>To build the package, execute the command:
-		</p>
-		<blockcode>
-		$ mvn package
-		</blockcode>
-
-		<h2 id="install">5. Installing the bundle in the Clerezza Platform</h2>
-		<p>
-			Download the latest clerezza platform launcher from
-			<a href="http://repo.trialox.org/snapshot/org/clerezza/org.clerezza.platform.launcher.sesame/" target="_blank" >
-			http://repo.trialox.org/snapshot/org/clerezza/org.clerezza.platform.launcher.sesame/</a> and start it.
-			Go to <a href="http://localhost:8080/user/admin/control-panel" target="_blank" >http://localhost:8080/user/admin/control-panel</a> (enter username: admin, password; admin) and upload your bundle.
-		</p>
-		<h2 id="test">Test your bundle</h2>
-		<p>Open the URL <a href="http://localhost:8080/foaf/find">http://localhost:8080/foaf/find</a> and add the URL parameter <code>mbox=mailto:john@example.org</code> to receive information about john</p>
-		<h2 id="references">References</h2>
-		<p id="ref1">[1] R.T. Fielding: Architectural Styles and the Design of Network-based Software Architectures; CHAPTER 5 Representational State Transfer (REST), 2000, <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm">http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm</a></p>
-		<p id="ref2">[2] Clerezza Smart Content Binding SCB <a href="http://clerezza.org/projects/org.clerezza.rdf.core/">http://clerezza.org/projects/org.clerezza.rdf.core/</a></p>
-		<p id="ref3">[3] Clerezza Triaxrs<a href="http://clerezza.org/projects/org.clerezza.triaxrs/">http://clerezza.org/projects/org.clerezza.triaxrs/</a></p>
-		<p id="ref4">[4] Clerezza Triaxrs Tutorial 1<a href="http://clerezza.org/projects/org.clerezza.triaxrs/documentation/tutorial_1.xhtml">http://clerezza.org/projects/org.clerezza.triaxrs/documentation/tutorial_1.xhtml</a></p>
-		<p><i>That's all folks for this time! <br/><!--You can send your feedback to: --></i></p>
-	</body>
-</html>
diff --git a/rdf/core/src/site/xsite/content/sitemap.xml b/rdf/core/src/site/xsite/content/sitemap.xml
deleted file mode 100644
index 300a1e1..0000000
--- a/rdf/core/src/site/xsite/content/sitemap.xml
+++ /dev/null
@@ -1,31 +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.
-
--->
-<sitemap>
-    <section>
-        <name>Overview</name>
-        <page>overview.xhtml</page>
-    </section>
-    <section>
-        <name>Tutorials</name>
-        <page>tutorial_1.xhtml</page>
-        <page>scb-triaxrs-tutorial.xhtml</page>
-    </section> 
-</sitemap>
diff --git a/rdf/core/src/site/xsite/content/tutorial_1.xhtml b/rdf/core/src/site/xsite/content/tutorial_1.xhtml
deleted file mode 100644
index d653d0c..0000000
--- a/rdf/core/src/site/xsite/content/tutorial_1.xhtml
+++ /dev/null
@@ -1,491 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * 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.
- */
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
-	<head>
-		<title>Tutorial 1: Exploring and aggregating RDF data with SCB</title>
-		<link rel="stylesheet" type="text/css" href="style/documentation.css"/>
-	</head>
-	<body>
-		<h1>Tutorial 1: Exploring and aggregating RDF data with SCB</h1>
-		<p>Author: Reto Bachmann-Gmür - clerezza.org</p>
-		<p>Contributor: Hasan - clerezza.org</p>
-		<p>Update : Florent - apache.org</p>
-		<p>Date: 2010-06-14</p>
-		<h2>Table of Contents</h2>
-		<p>
-			<a href="#objective">1. Objective</a>
-		</p>
-		<p>
-			<a href="#maven">2. Initializing a Maven Project</a>
-		</p>
-		<p>
-			<a href="#functionality">3. Creating a ImmutableGraph and loading Data</a>
-		</p>
-		<p>
-			<a href="#accessing">4. Accessing the Triples</a>
-		</p>
-		<p>
-			<a href="#context">5. Resource context</a>
-		</p>
-		<p>
-			<a href="#example">6. Putting it all together: the example app</a>
-		</p>
-		<p>
-			<a href="#further">7. Taking it further</a>
-		</p>
-		<p>
-			<a href="#references">8. References</a>
-		</p>
-		<h2 id="objective">1. Objective</h2>
-		<p>
-			In this tutorial you will learn how to use SCB to manage data modeled
-			as a ImmutableGraph based on the RDF [<a href="#ref1">1</a>] standard
-			maintained by W3C.
-		</p>
-		<p>
-			You'll learn how to get ImmutableGraph objects from serialized RDF data on
-			the web and how to access such a ImmutableGraph using the core SCB package
-			and the SCB utilities package.
-		</p>
-		<p>
-			Key advantages of SCB include the support of OSGi [<a href="#ref2">2</a>]
-			to allow for a better modularization of application and the support of
-			other triple store APIs through technology specific façades (adapters).
-			However, you will learn to know these key advantages in next tutorials. This
-			tutorial provides for a good foundation to work with and understand
-			the basic concept of SCB ImmutableGraph data model.
-		</p>
-		<p>
-			Our example will download data about BBC television sitcoms from
-			dbpedia into a local ImmutableGraph, display the context of a given resource
-			and download additional data from the web when the user requests it.
-			The	time it takes to go through this tutorial is approximately an hour. This
-			tutorial is intended for java developers, some familiarity with the
-			build tool maven [<a href="#ref3">3</a>] is an advantage.
-		</p>
-		<h2 id="maven">2. Setting up the Maven project</h2>
-		<p>
-			We use maven to build our project and to keep track of dependencies
-			in an IDE independent way. Maven will take care of downloading the
-			required dependencies from their respective repositories.
-		</p>
-		<h3 id="initialization">2.1. Initializing</h3>
-		<p>
-			First, a maven project with the groupId org.example.clerezza.scb
-			and the artifactId tutorial1 will be created by executing the
-			following command in a shell:
-		</p>
-		<!-- blockcode not yet supported in XHTML 1.1, squatting from XHTML 2.0 -->
-		<blockcode>
-$ mvn archetype:generate --batch-mode \
--DarchetypeGroupId=org.apache.maven.archetypes \
--DarchetypeArtifactId=maven-archetype-quickstart \
--DgroupId=org.example.clerezza.scb \
--DartifactId=tutorial1 \
--Dversion=1.0-SNAPSHOT \
--Dpackage=org.example.clerezza.scb.tutorial1
-		</blockcode>
-		<p>
-			If all goes well the output output of the command contains the
-			following:
-		</p>
-		<blockcode>
-------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO]
-------------------------------------------------------------------------
-		</blockcode>
-
-		<p>
-			A new directory called tutorial1 is created containing a source
-			directory src and a file called pom.xml used by maven to build the
-			project. A program file called App.java is created and placed under
-			the directory src/main/java/org/example/clerezza/scb/tutorial1/, we
-			will modify this Class to build our demo application, but before we
-			add the required dependencies to our pom.xml.
-		</p>
-
-		<h3 id="dependencies">2.2. Adding dependencies</h3>
-		<p>
-			As the required Clerezza artifacts are not yet in the maven default
-			repositories we need to add the respective repository locations to
-			our pom.xml (alternatively we could add them globally
-			to the maven settings.xml). Add the following as a child element of
-			<code>project</code> in your pom.xml:
-		</p>
-		<blockcode>
-
-  &lt;repositories>
-    &lt;repository>
-      &lt;id>apache&lt;/id>
-      &lt;name>apache repository&lt;/name>
-      &lt;snapshots>
-	&lt;updatePolicy>always&lt;/updatePolicy>
-	&lt;checksumPolicy>warn&lt;/checksumPolicy>
-      &lt;/snapshots>
-      &lt;url>http://repository.apache.org/content/groups/snapshots-group&lt;/url>
-      &lt;layout>default&lt;/layout>
-    &lt;/repository>
-  &lt;/repositories>
-		</blockcode>
-
-		<p>
-			Now we can add the dependencies to the <code>dependencies</code>
-			section that maven will download from the clerezza repositories.
-		</p>
-		<p>
-			The following are the compile-time dependencies (the default scope
-			for dependencies is <code>compile</code>). Beside
-			<code>org.clerezza.rdf.core</code> which provides the core scb bundles
-			we add <code>org.clerezza.rdf.utils</code> that contains handy utility
-			classes and <code>org.clerezza.rdf.ontologies</code> which contains
-			classes containing constants for the terms of popular ontologies.
-		</p>
-		<blockcode>
-&lt;dependency&gt;
-	&lt;groupId&gt;org.apache.clerezza&lt;/groupId&gt;
-	&lt;artifactId&gt;org.apache.clerezza.rdf.core&lt;/artifactId&gt;
-	&lt;version&gt;0.12-incubating-SNAPSHOT&lt;/version&gt;
-&lt;/dependency&gt;
-&lt;dependency&gt;
-	&lt;groupId&gt;org.apache.clerezza&lt;/groupId&gt;
-	&lt;artifactId&gt;org.apache.clerezza.rdf.utils&lt;/artifactId&gt;
-	&lt;version&gt;0.13-incubating-SNAPSHOT&lt;/version&gt;
-&lt;/dependency&gt;
-&lt;dependency&gt;
-	&lt;groupId&gt;org.apache.clerezza&lt;/groupId&gt;
-	&lt;artifactId&gt;org.apache.clerezza.rdf.ontologies&lt;/artifactId&gt;
-	&lt;version&gt;0.11-incubating-SNAPSHOT&lt;/version&gt;
-&lt;/dependency&gt;
-		</blockcode>
-
-		<p class="note">
-			The set version numbers were the latest at time of writing to
-			find the latest release or snapshot version check
-			https://repository.apache.org/content/repositories/releases/
-			respectively https://repository.apache.org/content/repositories/snapshots/.
-		</p>
-
-		<p>
-			The above dependencies will be sufficient to compile our application,
-			to run the application. However as SCB provides mainly interfaces
-			to exchangeable implementations we should add some runtime dependencies:
-		</p>
-		<!-- NOTE : think this comment is not still valid
-		     <div class="note">
-			At the time of writing this a bug in the maven exec-plugin prevents us
-			from declaring these dependencies as what they actually are, so
-			the runtime scope is commented out.
-		</div>-->
-		<blockcode>
-&lt;dependency>
-	&lt;groupId>org.apache.clerezza&lt;/groupId>
-	&lt;artifactId>org.apache.clerezza.rdf.jena.parser&lt;/artifactId>
-	&lt;version>0.10-incubating-SNAPSHOT&lt;/version>
-	&lt;scope>runtime&lt;/scope>
-&lt;/dependency>
-&lt;dependency>
-	&lt;groupId>org.apache.clerezza&lt;/groupId>
-	&lt;artifactId>org.apache.clerezza.rdf.jena.serializer&lt;/artifactId>
-	&lt;version>0.9-incubating-SNAPSHOT&lt;/version>
-	&lt;scope>runtime&lt;/scope>
-&lt;/dependency>
-&lt;dependency>
-	&lt;groupId>org.slf4j&lt;/groupId>
-	&lt;artifactId>slf4j-simple&lt;/artifactId>
-	&lt;version>1.5.5&lt;/version>
-	&lt;scope>runtime&lt;/scope>
-&lt;/dependency>
-&lt;dependency>
-	&lt;groupId>org.apache.clerezza&lt;/groupId>
-	&lt;artifactId>org.apache.clerezza.rdf.simple.storage&lt;/artifactId>
-	&lt;version>0.7-incubating-SNAPSHOT&lt;/version>
-	&lt;scope>runtime&lt;/scope>
-&lt;/dependency>
-		</blockcode>
-
-		<p>
-			The two dependencies are implementations of rdf parsers and
-			serializers for various formats. They are based on the Jena Framework
-			[<a href="#ref4">4</a>] but you don't have to care about this.
-		</p>
-
-		<p>
-			Almost forgot, maven defaults to some rather old java version, to fix
-			this we should add the following to configure the
-			<code>maven-compiler-plugin</code> to use java 6, the
-			<code>build</code> element is a child of <code>project</code>.
-		</p>
-		<blockcode>
-&lt;build>
-   &lt;pluginManagement>
-	&lt;plugins>
-		&lt;plugin>
-			&lt;groupId>org.apache.maven.plugins&lt;/groupId>
-			&lt;artifactId>maven-compiler-plugin&lt;/artifactId>
-                        &lt;version>2.0.2&lt;/version>
-			&lt;configuration>
-				&lt;source>1.6&lt;/source>
-				&lt;target>1.6&lt;/target>
-                                &lt;encoding>utf-8&lt;/encoding>
-			&lt;/configuration>
-		&lt;/plugin>
-	&lt;/plugins>
-  &lt;/pluginManagement>
-&lt;/build>
-		</blockcode>
-
-		<p>
-		  Try an "$mvn compile" command, build successful will apear.
-		</p> 
-
-		<p>
-		  Enough configuration, lets get our hands dirty and write some code.
-		</p>
-
-		<h2 id="functionality">3. Creating a ImmutableGraph and loading Data</h2>
-		<p>
-			In RDF, Graphs are collections of triples. Strictly speaking graphs
-			are immutable : if you add or remove a triple its a new ImmutableGraph. For
-			that SCB distinguishes between two types of
-			<code>Graph</code>s: <code>ImmutableGraph</code> and
-			<code>Graph</code> where 'M' stands for "mutable". The Graph
-			and ImmutableGraph interfaces both extend <code>Graph</code> which
-			apart from extending <code>java.util.Collection&lt;Triple&gt;</code>
-			provide a method <code>filter</code>
-			to query RDF triples according to filter parameters
-			specified: subject, predicate, and object.
-		</p>
-		<p>
-			The factory we need for getting <code>Graph</code>s
-			is <code>
-				<a href="http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/org/clerezza/rdf/core/access/TcManager.html">
-					TcManager
-				</a></code>, depending on the available
-			storage providers the returned instances may be backed on an efficient
-			triple store like Sesame, or if no provider is available a simple and
-			terribly inefficient HashSet based implementation is returned.
-		</p>
-		<p>
-			To store our accumulated knowledge around BBC television sitcoms
-			we create an <code>Graph</code> with the following code:
-		</p>
-		<blockcode>
-import org.apache.clerezza.rdf.core.*;
-import org.apache.clerezza.rdf.core.access.TcManager;
-
-...
-
-//get the singleton instance of TcManager
-final TcManager tcManager = TcManager.getInstance();
-//the arbitrary name we use for our mutable ImmutableGraph
-final UriRef mGraphName = new UriRef("http://tutorial.example.org/");
-//the m-ImmutableGraph into which we'll put the triples we collect
-final Graph graph = tcManager.createMGraph(mGraphName);
-		</blockcode>
-		<div class="note">
-			We don't repeat the skeleton code generated by the maven archetype
-			but trust the reader can add the statements above at a sensible
-			place in App.java.
-		</div>
-		<p>
-			The code creates an empty Graph with the name
-			&lt;http://tutorial.example.org/>. To verify that all went well
-			we can output the size of <code>graph</code> with the following:
-		</p>
-		<blockcode>
-System.out.println("Size of graph: "+graph.size());
-		</blockcode>
-		<p>
-			To compile and run the application using maven issue the following
-			command in the directory where the pom.xml is:
-		</p>
-		<blockcode>
-$ mvn compile exec:java -Dexec.mainClass=org.example.clerezza.scb.tutorial1.App
-		</blockcode>
-		<p>
-			The actual program output will be armored by the maven logging, you
-			may pass the -q argument, and you'll only see the actual output of our
-			program:
-		</p>
-		<blockcode>
-Size of graph: 0
-		</blockcode>
-		<p>
-			Boring emptiness, lets add the triples dbpedia has about
-			&lt;http://dbpedia.org/resource/Category:BBC_television_sitcoms>. First
-			use standard classes from the java.net package to dereference this
-			URI.
-		</p>
-		<blockcode>
-final URL url = new URL("http://dbpedia.org/resource/Category:BBC_television_sitcoms");
-final URLConnection con = url.openConnection();
-con.addRequestProperty("Accept", "application/rdf+xml");
-final InputStream inputStream = con.getInputStream();
-		</blockcode>
-		<div class="note">
-			The above code sets the "Accept"-Header of the HTTP-Request to
-			"application/rdf+xml" this tells the server that we can handle
-			responses in that format, for comparison the value of the
-			Accept-Header in the request of a browser might look like
-			"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".<br/>
-			The URI &lt;http://dbpedia.org/resource/Category:BBC_television_sitcoms>
-			represents the abstract notion (the category) of BBC television sitcoms
-			which is not something that can actually be passed over the wire,
-			the server will answer with "303 See Other" response pointing to a
-			document describing the category we originally requested, in our case
-			this is &lt;http://dbpedia.org/data/Category:BBC_television_sitcoms.rdf>
-			for a normal browser it would be
-			&lt;http://dbpedia.org/page/Category:BBC_television_sitcoms>. URLConnection
-			transparently handles this redirection so we don't have to care
-			about sending the second request to the server.
-		</div>
-		<p>
-			Now that we have an InputStream from which rdf/xml can be read we
-			use <code>org.apache.clerezza.rdf.core.serializedform.Parser</code> to
-			convert it to a ImmutableGraph:
-		</p>
-		<blockcode>
-//get the singleton instance of Parser
-final Parser parser = Parser.getInstance();
-ImmutableGraph deserializedGraph = parser.parse(inputStream, "application/rdf+xml");
-		</blockcode>
-		<p>
-			Using the <code>addAll</code> which Graph inherits from
-			<code>Collection&lt;triple></code> we can add the triples of the
-			retrieved ImmutableGraph to graph:
-		</p>
-		<blockcode>
-graph.addAll(deserializedGraph);
-		</blockcode>
-		<p>
-			Outputting the size of the ImmutableGraph now returns something else (the
-			number of triples will vary as dbpedia evolves):
-		</p>
-		<blockcode>
-Size of graph: 251
-		</blockcode>
-		<h2 id="accessing">4. Accessing the Triples</h2>
-		<p>
-			It's good to know that by loading data into our <code>Graph</code>
-			its size has increased, but actually we would like to get data
-			out of <code>graph</code>.  The easiest would be to just use
-			the Serializer to write the ImmutableGraph to standard output:
-		</p>
-		<blockcode>
-final Serializer serializer = Serializer.getInstance();
-serializer.serialize(System.out, graph, "text/turtle");
-		</blockcode>
-		<p>The above code serialized <code>graph</code> in the turtle format
-		to the standard output.  You may want to try "application/n-triples" and
-		"application/rdf+xml" to see the triples serialized in different ways.
-		</p>
-		<p>The typical way to get specific triples is to use the <code>filter</code>
-		method which <code>ImmutableGraph</code> and <code>Graph</code> inherit from
-		<code>Graph</code>. The following outputs the
-		<code>RDF:type</code> of the resource
-		&lt;http://dbpedia.org/resource/Category:BBC_television_sitcoms>:</p>
-		<blockcode>
-Iterator&lt;Triple> typeTriples = graph.filter(new UriRef("http://dbpedia.org/resource/Category:BBC_television_sitcoms"), RDF.type, null);
-while (typeTriples.hasNext()) {
-	System.out.println(typeTriples.next());
-}
-		</blockcode>
-		<p>Note the use of <code>RDF.type</code> a constant from the
-		org.clerezza.rdf.ontologies package and maven artifact, <code>null</code>
-		is used as a wild card, here in the object position</p>
-		<h2 id="context">5. Resource context</h2>
-		<p>Often we want to get a concise description of a resource, the context
-		of a resource. In terms of RDF this can be formalized "context" as the set of
-		statements in which the resource is either subject or object. If such a
-		statement contains a blank node its context is included as well
-		[<a href="#ref5">5</a>].</p>
-		<p>The context can easily be accessed by using the <code>GraphNode</code>
-		class in the org.apache.clerezza.rdf.utils package.</p>
-		<blockcode>
-public ImmutableGraph getCurrentContext() {
-	return new GraphNode(new UriRef(selectedUri), graph).getNodeContext();
-}
-		</blockcode>
-		<p>The method above returns the context of the resource of which
-		<code>selectedUri</code> contains the name.</p>
-		<h2 id="example">6. Putting it all together: the example app</h2>
-		<p>Putting what we learned together and adding a swing front-end:</p>
-		<p>The <a href="http://clerezza.org/projects/org.clerezza.rdf.core/documentation/tutorial1/pom.xml">pom.xml</a> should be equivalent to
-		what you already have if you followed this tutorial, the
-		<a href="http://clerezza.org/projects/org.clerezza.rdf.core/documentation/tutorial1/src/main/java/org/example/clerezza/scb/tutorial1/Tutorial1App.java">
-		java code</a> creates a swing frame with a table containing the context
-		of a selected resource. By default, when clicking on a named resource that
-		is the subject or object of a statement, the context of this resource is
-		shown. By clicking on the button "Load Context from Web" the resource
-		is dereferenced and the triples are added to the local store.</p>
-		<h2 id="further">7. Taking it further</h2>
-		<p>A trivially achievable improvement of the example application would
-		be to add persistent storage.</p>
-		<p>By adding the sesame persitent storage provider to the runtime classpath
-		of the application our <code>Graph</code> is stored in a sesame store
-		[<a href="#ref8">8</a>] (this obsolotes the dependency on
-		<code>org.apache.clerezza.rdf.sesame.storage</code>).
-		</p>
-		<blockcode>
-&lt;dependency>
-	&lt;groupId>org.apache.clerezza&lt;/groupId>
-	&lt;artifactId>org.apache.clerezza.rdf.sesame.storage&lt;/artifactId>
-	&lt;version>0.13-incubating-SNAPSHOT&lt;/version>
-	&lt;!-- &lt;scope>runtime&lt;/scope> -->
-&lt;/dependency>
-		</blockcode>
-		<p>After adding this dependency on the second launch of the application
-		we should get an exception complaining that the ImmutableGraph already exists, the
-		reason for this is that <code>TcManager</code> contains separate methods
-		to access an existing <code>Graph</code> and for creating a new one. The
-		following would solve the issue:</p>
-		<blockcode>
-try {
-	graph = tcManager.getMGraph(mGraphName);
-} catch (NoSuchEntityException e) {
-	graph = tcManager.createMGraph(mGraphName);
-}
-		</blockcode>
-		<p>If anything is unclear or you'd like to take it even further, ask
-		about it on our mailing list <a href="http://mail-archives.apache.org/mod_mbox/incubator-clerezza-dev/">
-		http://mail-archives.apache.org/mod_mbox/incubator-clerezza-dev/</a></p>
-		<h2 id="references">8. References</h2>
-		<p id="ref1">[1] W3C: Resource Description Framework (RDF): Concepts and Abstract Syntax; 2004,
-			<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/</a>
-		</p>
-		<p id="ref2">[2] OSGi, <a href="http://www.osgi.org/Main/HomePage">http://www.osgi.org/Main/HomePage</a></p>
-		<p id="ref3">[3] Maven, <a href="http://maven.apache.org/">http://maven.apache.org/</a></p>
-		<p id="ref4">[4] Jena Framework, <a href="http://jena.sourceforge.net/">http://jena.sourceforge.net/</a></p>
-		<p id="ref5">[5] The introduced concept of "context" is close to the
-		one of "RDF Molecules" [6] and Minimum Self contained Graphs [7]</p>
-		<p id="ref6">[6] Ding L.; Finin, T; Peng, Y; Pinheiro da
-		Silva, P; , McGuinness, D , "Tracking RDF ImmutableGraph Provenance using RDF
-		Molecules" , 2005, Proceedings of the Fourth International Semantic Web
-		Conference, November 2005</p>
-		<p id="ref7">[7] Tummarello G.,;Morbidoni C.; Puliti P; Piazza F.
-		"Signing individual fragments of an RDF ImmutableGraph" , 2005, World Wide Web
-		Conference 2005 Poster Track</p>
-		<p id="ref8">[8] Sesame, <a href="http://openrdf.com/">http://openrdf.com/</a></p>
-	</body>
-</html>
diff --git a/rdf/core/src/site/xsite/templates/skin.html b/rdf/core/src/site/xsite/templates/skin.html
deleted file mode 100644
index bb1b45d..0000000
--- a/rdf/core/src/site/xsite/templates/skin.html
+++ /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.
-
--->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <head>
-        <title>clerezza.org - ${title}</title>
-        <link rel="stylesheet" type="text/css" href="style/style.css"/>
-        ${head}
-    </head>
-    <body>
-
-        <div id="banner">
-            <a href="http://clerezza.org/">
-              <img id="logo" src="../images/clerezza.png" alt="clerezza.org"/>
-            </a><br />
-        </div>
-
-        <div id="center" class="${centerClass}">
-            <div id="content">
-                <!-- <h1 class="FirstChild">${title}</h1> -->
-                ${body}
-                <p>Copyright (c) 2008-2009 trialox.org (trialox AG, Switzerland)</p>
-                <br /><br />
-            </div>
-        </div>
-
-        <div class="SidePanel" id="left">
-            <#list sitemap.sections as section>
-                <div class="MenuGroup">
-                    <h1>${section.name}</h1>
-                    <ul>
-                        <#list section.entries as entry>
-                            <#if entry = page>
-                                <li class="currentLink">${entry.title}</li>
-                            <#else>
-                                <li><a href="${entry.href}">${entry.title}</a></li>
-                            </#if>
-                        </#list>
-                    </ul>
-                </div>
-            </#list>
-            <div class="MenuGroup">
-                  <h1>Project Site</h1>
-                  <ul>
-
-                              <li><a href="../index.html">Back to project site</a></li>
-                  </ul>
-              </div>
-        </div>
-
-  </body>
-</html>
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/SecurityTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/SecurityTest.java
deleted file mode 100644
index 36d8692..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/SecurityTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.io.FilePermission;
-import java.lang.reflect.ReflectPermission;
-import java.security.AccessControlException;
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
-import java.util.Collections;
-import java.util.PropertyPermission;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.providers.WeightedA;
-import org.apache.clerezza.rdf.core.access.providers.WeightedDummy;
-import org.apache.clerezza.rdf.core.access.security.TcPermission;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-
-/**
- *
- * @author reto
- */
-public class SecurityTest {
-    
-    public SecurityTest() {
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-        ////needed to unbind because this is injected with META-INF/services - file
-        TcManager.getInstance().unbindWeightedTcProvider(new WeightedA());
-        TcManager.getInstance().bindWeightedTcProvider(new WeightedDummy());
-        TcManager.getInstance().createGraph(new IRI("http://example.org/ImmutableGraph/alreadyexists"));
-        TcManager.getInstance().createGraph(new IRI("http://example.org/read/ImmutableGraph"));
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-    }
-
-    @Before
-    public void setUp() {
-        
-        Policy.setPolicy(new Policy() {
-
-            @Override
-            public PermissionCollection getPermissions(CodeSource codeSource) {
-                PermissionCollection result = new Permissions();
-                result.add(new TcPermission("http://example.org/permitted", "read"));
-                result.add(new TcPermission("http://example.org/ImmutableGraph/alreadyexists", "readwrite"));
-                result.add(new TcPermission("http://example.org/read/ImmutableGraph", "read"));
-                result.add(new TcPermission("http://example.org/area/allowed/*", "readwrite"));
-                result.add(new TcPermission("urn:x-localinstance:/graph-access.graph", "readwrite"));
-                //result.add(new AllPermission());
-                result.add(new RuntimePermission("*"));
-                result.add(new ReflectPermission("suppressAccessChecks"));
-                result.add(new PropertyPermission("*", "read"));
-                //(java.util.PropertyPermission line.separator read)
-                result.add(new FilePermission("/-", "read,write"));
-                return result;
-            }
-        });
-        System.setSecurityManager(new SecurityManager() {
-
-            @Override
-            public void checkPermission(Permission perm) {
-                //System.out.println("Checking "+perm);
-                super.checkPermission(perm);
-            }
-
-            @Override
-            public void checkPermission(Permission perm, Object context) {
-                //System.out.println("Checking "+perm);
-                super.checkPermission(perm, context);
-            }
-
-        });
-    }
-
-    @After
-    public void tearDown() {
-        System.setSecurityManager(null);
-    }
-
-
-    @Test(expected=NoSuchEntityException.class)
-    public void testAcessGraph() {        
-        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/permitted"));
-    }
-    
-    @Test(expected=AccessControlException.class)
-    public void testNoWildCard() {
-        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/permitted/subthing"));
-    }
-    
-    @Test(expected=NoSuchEntityException.class)
-    public void testAllowedArea() {
-        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/area/allowed/something"));
-    }
-    
-    @Test(expected=AccessControlException.class)
-    public void testAcessForbiddenGraph() {
-        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/forbidden"));
-    }
-
-    @Test(expected=NoSuchEntityException.class)
-    public void testCustomPermissions() {
-        IRI graphUri = new IRI("http://example.org/custom");
-        TcManager.getInstance().getTcAccessController().setRequiredReadPermissionStrings(graphUri,
-                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
-        //new FilePermission("/etc", "write").toString()));
-        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
-        System.out.print(ag.toString());
-        TcManager.getInstance().getMGraph(graphUri);
-    }
-
-    @Test(expected=AccessControlException.class)
-    public void testCustomPermissionsIncorrect() {
-        IRI graphUri = new IRI("http://example.org/custom");
-        TcManager.getInstance().getTcAccessController().setRequiredReadPermissionStrings(graphUri,
-                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
-        //new FilePermission("/etc", "write").toString()));
-        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
-        System.out.print(ag.toString());
-        TcManager.getInstance().createGraph(graphUri);
-    }
-
-    @Test
-    public void testCustomReadWritePermissions() {
-        IRI graphUri = new IRI("http://example.org/read-write-custom");
-        TcManager.getInstance().getTcAccessController().setRequiredReadWritePermissionStrings(graphUri,
-                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
-        //new FilePermission("/etc", "write").toString()));
-        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
-        System.out.print(ag.toString());
-        TcManager.getInstance().createGraph(graphUri);
-    }
-    
-    @Test(expected=EntityAlreadyExistsException.class)
-    public void testCreateMGraph() {
-        TcManager.getInstance().createGraph(new IRI("http://example.org/ImmutableGraph/alreadyexists"));
-    }
-    @Test(expected=AccessControlException.class)
-    public void testCreateMGraphWithoutWritePermission() {
-        TcManager.getInstance().createGraph(new IRI("http://example.org/read/ImmutableGraph"));
-    }
-    @Test(expected=ReadOnlyException.class)
-    public void testAddTripleToMGraph() {
-        Graph graph = TcManager.getInstance().getMGraph(new IRI("http://example.org/read/ImmutableGraph"));
-        Triple triple = new TripleImpl(new IRI("http://example.org/definition/isNonLiteral"), new IRI("http://example.org/definition/isTest"), new PlainLiteralImpl("test"));
-        graph.add(triple);
-    }
-}
\ No newline at end of file
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/TcManagerTest.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/TcManagerTest.java
deleted file mode 100644
index 181e36f..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/TcManagerTest.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access;
-
-import java.lang.reflect.Field;
-import java.util.Iterator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.providers.WeightedA;
-import org.apache.clerezza.rdf.core.access.providers.WeightedA1;
-import org.apache.clerezza.rdf.core.access.providers.WeightedAHeavy;
-import org.apache.clerezza.rdf.core.access.providers.WeightedBlight;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.sparql.NoQueryEngineException;
-import org.apache.clerezza.rdf.core.sparql.QueryEngine;
-import org.apache.clerezza.rdf.core.sparql.query.AskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-
-import static org.junit.Assert.*;
-
-/**
- * 
- * @author reto
- */
-public class TcManagerTest {
-
-	public static IRI uriRefAHeavy = new IRI("http://example.org/aHeavy");
-	public static IRI uriRefB = new IRI("http://example.org/b");;
-	public static final IRI uriRefA = new IRI("http://example.org/a");
-	public static final IRI uriRefA1 = new IRI("http://example.org/a1");
-	private TcManager graphAccess;
-	private QueryEngine queryEngine;
-	private final WeightedA weightedA = new WeightedA();
-	private final WeightedA1 weightedA1 = new WeightedA1();
-	private WeightedTcProvider weightedBlight = new WeightedBlight();
-
-	@Before
-	public void setUp() {
-		graphAccess = TcManager.getInstance();
-		graphAccess.bindWeightedTcProvider(weightedA);
-		graphAccess.bindWeightedTcProvider(weightedA1);
-		graphAccess.bindWeightedTcProvider(weightedBlight);
-
-		queryEngine = Mockito.mock(QueryEngine.class);
-	}
-
-	@After
-	public void tearDown() {
-		graphAccess = TcManager.getInstance();
-		graphAccess.unbindWeightedTcProvider(weightedA);
-		graphAccess.unbindWeightedTcProvider(weightedA1);
-		graphAccess.unbindWeightedTcProvider(weightedBlight);
-
-		queryEngine = null;
-	}
-
-	@Test
-	public void getGraphFromA() {
-		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
-		Iterator<Triple> iterator = graphA.iterator();
-		assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
-		assertFalse(iterator.hasNext());
-		Graph triplesA = graphAccess.getGraph(uriRefA);
-		iterator = triplesA.iterator();
-		assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
-		assertFalse(iterator.hasNext());
-	}
-
-	@Test
-	public void getGraphFromB() {
-		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefB);
-		Iterator<Triple> iterator = graphA.iterator();
-		assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-		assertFalse(iterator.hasNext());
-		Graph triplesA = graphAccess.getGraph(uriRefB);
-		iterator = triplesA.iterator();
-		assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-		assertFalse(iterator.hasNext());
-	}
-
-	@Test
-	public void getGraphFromAAfterUnbinding() {
-		graphAccess.unbindWeightedTcProvider(weightedA);
-		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
-		Iterator<Triple> iterator = graphA.iterator();
-		assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1),
-				iterator.next());
-		assertFalse(iterator.hasNext());
-		Graph triplesA = graphAccess.getGraph(uriRefA);
-		iterator = triplesA.iterator();
-		assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1),
-				iterator.next());
-		assertFalse(iterator.hasNext());
-	}
-
-	@Test
-	public void getGraphFromAWithHeavy() {
-		final WeightedAHeavy weightedAHeavy = new WeightedAHeavy();
-		graphAccess.bindWeightedTcProvider(weightedAHeavy);
-		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
-		Iterator<Triple> iterator = graphA.iterator();
-		assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy),
-				iterator.next());
-		assertFalse(iterator.hasNext());
-		Graph triplesA = graphAccess.getGraph(uriRefA);
-		iterator = triplesA.iterator();
-		assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy),
-				iterator.next());
-		assertFalse(iterator.hasNext());
-		graphAccess.unbindWeightedTcProvider(weightedAHeavy);
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithString() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess.executeSparqlQuery("", new SimpleMGraph());
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess.executeSparqlQuery((Query) null, new SimpleMGraph());
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithSelectQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess.executeSparqlQuery((SelectQuery) null, new SimpleMGraph());
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithAskQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess.executeSparqlQuery((AskQuery) null, new SimpleMGraph());
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithDescribeQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess
-				.executeSparqlQuery((DescribeQuery) null, new SimpleMGraph());
-	}
-
-	@Test(expected = NoQueryEngineException.class)
-	public void executeSparqlQueryNoEngineWithConstructQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(null);
-
-		// Execute
-		graphAccess.executeSparqlQuery((ConstructQuery) null,
-				new SimpleMGraph());
-	}
-
-	@Test
-	public void executeSparqlQueryWithEngineWithString() throws Exception {
-		// Prepare
-		injectQueryEngine(queryEngine);
-		Graph Graph = new SimpleMGraph();
-
-		// Execute
-		graphAccess.executeSparqlQuery("", Graph);
-
-		// Verify
-		Mockito.verify(queryEngine).execute(graphAccess, Graph, "");
-		Mockito.verify(queryEngine, Mockito.never()).execute(
-				(TcManager) Mockito.anyObject(),
-				(Graph) Mockito.anyObject(),
-				(Query) Mockito.anyObject());
-	}
-
-	@Test
-	public void executeSparqlQueryWithEngineWithSelectQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(queryEngine);
-		Graph Graph = new SimpleMGraph();
-		SelectQuery query = Mockito.mock(SelectQuery.class);
-
-		// Execute
-		graphAccess.executeSparqlQuery(query, Graph);
-
-		// Verify
-		Mockito.verify(queryEngine).execute(graphAccess, Graph,
-				(Query) query);
-		Mockito.verify(queryEngine, Mockito.never()).execute(
-				(TcManager) Mockito.anyObject(),
-				(Graph) Mockito.anyObject(), Mockito.anyString());
-	}
-
-	@Test
-	public void executeSparqlQueryWithEngineWithAskQuery() throws Exception {
-		// Prepare
-		injectQueryEngine(queryEngine);
-		Graph Graph = new SimpleMGraph();
-		AskQuery query = Mockito.mock(AskQuery.class);
-
-		Mockito.when(
-				queryEngine.execute((TcManager) Mockito.anyObject(),
-						(Graph) Mockito.anyObject(),
-						(Query) Mockito.anyObject())).thenReturn(Boolean.TRUE);
-
-		// Execute
-		graphAccess.executeSparqlQuery(query, Graph);
-
-		// Verify
-		Mockito.verify(queryEngine).execute(graphAccess, Graph,
-				(Query) query);
-		Mockito.verify(queryEngine, Mockito.never()).execute(
-				(TcManager) Mockito.anyObject(),
-				(Graph) Mockito.anyObject(), Mockito.anyString());
-	}
-
-	@Test
-	public void executeSparqlQueryWithEngineWithDescribeQuery()
-			throws Exception {
-		// Prepare
-		injectQueryEngine(queryEngine);
-		Graph Graph = new SimpleMGraph();
-		DescribeQuery query = Mockito.mock(DescribeQuery.class);
-
-		// Execute
-		graphAccess.executeSparqlQuery(query, Graph);
-
-		// Verify
-		Mockito.verify(queryEngine).execute(graphAccess, Graph,
-				(Query) query);
-		Mockito.verify(queryEngine, Mockito.never()).execute(
-				(TcManager) Mockito.anyObject(),
-				(Graph) Mockito.anyObject(), Mockito.anyString());
-	}
-
-	@Test
-	public void executeSparqlQueryWithEngineWithConstructQuery()
-			throws Exception {
-		// Prepare
-		injectQueryEngine(queryEngine);
-		Graph Graph = new SimpleMGraph();
-		ConstructQuery query = Mockito.mock(ConstructQuery.class);
-
-		// Execute
-		graphAccess.executeSparqlQuery(query, Graph);
-
-		// Verify
-		Mockito.verify(queryEngine).execute(graphAccess, Graph,
-				(Query) query);
-		Mockito.verify(queryEngine, Mockito.never()).execute(
-				(TcManager) Mockito.anyObject(),
-				(Graph) Mockito.anyObject(), Mockito.anyString());
-	}
-
-	// ------------------------------------------------------------------------
-	// Implementing QueryableTcProvider
-	// ------------------------------------------------------------------------
-
-	private void injectQueryEngine(QueryEngine engine)
-			throws NoSuchFieldException, IllegalAccessException {
-		Field queryEngineField = TcManager.class
-				.getDeclaredField("queryEngine");
-		queryEngineField.setAccessible(true);
-		queryEngineField.set(graphAccess, engine);
-	}
-}
\ No newline at end of file
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA.java
deleted file mode 100644
index 624a80d..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.providers;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.access.TcManagerTest;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-
-/**
- *
- * @author reto
- */
-public class WeightedA implements WeightedTcProvider {
-    private Set<IRI> mGraphList = new HashSet<IRI>();
-    @Override
-    public int getWeight() {
-        return 5;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        if (name.equals(TcManagerTest.uriRefA)) {
-            Graph mResult = new SimpleMGraph();
-            mResult.add(new TripleImpl(TcManagerTest.uriRefA, 
-                    TcManagerTest.uriRefA, TcManagerTest.uriRefA));
-            mGraphList.add(name);
-            return mResult.getImmutableGraph();
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name) throws NoSuchEntityException {
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name) throws NoSuchEntityException {
-        return getImmutableGraph(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public void deleteGraph(IRI name) throws NoSuchEntityException, 
-            EntityUndeletableException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> listGraphs() {
-        return Collections.singleton(TcManagerTest.uriRefA);
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        return mGraphList;
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        return listGraphs();
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA1.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA1.java
deleted file mode 100644
index 9053e02..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedA1.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.providers;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.access.TcManagerTest;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-
-/**
- * Same weight as WeightedA, but later in string-ordering
- *
- * @author reto
- */
-public class WeightedA1 implements WeightedTcProvider {
-    private Set<IRI> mGraphList = new HashSet<IRI>();
-    @Override
-    public int getWeight() {
-        return 5;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        if (name.equals(TcManagerTest.uriRefA)) {
-            Graph mResult = new SimpleMGraph();
-            mResult.add(new TripleImpl(TcManagerTest.uriRefA1, 
-                    TcManagerTest.uriRefA1, TcManagerTest.uriRefA1));
-            mGraphList.add(name);
-            return mResult.getImmutableGraph();
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name) throws NoSuchEntityException {
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name) throws NoSuchEntityException {
-        return getImmutableGraph(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public void deleteGraph(IRI name) throws NoSuchEntityException, 
-            EntityUndeletableException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        return mGraphList;
-    }
-
-    @Override
-    public Set<IRI> listGraphs() {
-        return listMGraphs();
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedAHeavy.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedAHeavy.java
deleted file mode 100644
index 7674ca6..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedAHeavy.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.providers;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.access.TcManagerTest;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-
-/**
- *
- * @author reto
- */
-public class WeightedAHeavy implements WeightedTcProvider {
-
-    @Override
-    public int getWeight() {
-        return 20;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        if (name.equals(TcManagerTest.uriRefA)) {
-            Graph mResult = new SimpleGraph();
-            mResult.add(new TripleImpl(TcManagerTest.uriRefAHeavy, 
-                    TcManagerTest.uriRefAHeavy, TcManagerTest.uriRefAHeavy));
-            return mResult.getImmutableGraph();
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name) throws NoSuchEntityException {
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name) throws NoSuchEntityException {
-        return getImmutableGraph(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public void deleteGraph(IRI name) throws NoSuchEntityException, 
-            EntityUndeletableException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-    @Override
-    public Set<IRI> listGraphs() {
-        return Collections.singleton(TcManagerTest.uriRefA);
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        return new HashSet<IRI>();
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        return listGraphs();
-    }
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedBlight.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedBlight.java
deleted file mode 100644
index 68ad4cf..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedBlight.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.access.providers;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.access.TcManagerTest;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-
-/**
- *
- * @author reto
- */
-public class WeightedBlight implements WeightedTcProvider {
-
-    @Override
-    public int getWeight() {
-        return 2;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
-        if (name.equals(TcManagerTest.uriRefB)) {
-            Graph mResult = new SimpleMGraph();
-            mResult.add(new TripleImpl(TcManagerTest.uriRefB, TcManagerTest.uriRefB, TcManagerTest.uriRefB));
-            return mResult.getImmutableGraph();
-        }
-        if (name.equals(TcManagerTest.uriRefA)) {
-            Graph mResult = new SimpleMGraph();
-            //empty ImmutableGraph
-            return mResult.getImmutableGraph();
-        }
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getMGraph(IRI name) throws NoSuchEntityException {
-        throw new NoSuchEntityException(name);
-    }
-
-    @Override
-    public Graph getGraph(IRI name) throws NoSuchEntityException {
-        return getImmutableGraph(name);
-    }
-
-    @Override
-    public Graph createGraph(IRI name) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public void deleteGraph(IRI name) throws NoSuchEntityException, 
-            EntityUndeletableException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> listImmutableGraphs() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    public Set<IRI> listMGraphs() {
-        return new HashSet<IRI>();
-    }
-
-    @Override
-    public Set<IRI> listGraphs() {
-        return listMGraphs();
-    }
-
-}
diff --git a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedDummy.java b/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedDummy.java
deleted file mode 100644
index 5d616fb..0000000
--- a/rdf/core/src/test/java/org/apache/clerezza/rdf/core/access/providers/WeightedDummy.java
+++ /dev/null
@@ -1,156 +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
- *
... 16754 lines suppressed ...


[clerezza] 21/45: CLEREZZA-1031: Copy PermissionParser used by TcAccessController from legacy bundle org.apache.clerezza.utils

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 036937761bae5fb3d9bf9bf458d0662b2f1be060
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 10 15:25:49 2019 +0100

    CLEREZZA-1031: Copy PermissionParser used by TcAccessController from legacy bundle org.apache.clerezza.utils
---
 dataset/pom.xml                                    |   5 -
 .../dataset/security/PermissionParser.java         | 186 +++++++++++++++++++++
 .../dataset/security/TcAccessController.java       |  26 ++-
 3 files changed, 198 insertions(+), 19 deletions(-)

diff --git a/dataset/pom.xml b/dataset/pom.xml
index 5225584..2042366 100644
--- a/dataset/pom.xml
+++ b/dataset/pom.xml
@@ -73,11 +73,6 @@
             <version>1.2.8</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>utils</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/security/PermissionParser.java b/dataset/src/main/java/org/apache/clerezza/dataset/security/PermissionParser.java
new file mode 100644
index 0000000..465ee03
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/security/PermissionParser.java
@@ -0,0 +1,186 @@
+/*
+ * 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.dataset.security;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.PushbackReader;
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.Permission;
+
+/**
+ * Provides a utility method to instantiate a permission given its string 
+ * representation as returned by <code>java security.Permission.toString</code>.
+ *
+ * @author reto
+ */
+public class PermissionParser {
+
+    final static Logger logger = LoggerFactory.getLogger(PermissionParser.class);
+
+    /**
+     * Parsers permissionDescription and instantiates the permission using
+     * the ClassLoader of this class.
+     *  
+     * @param permissionDescription
+     * @return
+     */
+    public static Permission getPermission(String permissionDescription) {
+        return getPermission(permissionDescription, PermissionParser.class.getClassLoader());
+    }
+
+    /**
+     * Parsers permissionDescription and instantiates the permission using
+     * classLoader.
+     *
+     * @param permissionDescription
+     * @param classLoader
+     * @return
+     */
+    public static Permission getPermission(String permissionDescription, ClassLoader classLoader) {
+        PermissionInfo permissionInfo = parse(permissionDescription);
+        try {
+            Class clazz = classLoader.loadClass(permissionInfo.className);
+            Constructor<?> constructor = clazz.getConstructor(
+                    String.class, String.class);
+            return (Permission) constructor.newInstance(
+                    permissionInfo.name, permissionInfo.actions);
+        } catch (InstantiationException ie) {
+            logger.warn("{}", ie);
+            throw new RuntimeException(ie);
+        } catch (ClassNotFoundException cnfe) {
+            logger.warn("{}", cnfe);
+            throw new RuntimeException(cnfe);
+        } catch (NoSuchMethodException nsme) {
+            logger.warn("{}", nsme);
+            throw new RuntimeException(nsme);
+        } catch (InvocationTargetException ite) {
+            logger.warn("{}", ite);
+            throw new RuntimeException(ite);
+        } catch (IllegalAccessException iae) {
+            logger.warn("{}", iae);
+            throw new RuntimeException(iae);
+        }
+    }
+
+    private static PermissionInfo parse(String permissionDescription) {
+        StringReader reader = new StringReader(permissionDescription);
+        try {
+            return parse(reader);
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static PermissionInfo parse(StringReader reader) throws IOException {
+        PermissionInfo result = new PermissionInfo();
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch == ' ') {
+                continue;
+            }
+            if (ch =='(') {
+                parseFromClassName(reader, result);
+                break;
+            } else {
+                throw new IllegalArgumentException("Permission description does not start with '('");
+            }
+        }
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch != ' ') {
+                throw new IllegalArgumentException("Unparsable characters after closing ')'");
+            }
+        }
+        return result;
+    }
+
+    private static void parseFromClassName(StringReader StringReader, PermissionInfo result) throws IOException {
+        PushbackReader reader = new PushbackReader(StringReader, 1);
+        result.className = readSection(reader);
+        result.name = readSection(reader);
+        result.actions = readSection(reader);
+        byte closingBracketsCount = 0;
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch == ' ')  {
+                continue;
+            }
+            if (ch == ')')  {
+                closingBracketsCount++;
+                if (closingBracketsCount > 1) {
+                    throw new IllegalArgumentException("more than 1 closing bracket");
+                }
+                continue;
+            }
+            else {
+                throw new IllegalArgumentException("illegal character at this position: "+ch);
+            }
+        }
+    }
+
+    private static String readSection(PushbackReader reader) throws IOException {
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch == ' ')  {
+                continue;
+            } else {
+                reader.unread(ch);
+                return readSectionWithNoHeadingSpace(reader);
+            }
+        }
+        return null;
+    }
+
+    private static String readSectionWithNoHeadingSpace(PushbackReader reader) throws IOException {
+        StringBuilder sectionWriter = new StringBuilder();
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch == '"')  {
+                if (sectionWriter.length() > 0) {
+                    throw new IllegalArgumentException("Quote at wrong position, characters before quote: "+sectionWriter.toString());
+                }
+                sectionWriter = null;
+                return readTillQuote(reader);
+            }
+            if (ch == ' ') {
+                return sectionWriter.toString();
+            }
+            if (ch  == ')') {
+                reader.unread(ch);
+                return sectionWriter.toString();
+            }
+            sectionWriter.append((char)ch);
+        }
+        throw new IllegalArgumentException("missing closing bracket (')')");
+    }
+
+    private static String readTillQuote(PushbackReader reader) throws IOException {
+        StringBuilder sectionWriter = new StringBuilder();
+        for (int ch = reader.read(); ch != -1; ch = reader.read()) {
+            if (ch == '"')  {
+                return sectionWriter.toString();
+            }
+            sectionWriter.append((char)ch);
+        }
+        throw new IllegalArgumentException("missing closing quote ('=')");
+    }
+
+    private static class PermissionInfo {
+        String className, name, actions;
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java
index 93b54ff..cba447e 100644
--- a/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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.
+ * 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.dataset.security;
 
@@ -23,7 +22,6 @@ import org.apache.clerezza.api.impl.TripleImpl;
 import org.apache.clerezza.api.impl.literal.LiteralFactory;
 import org.apache.clerezza.dataset.NoSuchEntityException;
 import org.apache.clerezza.dataset.TcManager;
-import org.apache.clerezza.utils.security.PermissionParser;
 
 import java.security.AccessControlException;
 import java.security.AccessController;


[clerezza] 27/45: CLEREZZA-1032: Add ontologies module to reactor's pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit e9a3fe5ad09eba055e7ec110d032d99425ef69f0
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 01:11:16 2019 +0100

    CLEREZZA-1032: Add ontologies module to reactor's pom.xml
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index 81f6d94..50ea9b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,6 +47,7 @@
         <module>sparql</module>
         <module>representation</module>
         <module>test.utils</module>
+        <module>ontologies</module>
         <module>dataset</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>


[clerezza] 16/45: CLEREZZA-1025: Update pom.xml in representation module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit fa9a8ba49002224ab1233dab311d7c66730b7d8e
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 3 18:50:30 2019 +0100

    CLEREZZA-1025: Update pom.xml in representation module
---
 representation/pom.xml | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/representation/pom.xml b/representation/pom.xml
index 274fc53..7101b66 100644
--- a/representation/pom.xml
+++ b/representation/pom.xml
@@ -1,16 +1,39 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
         <version>8-SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
+        <relativePath/>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>representation</artifactId>
+    <packaging>bundle</packaging>
+    <version>8-SNAPSHOT</version>
+    <name>Clerezza - Representation</name>
+    <description>This bundle provides for functionality to parse and serialize RDF Graphs</description>
 
     <dependencies>
         <dependency>


[clerezza] 01/45: Merged in clerezza-rdf-core

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 954f291614f83da1034a93692f5f282994fa1bf9
Author: Reto Gmür <me...@farewellutopia.com>
AuthorDate: Sat Dec 30 11:57:39 2017 +0000

    Merged in clerezza-rdf-core
---
 .gitignore                                         |   1 +
 LICENSE.txt                                        | 202 ++++++++
 NOTICE.txt                                         |   8 +
 README.md                                          |  72 +++
 alerts.txt                                         |   0
 api/pom.xml                                        |  65 +++
 api/src/main/assembly/bin.xml                      |  75 +++
 api/src/main/assembly/src.xml                      |  45 ++
 .../org/apache/clerezza/commons/rdf/BlankNode.java |  41 ++
 .../clerezza/commons/rdf/BlankNodeOrIRI.java       |  30 ++
 .../org/apache/clerezza/commons/rdf/Graph.java     |  88 ++++
 .../java/org/apache/clerezza/commons/rdf/IRI.java  |  83 ++++
 .../clerezza/commons/rdf/ImmutableGraph.java       |  55 +++
 .../org/apache/clerezza/commons/rdf/Language.java  |  63 +++
 .../org/apache/clerezza/commons/rdf/Literal.java   |  93 ++++
 .../org/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 ++
 .../clerezza/commons/rdf/event/FilterTriple.java   |  86 ++++
 .../clerezza/commons/rdf/event/GraphEvent.java     |  59 +++
 .../clerezza/commons/rdf/event/GraphListener.java  |  43 ++
 .../clerezza/commons/rdf/event/RemoveEvent.java    |  37 ++
 .../apache/clerezza/commons/rdf/package-info.java  |  21 +
 doap_rdf.rdf                                       |  40 ++
 impl.sparql/pom.xml                                | 123 +++++
 .../commons/rdf/impl/sparql/SparqlBNode.java       |  74 +++
 .../commons/rdf/impl/sparql/SparqlClient.java      |  79 ++++
 .../commons/rdf/impl/sparql/SparqlGraph.java       | 507 +++++++++++++++++++++
 .../rdf/impl/sparql/SparqlResultParser.java        | 225 +++++++++
 .../commons/rdf/impl/sparql/BNodeCircleTest.java   | 118 +++++
 .../commons/rdf/impl/sparql/BNodeTest.java         | 139 ++++++
 .../commons/rdf/impl/sparql/Dadmin2Test.java       |  94 ++++
 .../commons/rdf/impl/sparql/DadminTest.java        |  94 ++++
 .../commons/rdf/impl/sparql/SimilarBNodes.java     | 104 +++++
 .../commons/rdf/impl/sparql/SparqlClientTest.java  | 104 +++++
 .../commons/rdf/impl/sparql/SparqlGraphTest.java   | 113 +++++
 .../commons/rdf/impl/sparql/bnode-circle.ttl       |   7 +
 .../clerezza/commons/rdf/impl/sparql/dadmin.ttl    |   5 +
 .../clerezza/commons/rdf/impl/sparql/dadmin2.ttl   |  17 +
 .../clerezza/commons/rdf/impl/sparql/grounded.ttl  |  16 +
 .../commons/rdf/impl/sparql/similar-bnodes.ttl     |   8 +
 .../commons/rdf/impl/sparql/simple-bnode.ttl       |   7 +
 impl.utils/pom.xml                                 |  85 ++++
 .../commons/rdf/impl/utils/AbstractGraph.java      | 316 +++++++++++++
 .../rdf/impl/utils/AbstractImmutableGraph.java     | 112 +++++
 .../commons/rdf/impl/utils/AbstractLiteral.java    |  61 +++
 .../commons/rdf/impl/utils/DelayedNotificator.java | 113 +++++
 .../commons/rdf/impl/utils/LiteralImpl.java        |  82 ++++
 .../commons/rdf/impl/utils/LockingIterator.java    |  73 +++
 .../commons/rdf/impl/utils/PlainLiteralImpl.java   |  80 ++++
 .../commons/rdf/impl/utils/TripleImpl.java         | 100 ++++
 .../commons/rdf/impl/utils/TypedLiteralImpl.java   |  80 ++++
 .../rdf/impl/utils/WatchableGraphWrapper.java      | 289 ++++++++++++
 .../rdf/impl/utils/debug/ReadLockDebug.java        |  85 ++++
 .../utils/debug/ReentrantReadWriteLockTracker.java | 133 ++++++
 .../rdf/impl/utils/debug/WriteLockDebug.java       |  89 ++++
 .../rdf/impl/utils/graphmatching/GraphMatcher.java | 140 ++++++
 .../graphmatching/GraphNotIsomorphicException.java |  28 ++
 .../utils/graphmatching/GroupMappingIterator.java  | 102 +++++
 .../rdf/impl/utils/graphmatching/HashMatching.java | 268 +++++++++++
 .../impl/utils/graphmatching/MappingIterator.java  |  76 +++
 .../utils/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 +
 .../commons/rdf/impl/utils/simple/SimpleGraph.java | 218 +++++++++
 .../impl/utils/simple/SimpleImmutableGraph.java    |  79 ++++
 .../rdf/impl/utils/simple/SimpleMGraph.java        |  57 +++
 .../impl/utils/graphmatching/GraphMatcherTest.java | 211 +++++++++
 .../impl/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 +++
 pom.xml                                            | 246 ++--------
 81 files changed, 7379 insertions(+), 203 deletions(-)

diff --git a/.gitignore b/.gitignore
index 39dd015..b2a1ed9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ target/
 .classpath
 dependency-reduced-pom.xml
 release.properties
+.svn
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..66a6d0f
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,8 @@
+Apache Commons RDF
+Copyright 2001-2014 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed at
+https://github.com/commons-rdf/commons-rdf.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5e05c3d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,72 @@
+## Building
+
+Build using Apache Maven with
+
+    mvn install
+
+## Documentation
+
+You can build the documentation with:
+
+    mvn site
+
+## FAQ
+
+Some more advanced questions focused on showing the differences to other proposed APIs.
+
+### Can I add RdfTerms from one implementation to another?
+
+Yes, any compliant implementation of BlankNode, Iri or Literal as well as Triple
+can be added to any implemenation of Graph, as long the Graph supports adding triples. Implementation 
+may not require the nodes to be of a particular implementation of having been 
+created with a specific factory.
+
+### How does it work?
+
+Implementation might need to map instances of BlankNode to their internal 
+implementation. This should be done in a way that when there is no more reference
+to the BlankNode object (i.e. when the object can be garbage collected) the mapping
+to the internal implementation is removed from memory to. This can be achieved 
+by using a java.util.WeakHashMap
+
+### Do I get back the same object that I added?
+
+For instances of Iri or Literals you get back an object that result equal to the
+originally added object, i.e. an object with the same HashCode and of which the
+equals method return true when compared with the originally added object. Ther
+is no guarantee that the same instance will be returned.
+For instances of BlankNode the above in only guaranteed as long as the original 
+object is referenced. When the original object becomes eligible for garbage 
+collection the implementation may start returning a different (an not equal)
+object. In practice this means BlankNode objects cannot safely be serialized 
+(using Java serialization) or passed around via RMI.
+
+### Can an implementation remove redundant information from a Graph?
+
+Yes, as long as this doesn't affect any BlankNode instance that is currently 
+reachable (i.e. the Java object is in memory and is not eligible for garbage
+collection).
+
+For  example given the non-lean graph:
+
+    ex:a ex:p _:x .
+    _:y ex:p _:x .
+
+As long as there is no BlankNode instance referencing _:y the implementation can
+reduce the graph to:
+
+    ex:a ex:p _:x .
+
+removing the redundancy. If however there is a reachable BlankNode instance for 
+_:y the implementation must not remove the redundancy as the code which has
+access to the object can go on adding a triple:
+
+    _:y ex:p2 ex:b .
+
+Thus creating a graph that doesn't contain any internal redundancy, namely:
+
+    ex:a ex:p _:x .
+    _:y ex:p _:x .
+    _:y ex:p2 ex:b .
+
+
diff --git a/alerts.txt b/alerts.txt
new file mode 100644
index 0000000..e69de29
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 0000000..a58ef72
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+        <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7</version>
+        <relativePath />
+     </parent>
+
+    <groupId>org.apache.clerezza.commons-rdf</groupId>
+    <artifactId>commons-rdf-api</artifactId>
+    <version>0.3-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza Commons RDF API</name>
+    <description>
+        Apache Clerezza Commons RDF provides an API modelling the RDF data model as defined by 
+        http://www.w3.org/TR/rdf11-concepts/
+    </description>
+    
+    <url>http://clerezza.apache.org/commons-rdf/</url>
+    
+    <issueManagement>
+        <system>jira</system>
+        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
+    </issueManagement>
+    
+    <inceptionYear>2015</inceptionYear>
+    <scm>
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+      <tag>HEAD</tag>
+  </scm>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/api/src/main/assembly/bin.xml b/api/src/main/assembly/bin.xml
new file mode 100644
index 0000000..3c114dd
--- /dev/null
+++ b/api/src/main/assembly/bin.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<assembly
+  xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>bin</id>
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <includes>
+                <include>README*</include>
+                <include>LICENSE*</include>
+                <include>NOTICE*</include>
+                <include>RELEASE-NOTES.txt</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>commons-net-${project.version}.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target/site/apidocs</directory>
+            <outputDirectory>apidocs</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <!-- Include sources jar for IDEs -->
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>commons-net-${project.version}-sources.jar</include>
+            </includes>
+        </fileSet>
+        <!-- Include examples as binary jar -->
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>commons-net-examples-${project.version}.jar</include>
+            </includes>
+        </fileSet>
+        <!-- Include example sources for developers -->
+        <fileSet>
+            <directory>src/main/java/examples</directory>
+            <outputDirectory>examples</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+</assembly>
diff --git a/api/src/main/assembly/src.xml b/api/src/main/assembly/src.xml
new file mode 100644
index 0000000..a5f8da1
--- /dev/null
+++ b/api/src/main/assembly/src.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<assembly
+  xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>src</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>zip</format>
+  </formats>
+  <baseDirectory>${artifactId}-${version}-src</baseDirectory>
+  <fileSets>
+    <fileSet>
+      <includes>
+        <include>README*</include>
+        <include>LICENSE*</include>
+        <include>NOTICE*</include>
+        <include>RELEASE-NOTES.txt</include>
+        <include>pom.xml</include>
+        <include>findbugs-exclude-filter.xml</include>
+        <include>checkstyle*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>src</directory>
+    </fileSet>
+  </fileSets>
+</assembly>
+
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..9952fce
--- /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.clerezza.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 {
+
+}
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..8d80b4b
--- /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.clerezza.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 {
+
+}
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..6904722
--- /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.clerezza.commons.rdf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.clerezza.commons.rdf.event.FilterTriple;
+import org.apache.clerezza.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();
+}
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..be9b3a8
--- /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.clerezza.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
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..bd94671
--- /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.clerezza.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
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..62a921e
--- /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.clerezza.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;
+    }
+}
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..0f96256
--- /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.clerezza.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();
+}
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..197a182
--- /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.clerezza.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 {
+
+}
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..67cdef0
--- /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.clerezza.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();
+
+}
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..4ed2cd4
--- /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.clerezza.commons.rdf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.clerezza.commons.rdf.event.FilterTriple;
+import org.apache.clerezza.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);
+  
+}
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..c2716d6
--- /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.clerezza.commons.rdf.event;
+
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.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);
+    }
+
+}
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..4e22df7
--- /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.clerezza.commons.rdf.event;
+
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.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;
+    }
+
+}
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..b9e6ec0
--- /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.clerezza.commons.rdf.event;
+
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.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;
+    }
+}
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..9041546
--- /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.clerezza.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);
+}
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..103febc
--- /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.clerezza.commons.rdf.event;
+
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.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);
+    }
+
+}
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..62354fe
--- /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.clerezza.commons.rdf;
\ No newline at end of file
diff --git a/doap_rdf.rdf b/doap_rdf.rdf
new file mode 100644
index 0000000..a7a5e17
--- /dev/null
+++ b/doap_rdf.rdf
@@ -0,0 +1,40 @@
+<?xml version="1.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.
+-->
+<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
+  <Project rdf:about="http://commons.apache.org/rdf/">
+    <name>Apache Commons RDF</name>
+    <homepage rdf:resource="http://commons.apache.org/rdf/"/>
+    <programming-language>Java</programming-language>
+    <category rdf:resource="http://projects.apache.org/category/library"/>
+    <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
+    <bug-database rdf:resource="https://issues.apache.org/jira/browse/RDF"/>
+    <download-page rdf:resource="http://commons.apache.org/rdf/download_net.cgi"/>
+    <asfext:pmc rdf:resource="http://commons.apache.org/"/>
+    <shortdesc xml:lang="en">Apache Commons Rdf</shortdesc>
+    <description xml:lang="en"/>
+    <repository>
+      <SVNRepository>
+        <browse rdf:resource="http://svn.apache.org/repos/asf/commons/proper/rdf/trunk"/>
+        <location rdf:resource="http://svn.apache.org/repos/asf/commons/proper/rdf"/>
+      </SVNRepository>
+    </repository>
+    <release>
+    </release>
+    <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
+  </Project>
+</rdf:RDF>
diff --git a/impl.sparql/pom.xml b/impl.sparql/pom.xml
new file mode 100644
index 0000000..dcf81fc
--- /dev/null
+++ b/impl.sparql/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7</version>
+        <relativePath />
+    </parent>
+
+    <groupId>org.apache.clerezza.commons-rdf</groupId>
+    <artifactId>commons-rdf-impl-sparql</artifactId>
+    <version>0.3-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza Commons RDF SPARQL backed implementation.</name>
+    <description>An implementation of the rdf commons API backed by a sparql 
+        endpoint. STATUS: Current code only supports reading 
+        graphs.</description>
+        
+    <url>http://clerezza.apache.org/commons-rdf/</url>
+    
+    <issueManagement>
+        <system>jira</system>
+        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
+    </issueManagement>
+    
+    <inceptionYear>2015</inceptionYear>
+    <scm>
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+      <tag>HEAD</tag>
+  </scm>
+    
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <commons.encoding>UTF-8</commons.encoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.commons.rdf.impl.sparql</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza.commons-rdf</groupId>
+            <artifactId>commons-rdf-api</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza.commons-rdf</groupId>
+            <artifactId>commons-rdf-impl-utils</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jena</groupId>
+            <artifactId>jena-fuseki</artifactId>
+            <version>1.1.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.parser</artifactId>
+            <version>1.1.1</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.serializer</artifactId>
+            <version>1.1.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>    
+</project>
\ No newline at end of file
diff --git a/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlBNode.java b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlBNode.java
new file mode 100644
index 0000000..9035b0a
--- /dev/null
+++ b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlBNode.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import java.util.Collection;
+import java.util.Objects;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+
+/**
+ *
+ * @author developer
+ */
+class SparqlBNode extends BlankNode {
+    
+    final static IRI internalBNodeId = new IRI("urn:x-internalid:fdmpoihdfw");
+    
+    final ImmutableGraph context;
+    private final int isoDistinguisher;
+
+    SparqlBNode(BlankNode node, Collection<Triple> context, int isoDistinguisher) {
+        this.isoDistinguisher = isoDistinguisher;
+        final SimpleGraph contextBuider = new SimpleGraph();
+        for (Triple triple : context) {
+            BlankNodeOrIRI subject = triple.getSubject();
+            RDFTerm object = triple.getObject();
+            contextBuider.add(new TripleImpl(subject.equals(node) ? internalBNodeId : subject, 
+                    triple.getPredicate(), 
+                    object.equals(node) ? internalBNodeId : object));
+        }
+        this.context = contextBuider.getImmutableGraph();
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7+isoDistinguisher;
+        hash = 61 * hash + Objects.hashCode(this.context);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final SparqlBNode other = (SparqlBNode) obj;
+        if (isoDistinguisher != other.isoDistinguisher) {
+            return false;
+        }
+        return Objects.equals(this.context, other.context);
+    }
+}
diff --git a/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClient.java b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClient.java
new file mode 100644
index 0000000..63b0086
--- /dev/null
+++ b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClient.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+
+/**
+ *
+ * @author developer
+ */
+public class SparqlClient {
+
+    final String endpoint;
+
+    public SparqlClient(final String endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    public List<Map<String, RDFTerm>> queryResultSet(final String query) throws IOException {
+        return (List<Map<String, RDFTerm>>) queryResult(query);
+    }
+    
+    public Object queryResult(final String query) throws IOException {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(endpoint);
+        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+        nvps.add(new BasicNameValuePair("query", query));
+        httpPost.setEntity(new UrlEncodedFormEntity(nvps));
+        CloseableHttpResponse response2 = httpclient.execute(httpPost);
+        HttpEntity entity2 = response2.getEntity();
+        try {
+            InputStream in = entity2.getContent();
+            final String mediaType = entity2.getContentType().getValue();
+            if (mediaType.startsWith("application/sparql-results+xml")) {
+                return SparqlResultParser.parse(in);
+            } else {
+                //assuming RDF response
+                //FIXME clerezza-core-rdf to clerezza dependency
+                Parser parser = Parser.getInstance();
+                return parser.parse(in, mediaType);
+            }
+        }  finally {
+            EntityUtils.consume(entity2);
+            response2.close();
+        }
+
+    }
+
+    
+
+}
diff --git a/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraph.java b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraph.java
new file mode 100644
index 0000000..28eb28e
--- /dev/null
+++ b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraph.java
@@ -0,0 +1,507 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.logging.Logger;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.AbstractGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+
+/**
+ *
+ * @author reto
+ */
+public class SparqlGraph extends AbstractGraph {
+
+    private static final int MAX_ISOMORPHIC_BNODES = 1000;
+    private static final Logger log = Logger.getLogger(SparqlGraph.class.getName());
+
+    final SparqlClient sparqlClient;
+
+    /**
+     * Constructs a Graph representing the default graph at the specified
+     * endpoint
+     */
+    public SparqlGraph(final String endpoint) {
+        sparqlClient = new SparqlClient(endpoint);
+    }
+
+    @Override
+    protected Iterator<Triple> performFilter(final BlankNodeOrIRI filterSubject,
+            final IRI filterPredicate, final RDFTerm filterObject) {
+        try {
+            String query = createQuery(filterSubject, filterPredicate, filterObject);
+            final List<Map<String, RDFTerm>> sparqlResults = sparqlClient.queryResultSet(query);
+            //first to triples without bnode-conversion
+            //rawTriples contains the triples with the BNodes from the result set
+            final Collection<Triple> rawTriples = new ArrayList<>();
+            for (Map<String, RDFTerm> result : sparqlResults) {
+                rawTriples.add(new TripleImpl(filterSubject != null ? filterSubject : (BlankNodeOrIRI) result.get("s"),
+                        filterPredicate != null ? filterPredicate : (IRI) result.get("p"),
+                        filterObject != null ? filterObject : result.get("o")));
+
+            }
+            //then bnode conversion
+            final Iterator<Triple> rawTriplesIter = rawTriples.iterator();
+            //this is basically just wokring around the lack of (named) nested functions
+            return (new Callable<Iterator<Triple>>() {
+
+                final Map<BlankNode, SparqlBNode> nodeMap = new HashMap<>();
+                final Set<ImmutableGraph> usedContext = new HashSet<>();
+
+                private RDFTerm useSparqlNode(RDFTerm node) throws IOException {
+                    if (node instanceof BlankNodeOrIRI) {
+                        return useSparqlNode((BlankNodeOrIRI) node);
+                    }
+                    return node;
+                }
+
+                private BlankNodeOrIRI useSparqlNode(BlankNodeOrIRI node) throws IOException {
+                    if (node instanceof BlankNode) {
+                        if (!nodeMap.containsKey(node)) {
+                            createBlankNodesForcontext((BlankNode) node);
+                        }
+                        if (!nodeMap.containsKey(node)) {
+                            throw new RuntimeException("no Bnode created");
+                        }
+                        return nodeMap.get(node);
+                    } else {
+                        return node;
+                    }
+                }
+
+                private void createBlankNodesForcontext(final BlankNode node) throws IOException {
+                    final Collection<Triple> context = getContext(node);
+                    final Set<BlankNode> rawNodes = new HashSet<>();
+                    for (Triple triple : context) {
+                        {
+                            final BlankNodeOrIRI subject = triple.getSubject();
+                            if (subject instanceof BlankNode) {
+                                rawNodes.add((BlankNode) subject);
+                            }
+                        }
+                        {
+                            final RDFTerm object = triple.getObject();
+                            if (object instanceof BlankNode) {
+                                rawNodes.add((BlankNode) object);
+                            }
+                        }
+                    }
+                    final Set<SparqlBNode> createdSparqlNodes = new HashSet<>();
+                    //final Map<BlankNode, SparqlBNode> preliminaryNodes = new HashMap<>();
+                    for (BlankNode rawNode : rawNodes) {
+                        for (int i = 0; i < MAX_ISOMORPHIC_BNODES; i++) {
+                            SparqlBNode sparqlBNode = new SparqlBNode(rawNode, context, i);
+                            if (!createdSparqlNodes.contains(sparqlBNode)) {
+                                nodeMap.put(rawNode, sparqlBNode);
+                                createdSparqlNodes.add(sparqlBNode);
+                                break;
+                            }
+                        }
+                    }
+                }
+
+                private ImmutableGraph getContext(final BlankNode node) throws IOException {
+                    //we need to get the cntext of the BNode
+                    //if the filter was for (null, null, null) we have the whole
+                    //bnode context in the reuslt set, otherwise we need to get 
+                    //more triples from the endpoint,
+                    //let's first handle the easy case
+                    if ((filterSubject == null) && (filterPredicate == null)
+                            && (filterObject == null)) {
+                        return getContextInRaw(node);
+                    } else {
+                        final ImmutableGraph startContext = getContextInRaw(node);
+                        final Set<ImmutableGraph> expandedContexts = expandContext(startContext);
+                        //expand bnode context
+                        //note that there might be different contexts for 
+                        //a bnode as present in the current result set
+                        //in this case we just haveto make sure we don't 
+                        //pick the same context for different bnodes in the resultset
+                        ImmutableGraph result = null;
+                        for (ImmutableGraph expandedContext : expandedContexts) {
+                            if (!usedContext.contains(expandedContext)) {
+                                result = expandedContext;
+                                break;
+                            }
+                        }
+                        if (result == null) {
+                            log.warning("he underlying sparql graph seems to contain redundant triples, this might cause unexpected results");
+                            result = expandedContexts.iterator().next();
+                        } else {
+                            usedContext.add(result);
+                        }
+                        return result;
+                    }
+
+                }
+
+                private ImmutableGraph getContextInRaw(BlankNode node) {
+                    final Graph contextBuilder = new SimpleGraph();
+                    for (Triple rawTriple : rawTriples) {
+                        BlankNodeOrIRI rawSubject = rawTriple.getSubject();
+                        RDFTerm rawObject = rawTriple.getObject();
+                        if (rawSubject.equals(node) || rawObject.equals(node)) {
+                            contextBuilder.add(rawTriple);
+                        }
+                    }
+                    return contextBuilder.getImmutableGraph();
+                }
+
+                @Override
+                public Iterator<Triple> call() throws Exception {
+                    return new Iterator<Triple>() {
+
+                        @Override
+                        public boolean hasNext() {
+                            return rawTriplesIter.hasNext();
+                        }
+
+                        @Override
+                        public Triple next() {
+                            try {
+                                Triple rawTriple = rawTriplesIter.next();
+                                return new TripleImpl(useSparqlNode(rawTriple.getSubject()),
+                                        rawTriple.getPredicate(),
+                                        useSparqlNode(rawTriple.getObject()));
+                            } catch (IOException ex) {
+                                throw new RuntimeException(ex);
+                            }
+                        }
+                    };
+                }
+
+                /**
+                 * returns all MSGs that are supergraphs of startContext
+                 *
+                 * @param startContext
+                 * @return
+                 */
+                private Set<ImmutableGraph> expandContext(Collection<Triple> startContext) throws IOException {
+
+                    final StringBuilder queryBuilder = new StringBuilder();
+                    queryBuilder.append("SELECT * WHERE {\n ");
+                    Map<BlankNode, String> bNodeVarNameMap = writeTriplePattern(queryBuilder, startContext);
+                    Set<BlankNode> bNodesInContext = bNodeVarNameMap.keySet();
+                    for (BlankNode bNode : bNodesInContext) {
+                        final String bNodeVarLabel = bNodeVarNameMap.get(bNode);
+                        //looking for outgoing properties of the bnode
+                        queryBuilder.append("OPTIONAL { ");
+                        queryBuilder.append('?');
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(' ');
+                        queryBuilder.append("?po");
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(" ?o");
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(" } .\n");
+                        //looking for incoming properties of the bnode
+                        queryBuilder.append("OPTIONAL { ");
+                        queryBuilder.append("?s");
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(' ');
+                        queryBuilder.append("?pi");
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(" ?");
+                        queryBuilder.append(bNodeVarLabel);
+                        queryBuilder.append(" } .\n");
+                    }
+                    queryBuilder.append(" }");
+                    final List<Map<String, RDFTerm>> expansionQueryResults = sparqlClient.queryResultSet(queryBuilder.toString());
+                    Set<ImmutableGraph> expandedContexts = new HashSet<>();
+                    //the query results may or may be from disjoint supergraphs
+                    //we expand them all as if they are different which may lead
+                    //us to the same MSG multiple times
+                    RESULTS:
+                    for (Map<String, RDFTerm> expansionQueryResult : expansionQueryResults) {
+                        Collection<Triple> expandedContext = new HashSet<>();
+                        Map<BlankNode, BlankNode> newBNodesToOldBNodes = new HashMap<>();
+                        for (BlankNode oldBNode : bNodesInContext) {
+                            final String bNodeVarLabel = bNodeVarNameMap.get(oldBNode);
+                            final RDFTerm newNode = expansionQueryResult.get(bNodeVarLabel);
+                            if (!(newNode instanceof BlankNode)) {
+                                //this subgraph is't a match
+                                continue RESULTS;
+                            }
+                            newBNodesToOldBNodes.put((BlankNode) newNode, oldBNode);
+                        }
+                        expandedContext.addAll(startContext);
+                        boolean newBNodeIntroduced = false;
+                        boolean newTripleAdded = false;
+                        for (BlankNode oldBNode : bNodesInContext) {
+                            final String bNodeVarLabel = bNodeVarNameMap.get(oldBNode);
+                            {
+                                final IRI newPredicate = (IRI) expansionQueryResult.get("po" + bNodeVarLabel);
+                                if (newPredicate != null) {
+                                    RDFTerm newObject = expansionQueryResult.get("o" + bNodeVarLabel);
+                                    if (newObject instanceof BlankNode) {
+                                        if (newBNodesToOldBNodes.containsKey(newObject)) {
+                                            //point back to BNode in startContext
+                                            newObject = newBNodesToOldBNodes.get(newObject);
+                                        } else {
+                                            newBNodeIntroduced = true;
+                                        }
+                                    }
+                                    if (expandedContext.add(new TripleImpl(oldBNode, newPredicate, newObject))) {
+                                        newTripleAdded = true;
+                                    }
+                                }
+                            }
+                            {
+                                final IRI newPredicate = (IRI) expansionQueryResult.get("pi" + bNodeVarLabel);
+                                if (newPredicate != null) {
+                                    RDFTerm newSubject = expansionQueryResult.get("s" + bNodeVarLabel);
+                                    if (newSubject instanceof BlankNode) {
+                                        if (newBNodesToOldBNodes.containsKey(newSubject)) {
+                                            //point back to BNode in startContext
+                                            newSubject = newBNodesToOldBNodes.get(newSubject);
+                                        } else {
+                                            newBNodeIntroduced = true;
+                                        }
+                                    }
+                                    if (expandedContext.add(new TripleImpl((BlankNodeOrIRI) newSubject, newPredicate, oldBNode))) {
+                                        newTripleAdded = true;
+                                    }
+                                }
+                            }
+                        }
+                        if (newBNodeIntroduced) {
+                            //we could be more efficient than this ans just expand the newly introduced bnodes
+                            expandedContexts.addAll(expandContext(expandedContext));
+                        } else {
+                            if (newTripleAdded) {
+                                //look for more results
+                                expandedContexts.addAll(expandContext(expandedContext));
+                                //continued iteration obsoleted by recursion
+                                break;
+                            }
+                        }
+
+                    }
+                    if (expandedContexts.isEmpty()) {
+                        expandedContexts.add(new SimpleGraph(startContext).getImmutableGraph());
+                    }
+                    return expandedContexts;
+                }
+
+            }).call();
+        } catch (AlienBNodeException e) {
+            return new Iterator<Triple>() {
+
+                @Override
+                public boolean hasNext() {
+                    return false;
+                }
+
+                @Override
+                public Triple next() {
+                    throw new NoSuchElementException();
+                }
+            };
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private String createQuery(final BlankNodeOrIRI filterSubject, final IRI filterPredicate, final RDFTerm filterObject) {
+        final StringBuilder selectBuilder = new StringBuilder();
+        selectBuilder.append("SELECT ");
+        final StringBuilder whereBuilder = new StringBuilder();
+        whereBuilder.append("WHERE { ");
+        if (filterSubject == null) {
+            whereBuilder.append("?s");
+            selectBuilder.append("?s ");
+        } else {
+            if (filterSubject instanceof SparqlBNode) {
+                whereBuilder.append("?sn");
+            } else {
+                whereBuilder.append(asSparqlTerm(filterSubject));
+            }
+        }
+        whereBuilder.append(' ');
+        if (filterPredicate == null) {
+            whereBuilder.append("?p");
+            selectBuilder.append("?p ");
+        } else {
+            whereBuilder.append(asSparqlTerm(filterPredicate));
+        }
+        whereBuilder.append(' ');
+        if (filterObject == null) {
+            whereBuilder.append("?o");
+            selectBuilder.append("?o ");
+        } else {
+            if (filterObject instanceof SparqlBNode) {
+                whereBuilder.append("?on");
+            } else {
+                whereBuilder.append(asSparqlTerm(filterObject));
+            }
+        }
+        whereBuilder.append(" .\n");
+        if (filterSubject instanceof SparqlBNode) {
+            //expand bnode context
+            writeTriplePattern(whereBuilder, ((SparqlBNode) filterSubject).context, "sn");
+        }
+        
+        if (filterObject instanceof SparqlBNode) {
+            //expand bnode context
+            writeTriplePattern(whereBuilder, ((SparqlBNode) filterObject).context, "on");
+        }
+
+        whereBuilder.append(" }");
+        return selectBuilder.append(whereBuilder).toString();
+    }
+
+    @Override
+    protected int performSize() {
+        try {
+            //TODO replace this with count
+            return sparqlClient.queryResultSet("SELECT * WHERE { ?s ?p ?o}").size();
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private String asSparqlTerm(IRI iri) {
+        return "<" + iri.getUnicodeString() + ">";
+    }
+
+    private String asSparqlTerm(Literal literal) {
+        //TODO langauge and datatype
+        return "\"" + literal.getLexicalForm().replace("\n", "\\n").replace("\"", "\\\"") + "\"";
+    }
+
+    private String asSparqlTerm(BlankNode bnode) {
+        if (!(bnode instanceof SparqlBNode)) {
+            throw new AlienBNodeException();
+        }
+        //this requires adding additional clauses to the graph pattern
+        throw new RuntimeException("SparqlBNodes should have been handled earlier");
+    }
+
+    private String asSparqlTerm(BlankNodeOrIRI term) {
+        if (term instanceof IRI) {
+            return asSparqlTerm((IRI) term);
+        } else {
+            return asSparqlTerm((BlankNode) term);
+        }
+    }
+
+    private String asSparqlTerm(RDFTerm term) {
+        if (term instanceof BlankNodeOrIRI) {
+            return asSparqlTerm((BlankNodeOrIRI) term);
+        } else {
+            return asSparqlTerm((Literal) term);
+        }
+    }
+
+
+    private Map<BlankNode, String> writeTriplePattern(StringBuilder queryBuilder, Collection<Triple> triples) {
+        return writeTriplePattern(queryBuilder, triples, null);
+    }
+        
+    private Map<BlankNode, String> writeTriplePattern(StringBuilder queryBuilder, Collection<Triple> triples, String varLabelForInternalBNodeId) {
+        final Collection<String> triplePatterns = new ArrayList<>();
+        int varCounter = 0;
+        final Map<BlankNode, String> bNodeVarNameMap = new HashMap<>();
+        for (Triple t : triples) {
+            final StringBuilder builder = new StringBuilder();
+            {
+                final BlankNodeOrIRI s = t.getSubject();
+                String varName;
+                if (s instanceof BlankNode) {
+                    if (bNodeVarNameMap.containsKey(s)) {
+                        varName = bNodeVarNameMap.get(s);
+                    } else {
+                        varName = "v" + (varCounter++);
+                        bNodeVarNameMap.put((BlankNode) s, varName);
+                    }
+                    builder.append('?');
+                    builder.append(varName);
+                } else {
+                    if (s.equals(SparqlBNode.internalBNodeId)) {
+                        builder.append('?');
+                        builder.append(varLabelForInternalBNodeId);
+                    } else {
+                        builder.append(asSparqlTerm(s));
+                    }
+                    
+                }
+            }
+            builder.append(' ');
+            builder.append(asSparqlTerm(t.getPredicate()));
+            builder.append(' ');
+            {
+                final RDFTerm o = t.getObject();
+                String varName;
+                if (o instanceof BlankNode) {
+                    if (bNodeVarNameMap.containsKey(o)) {
+                        varName = bNodeVarNameMap.get(o);
+                    } else {
+                        varName = "v" + (varCounter++);
+                        bNodeVarNameMap.put((BlankNode) o, varName);
+                    }
+                    builder.append('?');
+                    builder.append(varName);
+                } else {
+                    if (o.equals(SparqlBNode.internalBNodeId)) {
+                        builder.append('?');
+                        builder.append(varLabelForInternalBNodeId);
+                    } else {
+                        builder.append(asSparqlTerm(o));
+                    }
+                }
+            }
+            builder.append('.');
+            triplePatterns.add(builder.toString());
+
+        }
+        for (String triplePattern : triplePatterns) {
+
+            queryBuilder.append(triplePattern);
+            queryBuilder.append('\n');
+        }
+        return bNodeVarNameMap;
+
+    }
+
+    private static class AlienBNodeException extends RuntimeException {
+
+        public AlienBNodeException() {
+        }
+    }
+
+}
diff --git a/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlResultParser.java b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlResultParser.java
new file mode 100644
index 0000000..43d48f0
--- /dev/null
+++ b/impl.sparql/src/main/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlResultParser.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2016 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.impl.utils.AbstractLiteral;
+import org.apache.http.util.EntityUtils;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ *
+ * @author user
+ */
+public class SparqlResultParser {
+
+    static Object parse(InputStream in) throws IOException {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            final SparqlsResultsHandler sparqlsResultsHandler = new SparqlsResultsHandler();
+            xmlReader.setContentHandler(sparqlsResultsHandler);
+            xmlReader.parse(new InputSource(in));
+            return sparqlsResultsHandler.getResults();
+        } catch (ParserConfigurationException | SAXException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    final public static class SparqlsResultsHandler extends DefaultHandler {
+
+        private String currentBindingName;
+        private Map<String, RDFTerm> currentResult = null;
+        private Object results = null;
+        private boolean readingValue;
+        private String lang; //the xml:lang attribute of a literal
+        private StringWriter valueWriter;
+        private Map<String, BlankNode> bNodeMap = new HashMap<>();
+        private static final IRI XSD_STRING = new IRI("http://www.w3.org/2001/XMLSchema#string");
+        private static final IRI RDF_LANG_STRING = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
+
+        private RDFTerm getBNode(String value) {
+            if (!bNodeMap.containsKey(value)) {
+                bNodeMap.put(value, new BlankNode());
+            }
+            return bNodeMap.get(value);
+        }
+
+        private Object getResults() {
+            return results;
+        }
+
+        private List<Map<String, RDFTerm>> getResultValueMaps() {
+            return (List<Map<String, RDFTerm>>) results;
+        }
+
+        enum BindingType {
+
+            uri, bnode, literal;
+        }
+
+        @Override
+        public void startDocument() throws SAXException {
+
+        }
+
+        @Override
+        public void startElement(String namespaceURI,
+                String localName,
+                String qName,
+                Attributes atts)
+                throws SAXException {
+            if ("http://www.w3.org/2005/sparql-results#".equals(namespaceURI)) {
+                if ("boolean".equals(localName)) {
+                    if (results != null) {
+                        throw new SAXException("unexpected tag <boolean>");
+                    }
+                    //results will have Boolean value assigned once value is read
+                    readingValue = true;
+                    valueWriter = new StringWriter();
+                } else if ("results".equals(localName)) {
+                    if (results != null) {
+                        throw new SAXException("unexpected tag <result>");
+                    }
+                    results = new ArrayList<Map<String, RDFTerm>>();
+                } else if ("result".equals(localName)) {
+                    if (currentResult != null) {
+                        throw new SAXException("unexpected tag <result>");
+                    }
+                    currentResult = new HashMap<String, RDFTerm>();
+                } else if ("binding".equals(localName)) {
+                    if (currentResult == null) {
+                        throw new SAXException("unexpected tag <binding>");
+                    }
+                    currentBindingName = atts.getValue("name");
+                } else if ("uri".equals(localName) || "bnode".equals(localName) || "literal".equals(localName)) {
+                    if (readingValue) {
+                        throw new SAXException("unexpected tag <" + localName + ">");
+                    }
+                    lang = atts.getValue("http://www.w3.org/XML/1998/namespace", "lang");
+                    readingValue = true;
+                    valueWriter = new StringWriter();
+                }
+            }
+
+            //System.out.println(namespaceURI);
+            //System.out.println(qName);
+        }
+
+        @Override
+        public void characters(char[] chars, int start, int length) throws SAXException {
+            if (readingValue) {
+                valueWriter.write(chars, start, length);
+                //System.err.println(value + start + ", " + length);
+            }
+        }
+
+        @Override
+        public void endElement(String namespaceURI,
+                String localName,
+                String qName)
+                throws SAXException {
+            if ("http://www.w3.org/2005/sparql-results#".equals(namespaceURI)) {
+                if ("result".equals(localName)) {
+                    ((List<Map<String, RDFTerm>>) results).add(currentResult);
+                    currentResult = null;
+                } else if ("binding".equals(localName)) {
+                    if (currentBindingName == null) {
+                        throw new SAXException("unexpected tag </binding>");
+                    }
+                    currentBindingName = null;
+                } else if ("boolean".equals(localName)) {
+                    results = new Boolean(valueWriter.toString());
+                    valueWriter = null;
+                    readingValue = false;
+                } else {
+                    try {
+                        BindingType b = BindingType.valueOf(localName);
+                        RDFTerm rdfTerm = null;
+                        final Language language = lang == null ? null : new Language(lang);;
+                        switch (b) {
+                            case uri:
+                                rdfTerm = new IRI(valueWriter.toString());
+                                valueWriter = null;
+                                break;
+                            case bnode:
+                                rdfTerm = getBNode(valueWriter.toString());
+                                valueWriter = null;
+                                break;
+                            case literal:
+                                final String lf = valueWriter.toString();
+                                rdfTerm = new AbstractLiteral() {
+
+                                    @Override
+                                    public String getLexicalForm() {
+                                        return lf;
+                                    }
+
+                                    @Override
+                                    public IRI getDataType() {
+                                        if (language != null) {
+                                            return RDF_LANG_STRING;
+                                        }
+                                        //TODO implement
+                                        return XSD_STRING;
+                                    }
+
+                                    @Override
+                                    public Language getLanguage() {
+                                        return language;
+                                    }
+
+                                    @Override
+                                    public String toString() {
+                                        return "\"" + getLexicalForm() + "\"@" + getLanguage();
+                                    }
+                                };
+                                break;
+                        }
+                        currentResult.put(currentBindingName, rdfTerm);
+                        readingValue = false;
+                    } catch (IllegalArgumentException e) {
+                        //not uri|bnode|literal
+                    }
+                }
+            }
+        }
+
+        public void endDocument() throws SAXException {
+            //System.out.println("results: " + results.size());
+        }
+
+    }
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeCircleTest.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeCircleTest.java
new file mode 100644
index 0000000..3bf063d
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeCircleTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class BNodeCircleTest {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = BNodeCircleTest.class.getResourceAsStream("bnode-circle.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 2, graph.size());
+    }
+
+    
+    
+    @Test
+    public void nullFilter() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        final Iterator<Triple> iter = graph.filter(null, null, null);
+        Assert.assertTrue(iter.hasNext());
+        final Triple triple1 = iter.next();
+        final BlankNodeOrIRI subject = triple1.getSubject();
+        final RDFTerm object = triple1.getObject();
+        Assert.assertTrue(subject instanceof BlankNode);
+        Assert.assertTrue(object instanceof BlankNode);
+        Assert.assertNotEquals(subject, object);
+        Assert.assertTrue(iter.hasNext());
+    }
+    
+    @Test
+    public void foafKnowsFilter() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        
+        final IRI foafKnows = new IRI("http://xmlns.com/foaf/0.1/knows");
+
+        final Iterator<Triple> iter = graph.filter(null, foafKnows, null);
+        Assert.assertTrue(iter.hasNext());
+        final Triple triple1 = iter.next();
+        final BlankNodeOrIRI subject = triple1.getSubject();
+        final RDFTerm object = triple1.getObject();
+        Assert.assertTrue(subject instanceof BlankNode);
+        Assert.assertTrue(object instanceof BlankNode);
+        Assert.assertNotEquals(subject, object);
+        Assert.assertTrue(iter.hasNext());
+    }
+    
+
+    
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeTest.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeTest.java
new file mode 100644
index 0000000..168ef74
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/BNodeTest.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class BNodeTest {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = BNodeTest.class.getResourceAsStream("simple-bnode.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the expected size", 3, graph.size());
+    }
+
+    /* Filtering with a Bode that cannot be in graph
+    */
+    @Test
+    public void filterAlienBNode() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        
+        final BlankNode blankNode = new BlankNode();
+        final Iterator<Triple> iter = graph.filter(blankNode, null, null);
+        Assert.assertFalse(iter.hasNext());
+    }
+    
+    @Test
+    public void bNodeIdentity() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        
+        final IRI foafPerson = new IRI("http://xmlns.com/foaf/0.1/Person");
+        final IRI foafName = new IRI("http://xmlns.com/foaf/0.1/name");
+        final IRI foafKnows = new IRI("http://xmlns.com/foaf/0.1/knows");
+        final IRI rdfType = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+        final Iterator<Triple> iter = graph.filter(null, foafName, null);
+        Assert.assertTrue(iter.hasNext());
+        final BlankNodeOrIRI namedThing = iter.next().getSubject();
+        Assert.assertTrue(namedThing instanceof BlankNode);
+        
+        final Iterator<Triple> iter2 = graph.filter(null, rdfType, foafPerson);
+        Assert.assertTrue(iter2.hasNext());
+        final BlankNodeOrIRI person = iter2.next().getSubject();
+        Assert.assertTrue(person instanceof BlankNode);
+        Assert.assertEquals(namedThing, person);
+        
+        final Iterator<Triple> iter3 = graph.filter(null, foafKnows, null);
+        Assert.assertTrue(iter3.hasNext());
+        final RDFTerm knownThing = iter3.next().getObject();
+        Assert.assertTrue(knownThing instanceof BlankNode);
+        Assert.assertEquals(knownThing, person);
+        Assert.assertEquals(namedThing, knownThing);
+    }
+    
+    @Test
+    public void filter1() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        
+        final IRI foafPerson = new IRI("http://xmlns.com/foaf/0.1/Person");
+        final IRI foafName = new IRI("http://xmlns.com/foaf/0.1/name");
+        final IRI rdfType = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+        final Iterator<Triple> iter = graph.filter(null, foafName, null);
+        Assert.assertTrue(iter.hasNext());
+        final BlankNodeOrIRI person = iter.next().getSubject();
+        Assert.assertTrue(person instanceof BlankNode);
+        
+        final Iterator<Triple> iter2 = graph.filter(person, rdfType, null);
+        Assert.assertTrue(iter2.hasNext());
+    }
+    
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
new file mode 100644
index 0000000..5b954c6
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class Dadmin2Test {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = Dadmin2Test.class.getResourceAsStream("dadmin2.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 12, graph.size());
+    }
+
+    @Test
+    public void dump() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Serializer serializer = Serializer.getInstance();
+        serializer.serialize(System.out, graph, SupportedFormat.TURTLE);
+    }
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/DadminTest.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/DadminTest.java
new file mode 100644
index 0000000..d65a327
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/DadminTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class DadminTest {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = DadminTest.class.getResourceAsStream("dadmin.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 1, graph.size());
+    }
+
+    @Test
+    public void dump() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Serializer serializer = Serializer.getInstance();
+        serializer.serialize(System.out, graph, SupportedFormat.TURTLE);
+    }
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SimilarBNodes.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SimilarBNodes.java
new file mode 100644
index 0000000..975084f
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SimilarBNodes.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class SimilarBNodes {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = SimilarBNodes.class.getResourceAsStream("similar-bnodes.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 2, graph.size());
+    }
+
+    
+    
+    @Test
+    public void foafKnowsFilter() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        
+        final IRI foafKnows = new IRI("http://xmlns.com/foaf/0.1/knows");
+
+        final Iterator<Triple> iter = graph.filter(null, foafKnows, null);
+        Assert.assertTrue(iter.hasNext());
+        final Triple triple1 = iter.next();
+        final BlankNodeOrIRI subject1 = triple1.getSubject();
+        Assert.assertTrue(subject1 instanceof BlankNode);
+        Assert.assertTrue(iter.hasNext());
+        final Triple triple2 = iter.next();
+        final BlankNodeOrIRI subject2 = triple2.getSubject();
+        Assert.assertTrue(subject2 instanceof BlankNode);
+        Assert.assertNotEquals(subject1, subject2);
+    }
+    
+
+    
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
new file mode 100644
index 0000000..ff1d794
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class SparqlClientTest {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = SparqlClientTest.class.getResourceAsStream("grounded.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+    
+    @Test
+    public void select() throws IOException {
+        final SparqlClient sparqlClient = new SparqlClient(
+                "http://localhost:" + serverPort + "/ds/query");
+        List<Map<String, RDFTerm>> result = sparqlClient.queryResultSet(
+                "SELECT ?name WHERE { "
+                        + "<http://example.org/#spiderman> "
+                        + "<http://xmlns.com/foaf/0.1/name> ?name}");
+        Assert.assertEquals("There should be two names", 2, result.size());
+    }
+    
+    @Test
+    public void ask() throws IOException {
+        final SparqlClient sparqlClient = new SparqlClient(
+                "http://localhost:" + serverPort + "/ds/query");
+        Object result = sparqlClient.queryResult(
+                "ASK { "
+                        + "<http://example.org/#spiderman> "
+                        + "<http://xmlns.com/foaf/0.1/name> ?name}");
+        Assert.assertEquals("ASK should result to true", Boolean.TRUE, result);
+    }
+
+    @Test
+    public void desribe() throws IOException {
+        final SparqlClient sparqlClient = new SparqlClient(
+                "http://localhost:" + serverPort + "/ds/query");
+        Object result = sparqlClient.queryResult(
+                "DESCRIBE <http://example.org/#spiderman>");
+        Assert.assertTrue("DESCRIBE should return a graph", result instanceof Graph);
+    }
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraphTest.java b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraphTest.java
new file mode 100644
index 0000000..0461f3e
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlGraphTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class SparqlGraphTest {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = SparqlGraphTest.class.getResourceAsStream("grounded.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 8, graph.size());
+    }
+
+    @Test
+    public void filter1() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        final IRI spiderman = new IRI("http://example.org/#spiderman");
+        final IRI greenGoblin = new IRI("http://example.org/#green-goblin");
+        final IRI enemyOf = new IRI("http://www.perceive.net/schemas/relationship/enemyOf");
+        final IRI foafName = new IRI("http://xmlns.com/foaf/0.1/name");
+        {
+            final Iterator<Triple> iter = graph.filter(spiderman, null, greenGoblin);
+            Assert.assertTrue(iter.hasNext());
+            Assert.assertEquals(enemyOf, iter.next().getPredicate());
+            Assert.assertFalse(iter.hasNext());
+        }
+        {
+            final Iterator<Triple> iter = graph.filter(spiderman, foafName, null);
+            Set<Literal> names = new HashSet<>();
+            for (int i = 0; i < 2; i++) {
+                Assert.assertTrue(iter.hasNext());
+                RDFTerm name = iter.next().getObject();
+                Assert.assertTrue(name instanceof Literal);
+                names.add((Literal)name);
+            }
+            Assert.assertFalse(iter.hasNext());
+            Assert.assertTrue(names.contains(new PlainLiteralImpl("Spiderman")));
+            Assert.assertTrue(names.contains(new PlainLiteralImpl("Человек-паук", new Language("ru"))));
+        }
+    }
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/bnode-circle.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/bnode-circle.ttl
new file mode 100644
index 0000000..f03ab4d
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/bnode-circle.ttl
@@ -0,0 +1,7 @@
+@base <http://example.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+_:a foaf:knows _:b .
+_:b foaf:knows _:a .
\ No newline at end of file
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin.ttl
new file mode 100644
index 0000000..1213792
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin.ttl
@@ -0,0 +1,5 @@
+@prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ns1:	<http://schema.org/> .
+
+_:b10521
+	ns1:articleBody	"\n  <li><a href=\"http://data.admin.ch/datasets\" title=\"Available Data\">Data</a></li>\n  <li><a href=\"http://data.admin.ch/apps\" title=\"Applications\">Applications</a></li>\n  <li><a href=\"http://data.admin.ch/sparql\" title=\"SPARQL Endpoint\">SPARQL</a></li>\n  <li><a title=\"About the Portal\" href=\"http://data.admin.ch/about\">About the Portal</a></li>\n  <li><a title=\"Contact Us\" href=\"http://data.admin.ch/contact\">Contact</a></li>\n" .
\ No newline at end of file
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
new file mode 100644
index 0000000..df46a1a
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
@@ -0,0 +1,17 @@
+@prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ns1:	<http://data.admin.ch/> .
+@prefix ns2:	<http://schema.org/> .
+ns1:apps	rdf:type	ns2:WebPage ;
+	ns2:hasPart	_:b10511 .
+@prefix ns3:	<http://schema.zazuko.com/site/> .
+ns1:apps	ns3:hasIntro	_:b10510 ;
+	ns3:hasMenu	_:b10509 .
+_:b10509	rdf:type	ns3:Menu ;
+	ns2:articleBody	"\n  <li><a href=\"http://data.admin.ch/datasets\" title=\"Available Data\">Data</a></li>\n  <li><a href=\"http://data.admin.ch/apps\" title=\"Applications\">Applications</a></li>\n  <li><a href=\"http://data.admin.ch/sparql\" title=\"SPARQL Endpoint\">SPARQL</a></li>\n  <li><a title=\"About the Portal\" href=\"http://data.admin.ch/about\">About the Portal</a></li>\n  <li><a title=\"Contact Us\" href=\"http://data.admin.ch/contact\">Contact</a></li>\n" .
+_:b10510	rdf:type	ns3:Intro ;
+	ns2:articleBody	"\n<p><a href=\"http://data.admin.ch/map/\">Sample application</a> based on STATTAB-SDMX-01-2A01+2011 data. This visualization was made within the prototype phase in colaboration with <a href=\"http://www.ti.bfh.ch/\">Berner Fachhochschule</a>. There are currently no other STATPOP datasets available as RDF.</p>\n" ;
+	ns3:title	"Choropleth" .
+_:b10511	rdf:type	ns3:Footer ;
+	ns2:articleBody	"<p>Do you have questions about the Linked Data pilot portal? Contact us via our\n<a title=\"github\" href=\"https://github.com/zazuko/fso-lod\">Github page</a>.</p>" .
+@prefix xsd:	<http://www.w3.org/2001/XMLSchema#> .
+_:b10511	ns2:dateCreated	"2015-11-15+01:00"^^xsd:date .
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/grounded.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/grounded.ttl
new file mode 100644
index 0000000..ccc39c4
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/grounded.ttl
@@ -0,0 +1,16 @@
+@base <http://example.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix rel: <http://www.perceive.net/schemas/relationship/> .
+
+<#green-goblin>
+    rel:enemyOf <#spiderman> ;
+    a foaf:Person ;    # in the context of the Marvel universe
+    foaf:name "Green Goblin" ;
+    foaf:age 128 .
+
+<#spiderman>
+    rel:enemyOf <#green-goblin> ;
+    a foaf:Person ;
+    foaf:name "Spiderman", "Человек-паук"@ru .
\ No newline at end of file
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/similar-bnodes.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/similar-bnodes.ttl
new file mode 100644
index 0000000..16c1ceb
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/similar-bnodes.ttl
@@ -0,0 +1,8 @@
+@base <http://example.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+
+[] foaf:knows [ foaf:name "Alice"] .
+[] foaf:knows [ foaf:name "Bob" ] .
\ No newline at end of file
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/simple-bnode.ttl b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/simple-bnode.ttl
new file mode 100644
index 0000000..6bcf67f
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/simple-bnode.ttl
@@ -0,0 +1,7 @@
+@base <http://example.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://example.org/#me> foaf:knows [ a foaf:Person;
+  foaf:name "Alice Barker"].
\ No newline at end of file
diff --git a/impl.utils/pom.xml b/impl.utils/pom.xml
new file mode 100644
index 0000000..b217d7e
--- /dev/null
+++ b/impl.utils/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7</version>
+        <relativePath />
+    </parent>
+
+    <groupId>org.apache.clerezza.commons-rdf</groupId>
+    <artifactId>commons-rdf-impl-utils</artifactId>
+    <version>0.3-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza Commons RDF Implementation Utils</name>
+    <description>
+        Apache Commons RDF provides an API modelling the RDF data model as defined by 
+        http://www.w3.org/TR/rdf11-concepts/
+    </description>
+
+    <url>http://clerezza.apache.org/commons-rdf/</url>
+    
+    <issueManagement>
+        <system>jira</system>
+        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
+    </issueManagement>
+    
+    <inceptionYear>2015</inceptionYear>
+    <scm>
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+      <tag>HEAD</tag>
+  </scm>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.commons.rdf.impl.utils.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza.commons-rdf</groupId>
+            <artifactId>commons-rdf-api</artifactId>
+            <version>0.3-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
new file mode 100644
index 0000000..15efce6
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
@@ -0,0 +1,316 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.lang.ref.WeakReference;
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.WatchableGraph;
+import org.apache.clerezza.commons.rdf.event.AddEvent;
+import org.apache.clerezza.commons.rdf.event.FilterTriple;
+import org.apache.clerezza.commons.rdf.event.GraphEvent;
+import org.apache.clerezza.commons.rdf.event.GraphListener;
+import org.apache.clerezza.commons.rdf.event.RemoveEvent;
+import org.apache.clerezza.commons.rdf.impl.utils.debug.ReentrantReadWriteLockTracker;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
+
+/**
+ * An abstract implementation of <code>Graph</code> implementing
+ * <code>iterator</code> and <code>contains</code> calling <code>filter</code>.
+ *
+ * @author reto
+ */
+public abstract class AbstractGraph extends AbstractCollection<Triple>
+        implements Graph {
+
+    
+    private static final String DEBUG_MODE = "rdfLocksDebugging";
+    private final ReadWriteLock lock;
+
+    private final Lock readLock;
+    private final Lock writeLock;
+
+    /**
+     * Constructs a LocalbleMGraph for an Graph.
+     *
+     * @param providedMGraph a non-lockable graph
+     */
+    public AbstractGraph() {
+        {
+            String debugMode = System.getProperty(DEBUG_MODE);
+            if (debugMode != null && debugMode.toLowerCase().equals("true")) {
+                lock = new ReentrantReadWriteLockTracker();
+            } else {
+                lock = new ReentrantReadWriteLock();
+            }
+        }
+        readLock = lock.readLock();
+        writeLock = lock.writeLock();
+    }
+    
+    public AbstractGraph(final ReadWriteLock lock) {
+        this.lock = lock;
+        readLock = lock.readLock();
+        writeLock = lock.writeLock();
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return lock;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        readLock.lock();
+        try {
+            return performGetImmutableGraph();
+        } finally {
+            readLock.unlock();
+        }
+    }
+    
+    public ImmutableGraph performGetImmutableGraph() {
+        return new SimpleImmutableGraph(this);
+    }
+
+    @Override
+    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        readLock.lock();
+        try {
+            return new LockingIterator(performFilter(subject, predicate, object), lock);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public int size() {
+        readLock.lock();
+        try {
+            return performSize();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean isEmpty() {
+        readLock.lock();
+        try {
+            return performIsEmpty();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    @SuppressWarnings("element-type-mismatch")
+    public boolean contains(Object o) {
+        readLock.lock();
+        try {
+            return performContains(o);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public Iterator<Triple> iterator() {
+        readLock.lock();
+        try {
+            return new LockingIterator(performIterator(), lock);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public Object[] toArray() {
+        readLock.lock();
+        try {
+            return performToArray();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        readLock.lock();
+        try {
+            return performToArray(a);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        readLock.lock();
+        try {
+            return performContainsAll(c);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        writeLock.lock();
+        try {
+            return performAdd(e);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        writeLock.lock();
+        try {
+            return performRemove(o);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        writeLock.lock();
+        try {
+            return performAddAll(c);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        writeLock.lock();
+        try {
+            return performRemoveAll(c);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        writeLock.lock();
+        try {
+            return performRetainAll(c);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public void clear() {
+        writeLock.lock();
+        try {
+            performClear();
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    
+    @Override
+    public boolean equals(Object obj) {
+        /*if (obj == null) {
+            return false;
+        }
+        if (obj == this) {
+            return true;
+        }
+        if (obj.getClass() != getClass()) {
+            return false;
+        }*/
+        return this == obj;
+    }
+
+
+    protected abstract Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+
+    protected abstract int performSize();
+
+    protected boolean performIsEmpty() {
+        return super.isEmpty();
+    }
+
+    protected Object[] performToArray() {
+        return super.toArray();
+    }
+
+    protected boolean performRemove(Object o) {
+        return super.remove(o);
+    }
+
+    protected boolean performAddAll(Collection<? extends Triple> c) {
+        return super.addAll(c);
+    }
+
+    protected boolean performRemoveAll(Collection<?> c) {
+        return super.removeAll(c);
+    }
+
+    protected boolean performRetainAll(Collection<?> c) {
+        return super.retainAll(c);
+    }
+
+    protected void performClear() {
+        super.clear();
+    }
+
+    protected boolean performContains(Object o) {
+        return super.contains(o);
+    }
+
+    protected Iterator<Triple> performIterator() {
+        return performFilter(null, null, null);
+    }
+
+    protected boolean performContainsAll(Collection<?> c) {
+        return super.containsAll(c);
+    }
+
+    protected <T> T[] performToArray(T[] a) {
+        return super.toArray(a);
+    }
+
+    protected boolean performAdd(Triple e) {
+        return super.add(e);
+    }
+
+ 
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
new file mode 100644
index 0000000..e5644ed
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
@@ -0,0 +1,112 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.GraphMatcher;
+
+/**
+ * <code>AbstractGraph</code> is an abstract implementation of <code>ImmutableGraph</code> 
+ * implementing the <code>equals</code> and the <code>hashCode</code> methods.
+ * 
+ * @author reto
+ * 
+ */
+public abstract class AbstractImmutableGraph extends AbstractGraph
+        implements ImmutableGraph {
+
+    public final synchronized int hashCode() {
+        int result = 0;
+        for (Iterator<Triple> iter = iterator(); iter.hasNext();) {
+            result += getBlankNodeBlindHash(iter.next());
+        }
+        return result;
+    }
+
+    /**
+     * @param triple
+     * @return hash without BNode hashes
+     */
+    private int getBlankNodeBlindHash(Triple triple) {
+        int hash = triple.getPredicate().hashCode();
+        RDFTerm subject = triple.getSubject();
+
+        if (!(subject instanceof BlankNode)) {
+            hash ^= subject.hashCode() >> 1;
+        }
+        RDFTerm object = triple.getObject();
+        if (!(object instanceof BlankNode)) {
+            hash ^= object.hashCode() << 1;
+        }
+
+        return hash;
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
+
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
+    }
+
+    @Override
+    public void clear() {
+        throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
+    }
+    
+    
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return this;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof ImmutableGraph)) {
+            return false;
+        }
+        if (hashCode() != obj.hashCode()) {
+            return false;
+        }
+        return GraphMatcher.getValidMapping(this, (ImmutableGraph) obj) != null;
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
new file mode 100644
index 0000000..a236f06
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.utils;
+
+import org.apache.clerezza.commons.rdf.Literal;
+
+/**
+ *
+ * @author developer
+ */
+public abstract class AbstractLiteral implements Literal {
+
+    @Override
+    public int hashCode() {
+        int result = 0;
+        if (getLanguage() != null) {
+            result = getLanguage().hashCode();
+        }
+        result += getLexicalForm().hashCode();
+        result += getDataType().hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Literal) {
+            Literal other = (Literal) obj;
+            
+            if (getLanguage() == null) {
+                if (other.getLanguage() != null) {
+                    return false;
+                }
+            } else {
+                if (!getLanguage().equals(other.getLanguage())) {
+                    return false;
+                }
+            }
+            boolean res = getDataType().equals(other.getDataType()) && getLexicalForm().equals(other.getLexicalForm());
+            return res;
+        } else {
+            return false;
+        }
+    }
+    
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java
new file mode 100644
index 0000000..1cf3321
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/DelayedNotificator.java
@@ -0,0 +1,113 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.lang.ref.WeakReference;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.clerezza.commons.rdf.event.GraphEvent;
+import org.apache.clerezza.commons.rdf.event.GraphListener;
+
+
+/**
+ *
+ * @author reto
+ */
+class DelayedNotificator {
+
+    private static final Logger log = Logger.getLogger(DelayedNotificator.class.getName());
+    private static Timer timer = new Timer("Event delivery timer",true);
+
+    static class ListenerHolder {
+
+        long delay;
+        List<GraphEvent> events = null;
+        WeakReference<GraphListener> listenerRef;
+
+        public ListenerHolder(GraphListener listener, long delay) {
+            this.listenerRef = new WeakReference<GraphListener>(listener);
+            this.delay = delay;
+        }
+
+        private void registerEvent(GraphEvent event) {
+            synchronized (this) {
+                if (events == null) {
+                    events = new ArrayList<GraphEvent>();
+                    events.add(event);
+                    timer.schedule(new TimerTask() {
+
+                        @Override
+                        public void run() {
+                            List<GraphEvent> eventsLocal;
+                            synchronized (ListenerHolder.this) {
+                                eventsLocal = events;
+                                events = null;
+                            }
+                            GraphListener listener = listenerRef.get();
+                            if (listener == null) {
+                                log.fine("Ignoring garbage collected listener");
+                            } else {
+                                try {
+                                    listener.graphChanged(eventsLocal);
+                                } catch (Exception e) {
+                                    log.log(Level.WARNING, "Exception delivering ImmutableGraph event", e);
+                                }
+                            }
+                        }
+                    }, delay);
+                } else {
+                    events.add(event);
+                }
+            }
+        }
+    }
+    
+    private final Map<GraphListener, ListenerHolder> map = Collections.synchronizedMap(
+            new WeakHashMap<GraphListener, ListenerHolder>());
+
+    void addDelayedListener(GraphListener listener, long delay) {
+        map.put(listener, new ListenerHolder(listener, delay));
+    }
+
+    /**
+     * removes a Listener, this doesn't prevent the listenerRef from receiving
+     * events alreay scheduled.
+     *
+     * @param listenerRef
+     */
+    void removeDelayedListener(GraphListener listener) {
+        map.remove(listener);
+    }
+
+    /**
+     * if the listenerRef has not been registered as delayed listenerRef te events is
+     * forwarded synchroneously
+     * @param event
+     */
+    void sendEventToListener(GraphListener listener, GraphEvent event) {
+        ListenerHolder holder = map.get(listener);
+        if (holder == null) {
+            listener.graphChanged(Collections.singletonList(event));
+        } else {
+            holder.registerEvent(event);
+        }
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java
new file mode 100644
index 0000000..b2aa4be
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LiteralImpl.java
@@ -0,0 +1,82 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.io.Serializable;
+
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+
+/**
+ *
+ * @author reto
+ */
+public class LiteralImpl extends AbstractLiteral implements  Serializable {
+    private String lexicalForm;
+    private IRI dataType;
+    private int hashCode;
+    private Language language;
+
+    /**
+     * @param lexicalForm 
+     * @param dataType 
+     * @param Language the language of this literal
+     */
+    public LiteralImpl(String lexicalForm, IRI dataType, Language language) {
+        this.lexicalForm = lexicalForm;
+        this.dataType = dataType;
+        this.language = language;
+        this.hashCode = super.hashCode();
+    }
+    
+    public IRI getDataType() {
+        return dataType;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.clerezza.rdf.core.LiteralNode#getLexicalForm()
+     */
+    @Override
+    public String getLexicalForm() {
+        return lexicalForm;
+    }
+
+    @Override
+    public int hashCode() {
+        return hashCode;
+    }
+    
+
+    @Override
+    public String toString() {
+        StringBuffer result = new StringBuffer();
+        result.append('\"');
+        result.append(getLexicalForm());
+        result.append('\"');
+        result.append("^^");
+        result.append(getDataType());
+        return result.toString();
+    }
+
+    @Override
+    public Language getLanguage() {
+        return language;
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java
new file mode 100644
index 0000000..79747c2
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/LockingIterator.java
@@ -0,0 +1,73 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.util.Iterator;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.clerezza.commons.rdf.Triple;
+
+/**
+ * Wrapps an iterator<Triple> reading entering a read-lock on every invocation
+ * of hasNext and next
+ * @author reto
+ */
+class LockingIterator implements Iterator<Triple> {
+
+    private Iterator<Triple> base;
+    private Lock readLock;
+    private Lock writeLock;
+
+    public LockingIterator(Iterator<Triple> iterator, ReadWriteLock lock) {
+        base = iterator;
+        readLock = lock.readLock();
+        writeLock = lock.writeLock();
+    }
+
+    @Override
+    public boolean hasNext() {
+        readLock.lock();
+        try {
+            return base.hasNext();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public Triple next() {
+        readLock.lock();
+        try {
+            return base.next();
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public void remove() {
+        writeLock.lock();
+        try {
+            base.remove();
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java
new file mode 100644
index 0000000..49f2633
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/PlainLiteralImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.io.Serializable;
+import org.apache.clerezza.commons.rdf.IRI;
+
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Literal;
+
+/**
+ *
+ * @author reto
+ */
+public class PlainLiteralImpl extends AbstractLiteral implements Literal, Serializable {
+
+    private final String lexicalForm;
+    private final Language language;
+
+    public PlainLiteralImpl(String value) {
+        this(value, null);
+    }
+
+    public PlainLiteralImpl(String value, Language language) {
+        if (value == null) {
+            throw new IllegalArgumentException("The literal string cannot be null");
+        }
+        this.lexicalForm = value;
+        this.language = language;
+        if (language == null) {
+            dataType = XSD_STRING;
+        } else {
+            dataType = RDF_LANG_STRING;
+        }
+    }
+
+    @Override
+    public String getLexicalForm() {
+        return lexicalForm;
+    }
+
+    @Override
+    public Language getLanguage() {
+        return language;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder result = new StringBuilder();
+        result.append('\"').append(lexicalForm).append('\"');
+        if (language != null) {
+            result.append("@").append(language.toString());
+        }
+        return result.toString();
+    }
+
+    @Override
+    public IRI getDataType() {
+        return dataType;
+    }
+    private final IRI dataType;
+    private static final IRI XSD_STRING = new IRI("http://www.w3.org/2001/XMLSchema#string");
+    private static final IRI RDF_LANG_STRING = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java
new file mode 100644
index 0000000..6137c4b
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TripleImpl.java
@@ -0,0 +1,100 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+
+/**
+ *
+ * @author reto
+ */
+public class TripleImpl implements Triple {
+
+    private final BlankNodeOrIRI subject;
+    private final IRI predicate;
+    private final RDFTerm object;
+
+    /**
+     * Creates a new <code>TripleImpl</code>.
+     *
+     * @param subject  the subject.
+     * @param predicate  the predicate.
+     * @param object  the object.
+     * @throws IllegalArgumentException  if an attribute is <code>null</code>.
+     */
+    public TripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        if (subject == null) {
+            throw new IllegalArgumentException("Invalid subject: null");
+        } else if (predicate == null) {
+            throw new IllegalArgumentException("Invalid predicate: null");
+        } else if (object == null) {
+            throw new IllegalArgumentException("Invalid object: null");
+        }
+        this.subject = subject;
+        this.predicate = predicate;
+        this.object = object;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof Triple)) {
+            return false;
+        }
+        final Triple other = (Triple) obj;
+        if (!this.subject.equals(other.getSubject())) {
+            return false;
+        }
+        if (!this.predicate.equals(other.getPredicate())) {
+            return false;
+        }
+        if (!this.object.equals(other.getObject())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (subject.hashCode() >> 1) ^ predicate.hashCode() ^ (object.hashCode() << 1);
+    }
+
+    @Override
+    public BlankNodeOrIRI getSubject() {
+        return subject;
+    }
+
+    public IRI getPredicate() {
+        return predicate;
+    }
+
+    public RDFTerm getObject() {
+        return object;
+    }
+
+    @Override
+    public String toString() {
+        return subject + " " + predicate + " " + object + ".";
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java
new file mode 100644
index 0000000..67f7c9c
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/TypedLiteralImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.rdf.impl.utils;
+
+import java.io.Serializable;
+
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Literal;
+
+/**
+ *
+ * @author reto
+ */
+public class TypedLiteralImpl extends AbstractLiteral implements  Serializable {
+    private String lexicalForm;
+    private IRI dataType;
+    private int hashCode;
+
+    /**
+     * @param lexicalForm 
+     * @param dataType 
+     */
+    public TypedLiteralImpl(String lexicalForm, IRI dataType) {
+        this.lexicalForm = lexicalForm;
+        this.dataType = dataType;
+        this.hashCode = super.hashCode();
+    }
+    
+    public IRI getDataType() {
+        return dataType;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.clerezza.rdf.core.LiteralNode#getLexicalForm()
+     */
+    @Override
+    public String getLexicalForm() {
+        return lexicalForm;
+    }
+
+    @Override
+    public int hashCode() {
+        return hashCode;
+    }
+    
+
+    @Override
+    public String toString() {
+        StringBuffer result = new StringBuffer();
+        result.append('\"');
+        result.append(getLexicalForm());
+        result.append('\"');
+        result.append("^^");
+        result.append(getDataType());
+        return result.toString();
+    }
+
+    @Override
+    public Language getLanguage() {
+        return null;
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java
new file mode 100644
index 0000000..de61fe4
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/WatchableGraphWrapper.java
@@ -0,0 +1,289 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.utils;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.WatchableGraph;
+import org.apache.clerezza.commons.rdf.event.AddEvent;
+import org.apache.clerezza.commons.rdf.event.FilterTriple;
+import org.apache.clerezza.commons.rdf.event.GraphEvent;
+import org.apache.clerezza.commons.rdf.event.GraphListener;
+import org.apache.clerezza.commons.rdf.event.RemoveEvent;
+
+/**
+ *
+ * @author developer
+ */
+public class WatchableGraphWrapper implements WatchableGraph {
+    
+    final Graph wrapped;
+
+    public WatchableGraphWrapper(Graph wrapped) {
+        this.wrapped = wrapped;
+    }
+    
+       
+    //all listeners
+    private final Set<ListenerConfiguration> listenerConfigs = Collections.synchronizedSet(
+            new HashSet<ListenerConfiguration>());
+    private DelayedNotificator delayedNotificator = new DelayedNotificator();
+
+    @Override
+    public Iterator<Triple> iterator() {
+        return filter(null, null, null);
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        if (!(o instanceof Triple)) {
+            return false;
+        }
+        Triple t = (Triple) o;
+        return filter(t.getSubject(), t.getPredicate(), t.getObject()).hasNext();
+    }
+
+    @Override
+    public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate,
+            RDFTerm object) {
+        final Iterator<Triple> baseIter = wrapped.filter(subject, predicate, object);
+        return new Iterator<Triple>() {
+
+            Triple currentTriple = null;
+
+            @Override
+            public boolean hasNext() {
+                return baseIter.hasNext();
+            }
+
+            @Override
+            public Triple next() {
+                currentTriple = baseIter.next();
+                return currentTriple;
+            }
+
+            @Override
+            public void remove() {
+                baseIter.remove();
+                dispatchEvent(new RemoveEvent(WatchableGraphWrapper.this, currentTriple));
+            }
+        };
+    }
+
+    @Override
+    public boolean add(Triple triple) {
+        boolean success = performAdd(triple);
+        if (success) {
+            dispatchEvent(new AddEvent(this, triple));
+        }
+        return success;
+    }
+
+    /**
+     * A subclass of <code>AbstractGraph</code> should override 
+     * this method instead of <code>add</code> for Graph event support to be
+     * added.
+     * 
+     * @param e The triple to be added to the triple collection
+     * @return
+     */
+    protected boolean performAdd(Triple e) {
+        return wrapped.add(e);
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        Triple triple = (Triple) o;
+        boolean success = performRemove(triple);
+        if (success) {
+            dispatchEvent(new RemoveEvent(this, triple));
+        }
+        return success;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        boolean modified = false;
+        for (Iterator<? extends Object> it = c.iterator(); it.hasNext();) {
+            Object object = it.next();
+            if (remove(object)) {
+                modified = true;
+            }
+        }
+        return modified;
+    }
+
+    /**
+     * A subclass of <code>AbstractGraph</code> should override 
+     * this method instead of <code>remove</code> for ImmutableGraph event support to be
+     * added.
+     * 
+     * @param o The triple to be removed from the triple collection
+     * @return
+     */
+    protected boolean performRemove(Triple triple) {
+        Iterator<Triple> e = filter(null, null, null);
+        while (e.hasNext()) {
+            if (triple.equals(e.next())) {
+                e.remove();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Dispatches a <code>GraphEvent</code> to all registered listeners for which
+     * the specified <code>Triple</code> matches the <code>FilterTriple</code>s
+     * of the listeners.
+     * 
+     * @param triple The Triple that was modified
+     * @param type The type of modification
+     */
+    protected void dispatchEvent(GraphEvent event) {
+        synchronized(listenerConfigs) {
+            Iterator<ListenerConfiguration> iter = listenerConfigs.iterator();
+            while (iter.hasNext()) {
+                ListenerConfiguration config = iter.next();
+                GraphListener registeredListener = config.getListener();
+                if (registeredListener == null) {
+                    iter.remove();
+                    continue;
+                }
+                if (config.getFilter().match(event.getTriple())) {
+                    delayedNotificator.sendEventToListener(registeredListener, event);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void addGraphListener(GraphListener listener, FilterTriple filter) {
+        addGraphListener(listener, filter, 0);
+    }
+
+    @Override
+    public void addGraphListener(GraphListener listener, FilterTriple filter,
+            long delay) {
+        listenerConfigs.add(new ListenerConfiguration(listener, filter));
+        if (delay > 0) {
+            delayedNotificator.addDelayedListener(listener, delay);
+        }
+    }
+
+    @Override
+    public void removeGraphListener(GraphListener listener) {
+        synchronized(listenerConfigs) {
+            Iterator<ListenerConfiguration> iter = listenerConfigs.iterator();
+            while (iter.hasNext()) {
+                ListenerConfiguration listenerConfig = iter.next();
+                GraphListener registeredListener = listenerConfig.getListener();
+                if ((registeredListener == null) || (registeredListener.equals(listener))) {
+                    iter.remove();
+                }
+            }
+        }
+        delayedNotificator.removeDelayedListener(listener);
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return wrapped.getLock();
+    }
+
+    @Override
+    public int size() {
+        return wrapped.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return wrapped.isEmpty();
+    }
+
+    @Override
+    public Object[] toArray() {
+        return wrapped.toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        return wrapped.toArray(a);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        return wrapped.containsAll(c);
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        return wrapped.addAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        return wrapped.retainAll(c);
+    }
+
+    @Override
+    public void clear() {
+        wrapped.clear();
+    }
+
+    private static class ListenerConfiguration {
+
+        private WeakReference<GraphListener> listenerRef;
+        private FilterTriple filter;
+
+        private ListenerConfiguration(GraphListener listener, FilterTriple filter) {
+            this.listenerRef = new WeakReference<GraphListener>(listener);
+            this.filter = filter;
+        }
+
+        /**
+         * @return the listener
+         */
+        GraphListener getListener() {
+            GraphListener listener = listenerRef.get();
+            return listener;
+        }
+
+        /**
+         * @return the filter
+         */
+        FilterTriple getFilter() {
+            return filter;
+        }
+    }
+    
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java
new file mode 100644
index 0000000..1f47fe9
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReadLockDebug.java
@@ -0,0 +1,85 @@
+/*
+ * 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.commons.rdf.impl.utils.debug;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
+
+/**
+ *
+ * @author mir
+ */
+public class ReadLockDebug extends ReadLock {
+
+    ReentrantReadWriteLockTracker lock;
+    StackTraceElement[] stackTrace;
+
+    ReadLock readLock;
+    public ReadLockDebug(ReentrantReadWriteLockTracker lock) {
+        super(lock);
+        this.lock = lock;
+        this.readLock = lock.realReadLock();
+    }
+
+    @Override
+    public void lock() {
+        readLock.lock();
+        lock.addLockedReadLock(this);
+        stackTrace = Thread.currentThread().getStackTrace();
+    }
+
+    @Override
+    public void lockInterruptibly() throws InterruptedException {
+        readLock.lockInterruptibly();
+    }
+
+    @Override
+    public Condition newCondition() {
+        return readLock.newCondition();
+    }
+
+    @Override
+    public String toString() {
+        return readLock.toString();
+    }
+
+    @Override
+    public boolean tryLock() {
+        return readLock.tryLock();
+    }
+
+    @Override
+    public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
+        return readLock.tryLock(timeout, unit);
+    }
+
+    @Override
+    public void unlock() {
+        readLock.unlock();
+        lock.removeReadLock(this);
+        stackTrace = null;
+    }
+
+    public StackTraceElement[] getStackTrace() {
+        return stackTrace;
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java
new file mode 100644
index 0000000..8f382aa
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/ReentrantReadWriteLockTracker.java
@@ -0,0 +1,133 @@
+/*
+ * 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.commons.rdf.impl.utils.debug;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ *
+ * @author mir
+ */
+public class ReentrantReadWriteLockTracker extends ReentrantReadWriteLock {
+
+
+    private Set<ReadLockDebug> lockedReadLocks = Collections.synchronizedSet(new HashSet<ReadLockDebug>());
+    private final WriteLockDebug writeLock = new WriteLockDebug(this);
+    @Override
+    protected Thread getOwner() {
+        return super.getOwner();
+    }
+
+    @Override
+    protected Collection<Thread> getQueuedReaderThreads() {
+        return super.getQueuedReaderThreads();
+    }
+
+    @Override
+    protected Collection<Thread> getQueuedThreads() {
+        return super.getQueuedThreads();
+    }
+
+    @Override
+    protected Collection<Thread> getQueuedWriterThreads() {
+        return super.getQueuedWriterThreads();
+    }
+
+    @Override
+    public int getReadHoldCount() {
+        return super.getReadHoldCount();
+    }
+
+    @Override
+    public int getReadLockCount() {
+        return super.getReadLockCount();
+    }
+
+    @Override
+    public int getWaitQueueLength(Condition condition) {
+        return super.getWaitQueueLength(condition);
+    }
+
+    @Override
+    protected Collection<Thread> getWaitingThreads(Condition condition) {
+        return super.getWaitingThreads(condition);
+    }
+
+    @Override
+    public int getWriteHoldCount() {
+        return super.getWriteHoldCount();
+    }
+
+    @Override
+    public boolean hasWaiters(Condition condition) {
+        return super.hasWaiters(condition);
+    }
+
+    @Override
+    public boolean isWriteLocked() {
+        return super.isWriteLocked();
+    }
+
+    @Override
+    public boolean isWriteLockedByCurrentThread() {
+        return super.isWriteLockedByCurrentThread();
+    }
+
+    @Override
+    public ReadLock readLock() {
+        return new ReadLockDebug(this);
+    }
+
+    ReadLock realReadLock() {
+        return super.readLock();
+    }
+
+    WriteLock realWriteLock() {
+        return super.writeLock();
+    }
+
+    @Override
+    public String toString() {
+        return super.toString();
+    }
+
+    @Override
+    public WriteLockDebug writeLock() {
+        return writeLock;
+    }
+
+    void addLockedReadLock(ReadLockDebug lock) {
+        lockedReadLocks.add(lock);
+    }
+
+    void removeReadLock(ReadLockDebug lock) {
+        lockedReadLocks.remove(lock);
+    }
+
+    public Set<ReadLockDebug> getLockedReadLocks() {
+        return lockedReadLocks;
+    }
+
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java
new file mode 100644
index 0000000..a4261e3
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/debug/WriteLockDebug.java
@@ -0,0 +1,89 @@
+/*
+ * 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.commons.rdf.impl.utils.debug;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+
+/**
+ *
+ * @author mir
+ */
+public class WriteLockDebug extends WriteLock {
+
+    private ReentrantReadWriteLockTracker lock;
+    private WriteLock writeLock;
+    private StackTraceElement[] stackTrace;
+
+    public WriteLockDebug(ReentrantReadWriteLockTracker lock) {
+        super(lock);
+        this.lock = lock;
+        this.writeLock = lock.realWriteLock();
+    }
+
+    @Override
+    public int getHoldCount() {
+        return writeLock.getHoldCount();
+    }
+
+    @Override
+    public boolean isHeldByCurrentThread() {
+        return writeLock.isHeldByCurrentThread();
+    }
+
+    @Override
+    public void lock() {
+        writeLock.lock();
+        stackTrace = Thread.currentThread().getStackTrace();
+    }
+
+    @Override
+    public void lockInterruptibly() throws InterruptedException {
+        writeLock.lockInterruptibly();
+    }
+
+    @Override
+    public Condition newCondition() {
+        return writeLock.newCondition();
+    }
+
+    @Override
+    public boolean tryLock() {
+        return writeLock.tryLock();
+    }
+
+    @Override
+    public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
+        return writeLock.tryLock(timeout, unit);
+    }
+
+    @Override
+    public void unlock() {
+        writeLock.unlock();
+        stackTrace = null;
+    }
+
+    public StackTraceElement[] getStackTrace() {
+        return stackTrace;
+    }
+
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java
new file mode 100644
index 0000000..ce65d1a
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcher.java
@@ -0,0 +1,140 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+
+/**
+ * @author reto
+ * 
+ */
+public class GraphMatcher {
+
+
+    private final static Logger log = Logger.getLogger(GraphMatcher.class.getName());
+
+    /**
+     * get a mapping from g1 to g2 or null if the graphs are not isomorphic. The
+     * returned map maps each <code>BNode</code>s from g1 to one
+     * of g2. If the graphs are ground graphs the method return an empty map if
+     * the ImmutableGraph are equals and null otherwise.
+     * <p/>
+     * NOTE: This method does not returned mapping from blank nodes to grounded
+     * nodes, a bnode in g1 is not a vraiable that may match any node, but must
+     * match a bnode in g2.
+     * <p/>
+     *
+     * On the algorithm:<br/>
+     * - In a first step it checked if every grounded triple in g1 matches one
+     * in g2<br/>
+     * - [optional] blank node blind matching</br>
+     * - in a map mbng1 bnode of g1 is mapped to a set of of its
+     * properties and inverse properties, this is the predicate and the object
+     * or subject respectively, analoguosly in mbgn2 every bnode of g2<br/>
+     * - based on the incoming and outgoing properties a hash is calculated for
+     * each bnode, in the first step when calculating the hash  aconstant value
+     * is taken for the bnodes that might be subject or object in the (inverse properties)
+     * - hash-classes:
+     * 
+     * @param g1
+     * @param g2
+     * @return a Set of NodePairs
+     */
+    public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) {
+        Graph g1 = new SimpleMGraph(og1);
+        Graph g2 = new SimpleMGraph(og2);
+        if (!Utils.removeGrounded(g1,g2)) {
+            return null;
+        }
+        final HashMatching hashMatching;
+        try {
+            hashMatching = new HashMatching(g1, g2);
+        } catch (GraphNotIsomorphicException ex) {
+            return null;
+        }
+        Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings();
+        if (g1.size() > 0) {
+            //start trial an error matching
+            //TODO (CLEREZZA-81) at least in the situation where one matching
+            //group is big (approx > 5) we should switch back to hash-based matching
+            //after a first guessed matching, rather than try all permutations
+            Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups());
+            if (remainingMappings == null) {
+                return null;
+            } else {
+                matchings.putAll(remainingMappings);
+            }
+        }
+        return matchings;
+    }
+
+    private static Map<BlankNode, BlankNode> trialAndErrorMatching(Graph g1, Graph g2,
+            Map<Set<BlankNode>, Set<BlankNode>> matchingGroups) {
+        if (log.isLoggable(Level.FINE)) {
+            Set<BlankNode> bn1  = Utils.getBNodes(g1);
+            log.log(Level.FINE,"doing trial and error matching for {0}"+" bnodes, "+"in graphs of size: {1}.", new Object[]{bn1.size(), g1.size()});
+        }
+        Iterator<Map<BlankNode, BlankNode>> mappingIter
+                = GroupMappingIterator.create(matchingGroups);
+        while (mappingIter.hasNext()) {
+            Map<BlankNode, BlankNode> map = mappingIter.next();
+            if (checkMapping(g1, g2, map)) {
+                return map;
+            }
+        }
+        return null;
+    }
+
+    private static boolean checkMapping(Graph g1, Graph g2, Map<BlankNode, BlankNode> map) {
+        for (Triple triple : g1) {
+            if (!g2.contains(map(triple, map))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static Triple map(Triple triple, Map<BlankNode, BlankNode> map) {
+        final BlankNodeOrIRI oSubject = triple.getSubject();
+
+        BlankNodeOrIRI subject = oSubject instanceof BlankNode ?
+            map.get((BlankNode)oSubject) : oSubject;
+
+        RDFTerm oObject = triple.getObject();
+        RDFTerm object = oObject instanceof BlankNode ?
+            map.get((BlankNode)oObject) : oObject;
+        return new TripleImpl(subject, triple.getPredicate(), object);
+    }
+
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java
new file mode 100644
index 0000000..5b5600f
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphNotIsomorphicException.java
@@ -0,0 +1,28 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+/**
+ *
+ * @author reto
+ */
+class GraphNotIsomorphicException extends Exception {
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java
new file mode 100644
index 0000000..4c7a0ae
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GroupMappingIterator.java
@@ -0,0 +1,102 @@
+/*
+ *  Copyright 2010 reto.
+ * 
+ *  Licensed 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.
+ *  under the License.
+ */
+
+package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * Iterates over all mappings from each element of every Set<T> to each
+ * elemenent of their corresponding Set<U>.
+ *
+ * @author reto
+ */
+class GroupMappingIterator<T,U> implements Iterator<Map<T, U>> {
+
+    private Iterator<Map<T, U>> firstPartIter;
+    private Map<T, U> currentFirstPart;
+    final private Map<Set<T>, Set<U>> restMap;
+    private Iterator<Map<T, U>> currentRestPartIter;
+
+    static <T,U> Iterator<Map<T, U>> create(Map<Set<T>, Set<U>> matchingGroups) {
+        if (matchingGroups.size() > 1) {
+            return new GroupMappingIterator<T, U>(matchingGroups);
+        } else {
+            if (matchingGroups.size() == 0) {
+                return new ArrayList<Map<T, U>>(0).iterator();
+            }
+            Map.Entry<Set<T>, Set<U>> entry = matchingGroups.entrySet().iterator().next();
+            return new MappingIterator<T,U>(entry.getKey(),
+                        entry.getValue());
+        }
+    }
+
+    private GroupMappingIterator(Map<Set<T>, Set<U>> matchingGroups) {
+        if (matchingGroups.size() == 0) {
+            throw new IllegalArgumentException("matchingGroups must not be empty");
+        }
+        restMap = new HashMap<Set<T>, Set<U>>();
+        boolean first = true;
+        for (Map.Entry<Set<T>, Set<U>> entry : matchingGroups.entrySet()) {
+            if (first) {
+                firstPartIter = new MappingIterator<T,U>(entry.getKey(),
+                        entry.getValue());
+                first = false;
+            } else {
+                restMap.put(entry.getKey(), entry.getValue());
+            }
+        }
+        currentRestPartIter = create(restMap);
+        currentFirstPart = firstPartIter.next();
+    }
+
+    @Override
+    public boolean hasNext() {
+        return firstPartIter.hasNext() || currentRestPartIter.hasNext();
+    }
+
+    @Override
+    public Map<T, U> next() {
+        Map<T, U> restPart;
+        if (currentRestPartIter.hasNext()) {
+            restPart = currentRestPartIter.next();
+        } else {
+            if (firstPartIter.hasNext()) {
+                currentFirstPart = firstPartIter.next();
+                currentRestPartIter = create(restMap);
+                restPart = currentRestPartIter.next();
+            } else {
+                throw new NoSuchElementException();
+            }
+        }
+        Map<T, U> result = new HashMap<T, U>(restPart);
+        result.putAll(currentFirstPart);
+        return result;
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java
new file mode 100644
index 0000000..369cf5c
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatching.java
@@ -0,0 +1,268 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+
+import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections.IntHashMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections.IntIterator;
+
+/**
+ *
+ * @author reto
+ */
+public class HashMatching {
+
+    private Map<BlankNode, BlankNode> matchings = new HashMap<BlankNode, BlankNode>();
+    private Map<Set<BlankNode>, Set<BlankNode>> matchingGroups;
+
+    /**
+     * tc1 and tc2 will be modified: the triples containing no unmatched bnode
+     * will be removed
+     *
+     * @param tc1
+     * @param tc2
+     * @throws GraphNotIsomorphicException
+     */
+    HashMatching(Graph tc1, Graph tc2) throws GraphNotIsomorphicException {
+        int foundMatchings = 0;
+        int foundMatchingGroups = 0;
+        Map<BlankNode, Integer> bNodeHashMap = new HashMap<BlankNode, Integer>();
+        while (true) {
+            bNodeHashMap = matchByHashes(tc1, tc2, bNodeHashMap);
+            if (bNodeHashMap == null) {
+                throw new GraphNotIsomorphicException();
+            }
+            if (matchings.size() == foundMatchings) {
+                if (!(matchingGroups.size() > foundMatchingGroups)) {
+                    break;
+                }
+            }
+            foundMatchings = matchings.size();
+            foundMatchingGroups = matchingGroups.size();
+        }
+    }
+
+    /**
+     *
+     * @return a map containing set of which each bnodes mappes one of the other set
+     */
+    public Map<Set<BlankNode>, Set<BlankNode>> getMatchingGroups() {
+        return matchingGroups;
+    }
+
+    public Map<BlankNode, BlankNode> getMatchings() {
+        return matchings;
+    }
+
+    
+    private static IntHashMap<Set<BlankNode>> getHashNodes(Map<BlankNode,
+            Set<Property>> bNodePropMap, Map<BlankNode, Integer> bNodeHashMap) {
+        IntHashMap<Set<BlankNode>> result = new IntHashMap<Set<BlankNode>>();
+        for (Map.Entry<BlankNode, Set<Property>> entry : bNodePropMap.entrySet()) {
+            int hash = computeHash(entry.getValue(), bNodeHashMap);
+            Set<BlankNode> bNodeSet = result.get(hash);
+            if (bNodeSet == null) {
+                bNodeSet = new HashSet<BlankNode>();
+                result.put(hash,bNodeSet);
+            }
+            bNodeSet.add(entry.getKey());
+        }
+        return result;
+    }
+    /*
+     * returns a Map from bnodes to hash that can be used for future
+     * refinements, this could be separate for each ImmutableGraph.
+     *
+     * triples no longer containing an unmatched bnodes ae removed.
+     *
+     * Note that the matched node are not guaranteed to be equals, but only to
+     * be the correct if the graphs are isomorphic.
+     */
+    private Map<BlankNode, Integer> matchByHashes(Graph g1, Graph g2,
+            Map<BlankNode, Integer> bNodeHashMap) {
+        Map<BlankNode, Set<Property>> bNodePropMap1  = getBNodePropMap(g1);
+        Map<BlankNode, Set<Property>> bNodePropMap2  = getBNodePropMap(g2);
+        IntHashMap<Set<BlankNode>> hashNodeMap1 = getHashNodes(bNodePropMap1, bNodeHashMap);
+        IntHashMap<Set<BlankNode>> hashNodeMap2 = getHashNodes(bNodePropMap2, bNodeHashMap);
+        if (!hashNodeMap1.keySet().equals(hashNodeMap2.keySet())) {
+            return null;
+        }
+
+        matchingGroups = new HashMap<Set<BlankNode>, Set<BlankNode>>();
+        IntIterator hashIter = hashNodeMap1.keySet().intIterator();
+        while (hashIter.hasNext()) {
+            int hash = hashIter.next();
+            Set<BlankNode> nodes1 = hashNodeMap1.get(hash);
+            Set<BlankNode> nodes2 = hashNodeMap2.get(hash);
+            if (nodes1.size() != nodes2.size()) {
+                return null;
+            }
+            if (nodes1.size() != 1) {
+                matchingGroups.put(nodes1, nodes2);
+                continue;
+            }
+            final BlankNode bNode1 = nodes1.iterator().next();
+            final BlankNode bNode2 = nodes2.iterator().next();
+            matchings.put(bNode1,bNode2);
+            //in the graphs replace node occurences with grounded node,
+            BlankNodeOrIRI mappedNode = new MappedNode(bNode1, bNode2);
+            replaceNode(g1,bNode1, mappedNode);
+            replaceNode(g2, bNode2, mappedNode);
+            //remove grounded triples
+            if (!Utils.removeGrounded(g1,g2)) {
+                return null;
+            }
+        }
+        Map<BlankNode, Integer> result = new HashMap<BlankNode, Integer>();
+        addInverted(result, hashNodeMap1);
+        addInverted(result, hashNodeMap2);
+        return result;
+    }
+    private static int computeHash(Set<Property> propertySet, Map<BlankNode, Integer> bNodeHashMap) {
+        int result = 0;
+        for (Property property : propertySet) {
+            result += property.hashCode(bNodeHashMap);
+        }
+        return result;
+    }
+    private static Map<BlankNode, Set<Property>> getBNodePropMap(Graph g) {
+        Set<BlankNode> bNodes = Utils.getBNodes(g);
+        Map<BlankNode, Set<Property>> result = new HashMap<BlankNode, Set<Property>>();
+        for (BlankNode bNode : bNodes) {
+            result.put(bNode, getProperties(bNode, g));
+        }
+        return result;
+    }
+    private static Set<Property> getProperties(BlankNode bNode, Graph g) {
+        Set<Property> result = new HashSet<Property>();
+        Iterator<Triple> ti = g.filter(bNode, null, null);
+        while (ti.hasNext()) {
+            Triple triple = ti.next();
+            result.add(new ForwardProperty(triple.getPredicate(), triple.getObject()));
+        }
+        ti = g.filter(null, null, bNode);
+        while (ti.hasNext()) {
+            Triple triple = ti.next();
+            result.add(new BackwardProperty(triple.getSubject(), triple.getPredicate()));
+        }
+        return result;
+    }
+    private static int nodeHash(RDFTerm resource, Map<BlankNode, Integer> bNodeHashMap) {
+        if (resource instanceof BlankNode) {
+            Integer mapValue = bNodeHashMap.get((BlankNode)resource);
+            if (mapValue == null) {
+                return 0;
+            } else {
+                return mapValue;
+            }
+        } else {
+            return resource.hashCode();
+        }
+    }
+    private static void replaceNode(Graph graph, BlankNode bNode, BlankNodeOrIRI replacementNode) {
+        Set<Triple> triplesToRemove = new HashSet<Triple>();
+        for (Triple triple : graph) {
+            Triple replacementTriple = getReplacement(triple, bNode, replacementNode);
+            if (replacementTriple != null) {
+                triplesToRemove.add(triple);
+                graph.add(replacementTriple);
+            }
+        }
+        graph.removeAll(triplesToRemove);
+    }
+    private static Triple getReplacement(Triple triple, BlankNode bNode, BlankNodeOrIRI replacementNode) {
+        if (triple.getSubject().equals(bNode)) {
+            if (triple.getObject().equals(bNode)) {
+                return new TripleImpl(replacementNode, triple.getPredicate(), replacementNode);
+            } else {
+                return new TripleImpl(replacementNode, triple.getPredicate(), triple.getObject());
+            }
+        } else {
+            if (triple.getObject().equals(bNode)) {
+                return new TripleImpl(triple.getSubject(), triple.getPredicate(), replacementNode);
+            } else {
+                return null;
+            }
+        }
+    }
+    private static void addInverted(Map<BlankNode, Integer> result, IntHashMap<Set<BlankNode>> hashNodeMap) {
+        for (int hash : hashNodeMap.keySet()) {
+            Set<BlankNode> bNodes = hashNodeMap.get(hash);
+            for (BlankNode bNode : bNodes) {
+                result.put(bNode, hash);
+            }
+        }
+    }
+    
+    private static class BackwardProperty implements Property {
+        private BlankNodeOrIRI subject;
+        private IRI predicate;
+    
+        public BackwardProperty(BlankNodeOrIRI subject, IRI predicate) {
+            this.subject = subject;
+            this.predicate = predicate;
+        }
+    
+        @Override
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
+            return  0xFF ^ predicate.hashCode() ^ nodeHash(subject, bNodeHashMap);
+        }
+    
+    }
+    private static class ForwardProperty implements Property {
+        private IRI predicate;
+        private RDFTerm object;
+    
+        public ForwardProperty(IRI predicate, RDFTerm object) {
+            this.predicate = predicate;
+            this.object = object;
+        }
+    
+        @Override
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
+            return predicate.hashCode() ^ nodeHash(object, bNodeHashMap);
+        }
+    }
+    private static class MappedNode implements BlankNodeOrIRI {
+        private BlankNode bNode1, bNode2;
+    
+        public MappedNode(BlankNode bNode1, BlankNode bNode2) {
+            this.bNode1 = bNode1;
+            this.bNode2 = bNode2;
+        }
+        
+    }
+    private static interface Property {
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap);
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java
new file mode 100644
index 0000000..016b590
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/MappingIterator.java
@@ -0,0 +1,76 @@
+package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+
+/*
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * An iterator over all possible mapping beetween the elemnets of two sets of
+ * the same size, each mapping maps each element from set1 to a disctinct one of
+ * set2.
+ *
+ *
+ *
+ * @author reto
+ */
+class MappingIterator<T,U> implements Iterator<Map<T, U>> {
+
+    private List<T> list1;
+    private Iterator<List<U>> permutationList2Iterator;
+
+
+    public MappingIterator(Set<T> set1, Set<U> set2) {
+        if (set1.size() != set2.size()) {
+            throw new IllegalArgumentException();
+        }
+        this.list1 = new ArrayList<T>(set1);
+        permutationList2Iterator = new PermutationIterator<U>(
+                new ArrayList<U>(set2));
+    }
+
+    @Override
+    public boolean hasNext() {
+        return permutationList2Iterator.hasNext();
+    }
+
+    @Override
+    public Map<T, U> next() {
+        List<U> list2 = permutationList2Iterator.next();
+        Map<T, U> result = new HashMap<T, U>(list1.size());
+        for (int i = 0; i < list1.size(); i++) {
+            result.put(list1.get(i), list2.get(i));
+        }
+        return result;
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java
new file mode 100644
index 0000000..6f01828
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIterator.java
@@ -0,0 +1,107 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ *
+ * An Iterator over all permuations of a list.
+ *
+ * @author reto
+ */
+class PermutationIterator<T> implements Iterator<List<T>> {
+
+    private Iterator<List<T>> restIterator;
+    private List<T> list;
+    private List<T> next;
+    int posInList = 0; //the position of the last element of next returned list
+    //with list, this is the one excluded from restIterator
+
+    PermutationIterator(List<T> list) {
+        this.list = Collections.unmodifiableList(list);
+        if (list.size() > 1) {
+            createRestList();
+        }
+        prepareNext();
+    }
+
+    @Override
+    public boolean hasNext() {
+        return next != null;
+    }
+
+    @Override
+    public List<T> next() {
+        List<T> result = next;
+        if (result == null) {
+            throw new NoSuchElementException();
+        }
+        prepareNext();
+        return result;
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    private void createRestList() {
+        List<T> restList = new ArrayList<T>(list);
+        restList.remove(posInList);
+        restIterator = new PermutationIterator<T>(restList);
+    }
+
+    private void prepareNext() {
+        next = getNext();
+        
+    }
+    private List<T> getNext() {
+        if (list.size() == 0) {
+            return null;
+        }
+        if (list.size() == 1) {
+            if (posInList++ == 0) {
+                return new ArrayList<T>(list);
+            } else {
+                return null;
+            }
+        } else {
+            if (!restIterator.hasNext()) {
+                if (posInList < (list.size()-1)) {
+                    posInList++;
+                    createRestList();
+                } else {
+                    return null;
+                }
+            }
+            List<T> result = restIterator.next();
+            result.add(list.get(posInList));
+            return result;
+        }
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java
new file mode 100644
index 0000000..68e178b
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils.java
@@ -0,0 +1,82 @@
+package org.apache.clerezza.commons.rdf.impl.utils.graphmatching;
+/*
+ *
+ * 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 java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.Triple;
+
+public class Utils {
+
+    static Set<BlankNode> getBNodes(Collection<Triple> s) {
+        Set<BlankNode> result = new HashSet<BlankNode>();
+        for (Triple triple : s) {
+            if (triple.getSubject() instanceof BlankNode) {
+                result.add((BlankNode) triple.getSubject());
+            }
+            if (triple.getObject() instanceof BlankNode) {
+                result.add((BlankNode) triple.getObject());
+            }
+        }
+        return result;
+    }
+
+    /**
+     * removes the common grounded triples from s1 and s2. returns false if
+     * a grounded triple is not in both sets, true otherwise
+     */
+    static boolean removeGrounded(Collection<Triple> s1, Collection<Triple> s2) {
+        Iterator<Triple> triplesIter = s1.iterator();
+        while (triplesIter.hasNext()) {
+            Triple triple = triplesIter.next();
+            if (!isGrounded(triple)) {
+                continue;
+            }
+            if (!s2.remove(triple)) {
+                return false;
+            }
+            triplesIter.remove();
+        }
+        //for efficiency we might skip this (redefine method)
+        for (Triple triple : s2) {
+            if (isGrounded(triple)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static boolean isGrounded(Triple triple) {
+        if (triple.getSubject() instanceof BlankNode) {
+            return false;
+        }
+        if (triple.getObject() instanceof BlankNode) {
+            return false;
+        }
+        return true;
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java
new file mode 100644
index 0000000..776a6af
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashMap.java
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+/*
+ * Note: originally released under the GNU LGPL v2.1, 
+ * but rereleased by the original author under the ASF license (above).
+ */
+
+package org.apache.clerezza.commons.rdf.impl.utils.graphmatching.collections;
+
+
+
+/**
+ * <p>A hash map that uses primitive ints for the key rather than objects.</p>
+ *
+ * <p>Note that this class is for internal optimization purposes only, and may
+ * not be supported in future releases of Jakarta Commons Lang.  Utilities of
+ * this sort may be included in future releases of Jakarta Commons Collections.</p>
+ *
+ * @author Justin Couch
+ * @author Alex Chaffee (alex@apache.org)
+ * @author Stephen Colebourne
+ * @since 2.0
+ * @version $Revision: 1.2 $
+ * @see java.util.HashMap
+ */
+public class IntHashMap<T> {
+
+
+    private IntSet keySet = new IntHashSet();
+
+    /**
+     * The hash table data.
+     */
+    private transient Entry<T> table[];
+
+    /**
+     * The total number of entries in the hash table.
+     */
+    private transient int count;
+
+    /**
+     * The table is rehashed when its size exceeds this threshold.  (The
+     * value of this field is (int)(capacity * loadFactor).)
+     *
+     * @serial
+     */
+    private int threshold;
+
+    /**
+     * The load factor for the hashtable.
+     *
+     * @serial
+     */
+    private float loadFactor;
+
+    /**
+     * <p>Innerclass that acts as a datastructure to create a new entry in the
+     * table.</p>
+     */
+    private static class Entry<T> {
+        int hash;
+        int key;
+        T value;
+        Entry<T> next;
+
+        /**
+         * <p>Create a new entry with the given values.</p>
+         *
+         * @param hash The code used to hash the object with
+         * @param key The key used to enter this in the table
+         * @param value The value for this key
+         * @param next A reference to the next entry in the table
+         */
+        protected Entry(int hash, int key, T value, Entry<T> next) {
+            this.hash = hash;
+            this.key = key;
+            this.value = value;
+            this.next = next;
+        }
+    }
+
+    /**
+     * <p>Constructs a new, empty hashtable with a default capacity and load
+     * factor, which is <code>20</code> and <code>0.75</code> respectively.</p>
+     */
+    public IntHashMap() {
+        this(20, 0.75f);
+    }
+
+    /**
+     * <p>Constructs a new, empty hashtable with the specified initial capacity
+     * and default load factor, which is <code>0.75</code>.</p>
+     *
+     * @param  initialCapacity the initial capacity of the hashtable.
+     * @throws IllegalArgumentException if the initial capacity is less
+     *   than zero.
+     */
+    public IntHashMap(int initialCapacity) {
+        this(initialCapacity, 0.75f);
+    }
+
+    /**
+     * <p>Constructs a new, empty hashtable with the specified initial
+     * capacity and the specified load factor.</p>
+     *
+     * @param initialCapacity the initial capacity of the hashtable.
+     * @param loadFactor the load factor of the hashtable.
+     * @throws IllegalArgumentException  if the initial capacity is less
+     *             than zero, or if the load factor is nonpositive.
+     */
+    public IntHashMap(int initialCapacity, float loadFactor) {
+        super();
+        if (initialCapacity < 0) {
+            throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
+        }
+        if (loadFactor <= 0) {
+            throw new IllegalArgumentException("Illegal Load: " + loadFactor);
+        }
+        if (initialCapacity == 0) {
+            initialCapacity = 1;
+        }
+
+        this.loadFactor = loadFactor;
+        table = new Entry[initialCapacity];
+        threshold = (int) (initialCapacity * loadFactor);
+    }
+
+    /**
+     * <p>Returns the number of keys in this hashtable.</p>
+     *
+     * @return  the number of keys in this hashtable.
+     */
+    public int size() {
+        return count;
+    }
+
+    /**
+     * <p>Tests if this hashtable maps no keys to values.</p>
+     *
+     * @return  <code>true</code> if this hashtable maps no keys to values;
+     *          <code>false</code> otherwise.
+     */
+    public boolean isEmpty() {
+        return count == 0;
+    }
+
+    /**
+     * <p>Tests if some key maps into the specified value in this hashtable.
+     * This operation is more expensive than the <code>containsKey</code>
+     * method.</p>
+     *
+     * <p>Note that this method is identical in functionality to containsValue,
+     * (which is part of the Map interface in the collections framework).</p>
+     *
+     * @param      value   a value to search for.
+     * @return     <code>true</code> if and only if some key maps to the
+     *             <code>value</code> argument in this hashtable as
+     *             determined by the <tt>equals</tt> method;
+     *             <code>false</code> otherwise.
+     * @throws  NullPointerException  if the value is <code>null</code>.
+     * @see        #containsKey(int)
+     * @see        #containsValue(Object)
+     * @see        java.util.Map
+     */
+    public boolean contains(Object value) {
+        if (value == null) {
+            throw new NullPointerException();
+        }
+
+        Entry tab[] = table;
+        for (int i = tab.length; i-- > 0;) {
+            for (Entry e = tab[i]; e != null; e = e.next) {
+                if (e.value.equals(value)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * <p>Returns <code>true</code> if this HashMap maps one or more keys
+     * to this value.</p>
+     *
+     * <p>Note that this method is identical in functionality to contains
+     * (which predates the Map interface).</p>
+     *
+     * @param value value whose presence in this HashMap is to be tested.
+     * @see    java.util.Map
+     * @since JDK1.2
+     */
+    public boolean containsValue(Object value) {
+        return contains(value);
+    }
+
+    /**
+     * <p>Tests if the specified object is a key in this hashtable.</p>
+     *
+     * @param  key  possible key.
+     * @return <code>true</code> if and only if the specified object is a
+     *    key in this hashtable, as determined by the <tt>equals</tt>
+     *    method; <code>false</code> otherwise.
+     * @see #contains(Object)
+     */
+    public boolean containsKey(int key) {
+        Entry tab[] = table;
+        int hash = key;
+        int index = (hash & 0x7FFFFFFF) % tab.length;
+        for (Entry e = tab[index]; e != null; e = e.next) {
+            if (e.hash == hash) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * <p>Returns the value to which the specified key is mapped in this map.</p>
+     *
+     * @param   key   a key in the hashtable.
+     * @return  the value to which the key is mapped in this hashtable;
+     *          <code>null</code> if the key is not mapped to any value in
+     *          this hashtable.
+     * @see     #put(int, Object)
+     */
+    public T get(int key) {
+        Entry<T> tab[] = table;
+        int hash = key;
+        int index = (hash & 0x7FFFFFFF) % tab.length;
+        for (Entry<T> e = tab[index]; e != null; e = e.next) {
+            if (e.hash == hash) {
+                return e.value;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * <p>Increases the capacity of and internally reorganizes this
+     * hashtable, in order to accommodate and access its entries more
+     * efficiently.</p>
+     *
+     * <p>This method is called automatically when the number of keys
+     * in the hashtable exceeds this hashtable's capacity and load
+     * factor.</p>
+     */
+    protected void rehash() {
+        int oldCapacity = table.length;
+        Entry<T> oldMap[] = table;
+
+        int newCapacity = oldCapacity * 2 + 1;
+        Entry<T> newMap[] = new Entry[newCapacity];
+
+        threshold = (int) (newCapacity * loadFactor);
+        table = newMap;
+
+        for (int i = oldCapacity; i-- > 0;) {
+            for (Entry<T> old = oldMap[i]; old != null;) {
+                Entry<T> e = old;
+                old = old.next;
+
+                int index = (e.hash & 0x7FFFFFFF) % newCapacity;
+                e.next = newMap[index];
+                newMap[index] = e;
+            }
+        }
+    }
+
+    /**
+     * <p>Maps the specified <code>key</code> to the specified
+     * <code>value</code> in this hashtable. The key cannot be
+     * <code>null</code>. </p>
+     *
+     * <p>The value can be retrieved by calling the <code>get</code> method
+     * with a key that is equal to the original key.</p>
+     *
+     * @param key     the hashtable key.
+     * @param value   the value.
+     * @return the previous value of the specified key in this hashtable,
+     *         or <code>null</code> if it did not have one.
+     * @throws  NullPointerException  if the key is <code>null</code>.
+     * @see     #get(int)
+     */
+    public Object put(int key, T value) {
+            keySet.add(key);
+        // Makes sure the key is not already in the hashtable.
+        Entry<T> tab[] = table;
+        int hash = key;
+        int index = (hash & 0x7FFFFFFF) % tab.length;
+        for (Entry<T> e = tab[index]; e != null; e = e.next) {
+            if (e.hash == hash) {
+                T old = e.value;
+                e.value = value;
+                return old;
+            }
+        }
+
+        if (count >= threshold) {
+            // Rehash the table if the threshold is exceeded
+            rehash();
+
+            tab = table;
+            index = (hash & 0x7FFFFFFF) % tab.length;
+        }
+
+        // Creates the new entry.
+        Entry<T> e = new Entry<T>(hash, key, value, tab[index]);
+        tab[index] = e;
+        count++;
+        return null;
+    }
+
+    /**
+     * <p>Removes the key (and its corresponding value) from this
+     * hashtable.</p>
+     *
+     * <p>This method does nothing if the key is not present in the
+     * hashtable.</p>
+     *
+     * @param   key   the key that needs to be removed.
+     * @return  the value to which the key had been mapped in this hashtable,
+     *          or <code>null</code> if the key did not have a mapping.
+     */
+    /*public Object remove(int key) {
+        Entry tab[] = table;
+        int hash = key;
+        int index = (hash & 0x7FFFFFFF) % tab.length;
+        for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.next) {
+            if (e.hash == hash) {
+                if (prev != null) {
+                    prev.next = e.next;
+                } else {
+                    tab[index] = e.next;
+                }
+                count--;
+                Object oldValue = e.value;
+                e.value = null;
+                return oldValue;
+            }
+        }
+        return null;
+    }*/
+
+    /**
+     * <p>Clears this hashtable so that it contains no keys.</p>
+     */
+    public synchronized void clear() {
+            keySet.clear();
+        Entry tab[] = table;
+        for (int index = tab.length; --index >= 0;) {
+            tab[index] = null;
+        }
+        count = 0;
+    }
+    
+    public IntSet keySet() {
+            return keySet;
+    }
+    
+    
+    
+}
+
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java
new file mode 100644
index 0000000..70091b8
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntHashSet.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.utils.graphmatching.collections;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * This is currently just a placeholder implementation based onm HashSet<Integer>
+ * an efficient implementation is to store the primitives directly.
+ *
+ * @author reto
+ */
+public class IntHashSet extends HashSet<Integer> implements IntSet {
+
+    @Override
+    public IntIterator intIterator() {
+        final Iterator<Integer> base = iterator();
+        return new IntIterator() {
+
+            @Override
+            public int nextInt() {
+                return base.next();
+            }
+
+            @Override
+            public boolean hasNext() {
+                return base.hasNext();
+            }
+
+            @Override
+            public Integer next() {
+                return base.next();
+            }
+
+            @Override
+            public void remove() {
+                base.remove();
+            }
+        };
+    }
+
+    @Override
+    public void add(int i) {
+        super.add((Integer)i);
+    }
+
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java
new file mode 100644
index 0000000..d298066
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntIterator.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.utils.graphmatching.collections;
+
+import java.util.Iterator;
+
+
+/**
+ * An iterator allowing to iterate over ints, Iterator<Integer> is extended for
+ * compatibility, however accessing nextInt allows faster implementations.
+ *
+ * @author reto
+ */
+public interface IntIterator extends Iterator<Integer> {
+    public int nextInt();
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java
new file mode 100644
index 0000000..b1d6c32
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/collections/IntSet.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.rdf.impl.utils.graphmatching.collections;
+
+import java.util.Set;
+
+/**
+ * A IntSet allows directly adding primitive ints to a set, Set<Integer> is 
+ * extended, but accessingt he respective methods is less efficient.
+ *
+ * @author reto
+ */
+public interface IntSet extends Set<Integer> {
+    /**
+     *
+     * @return an iterator over the primitive int
+     */
+    public IntIterator intIterator();
+    
+    public void add(int i);
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/package-info.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/package-info.java
new file mode 100644
index 0000000..a353062
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/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 Implementation utilities.
+ */
+package org.apache.clerezza.commons.rdf.impl.utils;
\ No newline at end of file
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java
new file mode 100644
index 0000000..96f168b
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraph.java
@@ -0,0 +1,218 @@
+/*
+ * 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.commons.rdf.impl.utils.simple;
+
+import org.apache.clerezza.commons.rdf.impl.utils.AbstractGraph;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+
+/**
+ * For now this is a minimalistic implementation, without any indexes or other
+ * optimizations.
+ *
+ * @author reto
+ */
+public class SimpleGraph extends AbstractGraph {
+
+    final Set<Triple> triples;
+
+    private boolean checkConcurrency = false;
+
+    class SimpleIterator implements Iterator<Triple> {
+
+        private Iterator<Triple> listIter;
+        private boolean isValid = true;
+
+        public SimpleIterator(Iterator<Triple> listIter) {
+            this.listIter = listIter;
+        }
+        private Triple currentNext;
+
+        @Override
+        public boolean hasNext() {
+            checkValidity();
+            return listIter.hasNext();
+        }
+
+        @Override
+        public Triple next() {
+            checkValidity();
+            currentNext = listIter.next();
+            return currentNext;
+        }        
+
+        @Override
+        public void remove() {
+            checkValidity();
+            listIter.remove();
+            triples.remove(currentNext);            
+            invalidateIterators(this);            
+        }
+
+        private void checkValidity() throws ConcurrentModificationException {
+            if (checkConcurrency && !isValid) {
+                throw new ConcurrentModificationException();
+            }
+        }
+
+        private void invalidate() {
+            isValid = false;
+        }
+    }    
+    
+    private final Set<SoftReference<SimpleIterator>> iterators =
+            Collections.synchronizedSet(new HashSet<SoftReference<SimpleIterator>>());
+    
+    /**
+     * Creates an empty SimpleGraph
+     */
+    public SimpleGraph() {
+        triples = Collections.synchronizedSet(new HashSet<Triple>());
+    }
+
+    /**
+     * Creates a SimpleGraph using the passed iterator, the iterator 
+     * is consumed before the constructor returns
+     * 
+     * @param iterator
+     */
+    public SimpleGraph(Iterator<Triple> iterator) {
+        triples = new HashSet<Triple>();
+        while (iterator.hasNext()) {
+            Triple triple = iterator.next();
+            triples.add(triple);
+        }
+    }
+
+    /**
+     * Creates a SimpleGraph for the specified set of triples, 
+     * subsequent modification of baseSet do affect the created instance.
+     * 
+     * @param baseSet
+     */
+    public SimpleGraph(Set<Triple> baseSet) {
+        this.triples = baseSet;
+    }
+
+    /**
+     * Creates a SimpleGraph for the specified collection of triples,
+     * subsequent modification of baseSet do not affect the created instance.
+     *
+     * @param baseSet
+     */
+    public SimpleGraph(Collection<Triple> baseCollection) {
+        this.triples = new HashSet<Triple>(baseCollection);
+    }
+
+    @Override
+    public int performSize() {
+        return triples.size();
+    }
+
+    @Override
+    public Iterator<Triple> performFilter(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) {
+        final List<Triple> tripleList = new ArrayList<Triple>();
+        synchronized (triples) {
+            Iterator<Triple> baseIter = triples.iterator();
+            while (baseIter.hasNext()) {
+                Triple triple = baseIter.next();
+                if ((subject != null)
+                        && (!triple.getSubject().equals(subject))) {
+                    continue;
+                }
+                if ((predicate != null)
+                        && (!triple.getPredicate().equals(predicate))) {
+                    continue;
+                }
+                if ((object != null)
+                        && (!triple.getObject().equals(object))) {
+                    continue;
+                }
+                tripleList.add(triple);
+            }
+
+            final Iterator<Triple> listIter = tripleList.iterator();
+            SimpleIterator resultIter = new SimpleIterator(listIter);
+            if (checkConcurrency) {
+                iterators.add(new SoftReference<SimpleIterator>(resultIter));
+            }
+            return resultIter;
+        }
+    }
+
+
+    @Override
+    public boolean performAdd(Triple e) {
+        boolean modified = triples.add(e);
+        if (modified) {
+            invalidateIterators(null);
+        }
+        return modified;
+    }
+    
+    private void invalidateIterators(SimpleIterator caller) {
+        if (!checkConcurrency) {
+            return;
+        }
+        Set<SoftReference> oldReferences = new HashSet<SoftReference>();
+        synchronized(iterators) {
+            for (SoftReference<SimpleGraph.SimpleIterator> softReference : iterators) {
+                SimpleIterator simpleIterator = softReference.get();
+                if (simpleIterator == null) {
+                    oldReferences.add(softReference);
+                    continue;
+                }
+                if (simpleIterator != caller) {
+                    simpleIterator.invalidate();
+                }
+            }
+        }
+        iterators.removeAll(oldReferences);
+    }
+
+    /**
+     * Specifies whether or not to throw <code>ConcurrentModificationException</code>s,
+     * if this simple triple collection is modified concurrently. Concurrency
+     * check is set to false by default.
+     *
+     * @param bool Specifies whether or not to check concurrent modifications.
+     */
+    public void setCheckConcurrency(boolean bool) {
+        checkConcurrency = bool;
+    }
+    
+    
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return new SimpleImmutableGraph(this);
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java
new file mode 100644
index 0000000..4cb3390
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleImmutableGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.commons.rdf.impl.utils.simple;
+
+import org.apache.clerezza.commons.rdf.impl.utils.AbstractImmutableGraph;
+import java.util.Iterator;
+
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+
+/**
+ *
+ * @author reto
+ */
+public class SimpleImmutableGraph extends AbstractImmutableGraph {
+
+    private Graph graph;
+    
+    /**
+     * Creates a ImmutableGraph with the triples in Graph
+     * 
+     * @param Graph the collection of triples this ImmutableGraph shall consist of
+     */
+    public SimpleImmutableGraph(Graph Graph) {
+        this.graph = new SimpleGraph(Graph.iterator());
+    }
+
+    /**
+     * Creates a ImmutableGraph with the triples in Graph.
+     *
+     * This construction allows to specify if the Graph might change
+     * in future. If GraphWillNeverChange is set to true it will
+     * assume that the collection never changes, in this case the collection
+     * isn't copied making things more efficient.
+     *
+     * @param Graph the collection of triples this ImmutableGraph shall consist of
+     * @param GraphWillNeverChange true if the caller promises Graph will never change
+     */
+    public SimpleImmutableGraph(Graph Graph, boolean GraphWillNeverChange) {
+        if (!GraphWillNeverChange) {
+            this.graph = new SimpleGraph(Graph.iterator());
+        } else {
+            this.graph = Graph;
+        }
+    }
+    
+    public SimpleImmutableGraph(Iterator<Triple> tripleIter) {
+        this.graph = new SimpleGraph(tripleIter);
+    }
+
+    @Override
+    public int performSize() {
+        return graph.size();
+    }
+
+    @Override
+    public Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return graph.filter(subject, predicate, object);
+    }
+}
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.java
new file mode 100644
index 0000000..1c00cdd
--- /dev/null
+++ b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleMGraph.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.clerezza.commons.rdf.impl.utils.simple;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.Triple;
+
+/**
+ *
+ * @deprecated Use SimpleGraph
+ * @author reto
+ */
+@Deprecated
+public class SimpleMGraph extends SimpleGraph implements Graph {
+
+    /**
+     * Creates an empty SimpleMGraph
+     */
+    public SimpleMGraph() {
+    }
+
+    public SimpleMGraph(Set<Triple> baseSet) {
+        super(baseSet);
+    }
+
+    public SimpleMGraph(Collection<Triple> baseCollection) {
+        super(baseCollection);
+    }
+
+    public SimpleMGraph(Iterator<Triple> iterator) {
+        super(iterator);
+    }
+
+}
+
+    
\ No newline at end of file
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java
new file mode 100644
index 0000000..24b92c5
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/GraphMatcherTest.java
@@ -0,0 +1,211 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.GraphMatcher;
+import java.util.Map;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class GraphMatcherTest {
+
+    final static IRI u1 = new IRI("http://example.org/u1");
+
+    @Test
+    public void testEmpty() {
+        Graph tc1 = new SimpleMGraph();
+        Graph tc2 = new SimpleMGraph();
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(0, mapping.size());
+    }
+
+    @Test
+    public void test2() {
+        Graph tc1 = new SimpleMGraph();
+        tc1.add(new TripleImpl(u1, u1, u1));
+        Graph tc2 = new SimpleMGraph();
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNull(mapping);
+    }
+
+    @Test
+    public void test3() {
+        Graph tc1 = new SimpleMGraph();
+        tc1.add(new TripleImpl(u1, u1, u1));
+        Graph tc2 = new SimpleMGraph();
+        tc2.add(new TripleImpl(u1, u1, u1));
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(0, mapping.size());
+    }
+
+    @Test
+    public void test4() {
+        Graph tc1 = new SimpleMGraph();
+        tc1.add(new TripleImpl(u1, u1, new BlankNode()));
+        Graph tc2 = new SimpleMGraph();
+        tc2.add(new TripleImpl(u1, u1, new BlankNode()));
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(1, mapping.size());
+    }
+
+    @Test
+    public void test5() {
+        Graph tc1 = new SimpleMGraph();
+        tc1.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
+        Graph tc2 = new SimpleMGraph();
+        tc2.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(2, mapping.size());
+    }
+
+    @Test
+    public void test6() {
+        Graph tc1 = new SimpleMGraph();
+        final BlankNode b11 = new BlankNode();
+        tc1.add(new TripleImpl(new BlankNode(), u1,b11));
+        tc1.add(new TripleImpl(new BlankNode(), u1,b11));
+        Graph tc2 = new SimpleMGraph();
+        tc2.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNull(mapping);
+    }
+
+    private Graph generateCircle(int size) {
+        return generateCircle(size, new BlankNode());
+    }
+
+    private Graph generateCircle(int size, final BlankNodeOrIRI firstNode) {
+        if (size < 1) {
+            throw new IllegalArgumentException();
+        }
+        Graph result = new SimpleMGraph();
+        BlankNodeOrIRI lastNode = firstNode;
+        for (int i = 0; i < (size-1); i++) {
+            final BlankNode newNode = new BlankNode();
+            result.add(new TripleImpl(lastNode, u1, newNode));
+            lastNode = newNode;
+        }
+        result.add(new TripleImpl(lastNode, u1, firstNode));
+        return result;
+    }
+
+    @Test
+    public void test7() {
+        Graph tc1 = generateCircle(2);
+        Graph tc2 = generateCircle(2);
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(2, mapping.size());
+    }
+
+    @Test
+    public void test8() {
+        Graph tc1 = generateCircle(5);
+        Graph tc2 = generateCircle(5);
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(5, mapping.size());
+    }
+
+    @Test
+    public void test9() {
+        BlankNodeOrIRI crossing = new IRI("http://example.org/");
+        Graph tc1 = generateCircle(2,crossing);
+        tc1.addAll(generateCircle(3,crossing));
+        Graph tc2 = generateCircle(2,crossing);
+        tc2.addAll(generateCircle(3,crossing));
+        Assert.assertEquals(5, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        //a circle of 2 with 1 bnode and one of 2 bnodes
+        Assert.assertEquals(3, mapping.size());
+    }
+
+    @Test
+    public void test10() {
+        BlankNodeOrIRI crossing1 = new BlankNode();
+        Graph tc1 = generateCircle(2,crossing1);
+        tc1.addAll(generateCircle(3,crossing1));
+        BlankNodeOrIRI crossing2 = new BlankNode();
+        Graph tc2 = generateCircle(2,crossing2);
+        tc2.addAll(generateCircle(3,crossing2));
+        Assert.assertEquals(5, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        //a circle of 2 and one of 3 with one common node
+        Assert.assertEquals(4, mapping.size());
+    }
+
+    @Test
+    public void test11() {
+        BlankNodeOrIRI crossing1 = new BlankNode();
+        Graph tc1 = generateCircle(2,crossing1);
+        tc1.addAll(generateCircle(4,crossing1));
+        BlankNodeOrIRI crossing2 = new BlankNode();
+        Graph tc2 = generateCircle(3,crossing2);
+        tc2.addAll(generateCircle(3,crossing2));
+        Assert.assertEquals(6, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNull(mapping);
+    }
+
+    @Test
+    public void test12() {
+        BlankNodeOrIRI start1 = new BlankNode();
+        Graph tc1 = Utils4Testing.generateLine(4,start1);
+        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        BlankNodeOrIRI start2 = new BlankNode();
+        Graph tc2 = Utils4Testing.generateLine(5,start2);
+        tc2.addAll(Utils4Testing.generateLine(4,start2));
+        Assert.assertEquals(9, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(10, mapping.size());
+    }
+
+    @Test
+    public void test13() {
+        BlankNodeOrIRI start1 = new BlankNode();
+        Graph tc1 = Utils4Testing.generateLine(4,start1);
+        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        BlankNodeOrIRI start2 = new BlankNode();
+        Graph tc2 = Utils4Testing.generateLine(3,start2);
+        tc2.addAll(Utils4Testing.generateLine(3,start2));
+        Assert.assertEquals(9, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
+        Assert.assertNull(mapping);
+    }
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java
new file mode 100644
index 0000000..8acbce5
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/HashMatchingTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+
+import java.util.Map;
+
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class HashMatchingTest {
+
+    @Test
+    public void twoLine() throws GraphNotIsomorphicException {
+        BlankNodeOrIRI start1 = new BlankNode();
+        Graph tc1 = Utils4Testing.generateLine(4,start1);
+        tc1.addAll(Utils4Testing.generateLine(5,start1));
+        BlankNodeOrIRI start2 = new BlankNode();
+        Graph tc2 = Utils4Testing.generateLine(5,start2);
+        tc2.addAll(Utils4Testing.generateLine(4,start2));
+        Assert.assertEquals(9, tc1.size());
+        final Map<BlankNode, BlankNode> mapping = new HashMatching(tc1, tc2).getMatchings();
+        Assert.assertNotNull(mapping);
+        Assert.assertEquals(10, mapping.size());
+    }
+
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java
new file mode 100644
index 0000000..3f61508
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/PermutationIteratorTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.PermutationIterator;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class PermutationIteratorTest {
+
+    @Test
+    public void simple() {
+        List<String> list = new ArrayList<String>();
+        PermutationIterator<String> pi = new PermutationIterator<String>(list);
+        Assert.assertFalse(pi.hasNext());
+    }
+
+    @Test
+    public void lessSimple() {
+        List<String> list = new ArrayList<String>();
+        list.add("Hasan");
+        PermutationIterator<String> pi = new PermutationIterator<String>(list);
+        Assert.assertTrue(pi.hasNext());
+    }
+
+    @Test
+    public void regular() {
+        List<String> list = new ArrayList<String>();
+        list.add("Hasan");
+        list.add("Tsuy");
+        PermutationIterator<String> pi = new PermutationIterator<String>(list);
+        Set<List<String>> permutations = new HashSet<List<String>>();
+        while (pi.hasNext()) {
+            permutations.add(pi.next());
+        }
+        Assert.assertEquals(2, permutations.size());
+    }
+
+    @Test
+    public void extended() {
+        List<String> list = new ArrayList<String>();
+        list.add("Hasan");
+        list.add("Tsuy");
+        list.add("Llena");
+        PermutationIterator<String> pi = new PermutationIterator<String>(list);
+        Set<List<String>> permutations = new HashSet<List<String>>();
+        while (pi.hasNext()) {
+            permutations.add(pi.next());
+        }
+        Assert.assertEquals(6, permutations.size());
+    }
+
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java
new file mode 100644
index 0000000..ca3237c
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/graphmatching/Utils4Testing.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.rdf.impl.utils.graphmatching;
+
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+
+/**
+ *
+ * @author reto
+ */
+public class Utils4Testing {
+
+    static Graph generateLine(int size, final BlankNodeOrIRI firstNode) {
+        if (size < 1) {
+            throw new IllegalArgumentException();
+        }
+        Graph result = new SimpleMGraph();
+        BlankNodeOrIRI lastNode = firstNode;
+        for (int i = 0; i < size; i++) {
+            final BlankNode newNode = new BlankNode();
+            result.add(new TripleImpl(lastNode, u1, newNode));
+            lastNode = newNode;
+        }
+        return result;
+    }
+
+    final static IRI u1 = new IRI("http://example.org/u1");
+
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/PlainLiteralImplTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/PlainLiteralImplTest.java
new file mode 100644
index 0000000..538a16d
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/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.commons.rdf.impl.utils.simple;
+
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.junit.Test;
+
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.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());
+    }
+
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java
new file mode 100644
index 0000000..9c94a8d
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/SimpleGraphTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.commons.rdf.impl.utils.simple;
+
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+
+/**
+ *
+ * @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());
+    }
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java
new file mode 100644
index 0000000..b064a60
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TripleImplTest.java
@@ -0,0 +1,57 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.clerezza.commons.rdf.impl.utils.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.junit.Test;
+import junit.framework.Assert;
+
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+/**
+ *
+ * @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);    
+    }
+
+}
diff --git a/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TypedLiteralImplTest.java b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/TypedLiteralImplTest.java
new file mode 100644
index 0000000..2da82cd
--- /dev/null
+++ b/impl.utils/src/test/java/org/apache/clerezza/commons/rdf/impl/utils/simple/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.commons.rdf.impl.utils.simple;
+
+import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
+import org.junit.Test;
+import junit.framework.Assert;
+
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.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());
+    }
+
+}
diff --git a/pom.xml b/pom.xml
index 78912b2..3635f73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,44 +1,50 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+         !!!!!!                                !!!!!!
+         !!!!!!    This pom is only provided   !!!!!!
+         !!!!!!   for build convenience and    !!!!!!
+         !!!!!!   should not be released       !!!!!!
+         !!!!!!                                !!!!!!
+         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
 
- 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.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
+    
     <parent>
-        <groupId>org.apache</groupId>
-        <artifactId>apache</artifactId>
-        <version>16</version>
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>reactor</artifactId>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7</version>
+        <relativePath />
+     </parent>
+
+    <groupId>org.apache.clerezza.commons-rdf</groupId>
+    <artifactId>clerezza-reactor</artifactId>
     <packaging>pom</packaging>
-    <name>Clerezza</name>
-    <url>http://incubator.apache.org/clerezza/mvn-site/</url>
-    <version>0.4-SNAPSHOT</version>
-    <description>A reactor to build all of clerezza</description>
-    <licenses>
-        <license>
-            <name>The Apache Software License, Version 2.0</name>
-            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-            <distribution>repo</distribution>
-        </license>
-    </licenses>
+    <version>0.3-SNAPSHOT</version>
+    <name>Clerezza - Reactor</name>
+    <description>
+        Apache Commons RDF provides an API modelling the RDF data model as defined by 
+        http://www.w3.org/TR/rdf11-concepts/
+    </description>
+    
+    <url>http://clerezza.apache.org/commons-rdf/</url>
+    
+    <issueManagement>
+        <system>jira</system>
+        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
+    </issueManagement>
+    
+    <inceptionYear>2015</inceptionYear>
+    <scm>
+        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
+        <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
+      <tag>HEAD</tag>
+  </scm>
+
     <modules>
+        <module>api</module>
+        <module>impl.utils</module>
+        <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>
         <module>rdf</module>
@@ -102,171 +108,5 @@
         </profile>
         
     </profiles>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <artifactId>maven-clean-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-install-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-site-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.xsite</groupId>
-                <artifactId>xsite-maven-plugin</artifactId>
-            </plugin>
-            <!-- having this here has the effect that the resources copied by the resources plugin (below) have
-            priority over the remote resources -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-remote-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>process</goal>
-                        </goals>
-                        <configuration>        
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-release-plugin</artifactId>
-                <version>2.5</version>
-                <configuration>
-                    <useReleaseProfile>false</useReleaseProfile>
-                    <goals>deploy</goals>
-                    <arguments>-Papache-release </arguments>
-                </configuration>
-            </plugin>
-        </plugins>
-        <resources>
-            <resource>
-                <targetPath>META-INF</targetPath>
-                <filtering>false</filtering>
-                <directory>${basedir}</directory>
-                <includes>
-                    <include>NOTICE</include>
-                    <include>LICENSE.*</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-            </resource>
-        </resources>
-    </build>
-    <distributionManagement>
-        <!-- where to deploy the web site -->
-        <site>
-            <id>people.apache.org</id>
-            <url>scp://people.apache.org/www/incubator.apache.org/clerezza/mvn-site/</url>
-        </site>
-
-        <!-- where to deploy the artifacts -->
-        <repository>
-            <id>apache.releases.https</id>
-            <name>Apache Release Distribution Repository</name>
-            <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
-        </repository>
-        <snapshotRepository>
-            <id>apache.snapshots.https</id>
-            <name>Apache Development Snapshot Repository</name>
-            <url>https://repository.apache.org/content/repositories/snapshots</url>
-        </snapshotRepository>
-    </distributionManagement>
-
-    <!-- jira -->
-    <issueManagement>
-        <system>Jira</system>
-        <url>https://issues.apache.org/jira/browse/CLEREZZA</url>
-    </issueManagement>
-    <ciManagement>
-        <system>Jenkins</system>
-        <url>https://builds.apache.org/job/clerezza-trunk-1.6/</url>
-    </ciManagement>
-
-
-    <scm>
-        <url>http://git.apache.org/clerezza.git/</url>
-        <connection>scm:git:git://git.apache.org/clerezza.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-      <tag>reactor-0.3</tag>
-  </scm>
-
-    <!-- lets generate reports -->
-    <reporting>
-        <plugins>
-            <!-- javadoc -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <!-- Version 2.6  passes invalid arguments to the wadl doclet -->
-                <version>2.4</version>
-            </plugin>
-
-            <!-- test results -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-report-plugin</artifactId>
-                <version>2.4.2</version>
-            </plugin>
-
-            <!-- pmd reports (potential bugs, suboptimal code, duplicate code) -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-pmd-plugin</artifactId>
-                <version>2.3</version>
-                <configuration>
-                    <targetJdk>1.6</targetJdk>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.clerezza</groupId>
-                <artifactId>maven-jaxrs-report-plugin</artifactId>
-                <version>0.1-incubating</version>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-plugin-plugin</artifactId>
-                <version>2.5.1</version>
-            </plugin>
-            <!--            <plugin>
-                <groupId>org.apache.clerezza</groupId>
-                <artifactId>maven-pladoc-plugin.core</artifactId>
-                <version>0.1</version>
-            </plugin> -->
-        </plugins>
-    </reporting>
+    
 </project>


[clerezza] 37/45: CLEREZZA-1039: Remove obsolete file DISCLAIMER

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 00379c47656c5ee982d7e375f7ef6c74c8e8bf97
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 20:44:55 2019 +0100

    CLEREZZA-1039: Remove obsolete file DISCLAIMER
---
 DISCLAIMER | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/DISCLAIMER b/DISCLAIMER
deleted file mode 100644
index ab24be4..0000000
--- a/DISCLAIMER
+++ /dev/null
@@ -1,11 +0,0 @@
-Apache Clerezza is an effort undergoing incubation at The Apache Software 
-Foundation (ASF), sponsored by the Apache Incubator. 
-
-Incubation is required of all newly accepted projects until a further 
-review indicates that the infrastructure, communications, and decision 
-making process have stabilized in a manner consistent with other 
-successful ASF projects. 
-
-While incubation status is not necessarily a reflection of the 
-completeness or stability of the code, it does indicate that the 
-project has yet to be fully endorsed by the ASF.


[clerezza] 45/45: Reapply commit ab278b609cfe1fee9704abb563679ae952bcc47f

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit cf3d51f26d533e9556641cab7881d79afddacd90
Author: Hasan <ha...@apache.org>
AuthorDate: Sat May 11 21:37:37 2019 +0200

    Reapply commit ab278b609cfe1fee9704abb563679ae952bcc47f
---
 .../src/main/java/org/apache/clerezza/test/utils/RandomGraph.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java
index d028594..a34a8b9 100644
--- a/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/RandomGraph.java
@@ -172,7 +172,7 @@ public class RandomGraph extends GraphWrapper {
     }
 
     private static int rollDice(int faces) {
-        return Double.valueOf(Math.random() * faces).intValue();
+        return (int) (Math.random() * faces);
     }
 
     private RDFTerm createRandomRDFTerm() {


[clerezza] 19/45: CLEREZZA-1035: Add module test.utils in reactor pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 2cd406bbb15fa0556875012add6975f6b4473662
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Feb 6 21:43:27 2019 +0100

    CLEREZZA-1035: Add module test.utils in reactor pom.xml
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index 6262f90..9e0dc55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
         <module>sparql</module>
         <module>representation</module>
         <module>dataset</module>
+        <module>test.utils</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>


[clerezza] 33/45: CLEREZZA-1038: Move scala.utils from rdf module into api.utils module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 80ad0d3c88ca8ce31978443c57fbdbbba5616292
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Feb 13 21:21:03 2019 +0100

    CLEREZZA-1038: Move scala.utils from rdf module into api.utils module
---
 api.utils/pom.xml                                  |  72 +++++-
 .../org/apache/clerezza/api/utils/GraphNode.java   |  32 +--
 .../org/apache/clerezza/api/utils/GraphUtils.java  |  15 +-
 .../org/apache/clerezza/api/utils/IRIUtil.java     |   8 +-
 .../org/apache/clerezza/api/utils/RdfList.java     |  37 ++--
 .../apache/clerezza/api/utils/SeeAlsoExpander.java |  12 +-
 .../org/apache/clerezza/api/utils/Smusher.java     |  11 +-
 .../org/apache/clerezza/api/utils/UnionGraph.java  |   8 +-
 .../clerezza/api/utils/UnionWatchableGraph.java    |  15 +-
 .../clerezza/api/utils/UriMutatingGraph.java       |  22 +-
 .../utils/graphnodeprovider/GraphNodeProvider.java |   4 +-
 .../clerezza/api/utils/smushing/BaseSmusher.java   |  30 ++-
 .../clerezza/api/utils/smushing/IfpSmusher.java    |  17 +-
 .../clerezza/api/utils/smushing/SameAsSmusher.java |  64 +++---
 .../clerezza/api/scala/utils/CollectedIter.scala   | 132 +++++++++++
 .../clerezza/api/scala/utils/EzLiteral.scala       |  74 +++++++
 .../apache/clerezza/api/scala/utils/EzMGraph.scala |  79 +++++++
 .../clerezza/api/scala/utils/NameSpace.scala       |  36 +++
 .../apache/clerezza/api/scala/utils/Preamble.scala | 117 ++++++++++
 .../clerezza/api/scala/utils/RichGraphNode.scala   | 242 +++++++++++++++++++++
 .../apache/clerezza/api/utils/GraphUtilsTest.java  |  13 +-
 .../apache/clerezza/api/utils/IfpSmushTest.java    |  15 +-
 .../org/apache/clerezza/api/utils/RdfListTest.java |  23 +-
 .../apache/clerezza/api/utils/SameAsSmushTest.java |  13 +-
 .../apache/clerezza/api/utils/TestGraphNode.java   |  43 ++--
 .../apache/clerezza/api/utils/UnionGraphTest.java  |   4 +-
 .../api/utils/smushing/SameAsSmushTest.java        |  17 +-
 .../clerezza/api/scala/utils/EzMGraphTest.scala    | 159 ++++++++++++++
 .../api/scala/utils/RichGraphNodeTest.scala        | 169 ++++++++++++++
 .../api/scala/utils/TypeConversionTest.scala       |  70 ++++++
 30 files changed, 1337 insertions(+), 216 deletions(-)

diff --git a/api.utils/pom.xml b/api.utils/pom.xml
index e67e3be..1b31090 100644
--- a/api.utils/pom.xml
+++ b/api.utils/pom.xml
@@ -16,7 +16,6 @@
   either  express  or implied.  See  the License  for  the  specific
   language governing permissions and limitations under  the License.
 -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -33,6 +32,7 @@
     <version>8-SNAPSHOT</version>
     <name>Clerezza - API Utilities</name>
     <description>Utility classes to work with Clerezza API</description>
+
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -70,6 +70,74 @@
             <version>8-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-library</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
     </dependencies>
 
-</project>
\ No newline at end of file
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>net.alchim31.maven</groupId>
+                    <artifactId>scala-maven-plugin</artifactId>
+                    <version>3.4.6</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>net.alchim31.maven</groupId>
+                <artifactId>scala-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>scala-compile-first</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>scala-test-compile</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java
index bedf30d..2a80559 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphNode.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.*;
@@ -32,8 +31,8 @@ import java.util.concurrent.locks.Lock;
  * modifying the graph will throw an {@link UnsupportedOperationException}
  * it the underlying Graph in immutable (i.e. is a {@link ImmutableGraph}.
  *
- * @since 0.2
  * @author reto, mir
+ * @since 0.2
  */
 public class GraphNode {
 
@@ -44,7 +43,7 @@ public class GraphNode {
      * Create a GraphNode representing resource within graph.
      *
      * @param resource the resource this GraphNode represents
-     * @param graph the Graph that describes the resource
+     * @param graph    the Graph that describes the resource
      */
     public GraphNode(RDFTerm resource, Graph graph) {
         if (resource == null) {
@@ -77,6 +76,7 @@ public class GraphNode {
 
     /**
      * Deletes the context of a node
+     *
      * @see getNodeContext()
      */
     public void deleteNodeContext() {
@@ -89,7 +89,7 @@ public class GraphNode {
      * The context of a node are the triples containing a node
      * as subject or object and recursively the context of the b-nodes in any
      * of these statements.
-     *
+     * <p>
      * The triples in the ImmutableGraph returned by this method contain the same bnode
      * instances as in the original graph.
      *
@@ -112,7 +112,7 @@ public class GraphNode {
     }
 
     private Graph getContextOf(IRI node, final Set<RDFTerm> dontExpand) {
-        final String uriPrefix = node.getUnicodeString()+'#';
+        final String uriPrefix = node.getUnicodeString() + '#';
         return getContextOf(node, dontExpand, new Acceptor() {
 
             @Override
@@ -121,7 +121,7 @@ public class GraphNode {
                     return true;
                 }
                 if (resource instanceof IRI) {
-                    return ((IRI)resource).getUnicodeString().startsWith(uriPrefix);
+                    return ((IRI) resource).getUnicodeString().startsWith(uriPrefix);
                 }
                 return false;
             }
@@ -133,7 +133,7 @@ public class GraphNode {
      *
      * @param node
      * @param dontExpand a list of bnodes at which to stop expansion, if node
-     * is a BlankNode it should be contained (potentially faster)
+     *                   is a BlankNode it should be contained (potentially faster)
      * @return the context of a node
      */
     private Graph getContextOf(RDFTerm node, final Set<RDFTerm> dontExpand) {
@@ -152,6 +152,7 @@ public class GraphNode {
     private interface Acceptor {
         boolean expand(RDFTerm resource);
     }
+
     private Graph getContextOf(RDFTerm node, final Set<RDFTerm> dontExpand, Acceptor acceptor) {
         Graph result = new SimpleGraph();
         if (node instanceof BlankNodeOrIRI) {
@@ -255,7 +256,7 @@ public class GraphNode {
      *
      * @param property the property to be examined
      * @return the number of triples in the underlying triple-collection
-     *        which meet the specified condition
+     * which meet the specified condition
      */
     public int countObjects(IRI property) {
         return countTriples(graph.filter((BlankNodeOrIRI) resource, property, null));
@@ -331,7 +332,7 @@ public class GraphNode {
      * @param property
      * @param object
      * @return true if the node represented by this object is the subject of a
-     *         statement with the given prediate and object, false otherwise
+     * statement with the given prediate and object, false otherwise
      */
     public boolean hasProperty(IRI property, RDFTerm object) {
         Lock l = readLock();
@@ -358,7 +359,7 @@ public class GraphNode {
      *
      * @param property the property to be examined
      * @return the number of triples in the underlying triple-collection
-     *        which meet the specified condition
+     * which meet the specified condition
      */
     public int countSubjects(IRI property) {
         Lock l = readLock();
@@ -448,7 +449,6 @@ public class GraphNode {
     }
 
     /**
-     *
      * @param triples
      * @returnan {@link Iterator}<{@link IRI}> containing the predicates from
      * an {@link Iterator}<{@link Triple}>
@@ -481,7 +481,7 @@ public class GraphNode {
      * specified property
      *
      * @param property the predicate of the triple to be created
-     * @param value the value of the typed literal object
+     * @param value    the value of the typed literal object
      */
     public void addPropertyValue(IRI property, Object value) {
         addProperty(property,
@@ -558,6 +558,7 @@ public class GraphNode {
     /**
      * Replaces the graph node resouce with the specified <code>BlankNodeOrIRI</code>.
      * The resource is only replaced where it is either subject or object.
+     *
      * @param replacement
      * @return a GraphNode representing the replecement node
      */
@@ -569,6 +570,7 @@ public class GraphNode {
      * Replaces the graph node resouce with the specified <code>BlankNodeOrIRI</code>.
      * Over the boolean <code>checkPredicate</code> it can be specified if the
      * resource should also be replaced where it is used as predicate.
+     *
      * @param replacement
      * @param checkPredicates
      * @return a GraphNode representing the replecement node
@@ -679,7 +681,6 @@ public class GraphNode {
     }
 
     /**
-     *
      * @param obj
      * @return true if obj is an instance of the same class represening the same
      * node in the same graph, subclasses may have different identity criteria.
@@ -704,17 +705,16 @@ public class GraphNode {
      */
     public Lock readLock() {
 
-            return getGraph().getLock().readLock();
+        return getGraph().getLock().readLock();
 
     }
 
     /**
-     *
      * @return
      */
     public Lock writeLock() {
 
-            return (getGraph()).getLock().writeLock();
+        return (getGraph()).getLock().writeLock();
 
     }
 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java
index 51e25b1..a8b3a3f 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/GraphUtils.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.*;
@@ -61,7 +60,8 @@ public class GraphUtils {
         }
 
         //we first remove the context of bnodes we find in object position
-        OBJ_BNODE_LOOP: while (true) {
+        OBJ_BNODE_LOOP:
+        while (true) {
             final Triple triple = getTripleWithBlankNodeObject(unGroundedTriples);
             if (triple == null) {
                 break;
@@ -73,7 +73,7 @@ public class GraphUtils {
             while (potentialIter.hasNext()) {
                 try {
                     final Triple potentialTriple = potentialIter.next();
-                    BlankNode potentialMatch = (BlankNode)potentialTriple.getObject();
+                    BlankNode potentialMatch = (BlankNode) potentialTriple.getObject();
                     final ImmutableGraph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
                     if (potentialContext.equals(context)) {
                         removingTriples.addAll(potentialContext);
@@ -86,7 +86,8 @@ public class GraphUtils {
             }
             throw new NoSuchSubGraphException();
         }
-        SUBJ_BNODE_LOOP: while (true) {
+        SUBJ_BNODE_LOOP:
+        while (true) {
             final Triple triple = getTripleWithBlankNodeSubject(unGroundedTriples);
             if (triple == null) {
                 break;
@@ -101,7 +102,7 @@ public class GraphUtils {
             while (potentialIter.hasNext()) {
                 try {
                     final Triple potentialTriple = potentialIter.next();
-                    BlankNode potentialMatch = (BlankNode)potentialTriple.getSubject();
+                    BlankNode potentialMatch = (BlankNode) potentialTriple.getSubject();
                     final ImmutableGraph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
                     if (potentialContext.equals(context)) {
                         removingTriples.addAll(potentialContext);
@@ -127,7 +128,8 @@ public class GraphUtils {
         return true;
     }
 
-    /** retrun triples with a bnode only at object position
+    /**
+     * retrun triples with a bnode only at object position
      *
      * @param triples
      * @return
@@ -143,6 +145,7 @@ public class GraphUtils {
         }
         return null;
     }
+
     private static Triple getTripleWithBlankNodeSubject(Graph triples) {
         for (Triple triple : triples) {
             if (triple.getSubject() instanceof BlankNode) {
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java
index e233052..64b45dd 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/IRIUtil.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 /**
@@ -27,13 +26,12 @@ public class IRIUtil {
 
     /**
      * Strips #x00 - #x1F and #x7F-#x9F from a Unicode string
-     * @see <a href="http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference">
-     * http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference</a> and
-     * replaces all US-ASCII space character with a "+".
      *
      * @param inputChars
      * @return the stripped string
-     * 
+     * @see <a href="http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference">
+     * http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference</a> and
+     * replaces all US-ASCII space character with a "+".
      */
     public static String stripNonIRIChars(CharSequence inputChars) {
 
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java
index e3bdc34..01b3d48 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/RdfList.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.*;
@@ -63,7 +62,7 @@ public class RdfList extends AbstractList<RDFTerm> {
 
     /**
      * Get a list for the specified resource.
-     *
+     * <p>
      * If the list is modified using the created instance
      * <code>listRDFTerm</code> will always be the first list.
      *
@@ -73,7 +72,6 @@ public class RdfList extends AbstractList<RDFTerm> {
     public RdfList(BlankNodeOrIRI listRDFTerm, Graph tc) {
         firstList = listRDFTerm;
         this.tc = tc;
-
     }
 
     /**
@@ -82,7 +80,7 @@ public class RdfList extends AbstractList<RDFTerm> {
      * @param listNode
      */
     public RdfList(GraphNode listNode) {
-        this((BlankNodeOrIRI)listNode.getNode(), listNode.getGraph());
+        this((BlankNodeOrIRI) listNode.getNode(), listNode.getGraph());
     }
 
     /**
@@ -91,9 +89,8 @@ public class RdfList extends AbstractList<RDFTerm> {
      *
      * @param listRDFTerm
      * @param tc
-     * @return    an empty rdf:List.
-     * @throws IllegalArgumentException
-     *        if the provided {@code  listRDFTerm} is a non-empty rdf:List.
+     * @return an empty rdf:List.
+     * @throws IllegalArgumentException if the provided {@code  listRDFTerm} is a non-empty rdf:List.
      */
     public static RdfList createEmptyList(BlankNodeOrIRI listRDFTerm, Graph tc)
             throws IllegalArgumentException {
@@ -113,7 +110,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         }
         BlankNodeOrIRI currentList;
         if (listList.size() > 0) {
-            currentList = listList.get(listList.size()-1);
+            currentList = listList.get(listList.size() - 1);
         } else {
             currentList = firstList;
             if (!tc.filter(currentList, RDF.first, null).hasNext()) {
@@ -125,7 +122,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         if (listList.size() >= pos) {
             return;
         }
-        while (true) {                
+        while (true) {
             currentList = getRest(currentList);
             if (currentList.equals(RDF_NIL)) {
                 totallyExpanded = true;
@@ -140,7 +137,6 @@ public class RdfList extends AbstractList<RDFTerm> {
     }
 
 
-
     @Override
     public RDFTerm get(int index) {
         expandTill(index + 1);
@@ -149,7 +145,7 @@ public class RdfList extends AbstractList<RDFTerm> {
 
     @Override
     public int size() {
-        expandTill(Integer.MAX_VALUE);        
+        expandTill(Integer.MAX_VALUE);
         return valueList.size();
     }
 
@@ -173,14 +169,13 @@ public class RdfList extends AbstractList<RDFTerm> {
         }
         valueList.add(index, element);
     }
-    
+
     /**
-     *
-     * @param index is > 0
+     * @param index   is > 0
      * @param element
      */
     private void addInRdfList(int index, RDFTerm element) {
-        expandTill(index+1);
+        expandTill(index + 1);
         BlankNodeOrIRI newList = new BlankNode() {
         };
         tc.add(new TripleImpl(newList, RDF.first, element));
@@ -201,7 +196,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         //keeping the first list resource
         tc.remove(new TripleImpl(listList.get(index), RDF.first, valueList.get(index)));
         if (index == (listList.size() - 1)) {
-            tc.remove(new TripleImpl(listList.get(index), RDF.rest, RDF_NIL));    
+            tc.remove(new TripleImpl(listList.get(index), RDF.rest, RDF_NIL));
             if (index > 0) {
                 tc.remove(new TripleImpl(listList.get(index - 1), RDF.rest, listList.get(index)));
                 tc.add(new TripleImpl(listList.get(index - 1), RDF.rest, RDF_NIL));
@@ -210,7 +205,7 @@ public class RdfList extends AbstractList<RDFTerm> {
             }
             listList.remove(index);
         } else {
-            tc.add(new TripleImpl(listList.get(index), RDF.first, valueList.get(index+1)));
+            tc.add(new TripleImpl(listList.get(index), RDF.first, valueList.get(index + 1)));
             tc.remove(new TripleImpl(listList.get(index), RDF.rest, listList.get(index + 1)));
             tc.remove(new TripleImpl(listList.get(index + 1), RDF.first, valueList.get(index + 1)));
             if (index == (listList.size() - 2)) {
@@ -220,7 +215,7 @@ public class RdfList extends AbstractList<RDFTerm> {
                 tc.remove(new TripleImpl(listList.get(index + 1), RDF.rest, listList.get(index + 2)));
                 tc.add(new TripleImpl(listList.get(index), RDF.rest, listList.get(index + 2)));
             }
-            listList.remove(index+1);
+            listList.remove(index + 1);
         }
         return valueList.remove(index);
     }
@@ -235,7 +230,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         } catch (final NullPointerException e) {
             RuntimeException runtimeEx = AccessController.doPrivileged(new PrivilegedAction<RuntimeException>() {
                 @Override
-                public RuntimeException run(){
+                public RuntimeException run() {
                     try {
                         final FileOutputStream fileOutputStream = new FileOutputStream("/tmp/broken-list.nt");
                         final GraphNode graphNode = new GraphNode(listRDFTerm, tc);
@@ -301,7 +296,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         }
 
         Set<RdfList> rdfLists = new HashSet<RdfList>();
-        for (Iterator<GraphNode> it = listNodes.iterator(); it.hasNext();) {
+        for (Iterator<GraphNode> it = listNodes.iterator(); it.hasNext(); ) {
             GraphNode listNode = it.next();
             rdfLists.add(new RdfList(listNode));
         }
@@ -328,7 +323,7 @@ public class RdfList extends AbstractList<RDFTerm> {
         }
         return listNodes;
     }
-    
+
     private static Set<GraphNode> findAllListNodes(GraphNode listPart) {
         Iterator<GraphNode> invRestNodesIter;
         Set<GraphNode> listNodes = new HashSet<GraphNode>();
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java
index 2cf73cd..0bc9026 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/SeeAlsoExpander.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.Graph;
@@ -40,9 +39,9 @@ public class SeeAlsoExpander {
      * using TcManger instead of TcProvider as this ensures LockableGraphs
      */
     private final TcManager tcManager;
+
     public SeeAlsoExpander(TcManager tcManager) {
         this.tcManager = tcManager;
-
     }
 
     /**
@@ -51,7 +50,7 @@ public class SeeAlsoExpander {
      * also associate rdfs:seeAlso properties to node this are expanded till
      * the maximum recursion depth specified.
      *
-     * @param node the node to be expanded
+     * @param node      the node to be expanded
      * @param recursion the maximum recursion depth
      * @return a new GraphNode over the union of the original and all expansion graphs
      */
@@ -68,8 +67,7 @@ public class SeeAlsoExpander {
         }
         return new GraphNode(node.getNode(),
                 new UnionGraph(resultTripleCollections.toArray(
-                new Graph[resultTripleCollections.size()])));
-
+                        new Graph[resultTripleCollections.size()])));
     }
 
     private Set<IRI> getSeeAlsoObjectUris(GraphNode node) {
@@ -81,7 +79,7 @@ public class SeeAlsoExpander {
             while (objects.hasNext()) {
                 RDFTerm next = objects.next();
                 if (next instanceof IRI) {
-                    result.add((IRI)next);
+                    result.add((IRI) next);
                 }
             }
         } finally {
@@ -101,7 +99,7 @@ public class SeeAlsoExpander {
             for (IRI target : rdfSeeAlsoTargets) {
                 try {
                     result.addAll(expand(new GraphNode(node.getNode(),
-                        tcManager.getGraph(target)), alreadyVisited, recursion));
+                            tcManager.getGraph(target)), alreadyVisited, recursion));
                 } catch (NoSuchEntityException e) {
                     //ignore
                 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java
index 1dbb8f2..64700ab 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/Smusher.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.Graph;
@@ -25,9 +24,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * A utility to smush equivalent resources. For greater flexibility use the 
+ * A utility to smush equivalent resources. For greater flexibility use the
  * classes in the smushing package.
- * 
+ *
  * @author reto
  */
 public class Smusher {
@@ -49,13 +48,11 @@ public class Smusher {
 
     /**
      * Smushes the specified graph adding owl:sameAs statements pointing to the new canonical IRI
-     * 
+     *
      * @param mGraph
-     * @param owlSameStatements 
+     * @param owlSameStatements
      */
     public static void sameAsSmush(Graph mGraph, Graph owlSameStatements) {
         new SameAsSmusher().smush(mGraph, owlSameStatements, true);
     }
-
-
 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java
index 3f939ce..c632765 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionGraph.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.*;
@@ -28,7 +27,6 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 
 /**
- *
  * This class represents the union of multiple triple collections. A UnionGraph
  * appears like a merge of the different graphs (see.
  * http://www.w3.org/TR/rdf-mt/#graphdefs).
@@ -64,7 +62,7 @@ public class UnionGraph extends AbstractGraph {
 
     @Override
     public Iterator<Triple> performFilter(final BlankNodeOrIRI subject,
-            final IRI predicate, final RDFTerm object) {
+                                          final IRI predicate, final RDFTerm object) {
         if (baseTripleCollections.length == 0) {
             return new HashSet<Triple>(0).iterator();
         }
@@ -152,6 +150,7 @@ public class UnionGraph extends AbstractGraph {
     public ReadWriteLock getLock() {
         return readWriteLock;
     }
+
     private ReadWriteLock readWriteLock = new ReadWriteLock() {
 
         @Override
@@ -185,9 +184,6 @@ public class UnionGraph extends AbstractGraph {
 
     }
 
-    ;
-
-
     private static class UnionLock implements Lock {
 
         Lock[] locks;
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java
index 81b2dbf..12e660a 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UnionWatchableGraph.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.Graph;
@@ -24,34 +23,32 @@ import org.apache.clerezza.api.event.FilterTriple;
 import org.apache.clerezza.api.event.GraphListener;
 
 /**
- *
  * @author developer
  */
 public class UnionWatchableGraph extends UnionGraph implements WatchableGraph {
-    
+
     public UnionWatchableGraph(WatchableGraph... baseTripleCollections) {
         super(baseTripleCollections);
     }
-        @Override
+
+    @Override
     public void addGraphListener(GraphListener listener, FilterTriple filter) {
         for (Graph graph : baseTripleCollections) {
-            ((WatchableGraph)graph).addGraphListener(listener, filter);
+            ((WatchableGraph) graph).addGraphListener(listener, filter);
         }
     }
 
     @Override
     public void addGraphListener(GraphListener listener, FilterTriple filter, long delay) {
         for (Graph graph : baseTripleCollections) {
-            ((WatchableGraph)graph).addGraphListener(listener, filter, delay);
+            ((WatchableGraph) graph).addGraphListener(listener, filter, delay);
         }
     }
 
     @Override
     public void removeGraphListener(GraphListener listener) {
         for (Graph graph : baseTripleCollections) {
-            ((WatchableGraph)graph).removeGraphListener(listener);
+            ((WatchableGraph) graph).removeGraphListener(listener);
         }
     }
-
-    
 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java
index 0c6871c..4233ea7 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/UriMutatingGraph.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.*;
@@ -29,7 +28,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 /**
  * This wrapps a Triplecollection changing a prefix for the IRIs contained
  * in subject or object position.
- *
+ * <p>
  * Currently it only supports read opearations.
  *
  * @author reto
@@ -43,12 +42,12 @@ public class UriMutatingGraph implements Graph {
     private final int targetPrefixLength;
 
     public UriMutatingGraph(Graph base, String sourcePrefix,
-            String targetPrefix) {
+                            String targetPrefix) {
         this.base = base;
         this.sourcePrefix = sourcePrefix;
-        sourcePrefixLength= sourcePrefix.length();
+        sourcePrefixLength = sourcePrefix.length();
         this.targetPrefix = targetPrefix;
-        targetPrefixLength= targetPrefix.length();
+        targetPrefixLength = targetPrefix.length();
     }
 
     private <R extends RDFTerm> R toTargetRDFTerm(final R sourceRDFTerm) {
@@ -57,10 +56,10 @@ public class UriMutatingGraph implements Graph {
             if (sourceIRI.getUnicodeString().startsWith(sourcePrefix)) {
                 final String uriRest = sourceIRI.getUnicodeString()
                         .substring(sourcePrefixLength);
-                return (R) new IRI(targetPrefix+uriRest);
+                return (R) new IRI(targetPrefix + uriRest);
             }
         }
-        return sourceRDFTerm;            
+        return sourceRDFTerm;
     }
 
     private Triple toTargetTriple(Triple triple) {
@@ -77,7 +76,7 @@ public class UriMutatingGraph implements Graph {
             if (sourceIRI.getUnicodeString().startsWith(targetPrefix)) {
                 final String uriRest = sourceIRI.getUnicodeString()
                         .substring(targetPrefixLength);
-                return (R) new IRI(sourcePrefix+uriRest);
+                return (R) new IRI(sourcePrefix + uriRest);
             }
         }
         return targetRDFTerm;
@@ -96,11 +95,8 @@ public class UriMutatingGraph implements Graph {
         final Iterator<Triple> baseIter = base.filter(toSourceRDFTerm(subject),
                 predicate, toSourceRDFTerm(object));
         return new WrappedIteraror(baseIter);
-
-
     }
 
-
     @Override
     public int size() {
         return base.size();
@@ -113,7 +109,7 @@ public class UriMutatingGraph implements Graph {
 
     @Override
     public boolean contains(Object o) {
-        return base.contains(toSourceTriple((Triple)o));
+        return base.contains(toSourceTriple((Triple) o));
     }
 
     @Override
@@ -191,7 +187,7 @@ public class UriMutatingGraph implements Graph {
         return base.getLock();
     }
 
-    class WrappedIteraror implements Iterator<Triple>{
+    class WrappedIteraror implements Iterator<Triple> {
         private final Iterator<Triple> baseIter;
 
         private WrappedIteraror(Iterator<Triple> baseIter) {
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java
index f72106d..3bd8f54 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/graphnodeprovider/GraphNodeProvider.java
@@ -39,8 +39,8 @@ public interface GraphNodeProvider {
     /**
      * Get a GraphNode for the specified resource, The resource is assumed to be
      * local, i.e. the method behaves like get(IRI) for a Uri with an
- authority section contained in the Set retuned by
- <code>org.apache.clerezza.platform.config.PlatformConfig#getBaseUris()</code>
+     * authority section contained in the Set retuned by
+     * <code>org.apache.clerezza.platform.config.PlatformConfig#getBaseUris()</code>
      */
     GraphNode getLocal(IRI uriRef);
 
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java
index 569e638..6785ae1 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/BaseSmusher.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils.smushing;
 
 import org.apache.clerezza.api.*;
@@ -27,7 +26,6 @@ import java.util.*;
 import java.util.concurrent.locks.Lock;
 
 /**
- *
  * @author Reto
  */
 public class BaseSmusher {
@@ -35,14 +33,14 @@ public class BaseSmusher {
     /**
      * Smushes the resources in mGraph that belong to the same set in equivalenceSets,
      * i.e. it adds all properties to one of the resources in the equivalence set.
-     * 
-     * Optionally owl:sameAs statement are added that point from the IRIs that 
+     * <p>
+     * Optionally owl:sameAs statement are added that point from the IRIs that
      * no longer have properties to the one with properties. If addOwlSameAs
      * is false the IRIs will just disappear from the graph.
-     * 
-     * @param mGraph the graph to smush
+     *
+     * @param mGraph          the graph to smush
      * @param equivalenceSets sets of equivalent resources
-     * @param addOwlSameAs whether owl:sameAs statements should be added
+     * @param addOwlSameAs    whether owl:sameAs statements should be added
      */
     public void smush(Graph mGraph, Set<Set<BlankNodeOrIRI>> equivalenceSets, boolean addOwlSameAs) {
         Map<BlankNodeOrIRI, BlankNodeOrIRI> current2ReplacementMap = new HashMap<BlankNodeOrIRI, BlankNodeOrIRI>();
@@ -59,7 +57,7 @@ public class BaseSmusher {
         Lock l = mGraph.getLock().writeLock();
         l.lock();
         try {
-            for (Iterator<Triple> it = mGraph.iterator(); it.hasNext();) {
+            for (Iterator<Triple> it = mGraph.iterator(); it.hasNext(); ) {
                 final Triple triple = it.next();
                 final BlankNodeOrIRI subject = triple.getSubject();
                 BlankNodeOrIRI subjectReplacement = current2ReplacementMap.get(subject);
@@ -85,9 +83,9 @@ public class BaseSmusher {
             l.unlock();
         }
     }
-    
-    private BlankNodeOrIRI getReplacementFor(Set<BlankNodeOrIRI> equivalenceSet, 
-            Graph owlSameAsGraph) {
+
+    private BlankNodeOrIRI getReplacementFor(Set<BlankNodeOrIRI> equivalenceSet,
+                                             Graph owlSameAsGraph) {
         final Set<IRI> uriRefs = new HashSet<IRI>();
         for (BlankNodeOrIRI nonLiteral : equivalenceSet) {
             if (nonLiteral instanceof IRI) {
@@ -111,14 +109,14 @@ public class BaseSmusher {
         return preferedIRI;
     }
 
-    
+
     /**
      * Returns a prefered IRI for the IRIs in a set. Typically and in the
-     * default implementation the IRI will be one of the set. Note however that 
+     * default implementation the IRI will be one of the set. Note however that
      * subclass implementations may also return another IRI to be used.
-     * 
+     *
      * @param uriRefs
-     * @return 
+     * @return
      */
     protected IRI getPreferedIRI(Set<IRI> uriRefs) {
         final Iterator<IRI> uriRefIter = uriRefs.iterator();
@@ -126,5 +124,5 @@ public class BaseSmusher {
         //or look at their frequency in mGraph
         return uriRefIter.next();
     }
-    
+
 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java
index 4c57af5..a1464bd 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/IfpSmusher.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils.smushing;
 
 import org.apache.clerezza.api.*;
@@ -27,13 +26,13 @@ import org.slf4j.LoggerFactory;
 import java.util.*;
 
 /**
- * A utility to equate duplicate nodes in an Mgarph, currently only nodes with 
+ * A utility to equate duplicate nodes in an Mgarph, currently only nodes with
  * a shared ifp are equated.
  *
  * @author reto
  */
 public class IfpSmusher extends BaseSmusher {
-    
+
     static final Logger log = LoggerFactory.getLogger(IfpSmusher.class);
 
     /**
@@ -49,7 +48,7 @@ public class IfpSmusher extends BaseSmusher {
     public void smush(Graph mGraph, Graph tBox) {
         final Set<IRI> ifps = getIfps(tBox);
         final Map<PredicateObject, Set<BlankNodeOrIRI>> ifp2nodesMap = new HashMap<PredicateObject, Set<BlankNodeOrIRI>>();
-        for (Iterator<Triple> it = mGraph.iterator(); it.hasNext();) {
+        for (Iterator<Triple> it = mGraph.iterator(); it.hasNext(); ) {
             final Triple triple = it.next();
             final IRI predicate = triple.getPredicate();
             if (!ifps.contains(predicate)) {
@@ -66,7 +65,6 @@ public class IfpSmusher extends BaseSmusher {
         Set<Set<BlankNodeOrIRI>> unitedEquivalenceSets = uniteSetsWithCommonElement(ifp2nodesMap.values());
         smush(mGraph, unitedEquivalenceSets, true);
     }
-    
 
     private Set<IRI> getIfps(Graph tBox) {
         final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type,
@@ -102,7 +100,7 @@ public class IfpSmusher extends BaseSmusher {
 
     private <T> Set<T> getMatchinSet(Set<T> set, Set<Set<T>> setOfSet) {
         for (Set<T> current : setOfSet) {
-            if (shareElements(set,current)) {
+            if (shareElements(set, current)) {
                 return current;
             }
         }
@@ -117,7 +115,6 @@ public class IfpSmusher extends BaseSmusher {
         }
         return false;
     }
-    
 
     class PredicateObject {
 
@@ -157,9 +154,7 @@ public class IfpSmusher extends BaseSmusher {
 
         @Override
         public String toString() {
-            return "("+predicate+", "+object+")";
+            return "(" + predicate + ", " + object + ")";
         }
-
-
-    };
+    }
 }
diff --git a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java
index 3571ae6..b9f4de2 100644
--- a/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java
+++ b/api.utils/src/main/java/org/apache/clerezza/api/utils/smushing/SameAsSmusher.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils.smushing;
 
 import org.apache.clerezza.api.BlankNodeOrIRI;
@@ -35,43 +34,44 @@ import java.util.*;
  * @author reto
  */
 public class SameAsSmusher extends BaseSmusher {
-    
+
     static final Logger log = LoggerFactory.getLogger(SameAsSmusher.class);
-    
+
     /**
      * This will ensure that all properties of sameAs resources are associated
      * to the preferedIRI as returned by {@code getPreferedIRI}
+     *
      * @param mGraph
-     * @param owlSameStatements 
+     * @param owlSameStatements
      * @param addCanonicalSameAsStatements if true owl:sameAsStatements with the preferedIRI as object will be added
      */
-    public void smush(Graph mGraph, 
-            Graph owlSameStatements,
-            boolean addCanonicalSameAsStatements) {
-    	
-    	log.info("Starting smushing");
-        
-    	// This hashmap contains a uri (key) and the set of equivalent uris (value)
-    	final Map<BlankNodeOrIRI, Set<BlankNodeOrIRI>> node2EquivalenceSet = new HashMap<BlankNodeOrIRI, Set<BlankNodeOrIRI>>();
-    	
-    	log.info("Creating the sets of equivalent uris of each subject or object in the owl:sameAs statements");
-    	// Determines for each subject and object in all the owl:sameAs statements the set of ewquivalent uris 
-    	for (Iterator<Triple> it = owlSameStatements.iterator(); it.hasNext();) {            
-    		final Triple triple = it.next();
+    public void smush(Graph mGraph,
+                      Graph owlSameStatements,
+                      boolean addCanonicalSameAsStatements) {
+
+        log.info("Starting smushing");
+
+        // This hashmap contains a uri (key) and the set of equivalent uris (value)
+        final Map<BlankNodeOrIRI, Set<BlankNodeOrIRI>> node2EquivalenceSet = new HashMap<BlankNodeOrIRI, Set<BlankNodeOrIRI>>();
+
+        log.info("Creating the sets of equivalent uris of each subject or object in the owl:sameAs statements");
+        // Determines for each subject and object in all the owl:sameAs statements the set of ewquivalent uris
+        for (Iterator<Triple> it = owlSameStatements.iterator(); it.hasNext(); ) {
+            final Triple triple = it.next();
             final IRI predicate = triple.getPredicate();
             if (!predicate.equals(OWL.sameAs)) {
                 throw new RuntimeException("Statements must use only <http://www.w3.org/2002/07/owl#sameAs> predicate.");
             }
             final BlankNodeOrIRI subject = triple.getSubject();
             //literals not yet supported
-            final BlankNodeOrIRI object = (BlankNodeOrIRI)triple.getObject();
-            
+            final BlankNodeOrIRI object = (BlankNodeOrIRI) triple.getObject();
+
             Set<BlankNodeOrIRI> equivalentNodes = node2EquivalenceSet.get(subject);
-            
+
             // if there is not a set of equivalent uris then create a new set
             if (equivalentNodes == null) {
-            	equivalentNodes = node2EquivalenceSet.get(object);
-            	if (equivalentNodes == null) {
+                equivalentNodes = node2EquivalenceSet.get(object);
+                if (equivalentNodes == null) {
                     equivalentNodes = new HashSet<BlankNodeOrIRI>();
                 }
             } else {
@@ -82,28 +82,26 @@ public class SameAsSmusher extends BaseSmusher {
                         node2EquivalenceSet.remove(res);
                     }
                     for (BlankNodeOrIRI res : objectSet) {
-                        node2EquivalenceSet.put(res,equivalentNodes);
+                        node2EquivalenceSet.put(res, equivalentNodes);
                     }
                     equivalentNodes.addAll(objectSet);
                 }
             }
-            
+
             // add both subject and object of the owl:sameAs statement to the set of equivalent uris
             equivalentNodes.add(subject);
             equivalentNodes.add(object);
-            
+
             // use both uris in the owl:sameAs statement as keys for the set of equivalent uris
             node2EquivalenceSet.put(subject, equivalentNodes);
             node2EquivalenceSet.put(object, equivalentNodes);
-            
+
             log.info("Sets of equivalent uris created.");
-        
-    	}
-    	
-    	// This set contains the sets of equivalent uris
-    	Set<Set<BlankNodeOrIRI>> unitedEquivalenceSets = new HashSet<Set<BlankNodeOrIRI>>(node2EquivalenceSet.values());
+
+        }
+
+        // This set contains the sets of equivalent uris
+        Set<Set<BlankNodeOrIRI>> unitedEquivalenceSets = new HashSet<Set<BlankNodeOrIRI>>(node2EquivalenceSet.values());
         smush(mGraph, unitedEquivalenceSets, addCanonicalSameAsStatements);
     }
-
-    
 }
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/CollectedIter.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/CollectedIter.scala
new file mode 100644
index 0000000..6ad12fe
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/CollectedIter.scala
@@ -0,0 +1,132 @@
+/*
+ * 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.scala.utils
+
+import java.util.concurrent.locks.Lock
+import java.util.{ConcurrentModificationException, Iterator}
+
+import _root_.scala.collection.JavaConversions._
+import scala.collection.immutable
+import scala.collection.mutable._
+
+/**
+  *
+  * A Collection that groups the elements of an iterator, giving a view over it as over a
+  * sequence.
+  *
+  * The collection takes a function returning an iterator, in order to allow for cases where the
+  * iterator needs to be called from the beginning again. i.e. when a ConcurrentModificationException
+  * occurs and the iteration is repeated in a section used using the provided readLock.
+  */
+class CollectedIter[T](iterCreator: () => Iterator[T], readLock: Lock) extends immutable.Seq[T] {
+
+    def this(jList: java.util.List[T], readLock: Lock) = this(() => jList.iterator(), readLock)
+
+    def this() = this(() => java.util.Collections.emptyList[T].iterator(), null)
+
+    var iter = iterCreator()
+    var firstIter = true
+
+    private val collectedElems = new ArrayBuffer[T]()
+
+    /**
+      * This method allows the position to be expressed between parenthesis
+      */
+    def apply(pos: Int) = {
+        ensureReadTill(pos)
+        collectedElems(pos)
+    }
+
+
+    /**
+      * returns a new fully expanded and sorted CollectediterCreator
+      */
+    def sort(lt: (T, T) => Boolean) = {
+        val sortedElems = iterator.toList.sortWith(lt)
+        //TODO this re-expands everything, return sorted-list directly
+        new CollectedIter[T](sortedElems, readLock)
+
+    }
+
+    /**
+      * Operator style syntax to access a position.
+      */
+    def %(pos: Int) = apply(pos)
+
+    private def ensureReadTill(pos: Int) {
+        try {
+
+            while (iter.hasNext && (collectedElems.length - 1 <= pos)) {
+                val next = iter.next()
+                if (firstIter || !collectedElems.contains(next)) {
+                    collectedElems += next
+                }
+            }
+        } catch {
+            case e: ConcurrentModificationException => {
+                readLock.lock()
+                try {
+                    iter = iterCreator()
+                    firstIter = false
+                    //going beyond pos, do reduce chance we have to aquire another lock
+                    val biggerPos = if (pos < (Integer.MAX_VALUE - 100)) {
+                        pos + 100
+                    } else {
+                        Integer.MAX_VALUE
+                    }
+                    while (iter.hasNext && (collectedElems.length - 1 <= biggerPos)) {
+                        val next = iter.next()
+                        if (!collectedElems.contains(next)) {
+                            collectedElems += next
+                        }
+                    }
+                } finally {
+                    readLock.unlock()
+                }
+            }
+            case e: Exception => throw e
+        }
+    }
+
+    override def length: Int = {
+        length(Integer.MAX_VALUE)
+    }
+
+    /**
+      * The value returned is same or less than the length of the collection,
+      * the underlying Iterator isn't expanded till more than <code>max</code>. If
+      * the result is smaller than max it is the length of the collection.
+      */
+    def length(max: Int): Int = {
+        ensureReadTill(max)
+        collectedElems.length
+    }
+
+    override def toString() = {
+        if (length(1) > 0) {
+            apply(0).toString
+        } else {
+            "empty"
+        }
+    }
+
+    override def iterator = {
+        ensureReadTill(Integer.MAX_VALUE)
+        collectedElems.iterator
+    }
+}
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzLiteral.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzLiteral.scala
new file mode 100644
index 0000000..de303e1
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzLiteral.scala
@@ -0,0 +1,74 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl.literal._
+import org.apache.clerezza.ontologies.XSD
+
+object EzLiteral extends EzLiteralImplicits
+
+trait EzLiteralImplicits {
+
+    implicit def string2lit(str: String) = new EzLiteral(str)
+
+}
+
+/**
+  * An EzLiteral is a typed string literal - ie, just a String literal - that comes with N3/turtle like methods
+  * to map to other types of literals.
+  *
+  * This makes it useful when combined with the EzLiteralImplicit for writing out literals
+  *
+  * <code>
+  * "ABCDEFGHIJKLMN"                   -- a plain string converted to a EzLiteral
+  * "some text in english".lang(en)    -- an english literal
+  * "1234"^^XSD.int                    -- a number
+  * </code>
+  *
+  * @author bblfish
+  */
+class EzLiteral(string: String) extends TypedLiteralImpl(string, XSD.string) {
+
+    /**
+      * @return a plain literal with language specified by lang
+      */
+    def lang(lng: String): Literal = lang(new Language(lng))
+
+    /**
+      * @return a plain literal with language specified by lang
+      */
+    def lang(lng: Language): Literal = new PlainLiteralImpl(string, lng)
+
+    /**
+      * Map to a Typed Literal of given type
+      */
+    def ^^(typ: IRI): Literal = new TypedLiteralImpl(string, typ)
+
+    /**
+      * alias for iri
+      */
+    @deprecated(message = "use  `iri`", since = "1.0.0")
+    def uri = iri
+
+    /**
+      * Map to an IRI of given lexical form
+      */
+    def iri = new IRI(string)
+
+}
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzMGraph.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzMGraph.scala
new file mode 100644
index 0000000..c5ab112
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/EzMGraph.scala
@@ -0,0 +1,79 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl.graph._
+
+import _root_.scala.collection.mutable.HashMap
+
+
+/**
+  * EzGraph enhances graph writing, it can make writing rdf graphs in code a lot more
+  * readable, as it avoids a lot of repetition.
+  *
+  * @param graph : a Triple collection
+  * @author hjs, reto
+  */
+class EzGraph(val baseTc: Graph) extends AbstractGraph with TcDependentConversions {
+
+
+    def this() = this(new SimpleGraph())
+
+    def performFilter(subject: BlankNodeOrIRI, predicate: IRI,
+                      obj: RDFTerm): java.util.Iterator[Triple] = baseTc.filter(subject, predicate, obj)
+
+    override def performSize = baseTc.size
+
+    override def add(t: Triple) = baseTc.add(t)
+
+    /**
+      * Add all triples into the other graph to this one
+      */
+    def +=(other: Graph) = {
+        if (baseTc ne other) baseTc.addAll(other)
+    }
+
+    /**
+      * create a new bnode
+      */
+    def bnode = blankNode
+
+    def blankNode: BlankNode = {
+        new BlankNode
+    }
+
+    private val namedBnodes = new HashMap[String, BlankNode]
+
+    /**
+      * create a new named bnode based EzGraphNode with the preferred writing style
+      */
+    def b_(name: String): BlankNode = {
+        namedBnodes.get(name) match {
+            case Some(bnode) => bnode
+            case None => {
+                val bn = new BlankNode
+                namedBnodes.put(name, bn);
+                bn
+            }
+        }
+    }
+
+}
+
+
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/NameSpace.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/NameSpace.scala
new file mode 100644
index 0000000..1231fcc
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/NameSpace.scala
@@ -0,0 +1,36 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api.IRI
+
+/**
+  * A IRI-namespace prefix
+  */
+class NameSpace(prefix: String) {
+
+    /**
+      * returns a IRI applying this namespace prefix to the given symbol
+      */
+    def +(s: Symbol) = new IRI(prefix + s.name)
+
+    /**
+      * returns a IRI applying this prefix to the given string
+      */
+    def +(s: String) = new IRI(prefix + s)
+}
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/Preamble.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/Preamble.scala
new file mode 100644
index 0000000..635f2f3
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/Preamble.scala
@@ -0,0 +1,117 @@
+/*
+ * 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.scala.utils
+
+import java.math.BigInteger
+import java.net.{URI, URL}
+import java.util.Date
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl.graph._
+import org.apache.clerezza.api.impl.literal._
+import org.apache.clerezza.api.utils.GraphNode
+
+/**
+  * This object provides the implicit conversions. Typically this is used by
+  * adding
+  * {{{
+  * import org.apache.clerezza.rdf.scala.utils.Preamble._
+  * }}} near the top of the
+  * file using SCB Utilities for Scala
+  *
+  * @author bblfish, reto
+  */
+object Preamble extends TcIndependentConversions {
+
+}
+
+/**
+  * This class provides the implicit conversions of its companion Object and
+  * additional conversions that require an evaluation graph, i.e. the conversion
+  * from a resource to a RichGraphNode.
+  *
+  * Typically this is used by
+  * adding
+  * {{{
+  * val preamble = new org.apache.clerezza.rdf.scala.utils.Preamble(myGraph)
+  * import preamble._
+  * }}}
+  * before the
+  * code section using the conversions
+  *
+  * @author bblfish, reto
+  */
+class Preamble(val baseTc: Graph) extends TcDependentConversions {
+
+}
+
+protected trait TcDependentConversions extends TcIndependentConversions {
+
+    def baseTc: Graph
+
+    implicit def toRichGraphNode(resource: RDFTerm) = {
+        new RichGraphNode(new GraphNode(resource, baseTc))
+    }
+}
+
+protected trait TcIndependentConversions extends EzLiteralImplicits {
+    implicit def toRichGraphNode(node: GraphNode) = {
+        new RichGraphNode(node)
+    }
+
+    implicit def toFirstElement(c: CollectedIter[RichGraphNode]) = {
+        if (c.length(1) > 0) {
+            c(0)
+        } else {
+            TcIndependentConversions.emptyLiteral
+        }
+    }
+
+    private val litFactory = LiteralFactory.getInstance
+
+
+    implicit def lit2String(lit: Literal) = lit.getLexicalForm
+
+    implicit def date2lit(date: Date) = litFactory.createTypedLiteral(date)
+
+    implicit def int2lit(int: Int) = litFactory.createTypedLiteral(int)
+
+    implicit def bigint2lit(bint: BigInt) = litFactory.createTypedLiteral(bint.underlying())
+
+    implicit def bigint2lit(bigInt: BigInteger) = litFactory.createTypedLiteral(bigInt)
+
+    implicit def bool2lit(boolean: Boolean) = litFactory.createTypedLiteral(boolean)
+
+    implicit def long2lit(long: Long) = litFactory.createTypedLiteral(long)
+
+    implicit def double2lit(double: Double) = litFactory.createTypedLiteral(double)
+
+    implicit def uriRef2Prefix(uriRef: IRI) = new NameSpace(uriRef.getUnicodeString)
+
+    implicit def URItoIRI(uri: URI) = new IRI(uri.toString)
+
+    implicit def URLtoIRI(url: URL) = new IRI(url.toExternalForm)
+
+}
+
+protected object TcIndependentConversions {
+    val emptyGraph = new SimpleImmutableGraph(new SimpleGraph)
+    val emptyLiteral = new RichGraphNode(new GraphNode(new PlainLiteralImpl(""), emptyGraph))
+
+}
+
diff --git a/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/RichGraphNode.scala b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/RichGraphNode.scala
new file mode 100644
index 0000000..e4327a2
--- /dev/null
+++ b/api.utils/src/main/scala/org/apache/clerezza/api/scala/utils/RichGraphNode.scala
@@ -0,0 +1,242 @@
+/*
+ * 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.scala.utils
+
+import java.util.Iterator
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl.graph.SimpleGraph
+import org.apache.clerezza.api.impl.literal.LiteralFactory
+import org.apache.clerezza.api.utils.{GraphNode, UnionGraph}
+import org.apache.clerezza.ontologies.RDF
+
+import _root_.scala.collection.JavaConversions._
+import _root_.scala.reflect.Manifest
+
+/**
+  * A RichGraphNode decorates A GraphNode with additional method to be part on a DSL-style scala library.
+  *
+  * The default constructor is same a the GraphNode constructor, i.e. it takes the node and its context
+  * Triple-collection
+  *
+  * @param resource the node represented by this RichGraphNode
+  * @param graph    the Graph that describes the resource
+  */
+class RichGraphNode(resource: RDFTerm, graph: Graph) extends GraphNode(resource, graph) {
+
+    /**
+      * Construct a RichGraphNode given an existing [[GraphNde]]
+      *
+      * @param node The GraphNode to be wrapped
+      */
+    def this(node: GraphNode) = this(node.getNode, node.getGraph)
+
+    /**
+      * Operator syntax shortcut to get all objects as <code>RichGraphNode</code>
+      *
+      * @return all objects of the specified property of the node wrapped by this object
+      */
+    def /(property: IRI): CollectedIter[RichGraphNode] = {
+        new CollectedIter[RichGraphNode](() => new GraphNodeIter(getObjects(property)), readLock)
+    }
+
+    /**
+      * Operator syntax shortcut to get all subjects as <code>RichGraphNode</code>ref
+      *
+      * @param property the property for which the subjects pointing to this node by that property are requested
+      * @return the matching resources
+      */
+    def /-(property: IRI): CollectedIter[RichGraphNode] = {
+        new CollectedIter[RichGraphNode](() => new GraphNodeIter(getSubjects(property)), readLock)
+    }
+
+    /**
+      * Get the elements of the rdf:List represented by this node
+      *
+      * @return a List with the elements of the rdf:List represented by this node
+      */
+    def !! = (for (listElem <- asList) yield {
+        new RichGraphNode(new GraphNode(listElem, getGraph))
+    }).toList
+
+    /**
+      * get a specified of the rdf:List represented by this node
+      *
+      * @return the specified index value
+      */
+    def %!!(index: Int) = new RichGraphNode(new GraphNode(asList.get(index),
+        getGraph))
+
+    /**
+      * produces a default String representation for the node, this is the lexical form of literals,
+      * the unicode-string for IRI and for BlankNodes the value returned by toString
+      *
+      * @return the default string representation of the node
+      */
+    def * : String = {
+        getNode() match {
+            case lit: Literal => lit.getLexicalForm
+            case uri: IRI => uri.getUnicodeString
+            case wrappedNode => wrappedNode.toString
+        }
+    }
+
+    private def asClass[T](clazz: Class[T]): T = {
+        val typedLiteral = getNode().asInstanceOf[Literal]
+        clazz match {
+            case c if (c == classOf[Boolean]) => LiteralFactory.getInstance().createObject(
+                classOf[java.lang.Boolean], typedLiteral).booleanValue.asInstanceOf[T]
+            case _ => LiteralFactory.getInstance().createObject(clazz, typedLiteral)
+        }
+    }
+
+    /**
+      * Creates an instance of specified Class-Type representing the value of the literal wrapped by this
+      * <code>GraphNode</code>
+      *
+      * @return the literal represented by this node as instance of the specified type
+      */
+    def as[T](implicit m: Manifest[T]): T = {
+        asClass(m.runtimeClass.asInstanceOf[Class[T]])
+    }
+
+    /**
+      * Operator syntax shortcut to get the <code>RDFTerm</code> wrapped by this
+      * <code>GraphNode</code>
+      *
+      * @return the node represented by this GraphNode as RDFTerm, same as <code>getNode</code>
+      */
+    def ! = {
+        getNode()
+    }
+
+    private class GraphNodeIter[T <: RDFTerm](base: Iterator[T]) extends Iterator[RichGraphNode] {
+        override def hasNext() = {
+            base.hasNext();
+        }
+
+        override def next(): RichGraphNode = {
+            new RichGraphNode(new GraphNode(base.next(), getGraph));
+        }
+
+        override def remove() {
+            base.remove()
+        }
+    }
+
+    /**
+      * Sets the RDF:type of the subject */
+    def a(rdfclass: IRI): RichGraphNode = {
+        addProperty(RDF.`type`, rdfclass)
+        return this
+    }
+
+    /*
+     * create an RichGraphNode from this one where the backing graph is protected from writes by a new
+     * SimpleGraph.
+     */
+    def protect(): RichGraphNode = new RichGraphNode(getNode, new UnionGraph(new SimpleGraph(), graph))
+
+
+    /**
+      * relate the subject via the given relation to....
+      */
+    def --(rel: RDFTerm): DashTuple = new DashTuple(rel)
+
+    def --(rel: RichGraphNode): DashTuple = new DashTuple(rel.getNode)
+
+
+    /**
+      * relate the subject via the inverse of the given relation to....
+      */
+    def <--(tuple: RichGraphNode#DashTuple): RichGraphNode = {
+        val inversePropertyRes = tuple.first.getNode
+        val inverseProperty: IRI = inversePropertyRes match {
+            case p: IRI => p
+            case _ => throw new RuntimeException("DashTuple must be a IRI")
+        }
+        RichGraphNode.this.addInverseProperty(inverseProperty, tuple.second)
+        RichGraphNode.this
+    }
+
+
+    /** class for Inverse relations with the current RichGraphNode.ref as object */
+    //TODO add support for adding many for symmetry reasons
+    //  class InverseDashTuple(rel: DashTuple) {
+    //
+    //    /**
+    //     * ...to the following non literal
+    //     */
+    //    def --(subj: BlankNodeOrIRI): RichGraphNode = {
+    //      RichGraphNode.this.addInverseProperty(rel, subj)
+    //      RichGraphNode.this
+    //    }
+    //
+    //    /**
+    //     * ...to the following resource (given as a string)
+    //     */
+    //    def --(subj: String): RichGraphNode = --(new IRI(subj))
+    //
+    //    /**
+    //     * ...to the following EzGraphNode
+    //     * (useful for opening a new parenthesis and specifying other things in more detail
+    //     */
+    //    def --(subj: GraphNode): RichGraphNode = {
+    //      --(subj.getNode.asInstanceOf[BlankNodeOrIRI])
+    //    }
+    //    // since we can only have inverses from non literals (howto deal with bndoes?)
+    //  }
+
+    /**
+      * class for relations with the current RichGraphNode.ref as subject
+      */
+    class DashTuple(val second: RDFTerm) {
+
+        val first = RichGraphNode.this
+
+        /**
+          * ...to the following non resource
+          */
+        def -->(obj: RDFTerm): RichGraphNode = {
+            val property = second match {
+                case u: IRI => u;
+                case _ => throw new RuntimeException("Property must be a IRI")
+            }
+            RichGraphNode.this.addProperty(property, obj)
+            RichGraphNode.this
+        }
+
+
+        /**
+          * ...to the EzGraphNode, which is useful for opening a parenthesis.
+          */
+        def -->(sub: GraphNode): RichGraphNode = {
+            //RichGraphNode.this + sub
+            -->(sub.getNode)
+        }
+
+        /**
+          * Add one relation for each member of the iterable collection
+          */
+        def -->>[T <: RDFTerm](uris: Iterable[T]): RichGraphNode = {
+            for (u <- uris) -->(u)
+            RichGraphNode.this
+        }
+    }
+
+}
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java
index f5df426..a4e5c1e 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/GraphUtilsTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.BlankNode;
@@ -28,7 +27,6 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- *
  * @author reto
  */
 public class GraphUtilsTest {
@@ -65,12 +63,13 @@ public class GraphUtilsTest {
         }
         return baseGraph;
     }
-    
-    /** It is required that the subgraph comprises the whole context of the Bnodes it ioncludes
-     * 
+
+    /**
+     * It is required that the subgraph comprises the whole context of the Bnodes it ioncludes
+     *
      * @throws org.apache.clerezza.utils.GraphUtils.NoSuchSubGraphException
      */
-    @Test(expected=NoSuchSubGraphException.class)
+    @Test(expected = NoSuchSubGraphException.class)
     public void removeIncompleteSubGraph() throws NoSuchSubGraphException {
         Graph baseGraph = createBaseGraph();
 
@@ -84,7 +83,7 @@ public class GraphUtilsTest {
         GraphUtils.removeSubGraph(baseGraph, subGraph);
     }
 
-    @Test(expected=NoSuchSubGraphException.class)
+    @Test(expected = NoSuchSubGraphException.class)
     public void removeInvalidSubGraph() throws NoSuchSubGraphException {
         Graph baseGraph = createBaseGraph();
 
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java
index 18d3f9d..dd19217 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/IfpSmushTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.BlankNode;
@@ -32,34 +31,34 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- *
  * @author reto
  */
 public class IfpSmushTest {
 
     private Graph ontology = new SimpleGraph();
+
     {
         ontology.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
     }
 
     @Test
-    public void simpleBlankNode()  {
+    public void simpleBlankNode() {
         Graph mGraph = new SimpleGraph();
         IRI mbox1 = new IRI("mailto:foo@example.org");
         final BlankNode bNode1 = new BlankNode();
         mGraph.add(new TripleImpl(bNode1, FOAF.mbox, mbox1));
-        mGraph.add(new TripleImpl(bNode1, RDFS.comment, 
+        mGraph.add(new TripleImpl(bNode1, RDFS.comment,
                 new PlainLiteralImpl("a comment")));
         final BlankNode bNode2 = new BlankNode();
         mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
-        mGraph.add(new TripleImpl(bNode2, RDFS.comment, 
+        mGraph.add(new TripleImpl(bNode2, RDFS.comment,
                 new PlainLiteralImpl("another comment")));
         Smusher.smush(mGraph, ontology);
         Assert.assertEquals(3, mGraph.size());
     }
 
     @Test
-    public void overlappingEquivalenceClasses()  {
+    public void overlappingEquivalenceClasses() {
         Graph mGraph = new SimpleGraph();
         IRI mbox1 = new IRI("mailto:foo@example.org");
         final BlankNode bNode1 = new BlankNode();
@@ -81,7 +80,7 @@ public class IfpSmushTest {
     }
 
     @Test
-    public void oneIRI()  {
+    public void oneIRI() {
         Graph mGraph = new SimpleGraph();
         IRI mbox1 = new IRI("mailto:foo@example.org");
         final IRI resource = new IRI("http://example.org/");
@@ -97,7 +96,7 @@ public class IfpSmushTest {
     }
 
     @Test
-    public void twoIRIs()  {
+    public void twoIRIs() {
         Graph mGraph = new SimpleGraph();
         IRI mbox1 = new IRI("mailto:foo@example.org");
         final IRI resource1 = new IRI("http://example.org/");
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java
index ea19303..0ef67c7 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/RdfListTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import junit.framework.Assert;
@@ -33,7 +32,6 @@ import java.util.Set;
 import static org.junit.Assert.assertEquals;
 
 /**
- *
  * @author rbn
  */
 public class RdfListTest {
@@ -88,11 +86,11 @@ public class RdfListTest {
         Graph tc = new SimpleGraph();
         List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
         assertEquals(0, list.size());
-        list.add(0,new PlainLiteralImpl("world"));
+        list.add(0, new PlainLiteralImpl("world"));
         list = new RdfList(new IRI("http://example.org/mytest"), tc);
-        list.add(0,new PlainLiteralImpl("beautifuly"));
+        list.add(0, new PlainLiteralImpl("beautifuly"));
         list = new RdfList(new IRI("http://example.org/mytest"), tc);
-        list.add(0,new PlainLiteralImpl("hello"));
+        list.add(0, new PlainLiteralImpl("hello"));
         assertEquals(new PlainLiteralImpl("hello"), list.get(0));
         assertEquals(new PlainLiteralImpl("beautifuly"), list.get(1));
         assertEquals(new PlainLiteralImpl("world"), list.get(2));
@@ -103,12 +101,15 @@ public class RdfListTest {
         Graph tc = new SimpleGraph();
         List<RDFTerm> list = new RdfList(new IRI("http://example.org/mytest"), tc);
         assertEquals(0, list.size());
-        BlankNode node0 = new BlankNode() {};
-        BlankNode node1 = new BlankNode() {};
-        BlankNode node2 = new BlankNode() {};
-        list.add(0,node2);
-        list.add(0,node1);
-        list.add(0,node0);
+        BlankNode node0 = new BlankNode() {
+        };
+        BlankNode node1 = new BlankNode() {
+        };
+        BlankNode node2 = new BlankNode() {
+        };
+        list.add(0, node2);
+        list.add(0, node1);
+        list.add(0, node0);
         assertEquals(node0, list.get(0));
         assertEquals(node1, list.get(1));
         assertEquals(node2, list.get(2));
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java
index c03e3c8..5622711 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/SameAsSmushTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.Graph;
@@ -34,21 +33,22 @@ import org.junit.Test;
 import java.util.Iterator;
 
 /**
- *
  * @author reto
  */
 public class SameAsSmushTest {
-    
+
     private final IRI uriA = new IRI("http://example.org/A");
     private final IRI uriB = new IRI("http://example.org/B");
     private final Literal lit = new PlainLiteralImpl("That's me (and you)");
 
     private Graph sameAsStatements = new SimpleGraph();
+
     {
         sameAsStatements.add(new TripleImpl(uriA, OWL.sameAs, uriB));
     }
-    
-    private Graph  dataGraph = new SimpleGraph();
+
+    private Graph dataGraph = new SimpleGraph();
+
     {
         dataGraph.add(new TripleImpl(uriA, FOAF.knows, uriB));
         dataGraph.add(new TripleImpl(uriB, RDFS.label, lit));
@@ -56,7 +56,7 @@ public class SameAsSmushTest {
     }
 
     @Test
-    public void simple()  {
+    public void simple() {
         Assert.assertEquals(3, dataGraph.size());
         Smusher.sameAsSmush(dataGraph, sameAsStatements);
         Assert.assertEquals(3, dataGraph.size());
@@ -73,5 +73,4 @@ public class SameAsSmushTest {
         Assert.assertEquals(litStmt.getSubject(), knowStmt.getObject());
         Assert.assertEquals(litStmt.getSubject(), dataGraph.filter(null, OWL.sameAs, null).next().getObject());
     }
-
 }
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java
index 3d0f8e3..2a39556 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/TestGraphNode.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import junit.framework.Assert;
@@ -32,7 +31,6 @@ import java.util.Iterator;
 import java.util.Set;
 
 /**
- *
  * @author reto, mir
  */
 public class TestGraphNode {
@@ -40,8 +38,10 @@ public class TestGraphNode {
     @Test
     public void nodeContext() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         IRI property2 = new IRI("http://example.org/property2");
         g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
@@ -59,8 +59,10 @@ public class TestGraphNode {
     @Test
     public void addNode() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         GraphNode n = new GraphNode(bNode1, g);
         n.addProperty(property1, bNode2);
@@ -102,10 +104,12 @@ public class TestGraphNode {
     }
 
     @Test
-    public void getAvailableProperties(){
+    public void getAvailableProperties() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         IRI property2 = new IRI("http://example.org/property2");
         IRI property3 = new IRI("http://example.org/property3");
@@ -122,7 +126,7 @@ public class TestGraphNode {
         n.addProperty(property4, bNode2);
         Iterator<IRI> properties = n.getProperties();
         int i = 0;
-        while(properties.hasNext()){
+        while (properties.hasNext()) {
             i++;
             IRI prop = properties.next();
             Assert.assertTrue(props.contains(prop));
@@ -136,8 +140,10 @@ public class TestGraphNode {
     @Test
     public void deleteAll() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         IRI property2 = new IRI("http://example.org/property2");
         //the two properties two be deleted
@@ -155,8 +161,10 @@ public class TestGraphNode {
     @Test
     public void deleteSingleProperty() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         IRI property2 = new IRI("http://example.org/property2");
         //the properties two be deleted
@@ -243,8 +251,10 @@ public class TestGraphNode {
     @Test
     public void equality() {
         Graph g = new SimpleGraph();
-        BlankNode bNode1 = new BlankNode() {};
-        BlankNode bNode2 = new BlankNode() {};
+        BlankNode bNode1 = new BlankNode() {
+        };
+        BlankNode bNode2 = new BlankNode() {
+        };
         IRI property1 = new IRI("http://example.org/property1");
         GraphNode n = new GraphNode(bNode1, g);
         n.addProperty(property1, bNode2);
@@ -262,5 +272,4 @@ public class TestGraphNode {
         }
         return set;
     }
-
 }
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java
index e1f8e33..d45f945 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/UnionGraphTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils;
 
 import org.apache.clerezza.api.BlankNode;
@@ -30,7 +29,6 @@ import org.junit.Test;
 import java.util.Iterator;
 
 /**
- *
  * @author hasan
  */
 public class UnionGraphTest {
@@ -61,7 +59,7 @@ public class UnionGraphTest {
         Assert.assertFalse(unionTriples.hasNext());
         Assert.assertEquals(2, unionGraph.size());
     }
-    
+
     @Test
     public void writeAccess() {
         Graph graph = new SimpleGraph();
diff --git a/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java b/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java
index 10ae1f0..0116014 100644
--- a/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java
+++ b/api.utils/src/test/java/org/apache/clerezza/api/utils/smushing/SameAsSmushTest.java
@@ -15,7 +15,6 @@
  * either  express  or implied.  See  the License  for  the  specific
  * language governing permissions and limitations under  the License.
  */
-
 package org.apache.clerezza.api.utils.smushing;
 
 import org.apache.clerezza.api.Graph;
@@ -35,23 +34,24 @@ import java.util.Iterator;
 import java.util.Set;
 
 /**
- *
  * @author reto
  */
 public class SameAsSmushTest {
-    
+
     private final IRI uriA = new IRI("http://example.org/A");
     private final IRI uriB = new IRI("http://example.org/B");
     private final IRI uriC = new IRI("http://example.org/C");
-    
+
     private final Literal lit = new PlainLiteralImpl("That's me (and you)");
 
     private Graph sameAsStatements = new SimpleGraph();
+
     {
         sameAsStatements.add(new TripleImpl(uriA, OWL.sameAs, uriB));
     }
-    
-    private Graph  dataGraph = new SimpleGraph();
+
+    private Graph dataGraph = new SimpleGraph();
+
     {
         dataGraph.add(new TripleImpl(uriA, FOAF.knows, uriB));
         dataGraph.add(new TripleImpl(uriB, RDFS.label, lit));
@@ -59,7 +59,7 @@ public class SameAsSmushTest {
     }
 
     @Test
-    public void simple()  {
+    public void simple() {
         SameAsSmusher smusher = new SameAsSmusher() {
 
             @Override
@@ -68,7 +68,7 @@ public class SameAsSmushTest {
                 if (!uriRefs.contains(uriB)) throw new RuntimeException("not the set we excpect");
                 return uriC;
             }
-            
+
         };
         Assert.assertEquals(3, dataGraph.size());
         smusher.smush(dataGraph, sameAsStatements, true);
@@ -87,5 +87,4 @@ public class SameAsSmushTest {
         Assert.assertEquals(litStmt.getSubject(), dataGraph.filter(null, OWL.sameAs, null).next().getObject());
         Assert.assertEquals(knowStmt.getSubject(), uriC);
     }
-
 }
diff --git a/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/EzMGraphTest.scala b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/EzMGraphTest.scala
new file mode 100644
index 0000000..3b51dfc
--- /dev/null
+++ b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/EzMGraphTest.scala
@@ -0,0 +1,159 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl._
+import org.apache.clerezza.api.impl.graph.SimpleGraph
+import org.apache.clerezza.api.impl.literal._
+import org.apache.clerezza.api.scala.utils.Preamble._
+import org.apache.clerezza.ontologies._
+import org.junit._
+
+/**
+  * @author bblfish, reto
+  */
+class EzGraphTest {
+
+    val bblfishModulus =
+        """
+    9D ☮ 79 ☮ BF ☮ E2 ☮ F4 ☮ 98 ☮ BC ☮ 79 ☮ 6D ☮ AB ☮ 73 ☮ E2 ☮ 8B ☮ 39 ☮ 4D ☮ B5 26 ✜ 68 ✜ 49 ✜ EE ✜ 71 ✜ 87 ✜
+    06 ✜ 32 ✜ C9 ✜ 9F ✜ 3F ✜ 94 ✜ E5 ✜ CB ✜ 4D ✜ B5 12 ☮ 35 ☮ 13 ☮ 69 ☮ 60 ☮ 81 ☮ 58 ☮ 79 ☮ 66 ☮ F3 ☮ 79 ☮ 20 ☮
+    91 ☮ 6A ☮ 3F ☮ 42 5A ✜ F6 ✜ 54 ✜ 42 ✜ 88 ✜ B2 ✜ E9 ✜ 19 ✜ 4A ✜ 79 ✜ 87 ✜ 2E ✜ 62 ✜ 44 ✜ 2D ✜ 7C 06 ☽ 78 ☽ F8
+    ☽ FD ☽ 52 ☽ 92 ☽ 6D ☽ CD ☽ D6 ☽ F3 ☽ 28 ☽ 6B ☽ 1F ☽ DB ☽ CB ☽ D3 F2 ☮ 08 ☮ 34 ☮ 72 ☮ A2 ☮ 12 ☮ 75 ☮ AE ☮ D1
+    ☮ 09 ☮ 17 ☮ D0 ☮ 88 ☮ 4C ☮ 04 ☮ 8E 04 ☾ E5 ☾ BF ☾ D1 ☾ 41 ☾ 64 ☾ D1 ☾ F7 ☾ 89 ☾ 6D ☾ 8B ☾ B2 ☾ F2 ☾ 46 ☾ C0
+    ☾ 56 87 ☮ 8D ☮ B8 ☮ 7C ☮ C6 ☮ FE ☮ E9 ☮ 61 ☮ 88 ☮ 08 ☮ 61 ☮ DD ☮ E3 ☮ B8 ☮ B5 ☮ 47 ♥
+    """
+
+    /** import some references in order to reduce dependencies */
+
+    final val hex: IRI = new IRI("http://www.w3.org/ns/auth/cert#hex")
+    final val identity: IRI = new IRI("http://www.w3.org/ns/auth/cert#identity")
+    final val RSAPublicKey: IRI = new IRI("http://www.w3.org/ns/auth/rsa#RSAPublicKey")
+    final val modulus: IRI = new IRI("http://www.w3.org/ns/auth/rsa#modulus")
+    final val public_exponent: IRI = new IRI("http://www.w3.org/ns/auth/rsa#public_exponent")
+
+    val henryUri: String = "http://bblfish.net/#hjs"
+    val retoUri: String = "http://farewellutopia.com/reto/#me"
+    val danbriUri: String = "http://danbri.org/foaf.rdf#danbri"
+
+
+    private val tinyGraph: ImmutableGraph = {
+        val gr = new SimpleGraph()
+        val reto = new BlankNode()
+        val danny = new BlankNode()
+        val henry = new IRI(henryUri)
+
+        gr.add(new TripleImpl(reto, RDF.`type`, FOAF.Person))
+        gr.add(new TripleImpl(reto, FOAF.name, new PlainLiteralImpl("Reto Bachman-Gmür", new Language("rm"))))
+        //it is difficult to remember that one needs to put a string literal if one does not want to specify a language
+        gr.add(new TripleImpl(reto, FOAF.title, new TypedLiteralImpl("Mr", XSD.string)))
+        gr.add(new TripleImpl(reto, FOAF.currentProject, new IRI("http://clerezza.org/")))
+        gr.add(new TripleImpl(reto, FOAF.knows, henry))
+        gr.add(new TripleImpl(reto, FOAF.knows, danny))
+
+        gr.add(new TripleImpl(danny, FOAF.name, new PlainLiteralImpl("Danny Ayers", new Language("en"))))
+        gr.add(new TripleImpl(danny, RDF.`type`, FOAF.Person))
+        gr.add(new TripleImpl(danny, FOAF.knows, henry))
+        gr.add(new TripleImpl(danny, FOAF.knows, reto))
+
+        gr.add(new TripleImpl(henry, FOAF.name, new TypedLiteralImpl("Henry Story", XSD.string))) //It is tricky to remember that one needs this for pure strings
+        gr.add(new TripleImpl(henry, FOAF.currentProject, new IRI("http://webid.info/")))
+        gr.add(new TripleImpl(henry, RDF.`type`, FOAF.Person))
+        gr.add(new TripleImpl(henry, FOAF.knows, danny))
+        gr.add(new TripleImpl(henry, FOAF.knows, reto))
+
+        val pk = new BlankNode()
+        gr.add(new TripleImpl(pk, RDF.`type`, RSAPublicKey))
+        gr.add(new TripleImpl(pk, identity, henry))
+        gr.add(new TripleImpl(pk, modulus, LiteralFactory.getInstance().createTypedLiteral(65537)))
+        gr.add(new TripleImpl(pk, public_exponent, new TypedLiteralImpl(bblfishModulus, hex)))
+        gr.getImmutableGraph
+    }
+
+
+    @Test
+    def singleTriple {
+        val expected = {
+            val s = new SimpleGraph
+            s.add(new TripleImpl(henryUri.iri, FOAF.knows, retoUri.iri))
+            s.getImmutableGraph
+        }
+        val ez = new EzGraph() {
+            henryUri.iri -- FOAF.knows --> retoUri.iri
+        }
+        Assert.assertEquals("The two graphs should be equals", expected, ez.getImmutableGraph)
+    }
+
+    @Test
+    def inverseTriple {
+        val expected = {
+            val s = new SimpleGraph
+            s.add(new TripleImpl(retoUri.iri, FOAF.knows, henryUri.iri))
+            s.getImmutableGraph
+        }
+        val ez = new EzGraph() {
+            henryUri.iri <-- FOAF.knows -- retoUri.iri
+        }
+        Assert.assertEquals("The two graphs should be equals", expected, ez.getImmutableGraph)
+    }
+
+    @Test
+    def usingAsciiArrows {
+        val ez = new EzGraph() {
+            (
+                    b_("reto").a(FOAF.Person) -- FOAF.name --> "Reto Bachman-Gmür".lang("rm")
+                            -- FOAF.title --> "Mr"
+                            -- FOAF.currentProject --> "http://clerezza.org/".iri
+                            -- FOAF.knows --> (
+                            "http://bblfish.net/#hjs".iri.a(FOAF.Person)
+                                    -- FOAF.name --> "Henry Story"
+                                    -- FOAF.currentProject --> "http://webid.info/".iri
+                                    -- FOAF.knows -->> List(b_("reto"), b_("danny"))
+                                    //one need to list properties before inverse properties, or use brackets
+                                    <-- identity -- (
+                                    bnode.a(RSAPublicKey) //. notation because of precedence of operators
+                                            -- modulus --> 65537
+                                            -- public_exponent --> (bblfishModulus ^^ hex) // brackets needed due to precedence
+                                    )
+                            )
+                            -- FOAF.knows --> (
+                            b_("danny").a(FOAF.Person)
+                                    -- FOAF.name --> "Danny Ayers".lang("en")
+                                    -- FOAF.knows --> "http://bblfish.net/#hjs".iri //knows
+                                    -- FOAF.knows --> b_("reto")
+                            )
+                    )
+        }
+        Assert.assertEquals("the two graphs should be of same size", tinyGraph.size, ez.size)
+        Assert.assertEquals("Both graphs should contain exactly the same triples", tinyGraph, ez.getImmutableGraph)
+        //We can add triples by creating a new anonymous instance
+        new EzGraph(ez) {
+            (
+                    "http://bblfish.net/#hjs".iri -- FOAF.name --> "William"
+                            -- FOAF.name --> "Bill"
+                    )
+        }
+        Assert.assertEquals("the triple colletion has grown by one", tinyGraph.size() + 2, ez.size)
+        //or by just importing it
+        import ez._
+        ez.b_("danny") -- FOAF.name --> "George"
+        Assert.assertEquals("the triple colletion has grown by one", tinyGraph.size() + 3, ez.size)
+    }
+
+}
diff --git a/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/RichGraphNodeTest.scala b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/RichGraphNodeTest.scala
new file mode 100644
index 0000000..ab723b1
--- /dev/null
+++ b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/RichGraphNodeTest.scala
@@ -0,0 +1,169 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl._
+import org.apache.clerezza.api.impl.graph._
+import org.apache.clerezza.api.impl.literal._
+import org.apache.clerezza.api.scala.utils.Preamble._
+import org.apache.clerezza.api.utils._
+import org.apache.clerezza.ontologies._
+import org.junit._
+
+class RichGraphNodeTest {
+
+    private val johnUri = new IRI("http://example.org/john")
+    private val susanneUri = new IRI("http://example.org/susanne")
+    private val listUri = new IRI("http://example.org/list")
+    private val greetingsUri = new IRI("http://example.org/greetings")
+    private val billBlankNode = new BlankNode()
+    private var node: RichGraphNode = null;
+    private var mGraph = new SimpleGraph()
+
+    @Before
+    def prepare() = {
+        mGraph.add(new TripleImpl(johnUri, FOAF.name, new PlainLiteralImpl("John")));
+        mGraph.add(new TripleImpl(johnUri, FOAF.nick, new PlainLiteralImpl("johny")));
+        mGraph.add(new TripleImpl(johnUri, FOAF.name, new PlainLiteralImpl("Johnathan Guller")));
+        mGraph.add(new TripleImpl(johnUri, FOAF.knows, billBlankNode))
+        mGraph.add(new TripleImpl(johnUri, RDF.`type`, FOAF.Person));
+        mGraph.add(new TripleImpl(billBlankNode, FOAF.nick, new PlainLiteralImpl("Bill")));
+        mGraph.add(new TripleImpl(billBlankNode, FOAF.name, new PlainLiteralImpl("William")));
+        mGraph.add(new TripleImpl(billBlankNode, RDF.`type`, FOAF.Person));
+        mGraph.add(new TripleImpl(susanneUri, FOAF.knows, johnUri));
+        mGraph.add(new TripleImpl(susanneUri, FOAF.name, new PlainLiteralImpl("Susanne")));
+        mGraph.add(new TripleImpl(susanneUri, RDF.`type`, FOAF.Person));
+        val rdfList = new RdfList(listUri, mGraph);
+        rdfList.add(johnUri)
+        rdfList.add(new PlainLiteralImpl("foo"))
+        rdfList.add(new PlainLiteralImpl("bar"))
+        mGraph.add(new TripleImpl(johnUri, SKOS04.related, listUri))
+        val litEn = new PlainLiteralImpl("hello",
+            new Language("en"))
+        val litFr = new PlainLiteralImpl("satul",
+            new Language("fr"))
+        mGraph.add(new TripleImpl(greetingsUri, RDF.value, litEn))
+        mGraph.add(new TripleImpl(greetingsUri, RDF.value, litFr))
+        node = new GraphNode(johnUri, mGraph)
+    }
+
+    @Test
+    def testBaseGraph {
+        val preamble = new Preamble(mGraph)
+        import preamble._
+        def asGn(gn: GraphNode) = gn
+
+        val johnUriNode = asGn(johnUri)
+        Assert.assertEquals(johnUriNode, node)
+    }
+
+    @Test
+    def testSlash = {
+        val rNode = new RichGraphNode(node)
+        Assert.assertEquals(new PlainLiteralImpl("johny"), (rNode / FOAF.nick) (0).getNode)
+        Assert.assertEquals(2, (rNode / FOAF.name).length(20))
+        val stringNames = (for (name <- (rNode / FOAF.name).iterator) yield {
+            name.toString
+        }).toList
+        Assert.assertTrue(stringNames.contains("\"Johnathan Guller\""))
+        Assert.assertTrue(stringNames.contains("\"John\""))
+    }
+
+    @Test
+    def testIterate = {
+        val simple: Graph = new SimpleGraph();
+        val node = new GraphNode(new BlankNode(), simple);
+        node.addProperty(DCTERMS.provenance, new IRI("http://example.org/foo"));
+        node.addProperty(DCTERMS.language, new IRI("http://www.bluewin.ch/"));
+        simple.add(new TripleImpl(new IRI("http://www.bluewin.ch/"), RDF.`type`, RDFS.Container));
+        node.addProperty(RDF.`type`, PLATFORM.HeadedPage);
+        node.addProperty(RDF.`type`, RDFS.Class);
+        val test: CollectedIter[RichGraphNode] = node / DCTERMS.language / RDF.`type`;
+        Assert.assertEquals(1, test.length)
+        var counter = 0;
+        for (k <- test) {
+            counter = counter + 1
+        }
+        Assert.assertEquals(1, counter)
+    }
+
+    @Test
+    def testInverse = {
+        val rNode = new RichGraphNode(node)
+        Assert.assertEquals(1, (rNode /- FOAF.knows).length)
+    }
+
+    @Test
+    def testMissingProperty = {
+        val rNode = new RichGraphNode(node)
+        Assert.assertEquals(0, (rNode / FOAF.thumbnail).length)
+        Assert.assertEquals("", rNode / FOAF.thumbnail *)
+
+    }
+
+    @Test
+    def testInverseImplicit = {
+        Assert.assertEquals(1, (node /- FOAF.knows).length)
+    }
+
+    @Test
+    def testPath = {
+        Assert.assertEquals(1, (node /- FOAF.knows).length)
+        Assert.assertEquals(new PlainLiteralImpl("Susanne"), node /- FOAF.knows % 0 / FOAF.name % 0 !)
+        Assert.assertEquals(new PlainLiteralImpl("Susanne"), ((node /- FOAF.knows) (0) / FOAF.name) (0) !)
+        Assert.assertEquals(new PlainLiteralImpl("Susanne"), node /- FOAF.knows / FOAF.name !)
+        Assert.assertEquals(new PlainLiteralImpl("Bill"), node / FOAF.knows / FOAF.nick !)
+        Assert.assertEquals("Bill", (node / FOAF.knows / FOAF.nick) (0) *)
+        Assert.assertEquals("Bill", node / FOAF.knows / FOAF.nick *)
+    }
+
+    @Test
+    def testLists = {
+        Assert.assertEquals(new PlainLiteralImpl("foo"), (node / SKOS04.related).asList().get(1))
+        Assert.assertEquals(new PlainLiteralImpl("foo"), (node / SKOS04.related % 0 !!) (1) !)
+        Assert.assertEquals(new PlainLiteralImpl("foo"),
+            (for (value <- node / SKOS04.related % 0 !!) yield value !).toList(1))
+        Assert.assertEquals(new PlainLiteralImpl("bar"),
+            (for (value <- node / SKOS04.related % 0 !!) yield value !).toList(2))
+        Assert.assertEquals(new PlainLiteralImpl("foo"), node / SKOS04.related % 0 %!! 1 !)
+    }
+
+    @Test
+    def sortProperties = {
+        Assert.assertEquals(new PlainLiteralImpl("bar"), (node / SKOS04.related % 0 !!).sortWith((a, b) => ((a *) < (b *)))(0) !)
+        Assert.assertEquals(johnUri, (node / SKOS04.related % 0 !!).sortWith((a, b) => ((a *) > (b *)))(0) !)
+    }
+
+    @Test
+    def literalAsObject = {
+        val dateLiteral = new TypedLiteralImpl("2009-01-01T01:33:58Z",
+            new IRI("http://www.w3.org/2001/XMLSchema#dateTime"))
+        val node = new GraphNode(dateLiteral, new SimpleGraph())
+        Assert.assertNotNull(node.as[java.util.Date])
+    }
+
+    @Test
+    def literalLanguage = {
+        node = new GraphNode(greetingsUri, mGraph)
+        val lang = new Language("en")
+        val enValue = (node / RDF.value).find(l => (l !).asInstanceOf[Literal].getLanguage == lang).get
+        Assert.assertEquals("hello", enValue *)
+    }
+
+}
diff --git a/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/TypeConversionTest.scala b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/TypeConversionTest.scala
new file mode 100644
index 0000000..2770926
--- /dev/null
+++ b/api.utils/src/test/scala/org/apache/clerezza/api/scala/utils/TypeConversionTest.scala
@@ -0,0 +1,70 @@
+/*
+ * 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.scala.utils
+
+import org.apache.clerezza.api._
+import org.apache.clerezza.api.impl._
+import org.apache.clerezza.api.impl.literal._
+import org.junit._
+
+class TypeConversionTest {
+
+    private val literalFactory = LiteralFactory.getInstance()
+
+    import Preamble._
+
+    @Test
+    def useStringAsObject {
+        val t = new TripleImpl(new IRI(("http://example.org/subject")), new IRI(("http://example.org/predicate")), "a value")
+        Assert.assertEquals(literalFactory.createTypedLiteral("a value"), t.getObject)
+    }
+
+    /*@Test
+    def useStringWithLanguageTag {
+      val t = new TripleImpl(new IRI(("http://example.org/subject")), new IRI(("http://example.org/predicate")), "a value"("en"))
+      Assert.assertEquals(new PlainLiteralImpl("a value", new Language("en")), t.getObject)
+    }*/
+
+    @Test
+    def useStringWithLanguageTag {
+        val lit = new PlainLiteralImpl("a value", new Language("en"))
+        val t = new TripleImpl(new IRI(("http://example.org/subject")), new IRI(("http://example.org/predicate")), "a value" lang "en")
+        Assert.assertEquals(lit, t.getObject)
+    }
+
+    @Test
+    def useStringWithType {
+        val typeUri = new IRI("http://example.org/dt")
+        val t = new TripleImpl(new IRI(("http://example.org/subject")), new IRI(("http://example.org/predicate")), "a value" ^^ typeUri)
+        Assert.assertEquals(new TypedLiteralImpl("a value", typeUri), t.getObject)
+    }
+
+    @Test
+    def literaToString {
+        val lit = literalFactory.createTypedLiteral("a value")
+        val s: String = lit
+        Assert.assertEquals("a value", s)
+    }
+
+    @Test
+    def dotUri {
+        val t = new TripleImpl(new IRI(("http://example.org/subject")), new IRI(("http://example.org/predicate")), "http://example.org".iri)
+        Assert.assertEquals(new IRI("http://example.org"), t.getObject)
+    }
+
+}


[clerezza] 40/45: CLEREZZA-1039: Remove doap_rdf.rdf

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 31f86582683e21ca554d084159535c4327a17ac9
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 21:19:46 2019 +0100

    CLEREZZA-1039: Remove doap_rdf.rdf
---
 doap_rdf.rdf | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/doap_rdf.rdf b/doap_rdf.rdf
deleted file mode 100644
index a7a5e17..0000000
--- a/doap_rdf.rdf
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.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.
--->
-<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
-  <Project rdf:about="http://commons.apache.org/rdf/">
-    <name>Apache Commons RDF</name>
-    <homepage rdf:resource="http://commons.apache.org/rdf/"/>
-    <programming-language>Java</programming-language>
-    <category rdf:resource="http://projects.apache.org/category/library"/>
-    <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
-    <bug-database rdf:resource="https://issues.apache.org/jira/browse/RDF"/>
-    <download-page rdf:resource="http://commons.apache.org/rdf/download_net.cgi"/>
-    <asfext:pmc rdf:resource="http://commons.apache.org/"/>
-    <shortdesc xml:lang="en">Apache Commons Rdf</shortdesc>
-    <description xml:lang="en"/>
-    <repository>
-      <SVNRepository>
-        <browse rdf:resource="http://svn.apache.org/repos/asf/commons/proper/rdf/trunk"/>
-        <location rdf:resource="http://svn.apache.org/repos/asf/commons/proper/rdf"/>
-      </SVNRepository>
-    </repository>
-    <release>
-    </release>
-    <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
-  </Project>
-</rdf:RDF>


[clerezza] 20/45: CLEREZZA-1034: Merge rdf simple storage into dataset module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit b314faa852faef954471773c784dd6ec6f266548
Author: Hasan <ha...@apache.org>
AuthorDate: Thu Feb 7 08:27:31 2019 +0100

    CLEREZZA-1034: Merge rdf simple storage into dataset module
---
 dataset/pom.xml                                    |  34 +++--
 .../clerezza/simple/storage/SimpleTcProvider.java  | 166 +++++++++++++++++++++
 .../org.apache.clerezza.dataset.WeightedTcProvider |   1 +
 .../simple/storage/AccessViaTcManager.java         |  40 +++++
 .../simple/storage/GenericTcProviderTest.java      |  43 ++++++
 .../simple/storage/SimpleGraphGenericTest.java     |  35 +++++
 pom.xml                                            |   2 +-
 7 files changed, 305 insertions(+), 16 deletions(-)

diff --git a/dataset/pom.xml b/dataset/pom.xml
index 3ce095f..5225584 100644
--- a/dataset/pom.xml
+++ b/dataset/pom.xml
@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!--
+  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
 
-   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.
+    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.
 -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -52,6 +51,11 @@
             <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>test.utils</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>
@@ -93,7 +97,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.dataset.*</Export-Package>
+                        <Export-Package>org.apache.clerezza.dataset.*, org.apache.clerezza.simple.storage.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/dataset/src/main/java/org/apache/clerezza/simple/storage/SimpleTcProvider.java b/dataset/src/main/java/org/apache/clerezza/simple/storage/SimpleTcProvider.java
new file mode 100644
index 0000000..f602ee4
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/simple/storage/SimpleTcProvider.java
@@ -0,0 +1,166 @@
+/*
+ * 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.simple.storage;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.graph.SimpleImmutableGraph;
+import org.apache.clerezza.dataset.*;
+import org.osgi.service.component.annotations.Component;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+@Component(service = WeightedTcProvider.class, property = TcManager.GENERAL_PURPOSE_TC+"=true")
+public class SimpleTcProvider implements WeightedTcProvider {
+
+    private Map<IRI, Graph> tripleMap = new HashMap<IRI, Graph>();
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples)
+            throws EntityAlreadyExistsException {
+        if ((name == null) || (name.getUnicodeString() == null)
+                || (name.getUnicodeString().trim().length() == 0)) {
+            throw new IllegalArgumentException("Name must not be null");
+        }
+
+        try {
+            // throws NoSuchEntityException if a Graph with that name
+            // already exists
+            this.getGraph(name);
+        } catch (NoSuchEntityException e) {
+            ImmutableGraph result;
+            if (triples == null) {
+                result = new SimpleImmutableGraph(new SimpleGraph());
+            } else {
+                if (ImmutableGraph.class.isAssignableFrom(triples.getClass())) {
+                    result = (ImmutableGraph) triples;
+                } else {
+                    result = new SimpleImmutableGraph(triples);
+                }
+            }
+            tripleMap.put(name, result);
+
+            return result;
+        }
+        throw new EntityAlreadyExistsException(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) throws EntityAlreadyExistsException {
+        if ((name == null) || (name.getUnicodeString() == null)
+                || (name.getUnicodeString().trim().length() == 0)) {
+            throw new IllegalArgumentException("Name must not be null");
+        }
+
+        try {
+            // throws NoSuchEntityException if a Graph with that name
+            // already exists
+            this.getGraph(name);
+        } catch (NoSuchEntityException e) {
+            Graph result = new SimpleGraph();
+            tripleMap.put(name, result);
+            return result;
+        }
+        throw new EntityAlreadyExistsException(name);
+    }
+
+    @Override
+    public void deleteGraph(IRI name)
+            throws NoSuchEntityException, EntityUndeletableException {
+        if (tripleMap.remove(name) == null) {
+            throw new NoSuchEntityException(name);
+        }
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        Graph tripleCollection = tripleMap.get(name);
+        if (tripleCollection == null) {
+            throw new NoSuchEntityException(name);
+        } else if (ImmutableGraph.class.isAssignableFrom(tripleCollection.getClass())) {
+            return (ImmutableGraph) tripleCollection;
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        Graph tripleCollection = tripleMap.get(name);
+        if (tripleCollection == null) {
+            throw new NoSuchEntityException(name);
+        } else if (!ImmutableGraph.class.isAssignableFrom(tripleCollection.getClass())) {
+            return (Graph) tripleCollection;
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph graph) {
+        throw new UnsupportedOperationException(
+                "Not supported yet. equals() has to be implemented first");
+    }
+
+    @Override
+    public Graph getGraph(IRI name)
+            throws NoSuchEntityException {
+        Graph tripleCollection = tripleMap.get(name);
+        if (tripleCollection == null) {
+            throw new NoSuchEntityException(name);
+        } else {
+            return tripleCollection;
+        }
+    }
+
+    @Override
+    public int getWeight() {
+        return 1;
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        Set<IRI> result = new HashSet<IRI>();
+        for (IRI uriRef : listGraphs()) {
+            if (tripleMap.get(uriRef) instanceof ImmutableGraph) {
+                result.add(uriRef);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        Set<IRI> result = new HashSet<IRI>();
+        for (IRI uriRef : listGraphs()) {
+            if (!(tripleMap.get(uriRef) instanceof ImmutableGraph)) {
+                result.add(uriRef);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        return tripleMap.keySet();
+    }
+}
diff --git a/dataset/src/main/resources/META-INF/services/org.apache.clerezza.dataset.WeightedTcProvider b/dataset/src/main/resources/META-INF/services/org.apache.clerezza.dataset.WeightedTcProvider
new file mode 100644
index 0000000..f2b0733
--- /dev/null
+++ b/dataset/src/main/resources/META-INF/services/org.apache.clerezza.dataset.WeightedTcProvider
@@ -0,0 +1 @@
+org.apache.clerezza.simple.storage.SimpleTcProvider
\ No newline at end of file
diff --git a/dataset/src/test/java/org/apache/clerezza/simple/storage/AccessViaTcManager.java b/dataset/src/test/java/org/apache/clerezza/simple/storage/AccessViaTcManager.java
new file mode 100644
index 0000000..3afbd63
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/simple/storage/AccessViaTcManager.java
@@ -0,0 +1,40 @@
+/*
+ * 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.simple.storage;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.dataset.TcManager;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author developer
+ */
+public class AccessViaTcManager {
+    
+    @Test
+    public void simple() {
+        Graph g = TcManager.getInstance().createGraph(new IRI("http://example.org/foo"));
+        Assert.assertTrue(g instanceof SimpleGraph);
+    }
+    
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java b/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.java
new file mode 100644
index 0000000..65dcd10
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/simple/storage/GenericTcProviderTest.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.clerezza.simple.storage;
+
+import org.apache.clerezza.dataset.TcProvider;
+import org.apache.clerezza.test.utils.TcProviderTest;
+import org.junit.After;
+
+/**
+ *
+ * @author mir
+ */
+public class GenericTcProviderTest extends TcProviderTest {
+
+    SimpleTcProvider provider = new SimpleTcProvider();
+
+    @After
+    public void cleanUp() {
+        provider = new SimpleTcProvider();
+    }
+
+    @Override
+    protected TcProvider getInstance() {
+        return provider;
+    }
+
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/simple/storage/SimpleGraphGenericTest.java b/dataset/src/test/java/org/apache/clerezza/simple/storage/SimpleGraphGenericTest.java
new file mode 100644
index 0000000..0445e97
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/simple/storage/SimpleGraphGenericTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.simple.storage;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.test.utils.GraphTest;
+
+/**
+ *
+ * @author mir
+ */
+public class SimpleGraphGenericTest extends GraphTest{
+
+    @Override
+    protected Graph getEmptyGraph() {
+        return new SimpleGraph();
+    }
+}
diff --git a/pom.xml b/pom.xml
index 9e0dc55..46ccaf4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,8 +45,8 @@
         <module>api.impl</module>
         <module>sparql</module>
         <module>representation</module>
-        <module>dataset</module>
         <module>test.utils</module>
+        <module>dataset</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>


[clerezza] 11/45: CLEREZZA-1026: Remove sparql parser generator in rdf.core

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 5bffbb5a194c37bd6a21efbd0736fa72bf1c34b6
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 04:20:17 2018 +0100

    CLEREZZA-1026: Remove sparql parser generator in rdf.core
---
 .../rdf/core/sparql/JavaCCGeneratedQueryParser.jj  | 1284 ----------
 .../core/sparql/JavaCCGeneratedSparqlPreParser.jj  | 2556 --------------------
 2 files changed, 3840 deletions(-)

diff --git a/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedQueryParser.jj b/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedQueryParser.jj
deleted file mode 100644
index c41426e..0000000
--- a/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedQueryParser.jj
+++ /dev/null
@@ -1,1284 +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.
- */
-options
-{
-   STATIC=false;
-   SUPPORT_CLASS_VISIBILITY_PUBLIC=false;
-   UNICODE_INPUT=true;
-   IGNORE_CASE=false;
-   JAVA_UNICODE_ESCAPE=false;
-   DEBUG_PARSER=false;
-   JDK_VERSION="1.6";
-}
-
-PARSER_BEGIN(JavaCCGeneratedQueryParser)
-
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BinaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.FunctionCall;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.LiteralExpression;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BuiltInCall;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefExpression;
-import org.apache.clerezza.rdf.core.sparql.query.UnaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleAlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleAskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleDescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleOrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleQueryWithSolutionModifier;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleSelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleTriplePattern;
-
-/**
- *
- * Credits: Fedora Commons, Inc.
- *            - for initial grammar of this file (available in mulgara project).
- * Modified by: Hasan <ha...@trialox.org>
- */
-class JavaCCGeneratedQueryParser {
-
-	private static final IRI RDF_TYPE =
-		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-	private static final IRI RDF_FIRST =
-		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
-	private static final IRI RDF_REST =
-		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
-	private static final IRI RDF_NIL =
-		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
-
-	/** A RegEx pattern for separating out a namespace from a prefixed name. */
-	private static final Pattern pfxNamePattern = Pattern.compile("([^:]*):(.*)");
-
-	private Query query;
-	private String base;
-	private Map<String, String> prefixes;
-	private Map<String, ResourceOrVariable> bNodes;
-	private int count;
-	private Map<String, Variable> vars;
-
-	void initialize() {
-		query = null;
-		base = null;
-		prefixes = new HashMap<String, String>();
-		bNodes = new HashMap<String, ResourceOrVariable>();
-		count = 0;
-		vars = new HashMap<String, Variable>();
-	}
-
-	Query parse() throws ParseException {
-		initialize();
-		this.Query();
-		return this.query;
-	}
-
-	private static String unquote(String s) {
-		return s.substring(1, s.length() - 1);
-	}
-
-	private static String unTripleQuote(String s) {
-		return s.substring(3, s.length() - 3);
-	}
-
-	private Variable getVariable(String name) {
-		name = name.substring(1);
-		Variable v = vars.get(name);
-		if (v == null) {
-			v = new Variable(name);
-			vars.put(name, v);
-			if (query instanceof SimpleSelectQuery) {
-				SimpleSelectQuery sq = (SimpleSelectQuery) query;
-				if (sq.isSelectAll()) {
-					sq.addSelection(v);
-				}
-			} else if (query instanceof SimpleDescribeQuery) {
-				SimpleDescribeQuery dq = (SimpleDescribeQuery) query;
-				if (dq.isDescribeAll()) {
-					dq.addResourceToDescribe(new ResourceOrVariable(v));
-				}
-			}
-		}
-		return v;
-	}
-
-	private void addTriplePatterns(Set<TriplePattern> triplePatterns,
-			ResourceOrVariable subject,
-			UriRefOrVariable predicate,
-			Set<ResourceOrVariable> objects) {
-
-		for (ResourceOrVariable object : objects) {
-			triplePatterns.add(
-				new SimpleTriplePattern(subject, predicate, object));
-		}
-	}
-
-	// nodes contain at least one element
-	private ResourceOrVariable addTriplePatterns(
-			Set<TriplePattern> triplePatterns,
-			List<ResourceOrVariable> nodes) {
-
-		ResourceOrVariable head = null;
-		UriRefOrVariable rdfFirst = new UriRefOrVariable(RDF_FIRST);
-		UriRefOrVariable rdfRest = new UriRefOrVariable(RDF_REST);
-		UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
-
-		ResourceOrVariable prevSubject = null;
-		for (ResourceOrVariable node : nodes) {
-			ResourceOrVariable currentSubject = getNewBNode();
-			if (prevSubject != null) {
-				triplePatterns.add(
-					new SimpleTriplePattern(prevSubject, rdfRest, currentSubject));
-			} else {
-				head = currentSubject;
-			}
-			triplePatterns.add(
-				new SimpleTriplePattern(currentSubject, rdfFirst, node));
-			prevSubject = currentSubject;
-		}
-		if (prevSubject != null) {
-			triplePatterns.add(
-				new SimpleTriplePattern(prevSubject, rdfRest, rdfNil));
-		}
-		return head;
-	}
-
-	private ResourceOrVariable getNewBNode() {
-		ResourceOrVariable bNode = new ResourceOrVariable(new BlankNode());
-		bNodes.put("*" + count++, bNode);
-		return bNode;
-	}
-
-	private ResourceOrVariable getBNode(String label) {
-		ResourceOrVariable bNode = bNodes.get(label);
-		if (bNode == null) {
-			bNode = new ResourceOrVariable(new BlankNode());
-			bNodes.put(label, bNode);
-		}
-		return bNode;
-	}
-
-	private IRI createUriRef(String r) throws ParseException {
-		// Create an IRI directly if the string does not start with a prefix
-		Matcher m = pfxNamePattern.matcher(r);
-		if (!m.matches()) {
-			// either a normal IRI, or one with a BASE
-			return isRelative(r) ? new IRI(base + r) : new IRI(r);
-		}
-		// extract the prefix, and attempt to convert to a URI before creating the reference
-		String ns = prefixes.get(m.group(1));
-		return ns == null ? new IRI(r) : new IRI(ns + m.group(2));
-	}
-
-	/**
-	 * Tests if the string for a URI is relative or absolute. The test is based on a scheme existing
-	 * in the string, which in turn expects a : character to follow it. If there is no colon, then
-	 * it is presumed to be relative. Otherwise, if there are special characters preceding the first
-	 * colon these are presumed to not be in a scheme.
-	 * @param u A string for a URI.
-	 * @return <code>true</code> if the URI appears to be relative, <code>false</code> otherwise.
-	 */
-	private static boolean isRelative(String u) {
-		int colon = u.indexOf(':');
-		if (colon < 0) {
-			return true;
-		}
-		for (int c = 0; c < colon; c++) {
-			// if there a non-alphanum characters then this is not a scheme, so the URI is relative
-			if (!Character.isLetterOrDigit(u.charAt(c))) {
-				return true;
-			}
-		}
-		// found a (probably) valid scheme, so the URI is absolute
-		return false;
-	}
-}
-PARSER_END(JavaCCGeneratedQueryParser)
-
-SKIP :
-{
-    "\t" | "\n" | "\r" | "\f" | " "
-}
-
-MORE :
-{
-    "#" : IN_COMMENT
-}
-
-<IN_COMMENT>
-SPECIAL_TOKEN :
-{
-  <COMMENT: ( ~[ "\r","\n" ] )* > : DEFAULT
-}
-
-TOKEN [IGNORE_CASE] :
-{
-    < SELECT : "SELECT" >
-|   < BASE : "BASE" >
-|   < ORDER : "ORDER" >
-|   < BY : "BY" >
-|   < FROM : "FROM" >
-|   < GRAPH : "GRAPH" >
-|   < STR : "STR" >
-|   < IS_URI : "isURI" >
-|   < PREFIX : "PREFIX" >
-|   < CONSTRUCT : "CONSTRUCT" >
-|   < LIMIT : "LIMIT" >
-|   < NAMED : "NAMED" >
-|   < OPTIONAL : "OPTIONAL" >
-|   < LANG : "lang" >
-|   < IS_IRI : "isIRI" >
-|   < DESCRIBE : "DESCRIBE" >
-|   < OFFSET : "OFFSET" >
-|   < WHERE : "WHERE" >
-|   < UNION : "UNION" >
-|   < LANGMATCHES : "langMatches" >
-|   < IS_BLANK : "isBlank" >
-|   < IS_LITERAL : "isLiteral" >
-|   < ASK : "ASK" >
-|   < DISTINCT : "DISTINCT" >
-|   < FILTER : "FILTER" >
-|   < DATATYPE : "datatype" >
-|   < REGEX : "regex" >
-|   < REDUCED : "REDUCED" >
-|   < BOUND : "bound" >
-|   < TRUE : "TRUE" >
-|   < SAME_TERM : "sameTerm" >
-|   < FALSE : "FALSE" >
-}
-
-
-/* [1]      Query      ::=      Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) */
-private void Query() : {} {
-	Prologue() ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() ) <EOF>
-}
-
-/* [2]      Prologue      ::=      BaseDecl? PrefixDecl* */
-private void Prologue() : {} {
-	( BaseDecl() )? ( PrefixDecl() )*
-}
-
-/* [3]      BaseDecl      ::=      'BASE' IRI_REF */
-private void BaseDecl() : {
-	Token iriRef; } {
-
-	<BASE> iriRef=<IRI_REF> { base = unquote(iriRef.image); }
-}
-
-/* [4]      PrefixDecl      ::=      'PREFIX' PNAME_NS IRI_REF */
-private void PrefixDecl() : {
-	Token ns, iriRef; } {
-
-	<PREFIX> ns=<PNAME_NS> iriRef=<IRI_REF> {
-	String pfx = ns.image;
-	prefixes.put(pfx.substring(0, pfx.length() - 1), unquote(iriRef.image)); }
-}
-
-/* [5]      SelectQuery   ::=   'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( Var+ | '*' ) DatasetClause* WhereClause SolutionModifier */
-private void SelectQuery() : {
-	Variable v; } {
-
-	<SELECT> {
-	query = new SimpleSelectQuery(); }
-	(
-		<DISTINCT> {
-		((SimpleSelectQuery) query).setDistinct(); }
-	|
-		<REDUCED> {
-		((SimpleSelectQuery) query).setReduced(); }
-	)?
-	(
-		( v=Var() {
-			((SimpleSelectQuery) query).addSelection(v); } )+
-		|
-		"*" {
-			((SimpleSelectQuery) query).setSelectAll(); }
-	)
-	( DatasetClause() )*
-	WhereClause()
-	SolutionModifier()
-}
-
-/* [6]      ConstructQuery    ::=   'CONSTRUCT' ConstructTemplate DatasetClause* WhereClause SolutionModifier */
-private void ConstructQuery() : {
-	Set<TriplePattern> triplePatterns = null; } {
-
-	<CONSTRUCT>
-	triplePatterns=ConstructTemplate() {
-	query = new SimpleConstructQuery(triplePatterns); }
-	( DatasetClause() )*
-	WhereClause()
-	SolutionModifier()
-}
-
-/* [7]      DescribeQuery      ::=      'DESCRIBE' ( VarOrIRIref+ | '*' ) DatasetClause* WhereClause? SolutionModifier */
-private void DescribeQuery() : {
-	UriRefOrVariable node; } {
-
-	<DESCRIBE> {
-	query = new SimpleDescribeQuery(); }
-	(
-		( node=VarOrIRIref() {
-			((SimpleDescribeQuery) query).addResourceToDescribe(node); } )+
-		|
-		"*" {
-			((SimpleDescribeQuery) query).setDescribeAll(); }
-	)
-	( DatasetClause() )*
-	( WhereClause() )?
-	SolutionModifier()
-}
-
-/* [8]      AskQuery      ::=   'ASK' DatasetClause* WhereClause */
-private void AskQuery() : {} {
-	<ASK> {
-	query = new SimpleAskQuery(); }
-	( DatasetClause() )*
-	WhereClause()
-}
-
-/* [9]   DatasetClause   ::=   'FROM' ( DefaultGraphClause | NamedGraphClause ) */
-private void DatasetClause() : {} {
-	<FROM> (DefaultGraphClause() | NamedGraphClause())
-}
-
-/* [10]    DefaultGraphClause    ::=    SourceSelector */
-private void DefaultGraphClause() : {
-	IRI defaultGraph; } {
-
-	defaultGraph=SourceSelector() {
-	((SimpleQuery) query).addDefaultGraph(defaultGraph); }
-}
-
-/* [11]    NamedGraphClause    ::=    'NAMED' SourceSelector */
-private void NamedGraphClause() : {
-	IRI namedGraph; } {
-
-	<NAMED> namedGraph=SourceSelector() {
-	((SimpleQuery) query).addNamedGraph(namedGraph); }
-}
-
-/* [12]    SourceSelector    ::=    IRIref */
-private IRI SourceSelector() : {
-	IRI graph; } {
-
-	graph=IRIref() {
-	return graph; }
-}
-
-/* [13]    WhereClause    ::=    'WHERE'? GroupGraphPattern */
-private void WhereClause() : {
-	GroupGraphPattern queryPattern; } {
-
-	(<WHERE>)? queryPattern=GroupGraphPattern() {
-	((SimpleQuery) query).setQueryPattern(queryPattern); }
-}
-
-/* [14]    SolutionModifier    ::=    OrderClause? LimitOffsetClauses? */
-private void SolutionModifier() : {} {
-	( OrderClause() )?
-	( LimitOffsetClauses() )?
-}
-
-/* [15]    LimitOffsetClauses    ::=    ( LimitClause OffsetClause? | OffsetClause LimitClause? ) */
-private void LimitOffsetClauses() : {} {
-	( LimitClause() (OffsetClause())? )
-	|
-	( OffsetClause() (LimitClause())? )
-}
-
-/* [16]    OrderClause    ::=    'ORDER' 'BY' OrderCondition+ */
-private void OrderClause() : {} {
-	<ORDER> <BY> ( OrderCondition() )+
-}
-
-/* [17]    OrderCondition    ::=     ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) */
-private void OrderCondition() : {
-	boolean asc = true;
-	Expression e; } {
-
-	(
-		( ( "ASC" | "DESC" { asc = false; } ) e=BrackettedExpression() )
-		|
-		( e=Constraint() | e=Var() )
-	) {
-	((SimpleQueryWithSolutionModifier) query).addOrderCondition(new SimpleOrderCondition(e, asc)); }
-}
-
-/* [18]    LimitClause    ::=    'LIMIT' INTEGER */
-private void LimitClause() : {
-	Token t; } {
-
-	<LIMIT> t=<INTEGER> {
-	((SimpleQueryWithSolutionModifier) query).setLimit(Integer.parseInt(t.image)); }
-}
-
-/* [19]    OffsetClause    ::=    'OFFSET' INTEGER */
-private void OffsetClause() : {
-	Token t; } {
-
-	<OFFSET> t=<INTEGER> {
-	((SimpleQueryWithSolutionModifier) query).setOffset(Integer.parseInt(t.image)); }
-}
-
-/* [20]    GroupGraphPattern    ::=    '{' TriplesBlock? ( ( GraphPatternNotTriples | Filter ) '.'? TriplesBlock? )* '}' */
-private GroupGraphPattern GroupGraphPattern() : {
-	GroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern();
-	Expression constraint; } {
-
-	"{"
-	( TriplesBlock(groupGraphPattern) )?
-	(
-		(
-		GraphPatternNotTriples(groupGraphPattern)
-		|
-		constraint=Filter() {
-		((SimpleGroupGraphPattern) groupGraphPattern).addConstraint(constraint); }
-		)
-
-		(".")?
-
-		(
-		TriplesBlock(groupGraphPattern)
-		)?
-	)*
-	"}" {
-	return groupGraphPattern; }
-}
-
-/* [21]    TriplesBlock    ::=    TriplesSameSubject ( '.' TriplesBlock? )? */
-private void TriplesBlock(GroupGraphPattern groupGraphPattern) : {
-	Set<TriplePattern> triplePatterns; } {
-
-	triplePatterns=TriplesSameSubject() {
-	((SimpleGroupGraphPattern) groupGraphPattern).addTriplePatterns(triplePatterns); }
-
-	( "." (TriplesBlock(groupGraphPattern) )?
-	)?
-}
-
-/* [22]    GraphPatternNotTriples    ::=    OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern */
-private void GraphPatternNotTriples(GroupGraphPattern groupGraphPattern) : {} {
-
-	(
-	OptionalGraphPattern(groupGraphPattern)
-	|
-	GroupOrUnionGraphPattern(groupGraphPattern)
-	|
-	GraphGraphPattern(groupGraphPattern)
-	)
-}
-
-/* [23]    OptionalGraphPattern    ::=    'OPTIONAL' GroupGraphPattern */
-private void OptionalGraphPattern(GroupGraphPattern groupGraphPattern) : {
-	GroupGraphPattern optional; } {
-
-	<OPTIONAL>
-	optional=GroupGraphPattern() {
-	((SimpleGroupGraphPattern) groupGraphPattern).addOptionalGraphPattern(optional); }
-}
-
-/* [24]    GraphGraphPattern    ::=    'GRAPH' VarOrIRIref GroupGraphPattern */
-private void GraphGraphPattern(GroupGraphPattern groupGraphPattern) : {
-	UriRefOrVariable graph;
-	GroupGraphPattern g; } {
-
-	<GRAPH>
-	graph=VarOrIRIref()
-	g=GroupGraphPattern() {
-	((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(
-		new SimpleGraphGraphPattern(graph, g)); }
-}
-
-/* [25]    GroupOrUnionGraphPattern    ::=    GroupGraphPattern ( 'UNION' GroupGraphPattern )* */
-private void GroupOrUnionGraphPattern(GroupGraphPattern groupGraphPattern) : {
-	GroupGraphPattern g;
-	AlternativeGraphPattern unionGraphPattern = null; } {
-
-	g=GroupGraphPattern()
-	(
-		<UNION> {
-		if (unionGraphPattern == null) {
-			unionGraphPattern = new SimpleAlternativeGraphPattern(g);
-		} }
-		g=GroupGraphPattern() {
-		((SimpleAlternativeGraphPattern) unionGraphPattern).addAlternativeGraphPattern(g); }
-	)* {
-	if (unionGraphPattern != null) {
-		((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(unionGraphPattern);
-	} else {
-		((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(g);
-	} }
-}
-
-/* [26]    Filter    ::=    'FILTER' Constraint */
-private Expression Filter() : {
-	Expression c; } {
-
-	<FILTER>
-	c=Constraint() {
-	return c; }
-}
-
-/* [27]    Constraint    ::=    BrackettedExpression | BuiltInCall | FunctionCall */
-private Expression Constraint() : {
-	Expression c; } {
-
-    ( c=BrackettedExpression() | c=BuiltInCall() | c=FunctionCall() ) {
-	return c; }
-}
-
-/* [28]    FunctionCall    ::=    IRIref ArgList */
-private FunctionCall FunctionCall() : {
-	IRI name;
-	List<Expression> arguments;} {
-
-	name=IRIref()
-	arguments=ArgList() {
-	return new FunctionCall(name, arguments); }
-}
-
-/* [29]    ArgList    ::=    ( NIL | '(' Expression ( ',' Expression )* ')' ) */
-private List<Expression> ArgList() : {
-	List<Expression> args = new ArrayList<Expression>();
-	Expression e; } {
-
-	(
-		<NIL>
-		|
-		(
-			"("
-			e=Expression() {
-			args.add(e); }
-				( ","
-				e=Expression() {
-				args.add(e); }
-				)*
-			")"
-		)
-	) {
-	return args; }
-}
-
-/* [30]    ConstructTemplate    ::=    '{' ConstructTriples? '}' */
-private Set<TriplePattern> ConstructTemplate() : {
-	Set<TriplePattern> triplePatterns = null; } {
-
-	"{" (
-	triplePatterns=ConstructTriples()
-	)? "}" {
-	return triplePatterns; }
-}
-
-/* [31]    ConstructTriples    ::=    TriplesSameSubject ( '.' ConstructTriples? )? */
-private Set<TriplePattern> ConstructTriples() : {
-	Set<TriplePattern> triplePatterns, t; } {
-
-	triplePatterns=TriplesSameSubject()
-	( "."
-		(
-		t=ConstructTriples() {
-		triplePatterns.addAll(t); }
-		)?
-	)? {
-	return triplePatterns; }
-}
-
-/* [32]    TriplesSameSubject    ::=    VarOrTerm PropertyListNotEmpty |  TriplesNode PropertyList */
-private Set<TriplePattern> TriplesSameSubject() : {
-	Set<TriplePattern> triplePatterns = new LinkedHashSet<TriplePattern>();
-	ResourceOrVariable subject; } {
-
-	( subject=VarOrTerm() PropertyListNotEmpty(subject, triplePatterns) {
-		return triplePatterns; }
-	)
-	|
-	( subject=TriplesNode(triplePatterns) PropertyList(subject, triplePatterns) {
-		return triplePatterns; }
-	)
-}
-
-/* [33]    PropertyListNotEmpty    ::=    Verb ObjectList ( ';' ( Verb ObjectList )? )* */
-private void PropertyListNotEmpty(ResourceOrVariable subject,
-		Set<TriplePattern> triplePatterns) : {
-	UriRefOrVariable predicate;
-	Set<ResourceOrVariable> objects; } {
-	predicate=Verb()
-	objects=ObjectList(triplePatterns) {
-	addTriplePatterns(triplePatterns, subject, predicate, objects); }
-
-	( ";"
-		( predicate=Verb() objects=ObjectList(triplePatterns) {
-			addTriplePatterns(triplePatterns, subject, predicate, objects); }
-		)?
-	)*
-}
-
-/* [34]    PropertyList    ::=    PropertyListNotEmpty? */
-private void PropertyList(ResourceOrVariable subject,
-		Set<TriplePattern> triplePatterns) : { } {
-	( PropertyListNotEmpty(subject, triplePatterns) )?
-}
-
-/* [35]    ObjectList    ::=    Object ( ',' Object )* */
-private Set<ResourceOrVariable> ObjectList(Set<TriplePattern> triplePatterns) : {
-	ResourceOrVariable object; } {
-
-	{
-	Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
-	}
-	object=Object(triplePatterns) {
-	objects.add(object); }
-
-	( ","
-		object=Object(triplePatterns) {
-			objects.add(object); }
-	)* {
-	return objects; }
-}
-
-/* [36]    Object    ::=    GraphNode */
-private ResourceOrVariable Object(Set<TriplePattern> triplePatterns) : {
-	ResourceOrVariable object; } {
-
-	object=GraphNode(triplePatterns) {
-	return object; }
-}
-
-/* [37]    Verb    ::=    VarOrIRIref | 'a' */
-private UriRefOrVariable Verb() : {
-	UriRefOrVariable predicate; } {
-
-	predicate=VarOrIRIref() {
-	return predicate; }
-	| "a" {
-	return new UriRefOrVariable(RDF_TYPE); }
-}
-
-// Fill in the specified set of TriplePattern and returns the subject node
-/* [38]    TriplesNode    ::=    Collection |  BlankNodePropertyList */
-private ResourceOrVariable TriplesNode(Set<TriplePattern> triplePatterns) : {
-	ResourceOrVariable subject; } {
-	(
-		subject=Collection(triplePatterns)
-	|
-		subject=BlankNodePropertyList(triplePatterns)
-	) {
-	return subject; }
-}
-
-/* [39]    BlankNodePropertyList    ::=    '[' PropertyListNotEmpty ']' */
-private ResourceOrVariable BlankNodePropertyList(Set<TriplePattern> triplePatterns) : { } {
-	{
-	ResourceOrVariable subject = getNewBNode();
-	}
-	"[" PropertyListNotEmpty(subject, triplePatterns) "]" {
-	return subject; }
-}
-
-/* [40]    Collection    ::=    '(' GraphNode+ ')' */
-private ResourceOrVariable Collection(Set<TriplePattern> triplePatterns) : {
-	ResourceOrVariable node;
-	List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
-
-	"("
-		(
-		node=GraphNode(triplePatterns) {
-		nodes.add(node); }
-		)+
-	")" {
-	return addTriplePatterns(triplePatterns, nodes); }
-}
-
-/* [41]    GraphNode    ::=    VarOrTerm |  TriplesNode */
-private ResourceOrVariable GraphNode(Set<TriplePattern> triplePatterns) : {
-	ResourceOrVariable node; } {
-
-	(
-	node=VarOrTerm()
-	|
-	node=TriplesNode(triplePatterns)
-	) {
-	return node; }
-}
-
-/* [42]    VarOrTerm    ::=    Var | GraphTerm */
-private ResourceOrVariable VarOrTerm() : {
-	ResourceOrVariable r;
-	Variable v; } {
-
-    (
-	v=Var() {
-	return new ResourceOrVariable(v); }
-	|
-	r=GraphTerm() {
-	return r; }
-	)
-}
-
-/* [43]    VarOrIRIref    ::=    Var | IRIref */
-private UriRefOrVariable VarOrIRIref() : {
-	Variable var;
-	IRI IRI; } {
-
-	(
-	var=Var() {
-	return new UriRefOrVariable(var); }
-	|
-	IRI=IRIref() {
-	return new UriRefOrVariable(IRI); }
-	)
-}
-
-/* [44]    Var    ::=    VAR1 | VAR2 */
-private Variable Var() : {
-	Token t;} {
-
-	(t=<VAR1> | t=<VAR2>) {
-	return getVariable(t.image); }
-}
-
-/* [45]    GraphTerm    ::=    IRIref |  RDFLiteral |  NumericLiteral |  BooleanLiteral |  BlankNode |  NIL */
-private ResourceOrVariable GraphTerm() : {
-	ResourceOrVariable bNode = null;
-	RDFTerm r = null; } {
-
-	(r=IRIref() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | bNode=BlankNode() | <NIL> {
-		r = RDF_NIL; }) {
-	if (bNode == null) {
-		return new ResourceOrVariable(r);
-	}
-	return bNode; }
-}
-
-/* [46]    Expression    ::=    ConditionalOrExpression */
-private Expression Expression() : {
-	Expression e; } {
-
-	e=ConditionalOrExpression() {
-	return e; }
-}
-
-/* [47]    ConditionalOrExpression    ::=    ConditionalAndExpression ( '||' ConditionalAndExpression )* */
-private Expression ConditionalOrExpression() : {
-	Expression e, ae; } {
-
-	e=ConditionalAndExpression()
-	( "||"
-		ae=ConditionalAndExpression() {
-		e = new BinaryOperation("||", e, ae); }
-	)* {
-	return e; }
-}
-
-/* [48]    ConditionalAndExpression    ::=    ValueLogical ( '&&' ValueLogical )* */
-private Expression ConditionalAndExpression() : {
-	Expression e, e2; } {
-
-	e=ValueLogical()
-	( "&&"
-		e2=ValueLogical() {
-		e = new BinaryOperation("&&", e, e2); }
-	)* {
-	return e; }
-}
-
-/* [49]    ValueLogical    ::=    RelationalExpression */
-private Expression ValueLogical() : {
-	Expression e; } {
-
-	e=RelationalExpression() {
-	return e; }
-}
-
-/* [50]    RelationalExpression    ::=    NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression )? */
-private Expression RelationalExpression() : {
-	Expression e, e2; } {
-
-	e=NumericExpression()
-	(
-		"=" e2=NumericExpression() {
-			e = new BinaryOperation("=", e, e2); }
-		| "!=" e2=NumericExpression() {
-			e = new BinaryOperation("!=", e, e2); }
-		| "<" e2=NumericExpression() {
-			e = new BinaryOperation("<", e, e2); }
-		| ">" e2=NumericExpression() {
-			e = new BinaryOperation(">", e, e2); }
-		| "<=" e2=NumericExpression() {
-			e = new BinaryOperation("<=", e, e2); }
-		| ">=" e2=NumericExpression() {
-			e = new BinaryOperation(">=", e, e2); }
-	)? {
-	return e; }
-}
-
-/* [51]    NumericExpression    ::=    AdditiveExpression */
-private Expression NumericExpression() : {
-	Expression e; } {
-
-	e=AdditiveExpression() {
-	return e; }
-}
-
-/* [52]    AdditiveExpression    ::=    MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | NumericLiteralPositive | NumericLiteralNegative )* */
-private Expression AdditiveExpression() : {
-	Expression e, e2;
-	Literal l; } {
-
-	e=MultiplicativeExpression()
-	(
-		"+" e2=MultiplicativeExpression() {
-			e = new BinaryOperation("+", e, e2); }
-		| "-" e2=MultiplicativeExpression() {
-			e = new BinaryOperation("-", e, e2); }
-		| l=NumericLiteralPositive() {
-			e = new BinaryOperation("+", e, new LiteralExpression(l)); }
-		| l=NumericLiteralNegative() {
-			e = new BinaryOperation("-", e, new LiteralExpression(l)); }
-	)* {
-	return e; }
-}
-
-/* [53]    MultiplicativeExpression    ::=    UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* */
-private Expression MultiplicativeExpression() : {
-	Expression e, e2; } {
-
-	e=UnaryExpression()
-	(
-		"*" e2=UnaryExpression() {
-			e = new BinaryOperation("*", e, e2); }
-		| "/" e2=UnaryExpression() {
-			e = new BinaryOperation("/", e, e2); }
-	)* {
-	return e; }
-}
-
-/* [54]    UnaryExpression    ::=      '!' PrimaryExpression  |  '+' PrimaryExpression  | '-' PrimaryExpression  | PrimaryExpression */
-private Expression UnaryExpression() : {
-	Expression e; } {
-
-	"!" e=PrimaryExpression() {
-		return new UnaryOperation("!", e); }
-    | "+" e=PrimaryExpression() {
-		return new UnaryOperation("+", e); }
-    | "-" e=PrimaryExpression() {
-		return new UnaryOperation("-", e); }
-    | e=PrimaryExpression() {
-		return e; }
-}
-
-/* [55]    PrimaryExpression    ::=    BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var */
-private Expression PrimaryExpression() : {
-	Expression e = null;
-	Literal l = null; } {
-
-	(
-	e=BrackettedExpression() | e=BuiltInCall() | e=IRIrefOrFunction() | l=RDFLiteral() | l=NumericLiteral() | l=BooleanLiteral() | e=Var()
-	) {
-	if (l != null) {
-		return new LiteralExpression(l);
-	}
-	return e; }
-}
-
-/* [56]    BrackettedExpression    ::=    '(' Expression ')' */
-private Expression BrackettedExpression() : {
-	Expression e; } {
-
-	"("
-	e=Expression()
-	")" {
-	return e; }
-}
-
-/* [57]    BuiltInCall    ::=      'STR' '(' Expression ')' */
-/* |  'LANG' '(' Expression ')' */
-/* |  'LANGMATCHES' '(' Expression ',' Expression ')' */
-/* |  'DATATYPE' '(' Expression ')' */
-/* |  'BOUND' '(' Var ')' */
-/* |  'sameTerm' '(' Expression ',' Expression ')' */
-/* |  'isIRI' '(' Expression ')' */
-/* |  'isURI' '(' Expression ')' */
-/* |  'isBLANK' '(' Expression ')' */
-/* |  'isLITERAL' '(' Expression ')' */
-/* |  RegexExpression */
-private BuiltInCall BuiltInCall() : {
-	List<Expression> args = new ArrayList<Expression>();
-	String name;
-	Expression e; } {
-	(
-	<STR> {
-		name = "STR"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <LANG> {
-		name = "LANG"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <LANGMATCHES> {
-		name = "LANGMATCHES"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		","
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <DATATYPE> {
-		name = "DATATYPE"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <BOUND> {
-		name = "BOUND"; }
-		"("
-		e=Var() {
-		args.add(e); }
-		")"
-	| <SAME_TERM> {
-		name = "sameTerm"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		","
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <IS_IRI> {
-		name = "isIRI"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <IS_URI> {
-		name = "isURI"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <IS_BLANK> {
-		name = "isBLANK"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| <IS_LITERAL> {
-		name = "isLITERAL"; }
-		"("
-		e=Expression() {
-		args.add(e); }
-		")"
-	| e=RegexExpression() {
-		return (BuiltInCall) e; }
-	) {
-		return new BuiltInCall(name, args);
-	}
-}
-
-/* [58]    RegexExpression    ::=    'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')' */
-private BuiltInCall RegexExpression() : {
-	List<Expression> args = new ArrayList<Expression>();
-	Expression e = null; } {
-
-	<REGEX>
-	"("
-	e=Expression() {
-	args.add(e); }
-	","
-	e=Expression() {
-	args.add(e); }
-	(
-		","
-		e=Expression() {
-		args.add(e); }
-	)?
-	")" {
-	return new BuiltInCall("REGEX", args); }
-}
-
-/* [59]    IRIrefOrFunction    ::=    IRIref ArgList? */
-private Expression IRIrefOrFunction() : {
-	IRI IRI;
-	List<Expression> args; } {
-
-	IRI=IRIref()
-	(
-		args=ArgList() {
-		return new FunctionCall(IRI, args); }
-	)? {
-	return new UriRefExpression(IRI); }
-}
-
-/* [60]    RDFLiteral    ::=    String ( LANGTAG | ( '^^' IRIref ) )? */
-private Literal RDFLiteral() : {
-	Token t;
-	String s;
-	IRI type; } {
-
-	s = String()
-	(
-		t=<LANGTAG> {
-		return new PlainLiteralImpl(s, new Language(t.image.substring(1))); }
-		|
-		( "^^"
-			type=IRIref() {
-			return new TypedLiteralImpl(s, type); }
-		)
-	)? {
-	return new PlainLiteralImpl(s); }
-}
-
-/* [61]    NumericLiteral    ::=    NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative */
-private Literal NumericLiteral() : {
-	Literal l; } {
-
-	( l=NumericLiteralUnsigned() | l=NumericLiteralPositive() | l=NumericLiteralNegative() ) {
-	return l; }
-}
-
-/* [62]    NumericLiteralUnsigned    ::=    INTEGER |  DECIMAL |  DOUBLE */
-private Literal NumericLiteralUnsigned() : {
-	Token t; } {
-
-	t=<INTEGER> {
-		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-	| t=<DECIMAL> {
-		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-	| t=<DOUBLE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [63]    NumericLiteralPositive    ::=    INTEGER_POSITIVE |  DECIMAL_POSITIVE |  DOUBLE_POSITIVE */
-private Literal NumericLiteralPositive() : {
-	Token t; } {
-
-	t=<INTEGER_POSITIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-	| t=<DECIMAL_POSITIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-	| t=<DOUBLE_POSITIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [64]    NumericLiteralNegative    ::=    INTEGER_NEGATIVE |  DECIMAL_NEGATIVE |  DOUBLE_NEGATIVE */
-private Literal NumericLiteralNegative() : {
-	Token t; } {
-
-	t=<INTEGER_NEGATIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-	| t=<DECIMAL_NEGATIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-	| t=<DOUBLE_NEGATIVE> {
-		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [65]    BooleanLiteral    ::=    'true' |  'false' */
-private Literal BooleanLiteral() : {} {
-
-	<TRUE> {
-		return LiteralFactory.getInstance().createTypedLiteral(true); }
-	| <FALSE> {
-		return LiteralFactory.getInstance().createTypedLiteral(false); }
-}
-
-/* [66]    String    ::=    STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 */
-private String String() : {
-	Token t; } {
-	t=<STRING_LITERAL1> {
-		return unquote(t.image) ; }
-	| t=<STRING_LITERAL2> {
-		return unquote(t.image) ; }
-	| t=<STRING_LITERAL_LONG1> {
-		return unTripleQuote(t.image) ; }
-	| t=<STRING_LITERAL_LONG2> {
-		return unTripleQuote(t.image) ; }
-}
-
-/* [67]    IRIref    ::=    IRI_REF |  PrefixedName */
-private IRI IRIref() : {
-	IRI IRI;
-	Token t; } {
-
-	t=<IRI_REF> {
-	return createUriRef(unquote(t.image)); }
-	|
-	IRI=PrefixedName() {
-	return IRI; }
-}
-
-/* [68]    PrefixedName    ::=    PNAME_LN | PNAME_NS */
-private IRI PrefixedName() : {
-	Token t; } {
-
-	( t=<PNAME_LN> | t=<PNAME_NS> ) {
-	return createUriRef(t.image); }
-}
-
-/* [69]    BlankNode    ::=    BLANK_NODE_LABEL |  ANON */
-private ResourceOrVariable BlankNode() : {
-	Token t; } {
-
-	t=<BLANK_NODE_LABEL> {
-	return getBNode(t.image); }
-	| <ANON> {
-	return getNewBNode(); }
-}
-
-
-TOKEN : {
-  /* [70]    IRI_REF    ::=    '<' ([^<>"{}|^`\]-[#x00-#x20])* '>' */
-  < IRI_REF : "<" ( ~["<", ">", "\"", "{", "}", "|", "^", "`", "\\", "\u0000"-"\u0020"] )* ">" >
-  |
-  /* [71]    PNAME_NS    ::=    PN_PREFIX? ':' */
-  < PNAME_NS : (<PN_PREFIX>)? ":" >
-  |
-  /* [72]    PNAME_LN    ::=    PNAME_NS PN_LOCAL */
-  < PNAME_LN : <PNAME_NS> <PN_LOCAL> >
-  |
-  /* [73]    BLANK_NODE_LABEL    ::=    '_:' PN_LOCAL */
-  < BLANK_NODE_LABEL : "_:" <PN_LOCAL> >
-  |
-  /* [74]    VAR1    ::=    '?' VARNAME */
-  < VAR1 : "?" <VARNAME> >
-  |
-  /* [75]    VAR2    ::=    '$' VARNAME */
-  < VAR2 : "$" <VARNAME> >
-  |
-  /* [76]    LANGTAG    ::=    '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* */
-  < LANGTAG : "@" (["a"-"z", "A"-"Z"])+ ( "-" (["a"-"z", "A"-"Z", "0"-"9"])+ )* >
-}
-
-TOKEN : {
-  < #Z_9 : ["0"-"9"] >
-  |
-  < #Z_9r : (<Z_9>)+ >
-  |
-   < #Z_9o : (<Z_9>)* >
-  |
-  /* [77]    INTEGER    ::=    [0-9]+ */
-  < INTEGER : <Z_9r> >
-  |
-  /* [78]    DECIMAL    ::=    [0-9]+ '.' [0-9]* | '.' [0-9]+ */
-  < DECIMAL : ( <Z_9r> "." <Z_9o> ) | ( "." <Z_9r> ) >
-  |
-  /* [79]    DOUBLE    ::=    [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT */
-  < DOUBLE : ( <Z_9r> "." <Z_9o>  <EXPONENT> ) | ( "." <Z_9r> <EXPONENT> ) | ( <Z_9r> <EXPONENT> ) >
-  |
-  /* [80]    INTEGER_POSITIVE    ::=    '+' INTEGER */
-  < INTEGER_POSITIVE : "+" <INTEGER> >
-  |
-  /* [81]    DECIMAL_POSITIVE    ::=    '+' DECIMAL */
-  < DECIMAL_POSITIVE : "+" <DECIMAL> >
-  |
-  /* [82]    DOUBLE_POSITIVE    ::=    '+' DOUBLE */
-  < DOUBLE_POSITIVE : "+" <DOUBLE> >
-  |
-  /* [83]    INTEGER_NEGATIVE    ::=    '-' INTEGER */
-  < INTEGER_NEGATIVE : "-" <INTEGER> >
-  |
-  /* [84]    DECIMAL_NEGATIVE    ::=    '-' DECIMAL */
-  < DECIMAL_NEGATIVE : "-" <DECIMAL> >
-  |
-  /* [85]    DOUBLE_NEGATIVE    ::=    '-' DOUBLE */
-  < DOUBLE_NEGATIVE : "-" <DOUBLE> >
-  |
-  /* [86]    EXPONENT    ::=    [eE] [+-]? [0-9]+ */
-  < #EXPONENT : ["e","E"] (["+","-"])? <Z_9r> >
-}
-
-TOKEN : {
-  /* [87]    STRING_LITERAL1    ::=    "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'" */
-  < STRING_LITERAL1 : "'" ( ~["'", "\\", "\r", "\n"] | <ECHAR> )* "'" >
-  |
-  /* [88]    STRING_LITERAL2    ::=    '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"' */
-  < STRING_LITERAL2 : "\"" ( ~["\"", "\\", "\r", "\n"] | <ECHAR> )* "\"" >
-  |
-  /* [89]    STRING_LITERAL_LONG1    ::=    "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''" */
-  < STRING_LITERAL_LONG1 : "'''" ( ( "'" | "''" )? ( ~["'","\\"] | <ECHAR> ) )* "'''" >
-  |
-  /* [90]    STRING_LITERAL_LONG2    ::=    '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""' */
-  < STRING_LITERAL_LONG2 : "\"\"\"" ( ( "\"" | "\"\"" )? ( ~["\"","\\"] | <ECHAR> ) )* "\"\"\"" >
-  |
-  /* [91]    #ECHAR    ::=    '\' [tbnrf\"'] */
-  < #ECHAR : "\\" ["t","b","n","r","f","\\","\"","'"] >
-}
-
-TOKEN : {
-  /* [92]    NIL    ::=    '(' WS* ')' */
-  < NIL : "(" (<WS>)* ")" >
-  |
-  /* [93]    WS    ::=    #x20 | #x9 | #xD | #xA */
-  < #WS : " " | "\t" | "\n" | "\r" >
-  |
-  /* [94]   ANON    ::=    '[' WS* ']' */
-  < ANON : "[" (<WS>)* "]" >
-}
-
-TOKEN : {
-  /* [95]   #PN_CHARS_BASE ::=  [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] */
-  < #PN_CHARS_BASE : ["A"-"Z", "a"-"z", "\u00C0"-"\u00D6", "\u00D8"-"\u00F6", "\u00F8"-"\u02FF", "\u0370"-"\u037D", "\u037F"-"\u1FFF", "\u200C"-"\u200D", "\u2070"-"\u218F", "\u2C00"-"\u2FEF", "\u3001"-"\uD7FF", "\uF900"-"\uFDCF", "\uFDF0"-"\uFFFD"] >
-  |
-  /* [96]   #PN_CHARS_U    ::=  PN_CHARS_BASE | '_' */
-  < #PN_CHARS_U : <PN_CHARS_BASE> | "_" >
-  |
-  /* [97]   #VARNAME  ::=   ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* */
-  < #VARNAME : (<PN_CHARS_U> | <Z_9>) ( <PN_CHARS_U> | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] )* >
-  |
-  /* [98]   #PN_CHARS  ::=  PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] */
-  < #PN_CHARS : <PN_CHARS_U> | "-" | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] >
-  |
-  /* [99]   PN_PREFIX  ::=  PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? */
-  < PN_PREFIX : <PN_CHARS_BASE> (( <PN_CHARS> | "." )* <PN_CHARS>)? >
-  |
-  /* [100]  PN_LOCAL  ::=   ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?  */
-  /* Note that SPARQL local names allow leading digits while XML local names do not. */
-  < PN_LOCAL : ( <PN_CHARS_U> | <Z_9> ) (( <PN_CHARS> | "." )* <PN_CHARS>)? >
-}
diff --git a/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedSparqlPreParser.jj b/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedSparqlPreParser.jj
deleted file mode 100644
index 4ef0976..0000000
--- a/rdf/core/src/main/javacc/org/apache/clerezza/rdf/core/sparql/JavaCCGeneratedSparqlPreParser.jj
+++ /dev/null
@@ -1,2556 +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.
- */
-options
-{
-   STATIC=false;
-   UNICODE_INPUT=true;
-   IGNORE_CASE=false;
-   JAVA_UNICODE_ESCAPE=false;
-   DEBUG_PARSER=false;
-   JDK_VERSION="1.6";
-}
-
-PARSER_BEGIN(JavaCCGeneratedSparqlPreParser)
-
-package org.apache.clerezza.rdf.core.sparql;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
-import org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl;
-import org.apache.clerezza.rdf.core.sparql.query.AlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.BinaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.BinaryPropertyPathOperation;
-import org.apache.clerezza.rdf.core.sparql.query.BuiltInCall;
-import org.apache.clerezza.rdf.core.sparql.query.Expression;
-import org.apache.clerezza.rdf.core.sparql.query.FunctionCall;
-import org.apache.clerezza.rdf.core.sparql.query.GroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.InlineData;
-import org.apache.clerezza.rdf.core.sparql.query.LiteralExpression;
-import org.apache.clerezza.rdf.core.sparql.query.PatternExistenceCondition;
-import org.apache.clerezza.rdf.core.sparql.query.PredicatePath;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathExpressionOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathExpression;
-import org.apache.clerezza.rdf.core.sparql.query.PropertyPathPattern;
-import org.apache.clerezza.rdf.core.sparql.query.PropertySet;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.RhsListBinaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.SparqlUnit;
-import org.apache.clerezza.rdf.core.sparql.query.TriplePattern;
-import org.apache.clerezza.rdf.core.sparql.query.UnaryOperation;
-import org.apache.clerezza.rdf.core.sparql.query.UnaryPropertyPathOperation;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefExpression;
-import org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleAlternativeGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleAskQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleConstructQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleDataSet;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleDescribeQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGraphGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGroupGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleInlineData;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleOrderCondition;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimplePropertyPathPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleQueryWithSolutionModifier;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleSelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleServiceGraphPattern;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleSparqlUnit;
-import org.apache.clerezza.rdf.core.sparql.query.impl.SimpleTriplePattern;
-import org.apache.clerezza.rdf.core.sparql.update.Update;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation;
-import org.apache.clerezza.rdf.core.sparql.update.UpdateOperation.GraphSpec;
-import org.apache.clerezza.rdf.core.sparql.update.impl.AddOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.ClearOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.ClearOrDropOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.CopyOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.CreateOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.DeleteDataOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.DeleteWhereOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.DropOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.InsertDataOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.LoadOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.ModifyOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.MoveOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.SimpleUpdate;
-import org.apache.clerezza.rdf.core.sparql.update.impl.SimpleUpdateOperation;
-import org.apache.clerezza.rdf.core.sparql.update.impl.UpdateOperationWithQuads;
-
-/**
- *
- * Credits: Fedora Commons, Inc.
- *            - for initial grammar of this file (available in mulgara project).
- * Modified by: Hasan <ha...@trialox.org>
- */
-class JavaCCGeneratedSparqlPreParser {
-
-    private static final IRI RDF_TYPE =
-        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-    private static final IRI RDF_FIRST =
-        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
-    private static final IRI RDF_REST =
-        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
-    private static final IRI RDF_NIL =
-        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
-
-    /** A RegEx pattern for separating out a namespace from a prefixed name. */
-    private static final Pattern pfxNamePattern = Pattern.compile("([^:]*):(.*)");
-
-    private String base;
-    private Map<String, String> prefixes;
-    private Map<String, ResourceOrVariable> bNodes;
-    private int count;
-
-    private class GraphRefAllSpec {
-        GraphSpec graphSpec;
-        IRI graph;
-        public void setGraphSpec(GraphSpec graphSpec) {
-            this.graphSpec = graphSpec;
-        }
-        public GraphSpec getGraphSpec() {
-            return this.graphSpec;
-        }
-        public void setGraph(IRI graph){
-            this.graph = graph;
-        }
-        public IRI getGraph() {
-            return this.graph;
-        }
-    }
-
-    void initialize() {
-        base = null;
-        prefixes = new HashMap<String, String>();
-        bNodes = new HashMap<String, ResourceOrVariable>();
-        count = 0;
-    }
-
-    SparqlUnit parse() throws ParseException {
-        SparqlUnit sparqlUnit;
-        initialize();
-        sparqlUnit = this.SparqlUnit();
-        return sparqlUnit;
-    }
-
-    Query parseQuery() throws ParseException {
-        Query query;
-        initialize();
-        query = this.QueryUnit();
-        return query;
-    }
-
-    Update parseUpdate() throws ParseException {
-        Update update;
-        initialize();
-        update = this.UpdateUnit();
-        return update;
-    }
-
-    private static String unquote(String s) {
-        return s.substring(1, s.length() - 1);
-    }
-
-    private static String unTripleQuote(String s) {
-        return s.substring(3, s.length() - 3);
-    }
-
-    private Variable createVariable(String name) {
-        name = name.substring(1);
-        Variable v = new Variable(name);
-        return v;
-    }
-
-    private void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns,
-            ResourceOrVariable subject,
-            PropertyPathExpressionOrVariable propertyPathExpression,
-            Set<ResourceOrVariable> objects) {
-
-        for (ResourceOrVariable object : objects) {
-            propertyPathPatterns.add(
-                new SimplePropertyPathPattern(subject, propertyPathExpression, object));
-        }
-    }
-
-    // nodes contain at least one element
-    private ResourceOrVariable addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns,
-            List<ResourceOrVariable> nodes) {
-
-        ResourceOrVariable head = null;
-        PropertyPathExpressionOrVariable rdfFirst = new PropertyPathExpressionOrVariable(new PredicatePath(RDF_FIRST));
-        PropertyPathExpressionOrVariable rdfRest = new PropertyPathExpressionOrVariable(new PredicatePath(RDF_REST));
-        UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
-
-        ResourceOrVariable prevSubject = null;
-        for (ResourceOrVariable node : nodes) {
-            ResourceOrVariable currentSubject = getNewBNode();
-            if (prevSubject != null) {
-                propertyPathPatterns.add(
-                    new SimplePropertyPathPattern(prevSubject, rdfRest, currentSubject));
-            } else {
-                head = currentSubject;
-            }
-            propertyPathPatterns.add(
-                new SimplePropertyPathPattern(currentSubject, rdfFirst, node));
-            prevSubject = currentSubject;
-        }
-        if (prevSubject != null) {
-            propertyPathPatterns.add(
-                new SimplePropertyPathPattern(prevSubject, rdfRest, rdfNil));
-        }
-        return head;
-    }
-
-    private void addTriplePatterns(Set<TriplePattern> triplePatterns,
-            ResourceOrVariable subject,
-            UriRefOrVariable predicate,
-            Set<ResourceOrVariable> objects) {
-
-        for (ResourceOrVariable object : objects) {
-            triplePatterns.add(
-                new SimpleTriplePattern(subject, predicate, object));
-        }
-    }
-
-    // nodes contain at least one element
-    private ResourceOrVariable addTriplePatterns(
-            Set<TriplePattern> triplePatterns,
-            List<ResourceOrVariable> nodes) {
-
-        ResourceOrVariable head = null;
-        UriRefOrVariable rdfFirst = new UriRefOrVariable(RDF_FIRST);
-        UriRefOrVariable rdfRest = new UriRefOrVariable(RDF_REST);
-        UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
-
-        ResourceOrVariable prevSubject = null;
-        for (ResourceOrVariable node : nodes) {
-            ResourceOrVariable currentSubject = getNewBNode();
-            if (prevSubject != null) {
-                triplePatterns.add(
-                    new SimpleTriplePattern(prevSubject, rdfRest, currentSubject));
-            } else {
-                head = currentSubject;
-            }
-            triplePatterns.add(
-                new SimpleTriplePattern(currentSubject, rdfFirst, node));
-            prevSubject = currentSubject;
-        }
-        if (prevSubject != null) {
-            triplePatterns.add(
-                new SimpleTriplePattern(prevSubject, rdfRest, rdfNil));
-        }
-        return head;
-    }
-
-    private ResourceOrVariable getNewBNode() {
-        ResourceOrVariable bNode = new ResourceOrVariable(new BlankNode());
-        bNodes.put("*" + count++, bNode);
-        return bNode;
-    }
-
-    private ResourceOrVariable getBNode(String label) {
-        ResourceOrVariable bNode = bNodes.get(label);
-        if (bNode == null) {
-            bNode = new ResourceOrVariable(new BlankNode());
-            bNodes.put(label, bNode);
-        }
-        return bNode;
-    }
-
-    private IRI createUriRef(String r) throws ParseException {
-        // Create an IRI directly if the string does not start with a prefix
-        Matcher m = pfxNamePattern.matcher(r);
-        if (!m.matches()) {
-            // either a normal IRI, or one with a BASE
-            return isRelative(r) ? new IRI(base + r) : new IRI(r);
-        }
-        // extract the prefix, and attempt to convert to a URI before creating the reference
-        String ns = prefixes.get(m.group(1));
-        return ns == null ? new IRI(r) : new IRI(ns + m.group(2));
-    }
-
-    /**
-     * Tests if the string for a URI is relative or absolute. The test is based on a scheme existing
-     * in the string, which in turn expects a : character to follow it. If there is no colon, then
-     * it is presumed to be relative. Otherwise, if there are special characters preceding the first
-     * colon these are presumed to not be in a scheme.
-     * @param u A string for a URI.
-     * @return <code>true</code> if the URI appears to be relative, <code>false</code> otherwise.
-     */
-    private static boolean isRelative(String u) {
-        int colon = u.indexOf(':');
-        if (colon < 0) {
-            return true;
-        }
-        for (int c = 0; c < colon; c++) {
-            // if there a non-alphanum characters then this is not a scheme, so the URI is relative
-            if (!Character.isLetterOrDigit(u.charAt(c))) {
-                return true;
-            }
-        }
-        // found a (probably) valid scheme, so the URI is absolute
-        return false;
-    }
-}
-PARSER_END(JavaCCGeneratedSparqlPreParser)
-
-SKIP :
-{
-    "\t" | "\n" | "\r" | "\f" | " "
-}
-
-MORE :
-{
-    "#" : IN_COMMENT
-}
-
-<IN_COMMENT>
-SPECIAL_TOKEN :
-{
-  <COMMENT: ( ~[ "\r","\n" ] )* > : DEFAULT
-}
-
-TOKEN [IGNORE_CASE] :
-{
-    < SELECT : "SELECT" >
-|   < BASE : "BASE" >
-|   < ORDER : "ORDER" >
-|   < BY : "BY" >
-|   < FROM : "FROM" >
-|   < GRAPH : "GRAPH" >
-|   < PREFIX : "PREFIX" >
-|   < CONSTRUCT : "CONSTRUCT" >
-|   < LIMIT : "LIMIT" >
-|   < NAMED : "NAMED" >
-|   < OPTIONAL : "OPTIONAL" >
-|   < DESCRIBE : "DESCRIBE" >
-|   < OFFSET : "OFFSET" >
-|   < WHERE : "WHERE" >
-|   < UNION : "UNION" >
-|   < ASK : "ASK" >
-|   < DISTINCT : "DISTINCT" >
-|   < FILTER : "FILTER" >
-|   < REDUCED : "REDUCED" >
-|   < GROUP_CONCAT : "GROUP_CONCAT" >
-|   < BOUND : "bound" >
-|   < TRUE : "TRUE" >
-|   < FALSE : "FALSE" >
-|   < VALUES : "VALUES" >
-|   < UNDEF : "UNDEF" >
-|   < AS : "AS" >
-|   < BIND : "BIND" >
-|   < MINUS : "MINUS" >
-|   < SERVICE : "SERVICE" >
-|   < GROUP : "GROUP" >
-|   < HAVING : "HAVING" >
-|   < LOAD : "LOAD" >
-|   < SILENT : "SILENT" >
-|   < INTO : "INTO" >
-|   < CLEAR : "CLEAR" >
-|   < DROP : "DROP" >
-|   < CREATE : "CREATE" >
-|   < ADD : "ADD" >
-|   < TO : "TO" >
-|   < MOVE : "MOVE" >
-|   < COPY : "COPY" >
-|   < INSERT : "INSERT" >
-|   < DELETE : "DELETE" >
-|   < DATA : "DATA" >
-|   < WITH : "WITH" >
-|   < USING : "USING" >
-|   < DEFAULT_T : "DEFAULT" >
-|   < ALL : "ALL" >
-|   < IN : "IN" >
-|   < NOT : "NOT" >
-|   < EXISTS : "EXISTS" >
-|   < BNODE : "BNODE" >
-|   < RAND : "RAND" >
-|   < CONCAT : "CONCAT" >
-|   < NOW : "NOW" >
-|   < UUID : "UUID" >
-|   < STRUUID : "STRUUID" >
-|   < COALESCE : "COALESCE" >
-|   < SEPARATOR : "SEPARATOR" >
-}
-
-/* SparqlUnit ::= Prologue ( Query | Update ) */
-private SparqlUnit SparqlUnit() : {
-    Query query;
-    Update update; } {
-
-    Prologue()
-    (
-        query=QueryUnit() {
-        return new SimpleSparqlUnit(query); }
-    |
-        update=UpdateUnit() {
-        return new SimpleSparqlUnit(update); }
-    )
-}
-
-/* [1]    QueryUnit ::= Query */
-private Query QueryUnit() : {
-    Query query; } {
-
-    query=Query() {
-    return query; }
-}
-
-/* [2]    Query ::= Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause */
-/* [2]    Query ::= ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause */
-private Query Query() : {
-    Query query; } {
-    (
-        query = SelectQuery()
-    |
-        query = ConstructQuery()
-    |
-        query = DescribeQuery()
-    |
-        query = AskQuery()
-    ) {
-    return query;
-    }
-}
-
-/* [3]    UpdateUnit ::= Update */
-private Update UpdateUnit() : {
-    Update update = new SimpleUpdate(); } {
-    Update(update) {
-    return update; }
-}
-
-/* [4]    Prologue ::= ( BaseDecl | PrefixDecl )* */
-private void Prologue() : {} {
-    ( BaseDecl() | PrefixDecl() )*
-}
-
-/* [5]    BaseDecl ::= 'BASE' IRIREF */
-private void BaseDecl() : {
-    Token iriRef; } {
-
-    <BASE> iriRef=<IRIREF> { base = unquote(iriRef.image); }
-}
-
-/* [6]    PrefixDecl ::= 'PREFIX' PNAME_NS IRIREF */
-private void PrefixDecl() : {
-    Token ns, iriRef; } {
-
-    <PREFIX> ns=<PNAME_NS> iriRef=<IRIREF> {
-    String pfx = ns.image;
-    prefixes.put(pfx.substring(0, pfx.length() - 1), unquote(iriRef.image)); }
-}
-
-/* [7]    SelectQuery ::= SelectClause DatasetClause* WhereClause SolutionModifier */
-private Query SelectQuery() : {
-    Query query; } {
-    query = SelectClause()
-    ( DatasetClause(query) )*
-    WhereClause(query)
-    SolutionModifier(query) {
-    return query; }
-}
-
-/* [8]    SubSelect ::= SelectClause WhereClause SolutionModifier ValuesClause */
-private Query SubSelect() : {
-    Query query; } {
-    query = SelectClause()
-    WhereClause(query)
-    SolutionModifier(query)
-    ValuesClause(query) {
-    return query; }
-}
-
-/* [9]    SelectClause ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' Expression 'AS' Var ')' ) )+ | '*' ) */
-private Query SelectClause() : {
-    Query query;
-    Variable v; 
-    Expression e; } {
-
-    <SELECT> {
-    query = new SimpleSelectQuery(); }
-    (
-        <DISTINCT> {
-        ((SimpleSelectQuery) query).setDistinct(); }
-    |
-        <REDUCED> {
-        ((SimpleSelectQuery) query).setReduced(); }
-    )?
-    (
-        (
-            v=Var() {
-            ((SimpleSelectQuery) query).addSelection(v); }
-        |
-            (
-                "("
-                e=Expression()
-                <AS>
-                v=Var() {
-                v.setBoundExpression(e); 
-                ((SimpleSelectQuery) query).addSelection(v); }
-                ")"
-            )
-        )+
-    |
-        "*" {
-        ((SimpleSelectQuery) query).setSelectAll(); }
-    ) {
-    return query; }
-}
-
-/* [10]    ConstructQuery ::= 'CONSTRUCT' ( ConstructTemplate DatasetClause* WhereClause SolutionModifier | DatasetClause* 'WHERE' '{' TriplesTemplate? '}' SolutionModifier ) */
-private Query ConstructQuery() : {
-    Query query;
-    Set<TriplePattern> triplePatterns = null;
-    GroupGraphPattern queryPattern; } {
-
-    <CONSTRUCT>
-    (
-        triplePatterns=ConstructTemplate() {
-        query = new SimpleConstructQuery(triplePatterns); }
-        ( DatasetClause(query) )*
-        WhereClause(query)
-    |
-        {
-        query = new SimpleConstructQuery(triplePatterns); }
-        ( DatasetClause(query) )*
-        <WHERE>
-        "{" {
-        queryPattern = new SimpleGroupGraphPattern(); }
-        (
-            triplePatterns=TriplesTemplate()
-        )? {
-        ((SimpleGroupGraphPattern) queryPattern).addTriplePatterns(triplePatterns); }
-        "}" {
-        ((SimpleQuery) query).setQueryPattern(queryPattern); }
-    )
-    SolutionModifier(query) {
-    return query; }
-}
-
-/* [11]    DescribeQuery ::= 'DESCRIBE' ( VarOrIRI+ | '*' ) DatasetClause* WhereClause? SolutionModifier */
-private Query DescribeQuery() : {
-    Query query;
-    UriRefOrVariable node; } {
-
-    <DESCRIBE> {
-    query = new SimpleDescribeQuery(); }
-    (
-        ( node=VarOrIRI() {
-            ((SimpleDescribeQuery) query).addResourceToDescribe(node); } )+
-        |
-        "*" {
-            ((SimpleDescribeQuery) query).setDescribeAll(); }
-    )
-    ( DatasetClause(query) )*
-    ( WhereClause(query) )?
-    SolutionModifier(query) {
-    return query; }
-}
-
-/* [12]    AskQuery ::= 'ASK' DatasetClause* WhereClause SolutionModifier */
-private Query AskQuery() : {
-    Query query; } {
-
-    <ASK> {
-    query = new SimpleAskQuery(); }
-    ( DatasetClause(query) )*
-    WhereClause(query)
-    SolutionModifier(query) {
-    return query; }
-}
-
-/* [13]    DatasetClause ::= 'FROM' ( DefaultGraphClause | NamedGraphClause ) */
-private void DatasetClause(Query query) : {} {
-    <FROM> (DefaultGraphClause(query) | NamedGraphClause(query))
-}
-
-/* [14]    DefaultGraphClause ::= SourceSelector */
-private void DefaultGraphClause(Query query) : {
-    IRI defaultGraph; } {
-
-    defaultGraph=SourceSelector() {
-    ((SimpleQuery) query).addDefaultGraph(defaultGraph); }
-}
-
-/* [15]    NamedGraphClause ::= 'NAMED' SourceSelector */
-private void NamedGraphClause(Query query) : {
-    IRI namedGraph; } {
-
-    <NAMED> namedGraph=SourceSelector() {
-    ((SimpleQuery) query).addNamedGraph(namedGraph); }
-}
-
-/* [16]    SourceSelector ::= iri */
-private IRI SourceSelector() : {
-    IRI graph; } {
-
-    graph=IRI() {
-    return graph; }
-}
-
-/* [17]    WhereClause ::= 'WHERE'? GroupGraphPattern */
-private void WhereClause(Query query) : {
-    GroupGraphPattern queryPattern; } {
-
-    (<WHERE>)?
-    queryPattern=GroupGraphPattern() {
-    ((SimpleQuery) query).setQueryPattern(queryPattern); }
-}
-
-/* [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses? */
-private void SolutionModifier(Query query) : {} {
-    ( GroupClause(query) )?
-    ( HavingClause(query) )?
-    ( OrderClause(query) )?
-    ( LimitOffsetClauses(query) )?
-}
-
-/* [19] GroupClause ::= 'GROUP' 'BY' GroupCondition+ */
-private void GroupClause(Query query) : {} {
-    <GROUP> <BY> ( GroupCondition(query) )+
-}
-
-/* [20] GroupCondition ::= BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var */
-private void GroupCondition(Query query) : {
-    Expression e;
-    Variable v; } {
-    (
-        e=BuiltInCall()
-    |
-        e=FunctionCall()
-    |
-        (
-            "("
-            e=Expression()
-            (
-                <AS>
-                v=Var() {
-                v.setBoundExpression(e);
-                e = v; }
-            )?
-            ")"
-        )
-    |
-        e=Var()
-    ) {
-    ((SimpleQueryWithSolutionModifier) query).addGroupCondition(e); }
-}
-
-/* [21] HavingClause ::= 'HAVING' HavingCondition+ */
-private void HavingClause(Query query) : {} {
-    <HAVING> ( HavingCondition(query) )+
-}
-
-/* [22] HavingCondition ::= Constraint */
-private void HavingCondition(Query query) : {
-    Expression c; } {
-
-    c=Constraint() {
-    ((SimpleQueryWithSolutionModifier) query).addHavingCondition(c); }
-}
-
-/* [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+ */
-private void OrderClause(Query query) : {} {
-    <ORDER> <BY> ( OrderCondition(query) )+
-}
-
-/* [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) */
-private void OrderCondition(Query query) : {
-    boolean asc = true;
-    Expression e; } {
-
-    (
-        ( ( "ASC" | "DESC" { asc = false; } ) e=BrackettedExpression() )
-    |
-        ( e=Constraint() | e=Var() )
-    ) {
-    ((SimpleQueryWithSolutionModifier) query).addOrderCondition(new SimpleOrderCondition(e, asc)); }
-}
-
-/* [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause? */
-private void LimitOffsetClauses(Query query) : {} {
-    ( LimitClause(query) (OffsetClause(query))? )
-    |
-    ( OffsetClause(query) (LimitClause(query))? )
-}
-
-/* [26] LimitClause ::= 'LIMIT' INTEGER */
-private void LimitClause(Query query) : {
-    Token t; } {
-
-    <LIMIT> t=<INTEGER> {
-    ((SimpleQueryWithSolutionModifier) query).setLimit(Integer.parseInt(t.image)); }
-}
-
-/* [27] OffsetClause ::= 'OFFSET' INTEGER */
-private void OffsetClause(Query query) : {
-    Token t; } {
-
-    <OFFSET> t=<INTEGER> {
-    ((SimpleQueryWithSolutionModifier) query).setOffset(Integer.parseInt(t.image)); }
-}
-
-/* [28] ValuesClause ::= ( 'VALUES' DataBlock )? */
-private void ValuesClause(Query query) : {
-    InlineData data; } {
-    (
-        <VALUES>
-        data=DataBlock() {
-        ((SimpleQuery) query).setInlineData(data); }
-    )?
-}
-
-/* [29]    Update ::= Prologue ( Update1 ( ';' Update )? )? */
-/* [29]    Update ::= ( Update1 ( ';' Prologue Update )? )? */
-private void Update(Update update) : {} {
-    (
-        Update1(update)
-        (
-            ";"
-            Prologue()
-            Update(update)
-        )?
-    )?
-}
-
-/* [30]    Update1 ::= Load | Clear | Drop | Add | Move | Copy | Create | InsertData | DeleteData | DeleteWhere | Modify */
-private void Update1(Update update) : {
-    UpdateOperation updateOperation = null; } {
-
-    (
-        updateOperation = Load()
-    |
-        updateOperation = Clear()
-    |
-        updateOperation = Drop()
-    |
-        updateOperation = Add()
-    |
-        updateOperation = Move()
-    |
-        updateOperation = Copy()
-    |
-        updateOperation = Create()
-    |
-        LOOKAHEAD(2)
-        updateOperation = InsertData()
-    |
-        LOOKAHEAD(2)
-        updateOperation = DeleteData()
-    |
-        LOOKAHEAD(2)
-        updateOperation = DeleteWhere()
-    |
-        updateOperation = Modify()
-    ) {
-    if (updateOperation != null) {
-        update.addOperation(updateOperation);
-    } }
-}
-
-/* [31]    Load ::= 'LOAD' 'SILENT'? iri ( 'INTO' GraphRef )? */
-private UpdateOperation Load() : {
-    IRI uriRef;
-    LoadOperation operation; } {
-    <LOAD> {
-    operation = new LoadOperation(); }
-    (
-        <SILENT> {
-        operation.setSilent(true); }
-    )?
-    uriRef = IRI() {
-    operation.setSource(uriRef); }
-    (
-        <INTO>
-        uriRef = GraphRef() {
-        operation.setDestinationGraph(uriRef); }
-    )? {
-    return operation; }
-}
-
-/* [32]    Clear ::= 'CLEAR' 'SILENT'? GraphRefAll */
-private UpdateOperation Clear() : {
-    ClearOperation operation; } {
-    <CLEAR> {
-    operation = new ClearOperation(); }
-    ProcessParametersOfClearOrDropOperation(operation) {
-    return operation; }
-}
-
-private void ProcessParametersOfClearOrDropOperation(ClearOrDropOperation operation) : {
-    GraphRefAllSpec graphRefAllSpec;
-    GraphSpec graphSpec; } {
-    (
-        <SILENT> {
-        operation.setSilent(true); }
-    )?
-    graphRefAllSpec = GraphRefAll() {
-    graphSpec = graphRefAllSpec.getGraphSpec();
-    operation.setDestinationGraphSpec(graphSpec);
-    if (graphSpec == GraphSpec.GRAPH) {
-        operation.setDestinationGraph(graphRefAllSpec.getGraph());
-    } }
-}
-
-/* [33]    Drop ::= 'DROP' 'SILENT'? GraphRefAll */
-private UpdateOperation Drop() : {
-    DropOperation operation; } {
-    <DROP> {
-    operation = new DropOperation(); }
-    ProcessParametersOfClearOrDropOperation(operation) {
-    return operation; }
-}
-
-/* [34]    Create ::= 'CREATE' 'SILENT'? GraphRef */
-private UpdateOperation Create() : {
-    IRI uriRef;
-    CreateOperation operation; } {
-    <CREATE> {
-    operation = new CreateOperation(); }
-    (
-        <SILENT> {
-        operation.setSilent(true); }
-    )?
-    uriRef = GraphRef() {
-    operation.setDestinationGraph(uriRef);
-    return operation; }
-}
-
-/* [35]    Add ::= 'ADD' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
-private UpdateOperation Add() : {
-    AddOperation operation; } {
-    <ADD> {
-    operation = new AddOperation(); }
-    ProcessParametersOfAddMoveOrCopyOperation(operation) {
-    return operation; }
-}
-
-private void ProcessParametersOfAddMoveOrCopyOperation(SimpleUpdateOperation operation) : {
-    GraphRefAllSpec graphRefAllSpec;
-    GraphSpec graphSpec; } {
-    (
-        <SILENT> {
-        operation.setSilent(true); }
-    )?
-    graphRefAllSpec = GraphOrDefault() {
-    graphSpec = graphRefAllSpec.getGraphSpec();
-    if (graphSpec == GraphSpec.GRAPH) {
-        operation.setInputGraph(graphRefAllSpec.getGraph());
-    } else {
-        operation.setInputGraphSpec(graphSpec);
-    } }
-    <TO>
-    graphRefAllSpec = GraphOrDefault() {
-    graphSpec = graphRefAllSpec.getGraphSpec();
-    if (graphSpec == GraphSpec.GRAPH) {
-        operation.setDestinationGraph(graphRefAllSpec.getGraph());
-    } else {
-        operation.setDestinationGraphSpec(graphSpec);
-    } }
-}
-
-/* [36]    Move ::= 'MOVE' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
-private UpdateOperation Move() : {
-    MoveOperation operation; } {
-    <MOVE> {
-    operation = new MoveOperation(); }
-    ProcessParametersOfAddMoveOrCopyOperation(operation) {
-    return operation; }
-}
-
-/* [37]    Copy ::= 'COPY' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
-private UpdateOperation Copy() : {
-    CopyOperation operation; } {
-    <COPY> {
-    operation = new CopyOperation(); }
-    ProcessParametersOfAddMoveOrCopyOperation(operation) {
-    return operation; }
-}
-
-/* [38]    InsertData ::= 'INSERT DATA' QuadData */
-private UpdateOperation InsertData() : {
-    InsertDataOperation operation; } {
-    <INSERT> <DATA> {
-    operation = new InsertDataOperation(); }
-    QuadData(operation) {
-    return operation; }
-}
-
-/* [39]    DeleteData ::= 'DELETE DATA' QuadData */
-private UpdateOperation DeleteData() : {
-    DeleteDataOperation operation; } {
-    <DELETE> <DATA> {
-    operation = new DeleteDataOperation(); }
-    QuadData(operation) {
-    return operation; }
-}
-
-/* [40]    DeleteWhere ::= 'DELETE WHERE' QuadPattern */
-private UpdateOperation DeleteWhere() : {
-    DeleteWhereOperation operation; } {
-    <DELETE> <WHERE> {
-    operation = new DeleteWhereOperation(); }
-    QuadPattern(operation) {
-    return operation; }
-}
-
-/* [41]    Modify ::= ( 'WITH' iri )? ( DeleteClause InsertClause? | InsertClause ) UsingClause* 'WHERE' GroupGraphPattern */
-private UpdateOperation Modify() : {
-    IRI fallbackGraph = null;
-    UpdateOperationWithQuads deleteOperation = null;
-    UpdateOperationWithQuads insertOperation = null;
-    SimpleDataSet dataSet = new SimpleDataSet();
-    GroupGraphPattern queryPattern;
-    ModifyOperation operation; } {
-    (
-        <WITH>
-        fallbackGraph = IRI()
-    )?
-    (
-        deleteOperation = DeleteClause()
-        (
-            insertOperation = InsertClause()
-        )?
-    |
-        insertOperation = InsertClause()
-    ) {
-    operation = new ModifyOperation();
-    if (fallbackGraph != null) {
-        operation.setFallbackGraph(fallbackGraph);
-    }
-    if (deleteOperation != null) {
-        operation.setDeleteOperation(deleteOperation);
-    }
-    if (insertOperation != null) {
-        operation.setInsertOperation(insertOperation);
-    } }
-    (
-        UsingClause(dataSet)
-    )* {
-    operation.setDataSet(dataSet); }
-
-    <WHERE>
-    queryPattern = GroupGraphPattern() {
-    operation.setQueryPattern(queryPattern);
-    return operation; }
-}
-
-/* [42]    DeleteClause ::= 'DELETE' QuadPattern */
-private UpdateOperationWithQuads DeleteClause() : {
-    UpdateOperationWithQuads operation; } {
-    <DELETE> {
-    operation = new UpdateOperationWithQuads(); }
-    QuadPattern(operation) {
-    return operation; }
-}
-
-/* [43]    InsertClause ::= 'INSERT' QuadPattern */
-private UpdateOperationWithQuads InsertClause() : {
-    UpdateOperationWithQuads operation; } {
-    <INSERT> {
-    operation = new UpdateOperationWithQuads(); }
-    QuadPattern(operation) {
-    return operation; }
-}
-
-/* [44]    UsingClause ::= 'USING' ( iri | 'NAMED' iri ) */
-private void UsingClause(SimpleDataSet dataSet) : {
-    IRI graph; } {
-    <USING>
-    (
-        graph = IRI() {
-        dataSet.addDefaultGraph(graph); }
-    |
-        <NAMED>
-        graph = IRI() {
-        dataSet.addNamedGraph(graph); }
-    )
-}
-
-/* [45]    GraphOrDefault ::= 'DEFAULT_T' | 'GRAPH'? iri */
-private GraphRefAllSpec GraphOrDefault() : {
-    IRI uriRef;
-    GraphRefAllSpec graphRefAllSpec = new GraphRefAllSpec(); } {
-    (
-        <DEFAULT_T> {
-        graphRefAllSpec.setGraphSpec(GraphSpec.DEFAULT); }
-    |
-        (
-            <GRAPH>
-        )?
-        uriRef = IRI() {
-        graphRefAllSpec.setGraph(uriRef);
-        graphRefAllSpec.setGraphSpec(GraphSpec.GRAPH); }
-    ) {
-    return graphRefAllSpec; }
-}
-
-/* [46]    GraphRef ::= 'GRAPH' iri */
-private IRI GraphRef() : {
-    IRI uriRef; } {
-    <GRAPH>
-    uriRef = IRI() {
-    return uriRef; }
-}
-
-/* [47]    GraphRefAll ::= GraphRef | 'DEFAULT_T' | 'NAMED' | 'ALL' */
-private GraphRefAllSpec GraphRefAll() : {
-    IRI uriRef;
-    GraphRefAllSpec graphRefAllSpec = new GraphRefAllSpec(); } {
-    (
-        uriRef = GraphRef() {
-        graphRefAllSpec.setGraph(uriRef);
-        graphRefAllSpec.setGraphSpec(GraphSpec.GRAPH); }
-    |
-        <DEFAULT_T> {
-        graphRefAllSpec.setGraphSpec(GraphSpec.DEFAULT); }
-    |
-        <NAMED> {
-        graphRefAllSpec.setGraphSpec(GraphSpec.NAMED); }
-    |
-        <ALL> {
-        graphRefAllSpec.setGraphSpec(GraphSpec.ALL); }
-    ) {
-    return graphRefAllSpec; }
-}
-
-/* [48]    QuadPattern ::= '{' Quads '}' */
-private void QuadPattern(UpdateOperationWithQuads operation) : {} {
-    "{"
-    Quads(operation)
-    "}"
-}
-
-/* [49]    QuadData ::= '{' Quads '}' */
-private void QuadData(UpdateOperationWithQuads operation) : {} {
-    "{"
-    Quads(operation)
-    "}"
-}
-
-/* [50]    Quads ::= TriplesTemplate? ( QuadsNotTriples '.'? TriplesTemplate? )* */
-private void Quads(UpdateOperationWithQuads operation) : {
-    Set<TriplePattern> triplePatterns; } {
-    (
-        triplePatterns=TriplesTemplate() {
-        operation.addQuad(triplePatterns); }
-    )?
-    (
-        QuadsNotTriples(operation)
-        ( "." )?
-        (
-            triplePatterns=TriplesTemplate() {
-            operation.addQuad(triplePatterns); }
-        )?
-    )*
-}
-
-/* [51]    QuadsNotTriples ::= 'GRAPH' VarOrIRI '{' TriplesTemplate? '}' */
-private void QuadsNotTriples(UpdateOperationWithQuads operation) : {
-    UriRefOrVariable graph;
-    Set<TriplePattern> triplePatterns = null; } {
-
-    <GRAPH>
-    graph=VarOrIRI()
-    "{"
-    (
-        triplePatterns=TriplesTemplate()
-    )?
-    "}" {
-    operation.addQuad(graph, triplePatterns); }
-}
-
-/* [52]    TriplesTemplate ::= TriplesSameSubject ( '.' TriplesTemplate? )? */
-private Set<TriplePattern> TriplesTemplate() : {
-    Set<TriplePattern> triplePatterns, t; } {
-
-    triplePatterns=TriplesSameSubject()
-    (
-        "."
-        (
-            t=TriplesTemplate() {
-            triplePatterns.addAll(t); }
-        )?
-    )? {
-    return triplePatterns; }
-}
-
-/* [53]    GroupGraphPattern ::= '{' ( SubSelect | GroupGraphPatternSub ) '}' */
-private GroupGraphPattern GroupGraphPattern() : {
-    Query query;
-    GroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern(); } {
-    "{"
-    (
-        query = SubSelect() {
-        ((SimpleGroupGraphPattern) groupGraphPattern).setSubSelect((SelectQuery) query); }
-    |
-        GroupGraphPatternSub(groupGraphPattern)
-    )
-    "}" {
-    return groupGraphPattern; }
-}
-
-/* [54]    GroupGraphPatternSub ::= TriplesBlock? ( GraphPatternNotTriples '.'? TriplesBlock? )* */
-private void GroupGraphPatternSub(GroupGraphPattern groupGraphPattern) : {} {
-    ( TriplesBlock(groupGraphPattern) )?
-    (
-        GraphPatternNotTriples(groupGraphPattern)
-        (".")?
-        ( TriplesBlock(groupGraphPattern) )?
-    )*
-}
-
-/* [55]    TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? */
-private void TriplesBlock(GroupGraphPattern groupGraphPattern) : {
-    Set<PropertyPathPattern> propertyPathPatterns; } {
-
-    propertyPathPatterns=TriplesSameSubjectPath() {
-    ((SimpleGroupGraphPattern) groupGraphPattern).addPropertyPathPatterns(propertyPathPatterns); }
-    (
-        "." ( TriplesBlock(groupGraphPattern) )?
-    )?
-}
-
-/* [56]    GraphPatternNotTriples ::= GroupOrUnionGraphPattern | OptionalGraphPattern | MinusGraphPattern | GraphGraphPattern | ServiceGraphPattern | Filter | Bind | InlineData */
-private void GraphPatternNotTriples(GroupGraphPattern groupGraphPattern) : {
-    Expression constraint;
-    Variable v; } {
-    (
-        GroupOrUnionGraphPattern(groupGraphPattern)
-    |
-        OptionalGraphPattern(groupGraphPattern)
-    |
-        MinusGraphPattern(groupGraphPattern)
-    |
-        GraphGraphPattern(groupGraphPattern)
-    |
-        ServiceGraphPattern(groupGraphPattern)
-    |
-        constraint=Filter() {
-        ((SimpleGroupGraphPattern) groupGraphPattern).addConstraint(constraint); }
-    |
-        v=Bind() {
-        // We should either store this binding in the respective variable in SelectQuery
-        // or we extend the BasicGraphPattern to store such binding.
-        // If we store the binding in the respective variable in SelectQuery, a serializer
-        // won't be able to determine whether a binding is defined by the BIND keyword or
-        // by an expression in the SELECT clause.
-        // The pre parser needs only to consume tokens, thus may ignore this binding.
-
-        // The use of BIND ends the preceding basic graph pattern, thus ...
-        ((SimpleGroupGraphPattern) groupGraphPattern).endLastBasicGraphPattern(); }
-    |
-        InlineData(groupGraphPattern)
-    )
-}
-
-/* [57]    OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern */
-private void OptionalGraphPattern(GroupGraphPattern groupGraphPattern) : {
-    GroupGraphPattern optional; } {
-
-    <OPTIONAL>
-    optional=GroupGraphPattern() {
-    ((SimpleGroupGraphPattern) groupGraphPattern).addOptionalGraphPattern(optional); }
-}
-
-/* [58]    GraphGraphPattern ::= 'GRAPH' VarOrIRI GroupGraphPattern */
-private void GraphGraphPattern(GroupGraphPattern groupGraphPattern) : {
-    UriRefOrVariable graph;
-    GroupGraphPattern g; } {
-
-    <GRAPH>
-    graph=VarOrIRI()
-    g=GroupGraphPattern() {
-    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(new SimpleGraphGraphPattern(graph, g)); }
-}
-
-/* [59]    ServiceGraphPattern ::= 'SERVICE' 'SILENT'? VarOrIRI GroupGraphPattern */
-private void ServiceGraphPattern(GroupGraphPattern groupGraphPattern) : {
-    UriRefOrVariable service;
-    GroupGraphPattern g;
-    boolean silent = false; } {
-
-    <SERVICE>
-    (
-        <SILENT> {
-        silent = true; }
-    )?
-    service=VarOrIRI()
-    g=GroupGraphPattern() {
-    SimpleServiceGraphPattern simpleServiceGraphPattern;
-    simpleServiceGraphPattern = new SimpleServiceGraphPattern(service, g);
-    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(simpleServiceGraphPattern);
-    if (silent) {
-        simpleServiceGraphPattern.setSilent(true);
-    } }
-}
-
-/* [60]    Bind ::= 'BIND' '(' Expression 'AS' Var ')' */
-private Variable Bind() : {
-    Variable v;
-    Expression e; } {
-
-    <BIND>
-    "("
-    e=Expression()
-    <AS>
-    v=Var() {
-    v.setBoundExpression(e); }
-    ")" {
-    return v; }
-}
-
-/* [61]    InlineData ::= 'VALUES' DataBlock */
-private void InlineData(GroupGraphPattern groupGraphPattern) : {
-    InlineData data; } {
-
-    <VALUES>
-    data=DataBlock() {
-    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(data); }
-}
-
-/* [62]    DataBlock ::= InlineDataOneVar | InlineDataFull */
-private InlineData DataBlock() : {
-    InlineData inlineData = new SimpleInlineData(); } {
-
-    (
-        InlineDataOneVar(inlineData)
-    |
-        InlineDataFull(inlineData)
-    ) {
-    return inlineData; }
-}
-
-/* [63]    InlineDataOneVar ::= Var '{' DataBlockValue* '}' */
-private void InlineDataOneVar(InlineData inlineData) : {
-    Variable var;
-    RDFTerm val; } {
-
-    var=Var() {
-    ((SimpleInlineData) inlineData).addVariable(var); }
-    "{"
-    (
-        val=DataBlockValue() {
-        List<RDFTerm> values = new ArrayList<RDFTerm>();
-        values.add(val);
-        ((SimpleInlineData) inlineData).addValues(values); }
-    )*
-    "}"
-}
-
-/* [64]    InlineDataFull ::= ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}' */
-private void InlineDataFull(InlineData inlineData) : {
-    Variable var;
-    RDFTerm val; } {
-    (
-        <NIL>
-    |
-        "("
-        (
-            var=Var() {
-            ((SimpleInlineData) inlineData).addVariable(var); }
-        )*
-        
-        ")"
-    )
-    "{"
-    (
-        (
-            "(" {
-            List<RDFTerm> values = new ArrayList<RDFTerm>(); }
-            (
-                val=DataBlockValue() {
-                values.add(val); }
-            )*
-            ")" {
-            ((SimpleInlineData) inlineData).addValues(values); }
-        )
-    |
-        <NIL> {
-        ((SimpleInlineData) inlineData).addValues(new ArrayList<RDFTerm>()); }
-    )*
-    "}"
-}
-
-/* [65]    DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF' */
-private RDFTerm DataBlockValue() : {
-    RDFTerm r = null; } {
-    (r=IRI() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | <UNDEF> ) {
-    return r; }
-}
-
-/* [66]    MinusGraphPattern ::= 'MINUS' GroupGraphPattern */
-private void MinusGraphPattern(GroupGraphPattern groupGraphPattern) : {
-    GroupGraphPattern subtrahend; } {
-
-    <MINUS>
-    subtrahend=GroupGraphPattern() {
-    ((SimpleGroupGraphPattern) groupGraphPattern).addMinusGraphPattern(subtrahend); }
-}
-
-/* [67]    GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* */
-private void GroupOrUnionGraphPattern(GroupGraphPattern groupGraphPattern) : {
-    GroupGraphPattern g;
-    AlternativeGraphPattern unionGraphPattern = null; } {
-
-    g=GroupGraphPattern()
-    (
-        <UNION> {
-        if (unionGraphPattern == null) {
-            unionGraphPattern = new SimpleAlternativeGraphPattern(g);
-        } }
-        g=GroupGraphPattern() {
-        ((SimpleAlternativeGraphPattern) unionGraphPattern).addAlternativeGraphPattern(g); }
-    )* {
-    if (unionGraphPattern != null) {
-        ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(unionGraphPattern);
-    } else {
-        ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(g);
-    } }
-}
-
-/* [68]    Filter ::= 'FILTER' Constraint */
-private Expression Filter() : {
-    Expression c; } {
-
-    <FILTER>
-    c=Constraint() {
-    return c; }
-}
-
-/* [69]    Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall */
-private Expression Constraint() : {
-    Expression c; } {
-
-    ( c=BrackettedExpression() | c=BuiltInCall() | c=FunctionCall() ) {
-    return c; }
-}
-
-/* [70]    FunctionCall ::= iri ArgList */
-private FunctionCall FunctionCall() : {
-    IRI name;
-    List<Expression> arguments; } {
-
-    name=IRI()
-    arguments=ArgList() {
-    return new FunctionCall(name, arguments); }
-}
-
-/* [71]    ArgList ::= NIL | '(' 'DISTINCT'? Expression ( ',' Expression )* ')' */
-private List<Expression> ArgList() : {
-    List<Expression> args = new ArrayList<Expression>();
-    Expression e; } {
-
-    (
-        <NIL>
-    |
-        (
-            "("
-            (
-                <DISTINCT>
-            )?
-            e=Expression() {
-            args.add(e); }
-            (
-                ","
-                e=Expression() {
-                args.add(e); }
-            )*
-            ")"
-        )
-    ) {
-    return args; }
-}
-
-/* [72]    ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' */
-private List<Expression> ExpressionList() : {
-    List<Expression> args = new ArrayList<Expression>();
-    Expression e; } {
-
-    (
-        <NIL>
-    |
-        (
-            "("
-            e=Expression() {
-            args.add(e); }
-            (
-                ","
-                e=Expression() {
-                args.add(e); }
-            )*
-            ")"
-        )
-    ) {
-    return args; }
-}
-
-/* [73]    ConstructTemplate ::= '{' ConstructTriples? '}' */
-private Set<TriplePattern> ConstructTemplate() : {
-    Set<TriplePattern> triplePatterns = null; } {
-
-    "{"
-    (
-        triplePatterns=ConstructTriples()
-    )?
-    "}" {
-    return triplePatterns; }
-}
-
-/* [74]    ConstructTriples ::= TriplesSameSubject ( '.' ConstructTriples? )? */
-private Set<TriplePattern> ConstructTriples() : {
-    Set<TriplePattern> triplePatterns, t; } {
-
-    triplePatterns=TriplesSameSubject()
-    (
-        "."
-        (
-            t=ConstructTriples() {
-            triplePatterns.addAll(t); }
-        )?
-    )? {
-    return triplePatterns; }
-}
-
-/* [75]    TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty |  TriplesNode PropertyList */
-private Set<TriplePattern> TriplesSameSubject() : {
-    Set<TriplePattern> triplePatterns = new LinkedHashSet<TriplePattern>();
-    ResourceOrVariable subject; } {
-
-    ( subject=VarOrTerm() PropertyListNotEmpty(subject, triplePatterns) {
-        return triplePatterns; }
-    )
-    |
-    ( subject=TriplesNode(triplePatterns) PropertyList(subject, triplePatterns) {
-        return triplePatterns; }
-    )
-}
-
-/* [76]    PropertyList ::= PropertyListNotEmpty? */
-private void PropertyList(ResourceOrVariable subject, Set<TriplePattern> triplePatterns) : { } {
-    ( PropertyListNotEmpty(subject, triplePatterns) )?
-}
-
-/* [77]    PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* */
-private void PropertyListNotEmpty(ResourceOrVariable subject, Set<TriplePattern> triplePatterns) : {
-    UriRefOrVariable predicate;
-    Set<ResourceOrVariable> objects; } {
-    predicate=Verb()
-    objects=ObjectList(triplePatterns) {
-    addTriplePatterns(triplePatterns, subject, predicate, objects); }
-
-    ( ";"
-        ( predicate=Verb() objects=ObjectList(triplePatterns) {
-            addTriplePatterns(triplePatterns, subject, predicate, objects); }
-        )?
-    )*
-}
-
-/* [78]    Verb ::= VarOrIRI | 'a' */
-private UriRefOrVariable Verb() : {
-    UriRefOrVariable predicate; } {
-
-    predicate=VarOrIRI() {
-    return predicate; }
-    | "a" {
-    return new UriRefOrVariable(RDF_TYPE); }
-}
-
-/* [79]    ObjectList ::= Object ( ',' Object )* */
-private Set<ResourceOrVariable> ObjectList(Set<TriplePattern> triplePatterns) : {
-    ResourceOrVariable object; } {
-
-    {
-    Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
-    }
-    object=Object(triplePatterns) {
-    objects.add(object); }
-
-    ( ","
-        object=Object(triplePatterns) {
-            objects.add(object); }
-    )* {
-    return objects; }
-}
-
-/* [80]    Object ::= GraphNode */
-private ResourceOrVariable Object(Set<TriplePattern> triplePatterns) : {
-    ResourceOrVariable object; } {
-
-    object=GraphNode(triplePatterns) {
-    return object; }
-}
-
-/* [81]    TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath */
-private Set<PropertyPathPattern> TriplesSameSubjectPath() : {
-    Set<PropertyPathPattern> propertyPathPatterns = new LinkedHashSet<PropertyPathPattern>();
-    ResourceOrVariable subject; } {
-
-    (
-        subject=VarOrTerm()
-        PropertyListPathNotEmpty(subject, propertyPathPatterns) {
-        return propertyPathPatterns; }
-    )
-    |
-    (
-        subject=TriplesNodePath(propertyPathPatterns)
-        PropertyListPath(subject, propertyPathPatterns) {
-        return propertyPathPatterns; }
-    )
-}
-
-/* [82]    PropertyListPath ::= PropertyListPathNotEmpty? */
-private void PropertyListPath(ResourceOrVariable subject, Set<PropertyPathPattern> propertyPathPatterns) : { } {
-    (
-        PropertyListPathNotEmpty(subject, propertyPathPatterns)
-    )?
-}
-
-/* [83]    PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )* */
-private void PropertyListPathNotEmpty(ResourceOrVariable subject, Set<PropertyPathPattern> propertyPathPatterns) : {
-    PropertyPathExpressionOrVariable propertyPathExpressionOrVariable;
-    PropertyPathExpression propertyPathExpression;
-    Variable v;
-    Set<ResourceOrVariable> objects; } {
-    (
-        propertyPathExpression=VerbPath() {
-        propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(propertyPathExpression); }
-    |
-        v=VerbSimple() {
-        propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(v); }
-    )
-    objects=ObjectListPath(propertyPathPatterns) {
-    addPropertyPathPatterns(propertyPathPatterns, subject, propertyPathExpressionOrVariable, objects); }
-    (
-        ";"
-        (
-            (
-                propertyPathExpression=VerbPath() {
-                propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(propertyPathExpression); }
-
-            |
-                v=VerbSimple() {
-                propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(v); }
-            )
-            objects=ObjectListPath(propertyPathPatterns) {
-            addPropertyPathPatterns(propertyPathPatterns, subject, propertyPathExpressionOrVariable, objects); }
-        )?
-    )*
-}
-
-/* [84]    VerbPath ::= Path */
-private PropertyPathExpression VerbPath() : {
-    PropertyPathExpression propertyPathExpression; } {
-    propertyPathExpression=Path() {
-    return propertyPathExpression; }
-}
-
-/* [85]    VerbSimple ::= Var */
-private Variable VerbSimple() : {
-    Variable v; } {
-    v=Var() {
-    return v; }
-}
-
-/* [86]    ObjectListPath ::= ObjectPath ( ',' ObjectPath )* */
-private Set<ResourceOrVariable> ObjectListPath(Set<PropertyPathPattern> propertyPathPatterns) : {
-    ResourceOrVariable object; } {
-    {
-    Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
-    }
-    object=ObjectPath(propertyPathPatterns) {
-    objects.add(object); }
-
-    (
-        ","
-        object=ObjectPath(propertyPathPatterns) {
-        objects.add(object); }
-    )* {
-    return objects; }
-}
-
-/* [87]    ObjectPath ::= GraphNodePath */
-private ResourceOrVariable ObjectPath(Set<PropertyPathPattern> propertyPathPatterns) : {
-    ResourceOrVariable object; } {
-
-    object=GraphNodePath(propertyPathPatterns) {
-    return object; }
-}
-
-/* [88]    Path ::= PathAlternative */
-private PropertyPathExpression Path() : {
-    PropertyPathExpression propertyPathExpression; } {
-    propertyPathExpression=PathAlternative() {
-    return propertyPathExpression; }
-}
-
-/* [89]    PathAlternative ::= PathSequence ( '|' PathSequence )* */
-private PropertyPathExpression PathAlternative() : {
-    PropertyPathExpression ppe, pathSequence; } {
-
-    ppe=PathSequence()
-    (
-        "|"
-        pathSequence=PathSequence() {
-        ppe = new BinaryPropertyPathOperation("|", ppe, pathSequence); }
-    )* {
-    return ppe; }
-}
-
-/* [90]    PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* */
-private PropertyPathExpression PathSequence() : {
-    PropertyPathExpression ppe, pathEltOrInverse; } {
-
-    ppe=PathEltOrInverse()
-    (
-        "/"
-        pathEltOrInverse=PathEltOrInverse() {
-        ppe = new BinaryPropertyPathOperation("/", ppe, pathEltOrInverse); }
-    )* {
-    return ppe; }
-}
-
-/* [91]    PathElt ::= PathPrimary PathMod? */
-private PropertyPathExpression PathElt() : {
-    PropertyPathExpression ppe;
-    String pathMode; } {
-
-    ppe=PathPrimary()
-    (
-        pathMode=PathMod() {
-        ppe = new UnaryPropertyPathOperation(pathMode, ppe); }
-    )? {
-    return ppe; }
-}
-
-/* [92]    PathEltOrInverse ::= PathElt | '^' PathElt */
-private PropertyPathExpression PathEltOrInverse() : {
-    PropertyPathExpression ppe; } {
-
-    (
-        ppe=PathElt() {
-        return ppe; }
-    |
-        "^"
-        ppe=PathElt() {
-        return new UnaryPropertyPathOperation("^", ppe); }
-    )
-}
-
-/* [93]    PathMod ::= '?' | '*' | '+' */
-private String PathMod() : {} {
-    (
-        "?" {
-        return "?"; }
-    |
-        "*" {
-        return "*"; }
-    |
-        "+" {
-        return "+"; }
-    )
-}
-
-/* [94]    PathPrimary ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')' */
-private PropertyPathExpression PathPrimary() : {
-    PropertyPathExpression ppe;
-    IRI uriRef; } {
-
-    (
-        uriRef=IRI() {
-        return new PredicatePath(uriRef); }
-    |
-        "a" {
-        return new PredicatePath(RDF_TYPE); }
-    |
-        "!"
-        ppe=PathNegatedPropertySet() {
-        return new UnaryPropertyPathOperation("!", ppe); }
-    |
-        "("
-        ppe=Path() {
-        return ppe; }
-        ")"
-    )
-}
-
-/* [95]    PathNegatedPropertySet ::= PathOneInPropertySet | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')' */
-private PropertyPathExpression PathNegatedPropertySet() : {
-    PropertyPathExpression pathOneInPropertySet;
-    PropertySet propertySet = new PropertySet(); } {
-
-    (
-        pathOneInPropertySet=PathOneInPropertySet() {
-        return pathOneInPropertySet; }
-    |
-        "("
-        (
-            pathOneInPropertySet=PathOneInPropertySet() {
-            propertySet.addElement(pathOneInPropertySet); }
-            (
-                "|"
-                pathOneInPropertySet=PathOneInPropertySet() {
-                propertySet.addElement(pathOneInPropertySet); }
-            )*
-        )?
-        ")" {
-        return propertySet; }
-    )
-}
-
-/* [96]    PathOneInPropertySet ::= iri | 'a' | '^' ( iri | 'a' ) */
-private PropertyPathExpression PathOneInPropertySet() : {
-    IRI uriRef; } {
-
-    (
-        uriRef=IRI() {
-        return new PredicatePath(uriRef); }
-    |
-        "a" {
-        return new PredicatePath(RDF_TYPE); }
-    |
-        "^"
-        (
-            uriRef=IRI() {
-            return new UnaryPropertyPathOperation("^", new PredicatePath(uriRef)); }
-        |
-            "a" {
-            return new UnaryPropertyPathOperation("^", new PredicatePath(RDF_TYPE)); }
-        )
-    )
-}
-
-/* [97]    Integer ::= INTEGER */
-
-// Fill in the specified set of TriplePattern and returns the subject node
-/* [98]    TriplesNode ::= Collection |  BlankNodePropertyList */
-private ResourceOrVariable TriplesNode(Set<TriplePattern> triplePatterns) : {
-    ResourceOrVariable subject; } {
-    (
-        subject=Collection(triplePatterns)
-    |
-        subject=BlankNodePropertyList(triplePatterns)
-    ) {
-    return subject; }
-}
-
-/* [99]    BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' */
-private ResourceOrVariable BlankNodePropertyList(Set<TriplePattern> triplePatterns) : { } {
-    {
-    ResourceOrVariable subject = getNewBNode();
-    }
-    "["
-    PropertyListNotEmpty(subject, triplePatterns)
-    "]" {
-    return subject; }
-}
-
-/* [100] TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath */
-private ResourceOrVariable TriplesNodePath(Set<PropertyPathPattern> propertyPathPatterns) : {
-    ResourceOrVariable subject; } {
-    (
-        subject=CollectionPath(propertyPathPatterns)
-    |
-        subject=BlankNodePropertyListPath(propertyPathPatterns)
-    ) {
-    return subject; }
-}
-
-
-/* [101] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' */
-private ResourceOrVariable BlankNodePropertyListPath(Set<PropertyPathPattern> propertyPathPatterns) : {} {
-    {
-    ResourceOrVariable subject = getNewBNode();
-    }
-    "["
-    PropertyListPathNotEmpty(subject, propertyPathPatterns)
-    "]" {
-    return subject; }
-}
-
-/* [102]    Collection ::= '(' GraphNode+ ')' */
-private ResourceOrVariable Collection(Set<TriplePattern> triplePatterns) : {
-    ResourceOrVariable node;
-    List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
-
-    "("
-    (
-        node=GraphNode(triplePatterns) {
-        nodes.add(node); }
-    )+
-    ")" {
-    return addTriplePatterns(triplePatterns, nodes); }
-}
-
-/* [103]    CollectionPath ::= '(' GraphNodePath+ ')' */
-private ResourceOrVariable CollectionPath(Set<PropertyPathPattern> propertyPathPatterns) : {
-    ResourceOrVariable node;
-    List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
-
-    "("
-    (
-        node=GraphNodePath(propertyPathPatterns) {
-        nodes.add(node); }
-    )+
-    ")" {
-    return addPropertyPathPatterns(propertyPathPatterns, nodes); }
-}
-
-/* [104]    GraphNode ::= VarOrTerm | TriplesNode */
-private ResourceOrVariable GraphNode(Set<TriplePattern> triplePatterns) : {
-    ResourceOrVariable node; } {
-    (
-        node=VarOrTerm()
-    |
-        node=TriplesNode(triplePatterns)
-    ) {
-    return node; }
-}
-
-/* [105]    GraphNodePath ::= VarOrTerm | TriplesNodePath */
-private ResourceOrVariable GraphNodePath(Set<PropertyPathPattern> propertyPathPatterns) : {
-    ResourceOrVariable node; } {
-    (
-        node=VarOrTerm()
-    |
-        node=TriplesNodePath(propertyPathPatterns)
-    ) {
-    return node; }
-}
-
-/* [106]    VarOrTerm ::= Var | GraphTerm */
-private ResourceOrVariable VarOrTerm() : {
-    ResourceOrVariable r;
-    Variable v; } {
-
-    (
-        v=Var() {
-        return new ResourceOrVariable(v); }
-    |
-        r=GraphTerm() {
-        return r; }
-    )
-}
-
-/* [107]    VarOrIRI ::= Var | iri */
-private UriRefOrVariable VarOrIRI() : {
-    Variable var;
-    IRI uriRef; } {
-
-    (
-    var=Var() {
-    return new UriRefOrVariable(var); }
-    |
-    uriRef=IRI() {
-    return new UriRefOrVariable(uriRef); }
-    )
-}
-
-/* [108]    Var ::= VAR1 | VAR2 */
-private Variable Var() : {
-    Token t;} {
-
-    (t=<VAR1> | t=<VAR2>) {
-    return createVariable(t.image); }
-}
-
-/* [109]    GraphTerm ::= IRI | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL */
-private ResourceOrVariable GraphTerm() : {
-    ResourceOrVariable bNode = null;
-    RDFTerm r = null; } {
-
-    (r=IRI() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | bNode=BlankNode() | <NIL> {
-        r = RDF_NIL; }) {
-    if (bNode == null) {
-        return new ResourceOrVariable(r);
-    }
-    return bNode; }
-}
-
-/* [110]    Expression ::= ConditionalOrExpression */
-private Expression Expression() : {
-    Expression e; } {
-
-    e=ConditionalOrExpression() {
-    return e; }
-}
-
-/* [111]    ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* */
-private Expression ConditionalOrExpression() : {
-    Expression e, ae; } {
-
-    e=ConditionalAndExpression()
-    (
-        "||" ae=ConditionalAndExpression() {
-        e = new BinaryOperation("||", e, ae); }
-    )* {
-    return e; }
-}
-
-/* [112]    ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* */
-private Expression ConditionalAndExpression() : {
-    Expression e, e2; } {
-
-    e=ValueLogical()
-    (
-        "&&" e2=ValueLogical() {
-        e = new BinaryOperation("&&", e, e2); }
-    )* {
-    return e; }
-}
-
-/* [113]    ValueLogical ::= RelationalExpression */
-private Expression ValueLogical() : {
-    Expression e; } {
-
-    e=RelationalExpression() {
-    return e; }
-}
-
-/* [114]    RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? */
-private Expression RelationalExpression() : {
-    Expression e, e2; 
-    List<Expression> l; } {
-
-    e=NumericExpression()
-    (
-        "=" e2=NumericExpression() {
-        e = new BinaryOperation("=", e, e2); }
-    |
-        "!=" e2=NumericExpression() {
-        e = new BinaryOperation("!=", e, e2); }
-    |
-        "<" e2=NumericExpression() {
-        e = new BinaryOperation("<", e, e2); }
-    |
-        ">" e2=NumericExpression() {
-        e = new BinaryOperation(">", e, e2); }
-    |
-        "<=" e2=NumericExpression() {
-        e = new BinaryOperation("<=", e, e2); }
-    |
-        ">=" e2=NumericExpression() {
-        e = new BinaryOperation(">=", e, e2); }
-    |
-        <IN> l=ExpressionList() {
-        e = new RhsListBinaryOperation("IN", e, l); }
-    |
-        <NOT> <IN> l=ExpressionList() {
-        e = new RhsListBinaryOperation("NOT IN", e, l); }
-    )? {
-    return e; }
-}
-
-/* [115]    NumericExpression ::= AdditiveExpression */
-private Expression NumericExpression() : {
-    Expression e; } {
-
-    e=AdditiveExpression() {
-    return e; }
-}
-
-/* [116]    AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* */
-private Expression AdditiveExpression() : {
-    Expression e, e2, u;
-    Literal l; } {
-
-    e=MultiplicativeExpression()
-    (
-        "+" e2=MultiplicativeExpression() {
-        e = new BinaryOperation("+", e, e2); }
-    |
-        "-" e2=MultiplicativeExpression() {
-        e = new BinaryOperation("-", e, e2); }
-    |
-        (
-            (
-                l=NumericLiteralPositive()
-            |
-                l=NumericLiteralNegative()
-            ) {
-            e2 = new LiteralExpression(l); }
-            (
-                "*" u=UnaryExpression() {
-                e2 = new BinaryOperation("*", e2, u); }
-            |
-                "/" u=UnaryExpression() {
-                e2 = new BinaryOperation("/", e2, u); }
-            )*
-        ) {
-        e = new BinaryOperation("+", e, e2); }
-    )* {
-    return e; }
-}
-
-/* [117]    MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* */
-private Expression MultiplicativeExpression() : {
-    Expression e, e2; } {
-
-    e=UnaryExpression()
-    (
-        "*" e2=UnaryExpression() {
-        e = new BinaryOperation("*", e, e2); }
-    |
-        "/" e2=UnaryExpression() {
-        e = new BinaryOperation("/", e, e2); }
-    )* {
-    return e; }
-}
-
-/* [118]    UnaryExpression ::=   '!' PrimaryExpression  |  '+' PrimaryExpression  | '-' PrimaryExpression  | PrimaryExpression */
-private Expression UnaryExpression() : {
-    Expression e; } {
-
-        "!" e=PrimaryExpression() {
-        return new UnaryOperation("!", e); }
-    |
-        "+" e=PrimaryExpression() {
-        return new UnaryOperation("+", e); }
-    |
-        "-" e=PrimaryExpression() {
-        return new UnaryOperation("-", e); }
-    |
-        e=PrimaryExpression() {
-        return e; }
-}
-
-/* [119]    PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var */
-private Expression PrimaryExpression() : {
-    Expression e = null;
-    Literal l = null; } {
-
-    (
-        e=BrackettedExpression()
-/* There is a capture all names in BuiltInCall, so put it last
-    |
-        e=BuiltInCall()
-*/
-    |
-        e=IRIOrFunction()
-    |
-        l=RDFLiteral()
-    |
-        l=NumericLiteral()
-    |
-        l=BooleanLiteral()
-    |
-        e=Var()
-    |
-        e=BuiltInCall()
-    ) {
-    if (l != null) {
-        return new LiteralExpression(l);
-    }
-    return e; }
-}
-
-/* [120]    BrackettedExpression ::= '(' Expression ')' */
-private Expression BrackettedExpression() : {
-    Expression e; } {
-
-    "("
-    e=Expression()
-    ")" {
-    return e; }
-}
-
-/* [121]    BuiltInCall ::= Aggregate 
-|    'STR' '(' Expression ')' 
-|    'LANG' '(' Expression ')' 
-|    'LANGMATCHES' '(' Expression ',' Expression ')' 
-|    'DATATYPE' '(' Expression ')' 
-|    'BOUND' '(' Var ')' 
-|    'IRI' '(' Expression ')' 
-|    'URI' '(' Expression ')' 
-|    'BNODE' ( '(' Expression ')' | NIL ) 
-|    'RAND' NIL 
-|    'ABS' '(' Expression ')' 
-|    'CEIL' '(' Expression ')' 
-|    'FLOOR' '(' Expression ')' 
-|    'ROUND' '(' Expression ')' 
-|    'CONCAT' ExpressionList 
-|    SubstringExpression 
-|    'STRLEN' '(' Expression ')' 
-|    StrReplaceExpression 
-|    'UCASE' '(' Expression ')' 
-|    'LCASE' '(' Expression ')' 
-|    'ENCODE_FOR_URI' '(' Expression ')' 
-|    'CONTAINS' '(' Expression ',' Expression ')' 
-|    'STRSTARTS' '(' Expression ',' Expression ')' 
-|    'STRENDS' '(' Expression ',' Expression ')' 
-|    'STRBEFORE' '(' Expression ',' Expression ')' 
-|    'STRAFTER' '(' Expression ',' Expression ')' 
-|    'YEAR' '(' Expression ')' 
-|    'MONTH' '(' Expression ')' 
-|    'DAY' '(' Expression ')' 
-|    'HOURS' '(' Expression ')' 
-|    'MINUTES' '(' Expression ')' 
-|    'SECONDS' '(' Expression ')' 
-|    'TIMEZONE' '(' Expression ')' 
-|    'TZ' '(' Expression ')' 
-|    'NOW' NIL 
-|    'UUID' NIL 
-|    'STRUUID' NIL 
-|    'MD5' '(' Expression ')' 
-|    'SHA1' '(' Expression ')' 
-|    'SHA256' '(' Expression ')' 
-|    'SHA384' '(' Expression ')' 
-|    'SHA512' '(' Expression ')' 
-|    'COALESCE' ExpressionList 
-|    'IF' '(' Expression ',' Expression ',' Expression ')' 
-|    'STRLANG' '(' Expression ',' Expression ')' 
-|    'STRDT' '(' Expression ',' Expression ')' 
-|    'sameTerm' '(' Expression ',' Expression ')' 
-|    'isIRI' '(' Expression ')' 
-|    'isURI' '(' Expression ')' 
-|    'isBLANK' '(' Expression ')' 
-|    'isLITERAL' '(' Expression ')' 
-|    'isNUMERIC' '(' Expression ')' 
-|    RegexExpression 
-|    ExistsFunc 
-|    NotExistsFunc
-
-[122]    RegexExpression ::= 'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')'
-[123]    SubstringExpression ::= 'SUBSTR' '(' Expression ',' Expression ( ',' Expression )? ')'
-[124]    StrReplaceExpression ::= 'REPLACE' '(' Expression ',' Expression ',' Expression ( ',' Expression )? ')'
-
-[127]    Aggregate ::= 'COUNT' '(' 'DISTINCT'? ( '*' | Expression ) ')' 
-| 'SUM' '(' 'DISTINCT'? Expression ')' 
-| 'MIN' '(' 'DISTINCT'? Expression ')' 
-| 'MAX' '(' 'DISTINCT'? Expression ')' 
-| 'AVG' '(' 'DISTINCT'? Expression ')' 
-| 'SAMPLE' '(' 'DISTINCT'? Expression ')' 
-| 'GROUP_CONCAT' '(' 'DISTINCT'? Expression ( ';' 'SEPARATOR' '=' String )? ')'
-
-*/
-
-private BuiltInCall BuiltInCall() : {
-    List<Expression> args = new ArrayList<Expression>();
-    String name, s;
-    Expression e; } {
-    (
-        <GROUP_CONCAT> {
-        name = "GROUP_CONCAT"; }
-        "("
-        (
-            <DISTINCT>
-        )?
-        (
-            e=Expression() {
-            args.add(e); }
-            (
-                ";"
-                <SEPARATOR>
-                "="
-                s = String()
-            )?
-        )
-        ")"
-    |
-        <BOUND> {
-        name = "BOUND"; }
-        "("
-        e=Var() {
-        args.add(e); }
-        ")"
-    |
-        <BNODE> {
-        name = "BNODE"; }
-        (
-            (
-                "("
-                e=Expression() {
-                args.add(e); }
-                ")"
-            )
-        |
-            <NIL>
-        )
-    |
-        <RAND> {
-        name = "RAND"; }
-        <NIL>
-    |
-        <CONCAT> {
-        name = "CONCAT"; }
-        args=ExpressionList()
-    |
-        <NOW> {
-        name = "NOW"; }
-        <NIL>
-    |
-        <UUID> {
-        name = "UUID"; }
-        <NIL>
-    |
-        <STRUUID> {
-        name = "STRUUID"; }
-        <NIL>
-    |
-        <COALESCE> {
-        name = "COALESCE"; }
-        args=ExpressionList()
-    |
-        e=NotExistsFunc() {
-        return (BuiltInCall) e; }
-    |
-        e=ExistsFunc() {
-        return (BuiltInCall) e; }
-    |
-        name=BuiltInCallName()
-        "("
-        (
-            <DISTINCT>
-        )?
-        (
-            "*"
-        |
-            (
-                e=Expression() {
-                args.add(e); }
-                (
-                    ","
-                    e=Expression() {
-                    args.add(e); }
-                )*
-            )
-        )
-        ")"
-    ) {
-    return new BuiltInCall(name, args); }
-}
-
-private String BuiltInCallName() : {
-    Token t;} {
-
-    t=<BUILT_IN_CALL_NAME> {
-    return t.image; }
-}
-
-/* [125]    ExistsFunc ::= 'EXISTS' GroupGraphPattern */
-private Expression ExistsFunc() : {
-    GroupGraphPattern pattern; 
-    PatternExistenceCondition patternExistenceCondition; } {
-
-    <EXISTS>
-    pattern = GroupGraphPattern() {
-    patternExistenceCondition = new PatternExistenceCondition();
-    patternExistenceCondition.setPattern(pattern);
-    return patternExistenceCondition; }
-}
-
-/* [126]    NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern */
-private Expression NotExistsFunc() : {
-    GroupGraphPattern pattern; 
-    PatternExistenceCondition patternExistenceCondition; } {
-
-    <NOT> <EXISTS>
-    pattern = GroupGraphPattern() {
-    patternExistenceCondition = new PatternExistenceCondition();
-    patternExistenceCondition.setPattern(pattern);
-    patternExistenceCondition.setExistenceTest(false);
-    return patternExistenceCondition; }
-}
-
-/* [128]    IRIOrFunction ::= iri ArgList? */
-private Expression IRIOrFunction() : {
-    IRI uriRef;
-    List<Expression> args; } {
-
-    uriRef=IRI()
-    (
-        args=ArgList() {
-        return new FunctionCall(uriRef, args); }
-    )? {
-    return new UriRefExpression(uriRef); }
-}
-
-/* [129]    RDFLiteral ::= String ( LANGTAG | ( '^^' iri ) )? */
-private Literal RDFLiteral() : {
-    Token t;
-    String s;
-    IRI type; } {
-
-    s = String()
-    (
-        t=<LANGTAG> {
-        return new PlainLiteralImpl(s, new Language(t.image.substring(1))); }
-    |
-        (
-            "^^"
-            type=IRI() {
-            return new TypedLiteralImpl(s, type); }
-        )
-    )? {
-    return new PlainLiteralImpl(s); }
-}
-
-/* [130]    NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative */
-private Literal NumericLiteral() : {
-    Literal l; } {
-
-    (
-        l=NumericLiteralUnsigned()
-    |
-        l=NumericLiteralPositive()
-    |
-        l=NumericLiteralNegative()
-    ) {
-    return l; }
-}
-
-/* [131]    NumericLiteralUnsigned ::= INTEGER |  DECIMAL |  DOUBLE */
-private Literal NumericLiteralUnsigned() : {
-    Token t; } {
-
-        t=<INTEGER> {
-        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-    |
-        t=<DECIMAL> {
-        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-    |
-        t=<DOUBLE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [132]    NumericLiteralPositive ::= INTEGER_POSITIVE |  DECIMAL_POSITIVE |  DOUBLE_POSITIVE */
-private Literal NumericLiteralPositive() : {
-    Token t; } {
-
-        t=<INTEGER_POSITIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-    |
-        t=<DECIMAL_POSITIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-    |
-        t=<DOUBLE_POSITIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [133]    NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE */
-private Literal NumericLiteralNegative() : {
-    Token t; } {
-
-        t=<INTEGER_NEGATIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
-    |
-        t=<DECIMAL_NEGATIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
-    |
-        t=<DOUBLE_NEGATIVE> {
-        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
-}
-
-/* [134]    BooleanLiteral ::= 'true' | 'false' */
-private Literal BooleanLiteral() : {} {
-
-        <TRUE> {
-        return LiteralFactory.getInstance().createTypedLiteral(true); }
-    |
-        <FALSE> {
-        return LiteralFactory.getInstance().createTypedLiteral(false); }
-}
-
-/* [135]    String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 */
-private String String() : {
-    Token t; } {
-
-        t=<STRING_LITERAL1> {
-        return unquote(t.image) ; }
-    |
-        t=<STRING_LITERAL2> {
-        return unquote(t.image) ; }
-    |
-        t=<STRING_LITERAL_LONG1> {
-        return unTripleQuote(t.image) ; }
-    |
-        t=<STRING_LITERAL_LONG2> {
-        return unTripleQuote(t.image) ; }
-}
-
-/* [136]    iri ::= IRIREF |  PrefixedName */
-private IRI IRI() : {
-    IRI uriRef;
-    Token t; } {
-
-        t=<IRIREF> {
-        return createUriRef(unquote(t.image)); }
-    |
-        uriRef=PrefixedName() {
-        return uriRef; }
-}
-
-/* [137]    PrefixedName ::= PNAME_LN | PNAME_NS */
-private IRI PrefixedName() : {
-    Token t; } {
-
-    ( t=<PNAME_LN> | t=<PNAME_NS> ) {
-    return createUriRef(t.image); }
-}
-
-/* [138]    BlankNode ::= BLANK_NODE_LABEL | ANON */
-private ResourceOrVariable BlankNode() : {
-    Token t; } {
-
-        t=<BLANK_NODE_LABEL> {
-        return getBNode(t.image); }
-    |
-        <ANON> {
-        return getNewBNode(); }
-}
-
-
-TOKEN : {
-  /* [139]    IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* '>' */
-  < IRIREF : "<" ( ~["<", ">", "\"", "{", "}", "|", "^", "`", "\\", "\u0000"-"\u0020"] )* ">" >
-  |
-  /* [140]    PNAME_NS ::= PN_PREFIX? ':' */
-  < PNAME_NS : (<PN_PREFIX>)? ":" >
-  |
-  /* [141]    PNAME_LN ::= PNAME_NS PN_LOCAL */
-  < PNAME_LN : <PNAME_NS> <PN_LOCAL> >
-  |
-  /* [142]    BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? */
-  < BLANK_NODE_LABEL : "_:" ( <PN_CHARS_U> | ["0"-"9"] ) ( ( <PN_CHARS> | "." )* <PN_CHARS> )? >
-  |
-  /* [143]    VAR1 ::= '?' VARNAME */
-  < VAR1 : "?" <VARNAME> >
-  |
-  /* [144]    VAR2 ::= '$' VARNAME */
-  < VAR2 : "$" <VARNAME> >
-  |
-  /* [145]    LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* */
-  < LANGTAG : "@" (["a"-"z", "A"-"Z"])+ ( "-" (["a"-"z", "A"-"Z", "0"-"9"])+ )* >
-  |
-  < BUILT_IN_CALL_NAME : ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "0"-"9", "_"])* >
-}
-
-TOKEN : {
-  < #Z_9 : ["0"-"9"] >
-  |
-  < #Z_9r : (<Z_9>)+ >
-  |
-  < #Z_9o : (<Z_9>)* >
-  |
-  /* [146]    INTEGER ::= [0-9]+ */
-  < INTEGER : <Z_9r> >
-  |
-  /* [147]    DECIMAL ::= [0-9]* '.' [0-9]+ */
-  < DECIMAL : <Z_9o> "." <Z_9r> >
-  |
-  /* [148]    DOUBLE ::= [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT */
-  < DOUBLE : ( <Z_9r> "." <Z_9o>  <EXPONENT> ) | ( "." <Z_9r> <EXPONENT> ) | ( <Z_9r> <EXPONENT> ) >
-  |
-  /* [149]    INTEGER_POSITIVE ::= '+' INTEGER */
-  < INTEGER_POSITIVE : "+" <INTEGER> >
-  |
-  /* [150]    DECIMAL_POSITIVE ::= '+' DECIMAL */
-  < DECIMAL_POSITIVE : "+" <DECIMAL> >
-  |
-  /* [151]    DOUBLE_POSITIVE ::= '+' DOUBLE */
-  < DOUBLE_POSITIVE : "+" <DOUBLE> >
-  |
-  /* [152]    INTEGER_NEGATIVE ::= '-' INTEGER */
-  < INTEGER_NEGATIVE : "-" <INTEGER> >
-  |
-  /* [153]    DECIMAL_NEGATIVE ::= '-' DECIMAL */
-  < DECIMAL_NEGATIVE : "-" <DECIMAL> >
-  |
-  /* [154]    DOUBLE_NEGATIVE ::= '-' DOUBLE */
-  < DOUBLE_NEGATIVE : "-" <DOUBLE> >
-  |
-  /* [155]    EXPONENT ::= [eE] [+-]? [0-9]+ */
-  < #EXPONENT : ["e","E"] (["+","-"])? <Z_9r> >
-}
-
-TOKEN : {
-  /* [156]    STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'" */
-  < STRING_LITERAL1 : "'" ( ~["'", "\\", "\r", "\n"] | <ECHAR> )* "'" >
-  |
-  /* [157]    STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"' */
-  < STRING_LITERAL2 : "\"" ( ~["\"", "\\", "\r", "\n"] | <ECHAR> )* "\"" >
-  |
-  /* [158]    STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''" */
-  < STRING_LITERAL_LONG1 : "'''" ( ( "'" | "''" )? ( ~["'","\\"] | <ECHAR> ) )* "'''" >
-  |
-  /* [159]    STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""' */
-  < STRING_LITERAL_LONG2 : "\"\"\"" ( ( "\"" | "\"\"" )? ( ~["\"","\\"] | <ECHAR> ) )* "\"\"\"" >
-  |
-  /* [160]    #ECHAR ::= '\' [tbnrf\"'] */
-  < #ECHAR : "\\" ["t","b","n","r","f","\\","\"","'"] >
-}
-
-TOKEN : {
-  /* [161]    NIL ::= '(' WS* ')' */
-  < NIL : "(" (<WS>)* ")" >
-  |
-  /* [162]    WS ::= #x20 | #x9 | #xD | #xA */
-  < #WS : " " | "\t" | "\n" | "\r" >
-  |
-  /* [163]    ANON ::= '[' WS* ']' */
-  < ANON : "[" (<WS>)* "]" >
-}
-
-TOKEN : {
-  /* [164]    #PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] */
-  < #PN_CHARS_BASE : ["A"-"Z", "a"-"z", "\u00C0"-"\u00D6", "\u00D8"-"\u00F6", "\u00F8"-"\u02FF", "\u0370"-"\u037D", "\u037F"-"\u1FFF", "\u200C"-"\u200D", "\u2070"-"\u218F", "\u2C00"-"\u2FEF", "\u3001"-"\uD7FF", "\uF900"-"\uFDCF", "\uFDF0"-"\uFFFD"] >
-  |
-  /* [165]    #PN_CHARS_U ::= PN_CHARS_BASE | '_' */
-  < #PN_CHARS_U : <PN_CHARS_BASE> | "_" >
-  |
-  /* [166]    #VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* */
-  < #VARNAME : (<PN_CHARS_U> | <Z_9>) (<PN_CHARS_U> | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"])* >
-  |
-  /* [167]    #PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] */
-  < #PN_CHARS : <PN_CHARS_U> | "-" | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] >
-  |
-  /* [168]    PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? */
-  < PN_PREFIX : <PN_CHARS_BASE> ((<PN_CHARS> | "." )* <PN_CHARS>)? >
-  |
-  /* [169]    PN_LOCAL ::= ( PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? */
-  /* Note that SPARQL local names allow leading digits while XML local names do not. */
-  < PN_LOCAL : (<PN_CHARS_U> | ":" | <Z_9> | <PLX>) ((<PN_CHARS> | "." | ":" | <PLX>)* (<PN_CHARS> | ":" | <PLX>) )? >
-  |
-  /* [170]    PLX ::= PERCENT | PN_LOCAL_ESC */
-  < PLX : <PERCENT> | <PN_LOCAL_ESC> >
-  |
-  /* [171]    PERCENT ::= '%' HEX HEX */
-  < PERCENT : "%" <HEX> <HEX> >
-  |
-  /* [172]    HEX ::= [0-9] | [A-F] | [a-f] */
-  < #HEX : <Z_9> | ["A"-"F", "a"-"f"] >
-  |
-  /* [173]    PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) */
-  < PN_LOCAL_ESC : "\\" ( "_" | "~" | "." | "-" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%" ) >
-}


[clerezza] 15/45: CLEREZZA-1031: Move rdf.core access to a new module called dataset

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 1a52443a0485f2ed18016ca8b37ae0b0f7792cda
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 3 18:36:35 2019 +0100

    CLEREZZA-1031: Move rdf.core access to a new module called dataset
---
 dataset/pom.xml                                    | 114 ++++
 .../dataset/EntityAlreadyExistsException.java      |  50 ++
 .../dataset/EntityUndeletableException.java        |  50 ++
 .../dataset/ImmutableGraphServiceFactory.java      |  58 ++
 .../clerezza/dataset/MGraphServiceFactory.java     |  54 ++
 .../clerezza/dataset/NoSuchEntityException.java    |  51 ++
 .../clerezza/dataset/QueryableTcProvider.java      |  41 ++
 .../org/apache/clerezza/dataset/SecuredGraph.java  | 191 +++++++
 .../org/apache/clerezza/dataset/TcManager.java     | 613 +++++++++++++++++++++
 .../org/apache/clerezza/dataset/TcProvider.java    | 151 +++++
 .../clerezza/dataset/TcProviderMultiplexer.java    | 446 +++++++++++++++
 .../dataset/WeightedProviderComparator.java        |  41 ++
 .../clerezza/dataset/WeightedTcProvider.java       |  36 ++
 .../java/org/apache/clerezza/dataset/package.html  |  56 ++
 .../dataset/security/TcAccessController.java       | 342 ++++++++++++
 .../clerezza/dataset/security/TcPermission.java    | 149 +++++
 .../org/apache/clerezza/dataset/SecurityTest.java  | 175 ++++++
 .../org/apache/clerezza/dataset/TcManagerTest.java | 299 ++++++++++
 .../clerezza/dataset/providers/WeightedA.java      | 103 ++++
 .../clerezza/dataset/providers/WeightedA1.java     | 103 ++++
 .../clerezza/dataset/providers/WeightedAHeavy.java | 101 ++++
 .../clerezza/dataset/providers/WeightedBlight.java | 106 ++++
 .../clerezza/dataset/providers/WeightedDummy.java  | 155 ++++++
 23 files changed, 3485 insertions(+)

diff --git a/dataset/pom.xml b/dataset/pom.xml
new file mode 100644
index 0000000..3ce095f
--- /dev/null
+++ b/dataset/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>8-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>dataset</artifactId>
+    <packaging>bundle</packaging>
+    <version>8-SNAPSHOT</version>
+    <name>Clerezza - DataSet</name>
+    <description>Interfaces and utilities to access RDF Graphs</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>sparql</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>utils</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>1.9.5</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.dataset.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-scr-scrdescriptor</id>
+                        <goals>
+                            <goal>scr</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/EntityAlreadyExistsException.java b/dataset/src/main/java/org/apache/clerezza/dataset/EntityAlreadyExistsException.java
new file mode 100644
index 0000000..15dcb56
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/EntityAlreadyExistsException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * is thrown on an attempt to create an entity with a name which already exists
+ *
+ * @author hasan
+ */
+public class EntityAlreadyExistsException extends RuntimeException {
+
+    private IRI entityName;
+
+    /**
+     * creates an exception indicating that an entity with the specified name
+     * already exists.
+     * 
+     * @param entityName the name of the entity which already exists
+     */
+    public EntityAlreadyExistsException(IRI entityName) {
+        super("An entity with this name already exists: "+entityName);
+        this.entityName = entityName;
+    }
+
+    /**
+     * 
+     * @return the name of the entity which already exists
+     */
+    public IRI getEntityName() {
+        return entityName;
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/EntityUndeletableException.java b/dataset/src/main/java/org/apache/clerezza/dataset/EntityUndeletableException.java
new file mode 100644
index 0000000..32c5088
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/EntityUndeletableException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * is thrown on an attempt to delete an entity with a provider that
+ * supports the delete operation when the specified entity cannot be deleted
+ *
+ * @author reto
+ */
+public class EntityUndeletableException extends RuntimeException {
+    private IRI entityName;
+
+    /**
+     * creates an exception indicating that the entity with the specified name
+     * cannot be deleted
+     * 
+     * @param entityName the name of the entity which is undeletable
+     */
+    public EntityUndeletableException(IRI entityName) {
+        super("This entity is undeletable: "+entityName);
+        this.entityName = entityName;
+    }
+
+    /**
+     * 
+     * @return the name of the entity which is undeletable
+     */
+    public IRI getEntityName() {
+        return entityName;
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/ImmutableGraphServiceFactory.java b/dataset/src/main/java/org/apache/clerezza/dataset/ImmutableGraphServiceFactory.java
new file mode 100644
index 0000000..b775d82
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/ImmutableGraphServiceFactory.java
@@ -0,0 +1,58 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.dataset.security.TcAccessController;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @see <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceFactory.html">
+ * Interface ServiceFactory</a>
+ *
+ * @author mir
+ */
+public class ImmutableGraphServiceFactory implements ServiceFactory {
+    
+    private final TcManager tcManager;
+    private final IRI name;
+    private final TcAccessController tcAccessController;
+
+    ImmutableGraphServiceFactory(TcManager tcManager, IRI name,
+                                 TcAccessController tcAccessController) {
+        this.tcManager = tcManager;
+        this.name = name;
+        this.tcAccessController = tcAccessController;
+    }
+
+    @Override
+    public Object getService(Bundle arg0, ServiceRegistration arg1) {
+        Graph tc = 
+                new SecuredGraph(tcManager.getImmutableGraph(name), name,
+                tcAccessController);
+        return tc.getImmutableGraph();
+    }
+
+    @Override
+    public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/MGraphServiceFactory.java b/dataset/src/main/java/org/apache/clerezza/dataset/MGraphServiceFactory.java
new file mode 100644
index 0000000..cf3435c
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/MGraphServiceFactory.java
@@ -0,0 +1,54 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.dataset.security.TcAccessController;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @see <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceFactory.html">
+ * Interface ServiceFactory</a>
+ *
+ * @author mir
+ */
+public class MGraphServiceFactory implements ServiceFactory {
+    
+    private TcManager tcManager;
+    private IRI name;
+    private final TcAccessController tcAccessController;
+
+    MGraphServiceFactory(TcManager tcManager, IRI name,
+                         TcAccessController tcAccessController) {
+        this.tcManager = tcManager;
+        this.name = name;
+        this.tcAccessController = tcAccessController;
+    }
+
+    @Override
+    public Object getService(Bundle arg0, ServiceRegistration arg1) {
+        return new SecuredGraph(tcManager.getMGraph(name), name, tcAccessController);
+    }
+
+    @Override
+    public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/NoSuchEntityException.java b/dataset/src/main/java/org/apache/clerezza/dataset/NoSuchEntityException.java
new file mode 100644
index 0000000..789dc6b
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/NoSuchEntityException.java
@@ -0,0 +1,51 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * is thrown on an attempt to perform an operation on an entity (i.e. a
+ * <code>ImmutableGraph</code> or <code>Graph</code> that does not exist.
+ *
+ * @author reto
+ */
+public class NoSuchEntityException extends RuntimeException {
+    private IRI entityName;
+
+    /**
+     * creates an exception indicating that the entity with the specified name
+     * does not exist.
+     * 
+     * @param entityName the name for which no entity exists
+     */
+    public NoSuchEntityException(IRI entityName) {
+        super("No such entity: "+entityName);
+        this.entityName = entityName;
+    }
+
+    /**
+     * the name for which no entity exists.
+     * 
+     * @return the name of the entity that doesn't exist
+     */
+    public IRI getEntityName() {
+        return entityName;
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/QueryableTcProvider.java b/dataset/src/main/java/org/apache/clerezza/dataset/QueryableTcProvider.java
new file mode 100644
index 0000000..0490a4c
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/QueryableTcProvider.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.clerezza.dataset;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * Extends the TcProvider interface for providers that support sparql queries.
+ */
+public interface QueryableTcProvider extends TcProvider {
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query.
+     * 
+     * @param query
+     *            the sparql query to execute
+     * @param defaultGraph
+     *            the default ImmutableGraph against which to execute the query if not
+     *            FROM clause is present
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, IRI defaultGraphUri);
+
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/SecuredGraph.java b/dataset/src/main/java/org/apache/clerezza/dataset/SecuredGraph.java
new file mode 100644
index 0000000..afc2102
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/SecuredGraph.java
@@ -0,0 +1,191 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.graph.SimpleImmutableGraph;
+import org.apache.clerezza.api.impl.graph.WriteBlockedGraph;
+import org.apache.clerezza.dataset.security.TcAccessController;
+
+import java.security.AccessControlException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ * A Secured triple collection wraps a triple collection checking each access
+ * for the rights on a the ImmutableGraph for which the uri is passed to the 
+ * constructor.
+ *
+ * @author mir, hasan
+ */
+public class SecuredGraph implements Graph {
+
+    private final Graph wrapped;
+    private final IRI name;
+    private final TcAccessController tcAccessController;
+
+    public SecuredGraph(Graph wrapped, IRI name,
+                        TcAccessController tcAccessController) {
+        this.wrapped = wrapped;
+        this.name = name;
+        this.tcAccessController = tcAccessController;
+    }
+
+    @Override
+    public Iterator<Triple> filter(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) {
+        final Iterator<Triple> baseIter = wrapped.filter(subject, predicate, object);
+        return new Iterator<Triple>() {
+
+            @Override
+            public boolean hasNext() {
+                checkRead();
+                return baseIter.hasNext();
+            }
+
+            @Override
+            public Triple next() {
+                checkRead();
+                return baseIter.next();
+            }
+
+            @Override
+            public void remove() {
+                checkWrite();
+                baseIter.remove();
+            }
+        };
+    }
+
+    @Override
+    public int size() {
+        checkRead();
+        return wrapped.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        checkRead();
+        return wrapped.isEmpty();
+    }
+
+    @Override
+    public Object[] toArray() {
+        checkRead();
+        return wrapped.toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        checkRead();
+        return wrapped.toArray(a);
+    }
+
+    @Override
+    public boolean add(Triple e) {
+        checkWrite();
+        return wrapped.add(e);
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        checkWrite();
+        return wrapped.remove(o);
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        checkWrite();
+        return wrapped.addAll(c);
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        checkWrite();
+        return wrapped.removeAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        checkWrite();
+        return wrapped.retainAll(c);
+    }
+
+    @Override
+    public void clear() {
+        checkWrite();
+        wrapped.clear();
+    }
+
+    void checkRead() {
+        tcAccessController.checkReadPermission(name);
+    }
+
+    void checkWrite() {
+        tcAccessController.checkReadWritePermission(name);
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        checkRead();
+        return wrapped.contains((Triple) o);
+    }
+
+
+    @Override
+    public Iterator<Triple> iterator() {
+        return filter(null, null, null);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        checkRead();
+        return wrapped.containsAll(c);
+    }
+    
+    @Override
+    public ImmutableGraph getImmutableGraph() {
+        return new SimpleImmutableGraph(this);
+    }
+
+    @Override
+    public ReadWriteLock getLock() {
+        return wrapped.getLock();
+    }
+    
+    /**
+     * Returns the wrapped Graph if the caller has all access rights.
+     * If the caller has only the read access right, then a write-blocked
+     * Graph is returned. If the caller has neither the read nor the write
+     * access right then an AccessControlException is thrown.
+     *
+     * @return the wrapped Graph or a write-block Graph depending
+     *        on the access rights of the caller.
+     */
+    public Graph getUnsecuredGraph() {
+        try {
+            checkWrite();
+            return wrapped;
+        } catch (AccessControlException ex) {
+            checkRead();
+            return new WriteBlockedGraph(wrapped);
+        }
+        
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/TcManager.java b/dataset/src/main/java/org/apache/clerezza/dataset/TcManager.java
new file mode 100644
index 0000000..8981ad3
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/TcManager.java
@@ -0,0 +1,613 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.impl.graph.WriteBlockedGraph;
+import org.apache.clerezza.dataset.security.TcAccessController;
+import org.apache.clerezza.sparql.*;
+import org.apache.clerezza.sparql.query.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+
+import java.security.AccessControlException;
+import java.util.*;
+
+/**
+ * This class implements
+ * <code>TcManager</code>, delegating the actual provision and creation of
+ * Graphs or MGraphs to registered
+ * <code>TcProvider</code>s. The class attempts to satisfy the request using the
+ * register
+ * <code>WeightedTcProvider</code> in decreasing order of weight. If multiple
+ * providers have the same weight the lexicographical order of the fully
+ * qualified class name determines which one is used, namely the one that occurs
+ * earlier. If a call to a registered provider causes an
+ * <code>IllegalArgumentException</code>,
+ * <code>NoSuchEntityException</code> or
+ * <code>UnsupportedOperationException</code> then the call is delegated to the
+ * next provider.
+ *
+ * Only one instance of this class should exist in a system, the public no
+ * argument constructor is meant for initialization by dependency injection
+ * systems such as OSGi-DS. Applications should use the static
+ * <code>getInstance()</code> method if they aren't using a framework that
+ * injects them the instance.
+ *
+ * This class returns
+ * <code>Graph</code>s a subtype of
+ * <code>Graph</code> that allows read/write locks.
+ *
+ * This class also registers all Graphs as services with the property
+ * 'name' indicating there name.
+ *
+ * Security checks are done when a Graph is retrieved. The returned
+ * Graph will do no further security checks. Because of this it
+ * should not be passed to a context where different access control applies. If
+ * an Graph is retrieved without having write permission the returned graph
+ * will be read-only.
+ *
+ * If a Graphs needs to passed around across different security
+ * contexts the one retrieved from the OSGi service whiteboard should be used as
+ * this performs access control on every access.
+ *
+ * @author reto, mir, hasan
+ *
+ */
+//immedia is set to true as this should register the ImmutableGraph services (even if manager service is not required)
+@Component(service = TcManager.class, immediate = true,
+        property={
+            "graph.cache.enabled=true",
+            "Graph.services.enabled=true"})
+public class TcManager extends TcProviderMultiplexer implements GraphStore {
+
+    public final static String GENERAL_PURPOSE_TC = "general.purpose.tc";
+    public final static String Graph_SERVICES_ENABLED = "Graph.services.enabled";
+    public final static String MGRAPH_CACHE_ENABLED = "graph.cache.enabled";
+
+    private static volatile TcManager instance;
+    private TcAccessController tcAccessController = new TcAccessController() {
+
+        @Override
+        protected TcManager getTcManager() {
+            return TcManager.this;
+        }
+            
+    };
+    private Map<IRI, ServiceRegistration> serviceRegistrations = Collections
+            .synchronizedMap(new HashMap<IRI, ServiceRegistration>());
+    
+    protected QueryEngine queryEngine;
+    private boolean isActivated = false;
+    private boolean isTcServicesEnabled = true;
+
+    private ComponentContext componentContext;
+    protected SortedSet<WeightedTcProvider> tempProviderList = new TreeSet<WeightedTcProvider>(
+            new WeightedProviderComparator());
+
+    /**
+     * the constructor sets the singleton instance to allow instantiation by
+     * OSGi-DS. This constructor should not be called except by OSGi-DS,
+     * otherwise the static
+     * <code>getInstance</code> method should be used.
+     */
+    public TcManager() {
+        TcManager.instance = this;
+    }
+
+    /**
+     * This returns the singleton instance. If an instance has been previously
+     * created (e.g. by OSGi declarative services) this instance is returned,
+     * otherwise a new instance is created and providers are injected using the
+     * service provider interface (META-INF/services/)
+     *
+     * @return the singleton instance
+     */
+    public static TcManager getInstance() {
+        if (instance == null) {
+            synchronized (TcManager.class) {
+                if (instance == null) {
+                    instance = new TcManager();
+                    instance.isActivated = true;
+                    Iterator<WeightedTcProvider> weightedProviders = ServiceLoader
+                            .load(WeightedTcProvider.class).iterator();
+                    while (weightedProviders.hasNext()) {
+                        WeightedTcProvider weightedProvider = weightedProviders
+                                .next();
+                        instance
+                                .bindWeightedTcProvider(weightedProvider);
+                    }
+                    Iterator<QueryEngine> queryEngines = ServiceLoader.load(
+                            QueryEngine.class).iterator();
+                    System.out.println("looking for QE");
+                    if (queryEngines.hasNext()) {
+                        instance.queryEngine = queryEngines.next();
+                        System.out.println("QE: "
+                                + instance.queryEngine.getClass());
+                    }
+                }
+            }
+        }
+        return instance;
+    }
+    
+    protected void activate(final ComponentContext componentContext) {
+        this.componentContext = componentContext;
+        
+        // Read configuration
+		isTcServicesEnabled = true;
+		Object configTcServicesEnabled = componentContext.getProperties().get(Graph_SERVICES_ENABLED);
+		if ( configTcServicesEnabled != null && configTcServicesEnabled instanceof String ) {
+			isTcServicesEnabled = Boolean.valueOf((String)configTcServicesEnabled);				
+		}
+		Object configCacheEnabled = componentContext.getProperties().get(MGRAPH_CACHE_ENABLED);
+		if ( configCacheEnabled != null && configCacheEnabled instanceof String ) {
+			setCachingEnabled(Boolean.valueOf((String)configCacheEnabled));				
+		}
+		isActivated = true;
+		
+        for (WeightedTcProvider provider : tempProviderList) {
+        	addWeightedTcProvider(provider);
+        }
+        tempProviderList.clear();
+    }
+
+    protected void deactivate(final ComponentContext componentContext) {
+        for (ServiceRegistration registration : serviceRegistrations.values()) {
+            registration.unregister();
+        }
+        serviceRegistrations.clear();
+        this.componentContext = null;
+		isActivated = false;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        tcAccessController.checkReadPermission(name);
+        return super.getImmutableGraph(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) {
+        try {
+            tcAccessController.checkReadWritePermission(name);
+        } catch (AccessControlException e) {
+            tcAccessController.checkReadPermission(name);
+            return new WriteBlockedGraph(super.getMGraph(name));
+        }
+        return super.getMGraph(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name) {
+        try {
+            tcAccessController.checkReadWritePermission(name);
+        } catch (AccessControlException e) {
+            tcAccessController.checkReadPermission(name);
+            return new WriteBlockedGraph(
+                    super.getGraph(name));
+        }
+        return super.getGraph(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name)
+            throws UnsupportedOperationException {
+        tcAccessController.checkReadWritePermission(name);
+        return super.createGraph(name);
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        tcAccessController.checkReadWritePermission(name);
+        return super.createImmutableGraph(name, triples);
+    }
+
+    @Override
+    public void deleteGraph(IRI name) {
+        tcAccessController.checkReadWritePermission(name);
+        super.deleteGraph(name);
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        return super.getNames(ImmutableGraph);
+    }
+
+    @Override
+    public Set<IRI> listNamedGraphs() {
+        return this.listGraphs();
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        Set<IRI> result = super.listGraphs();
+        return excludeNonReadable(result);
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        Set<IRI> result = super.listMGraphs();
+        return excludeNonReadable(result);
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        Set<IRI> result = super.listImmutableGraphs();
+        return excludeNonReadable(result);
+    }
+
+    private Set<IRI> excludeNonReadable(Set<IRI> tcNames) {
+        SecurityManager security = System.getSecurityManager();
+        if (security == null) {
+            return tcNames;
+        }
+        Set<IRI> result = new HashSet<IRI>();
+        for (IRI name : tcNames) {
+            try {
+                tcAccessController.checkReadPermission(name);
+            } catch (AccessControlException e) {
+                continue;
+            }
+            result.add(name);
+        }
+        return result;
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query. If the defaultGraph is available
+     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
+     *
+     * @param query the sparql query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if no FROM clause is present
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, Graph defaultGraph) throws ParseException {
+        TcProvider singleTargetTcProvider = null;
+
+        final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
+        final SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
+        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
+            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
+        }
+        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
+            return ((QueryableTcProvider) singleTargetTcProvider).executeSparqlQuery(query, null);
+        }
+        final QueryEngine queryEngine = this.queryEngine;
+        if (queryEngine != null) {
+            return queryEngine.execute(this, defaultGraph, query);
+        } else {
+            throw new NoQueryEngineException();
+        }
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query. Note that this method only works for
+     * queries that do not need a default ImmutableGraph.
+     *
+     * @param query the sparql query to execute
+     * @param forceFastlane indicate whether to force fastlane usage.
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, boolean forceFastlane) throws ParseException {
+        TcProvider singleTargetTcProvider = null;
+    	if (forceFastlane) {
+            singleTargetTcProvider = getSingleTargetTcProvider(Collections.EMPTY_SET);
+    	} else {
+	        final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
+	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
+	        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+	        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
+	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
+	        }
+    	}
+
+        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
+            return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, null);
+        }
+        final QueryEngine queryEngine = this.queryEngine;
+        if (queryEngine != null) {
+            return queryEngine.execute(this, new SimpleGraph(), query);
+        } else {
+            throw new NoQueryEngineException();
+        }
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query. If the defaultGraph is available
+     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
+     *
+     * @param query the sparql query to execute
+     * @param defaultGraphName the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, IRI defaultGraphName) throws ParseException {
+      return executeSparqlQuery(query, defaultGraphName, false);
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query. If the defaultGraph is available
+     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
+     *
+     * @param query the sparql query to execute
+     * @param defaultGraph the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
+     * @param forceFastlane indicate whether to force fastlane usage.
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, IRI defaultGraphName, boolean forceFastlane) throws ParseException {
+        TcProvider singleTargetTcProvider = null;
+    	if (forceFastlane) {
+            singleTargetTcProvider = getSingleTargetTcProvider(Collections.singleton(defaultGraphName));
+    	} else {
+	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
+	        final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+	        if ((referencedGraphs != null)) {
+	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
+	        }
+    	}
+        if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
+            return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, defaultGraphName);
+        }
+        final QueryEngine queryEngine = this.queryEngine;
+        if (queryEngine != null) {
+            return queryEngine.execute(this, this.getGraph(defaultGraphName), query);
+        } else {
+            throw new NoQueryEngineException();
+        }
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query.
+     *
+     * @param query the sparql query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if no FROM clause is present
+     * @return the resulting ResultSet, ImmutableGraph or Boolean value
+     *
+     * @deprecated Query is discontinued
+     */
+    @Deprecated
+    public Object executeSparqlQuery(Query query, Graph defaultGraph) {
+        final QueryEngine queryEngine = this.queryEngine;
+        if (queryEngine != null) {
+            return queryEngine.execute(this, defaultGraph, query.toString());
+        } else {
+            throw new NoQueryEngineException();
+        }
+    }
+
+    /**
+     * Executes a sparql SELECT query.
+     *
+     * @param query the sparql SELECT query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if not FROM clause is present
+     * @return the resulting ResultSet
+     * @deprecated Query is discontinued
+     */
+    @Deprecated
+    public ResultSet executeSparqlQuery(SelectQuery query,
+                                        Graph defaultGraph) {
+        return (ResultSet) executeSparqlQuery((Query) query, defaultGraph);
+    }
+
+    /**
+     * Executes a sparql ASK query.
+     *
+     * @param query the sparql ASK query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if not FROM clause is present
+     * @return the boolean value this query evaluates to
+     * @deprecated Query is discontinued
+     */
+    @Deprecated
+    public boolean executeSparqlQuery(AskQuery query,
+            Graph defaultGraph) {
+        return (Boolean) executeSparqlQuery((Query) query, defaultGraph);
+    }
+
+    /**
+     * Executes a sparql DESCRIBE query.
+     *
+     * @param query the sparql DESCRIBE query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if not FROM clause is present
+     * @return the resulting ImmutableGraph
+     * @deprecated Query is discontinued
+     */
+    @Deprecated
+    public ImmutableGraph executeSparqlQuery(DescribeQuery query,
+            Graph defaultGraph) {
+        return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
+    }
+
+    /**
+     * Executes a sparql CONSTRUCT query.
+     *
+     * @param query the sparql CONSTRUCT query to execute
+     * @param defaultGraph the default ImmutableGraph against which to execute the query
+     * if not FROM clause is present
+     * @return the resulting ImmutableGraph
+     * @deprecated Query is discontinued
+     */
+    @Deprecated
+    public ImmutableGraph executeSparqlQuery(ConstructQuery query,
+            Graph defaultGraph) {
+        return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
+    }
+
+    /**
+     * @return the TcAccessController that can be used to set the permissions
+     * needed to access a Triple Collection
+     */
+    public TcAccessController getTcAccessController() {
+        return tcAccessController;
+    }
+
+    /**
+     * Registers a provider
+     *
+     * @param provider the provider to be registered
+     */
+    @Reference(policy = ReferencePolicy.DYNAMIC,
+            cardinality = ReferenceCardinality.MULTIPLE)
+    protected void bindWeightedTcProvider(WeightedTcProvider provider) {
+    	if (isActivated) {
+    		addWeightedTcProvider(provider);
+    	} else {
+    		tempProviderList.add(provider);
+    	}
+    }
+
+    /**
+     * Unregister a provider
+     *
+     * @param provider the provider to be deregistered
+     */
+    protected void unbindWeightedTcProvider(
+            WeightedTcProvider provider) {
+        removeWeightedTcProvider(provider);
+    }
+
+    /**
+     * Registers a provider
+     *
+     * @param provider the provider to be registered
+     */
+    @Reference(policy = ReferencePolicy.DYNAMIC,
+            cardinality = ReferenceCardinality.AT_LEAST_ONE,
+            target = "("+ TcManager.GENERAL_PURPOSE_TC+"=true)")
+    protected void bindGpWeightedTcProvider(WeightedTcProvider provider) {
+    	if (isActivated) {
+    		addWeightedTcProvider(provider);
+    	} else {
+    		tempProviderList.add(provider);
+    	}
+    }
+
+    /**
+     * Unregister a provider
+     *
+     * @param provider the provider to be deregistered
+     */
+    protected void unbindGpWeightedTcProvider(
+            WeightedTcProvider provider) {
+        removeWeightedTcProvider(provider);
+    }
+
+    @Reference(policy = ReferencePolicy.DYNAMIC,
+            cardinality = ReferenceCardinality.OPTIONAL)
+    protected void bindQueryEngine(QueryEngine queryEngine) {
+        this.queryEngine = queryEngine;
+    }
+
+    protected void unbindQueryEngine(QueryEngine queryEngine) {
+        this.queryEngine = null;
+    }
+
+    @Override
+    protected void mGraphAppears(IRI name) {
+    	if (isTcServicesEnabled()) {
+    		// Only create the service when activated. When not activated
+    		// creating will be delayed till after activation.
+	        if (componentContext != null) {
+	            registerGraphAsService(name, true);
+	        }
+    	}
+    }
+
+    @Override
+    protected void graphAppears(IRI name) {
+    	if (isTcServicesEnabled()) {
+    		// Only create the service when activated. When not activated
+    		// creating will be delayed till after activation.
+	        if (componentContext != null) {
+	            registerGraphAsService(name, false);
+	        }
+    	}
+    }
+
+    private void registerGraphAsService(IRI name, boolean isMGraph) {
+        Dictionary<String,Object> props = new Hashtable<String, Object>();
+        props.put("name", name.getUnicodeString());
+        String[] interfaceNames;
+        Object service;
+        if (isMGraph) {
+            interfaceNames = new String[]{
+                Graph.class.getName(),
+                Graph.class.getName()
+            };
+            service = new MGraphServiceFactory(this, name, tcAccessController);
+        } else {
+            interfaceNames = new String[]{ImmutableGraph.class.getName()};
+            service = new ImmutableGraphServiceFactory(this, name, tcAccessController);
+        }
+        final int bundleState = componentContext.getBundleContext().getBundle().getState();
+        if ((bundleState == Bundle.ACTIVE) || (bundleState == Bundle.STARTING)) {
+            ServiceRegistration serviceReg = componentContext.getBundleContext()
+                    .registerService(interfaceNames, service, props);
+            serviceRegistrations.put(name, serviceReg);
+        }
+    }
+
+    @Override
+    protected void tcDisappears(IRI name) {
+        ServiceRegistration reg = serviceRegistrations.get(name);
+        if (reg != null) {
+            reg.unregister();
+            serviceRegistrations.remove(name);
+        }
+    }
+
+    private TcProvider getSingleTargetTcProvider(final Set<IRI> referencedGraphs) {
+        TcProvider singleTargetTcProvider = null;
+        for (WeightedTcProvider provider : providerList) {
+            final Set<IRI> providerGraphs = provider.listGraphs();
+            if (providerGraphs.containsAll(referencedGraphs)) {
+               singleTargetTcProvider = provider;
+               break; //success
+            }
+            for (IRI graphName : referencedGraphs) {
+                if (providerGraphs.contains(graphName)) {
+                    break; //failure
+                }
+            }      
+        }
+        return singleTargetTcProvider;
+    }
+
+    public boolean isTcServicesEnabled() {
+		return isTcServicesEnabled;
+	}
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/TcProvider.java b/dataset/src/main/java/org/apache/clerezza/dataset/TcProvider.java
new file mode 100644
index 0000000..6135790
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/TcProvider.java
@@ -0,0 +1,151 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+
+import java.util.Set;
+
+/**
+ * A TC (Graph) Provider allows access to and optionally 
+ * creation of named {@link ImmutableGraph}s and {@link Graph}s (mutable graphs)
+ *
+ * @author reto
+ */
+public interface TcProvider {
+
+    /**
+     * Get a <code>ImmutableGraph</code> by its name
+     *
+     * @param name the name of the ImmutableGraph
+     * @return the <code>ImmutableGraph</code> with the specified name
+     * @throws NoSuchEntityException if there is no <code>ImmutableGraph</code>
+     *         with the specified name
+     */
+    ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException;
+
+    /**
+     * Get an <code>Graph</code> taht is not <code>ImmutableGrah</code>. The instances
+     * returned in different invocations are <code>equals</code>.
+     *
+     * @param the name of the <code>Graph</code>
+     * @return name the <code>Graph</code> with the specified name
+     * @throws NoSuchEntityException if there is no <code>Graph</code>
+     *         with the specified name
+     */
+    Graph getMGraph(IRI name) throws NoSuchEntityException;
+
+    /**
+     * This method is used to get a <code>Graph</code> indifferently
+     * whether it's a ImmutableGraph or not. If the <code>name</code> names an
+     * <code>Graph</code> the result is the same as when invoking
+     * <code>getMGraph</code> with that argument, analogously for
+     * <code>ImmutableGraph</code>S the method returns an instance equals to what
+     * <code>getImmutableGraph</code> would return.
+     *
+     * @param name the name of the <Code>ImmutableGraph</code> or <code>Graph</code>
+     * @return the <Code>ImmutableGraph</code> or <code>Graph</code>
+     * @throws NoSuchEntityException if there is no <code>ImmutableGraph</code>
+     *         or <code>Graph</code> with the specified name
+     */
+    Graph getGraph(IRI name) throws NoSuchEntityException;
+
+    /**
+     * Lists the name of the <Code>ImmutableGraph</code>s available through this
+     * <code>TcProvider</code>, implementations may take into account the
+     * security context and omit <Code>ImmutableGraph</code>s for which access is not
+     * allowed.
+     *
+     * @return the list of <Code>ImmutableGraph</code>s
+     */
+    Set<IRI> listImmutableGraphs();
+
+    /**
+     * Lists the name of the <Code>Graph</code>s available through this
+     * <code>TcProvider</code> that are not <Code>ImmutableGraph</code>, implementations may take into account the
+     * security context and omit <Code>Graph</code>s for which access is not
+     * allowed.
+     *
+     * @return the list of <Code>Graph</code>s
+     */
+    Set<IRI> listMGraphs();
+
+    /**
+     * Lists the name of the <Code>Graph</code>s available through this
+     * <code>TcProvider</code> indifferently whether they are mutables or
+     * immutables, implementations may take into account the security context and
+     * omit <Code>Graph</code>s for which access is not allowed.
+     *
+     * @return the list of <Code>Graph</code>s
+     */
+    Set<IRI> listGraphs();
+
+    /**
+     * Creates an initially empty <code>Graph</code> with a specified name
+     *
+     * @param name names the new <code>Graph</code>
+     * @return the newly created <code>Graph</code>
+     * @throws UnsupportedOperationException if this provider doesn't support
+     *         creating <code>Graph</code>S
+     * @throws EntityAlreadyExistsException if an Graph with the specified name
+     *         already exists
+     */
+    Graph createGraph(IRI name) throws UnsupportedOperationException,
+            EntityAlreadyExistsException;
+
+    /**
+     * Creates a <code>ImmutableGraph</code> with a specified name
+     *
+     * @param name the name of the <code>ImmutableGraph</code> to be created
+     * @param triples the triples of the new <code>ImmutableGraph</code>
+     * @return the newly created <code>ImmutableGraph</code>
+     * @throws UnsupportedOperationException if this provider doesn't support
+     *         creating <code>ImmutableGraph</code>S
+     * @throws EntityAlreadyExistsException if a ImmutableGraph with the specified name
+     *         already exists
+     */
+    ImmutableGraph createImmutableGraph(IRI name, Graph triples)
+            throws UnsupportedOperationException, EntityAlreadyExistsException;
+
+    /**
+     * Deletes the <code>ImmutableGraph</code> or <code>Graph</code> of a specified name.
+     * If <code>name</code> references a ImmutableGraph and the ImmutableGraph has other names, it
+     * will still be available with those other names.
+     *
+     * @param name the entity to be removed
+     * @throws UnsupportedOperationException if this provider doesn't support
+     *         entities deletion.
+     * @throws NoSuchEntityException if <code>name</code> doesn't refer to a
+     *           <code>ImmutableGraph</code> or an <code>Graph</code>.
+     * @throws EntityUndeletableException if the specified ImmutableGraph is undeletable
+     */
+    void deleteGraph(IRI name) throws UnsupportedOperationException,
+            NoSuchEntityException, EntityUndeletableException;
+
+    /**
+     * get a set of the names of a <code>ImmutableGraph</code>
+     *
+     * @param ImmutableGraph
+     * @return the set names of <code>ImmutableGraph</code>, the set is empty if
+     *         <code>ImmutableGraph</code> is unknown
+     */
+    Set<IRI> getNames(ImmutableGraph immutableGraph);
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/TcProviderMultiplexer.java b/dataset/src/main/java/org/apache/clerezza/dataset/TcProviderMultiplexer.java
new file mode 100644
index 0000000..ceaddc3
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/TcProviderMultiplexer.java
@@ -0,0 +1,446 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+
+import java.lang.ref.WeakReference;
+import java.util.*;
+
+/**
+ * This makes a set of WeightedTcProvider appear as one TcProvider. It delegates
+ * requests to the WeightedTcProvider with the highest Weight
+ *
+ * @author reto
+ */
+public class TcProviderMultiplexer implements TcProvider {
+
+    protected SortedSet<WeightedTcProvider> providerList = new TreeSet<>(
+            new WeightedProviderComparator());
+    /**
+     * Mapping to Graph's and ServiceRegistration using their URI's as key.
+     * Makes sure that per URI only one instance of the Graph is used,
+     * otherwise the locks in the <code>Graph</code>s would have no effect
+     * between different instances and concurrency issues could occur.
+     */
+    private Map<IRI, MGraphHolder> mGraphCache = Collections.synchronizedMap(new HashMap<IRI, MGraphHolder>());
+
+	/**
+	 * Flag to indicate whether mgraphs should be cached for faster access. By
+	 * default caching is enabled for backward compatibility.
+	 */
+	private boolean isCachingEnabled = true;
+
+    /**
+     * Registers a provider
+     *
+     * @param provider
+     *            the provider to be registered
+     */
+    public void addWeightedTcProvider(WeightedTcProvider provider) {
+        providerList.add(provider);
+        updateGraphCache(provider, true);
+    }
+
+    /**
+     * Unregister a provider
+     *
+     * @param provider
+     *            the provider to be deregistered
+     */
+    public void removeWeightedTcProvider(
+            WeightedTcProvider provider) {
+        providerList.remove(provider);
+        updateGraphCache(provider, false);
+    }
+
+    /**
+     * subclasses overwrite this method to be notified when a new
+     * ImmutableGraph is available (either because it has been created or being
+     * provided by a newly added WeightedTcProvider). The default implementation
+     * does nothing.
+     *
+     * @param name
+     */
+    protected void graphAppears(IRI name) {
+    }
+
+    /**
+     * subclasses overwrite this method to be notified when a new
+     * Graph is available (either because it has been created or being
+     * provided by a newly added WeightedTcProvider). The default implementation
+     * does nothing.
+     *
+     * @param name
+     */
+    protected void mGraphAppears(IRI name) {
+    }
+
+    /**
+     * subclasses overwrite this method to be notified whenGraph is
+     * no longer available (either because it has been deleted or bacause its
+     * WeightedTcProvider was removed). The default implementation does nothing.
+     *
+     * for implementational reasons even for name of Graph not
+     * previously registered.
+     *
+     * @param name
+     */
+    protected void tcDisappears(IRI name) {
+    }
+
+    /**
+     * Updates the lockableMGraphCache AFTER a new <code>provider</code> was
+     * bound or unbound.
+     * This method also takes care of registering and unregistering
+     * provided triple collections as services based on the weight of
+     * all affected providers.
+     *
+     * @param provider
+     *            the provider that was added or removed
+     * @param providerAdded
+     *            <code>boolean</code> that should be set as <code>true</code>
+     *            if <code>provider</code> was added to
+     *            <code>org.apache.clerezza.rdf.core.TcManager.providerList</code>
+     *            otherwise <code>false</code>
+     */
+    private void updateGraphCache(WeightedTcProvider provider,
+            boolean providerAdded) {
+        Set<IRI> uriSet = provider.listGraphs();
+        if (!(uriSet == null || uriSet.isEmpty())) {
+            if (providerAdded) {
+                weightedProviderAdded(provider, uriSet);
+            } else {
+                weightedProviderRemoved(provider, uriSet);
+            }
+        }
+    }
+
+    private void weightedProviderAdded(WeightedTcProvider newProvider,
+            Set<IRI> newProvidedUris) {
+        Set<WeightedTcProvider> lowerWeightedProviderList = getLowerWeightedProvider(newProvider);
+    	if (isCachingEnabled()) {
+	        for (IRI name : newProvidedUris) {
+	            final MGraphHolder holder = mGraphCache.get(name);
+	            if ((holder != null) && (holder.getWeightedTcProvider() != null)) {
+	                if (lowerWeightedProviderList.contains(holder.getWeightedTcProvider())) {
+	                    tcDisappears(name);
+	                    mGraphCache.remove(name);
+	                } else {
+	                    continue;
+	                }
+	            }
+	            Graph triples = newProvider.getGraph(name);
+	            if (triples instanceof Graph) {
+	           		mGraphCache.put(name, new MGraphHolder(newProvider, ensureLockable((Graph)triples)));
+	                mGraphAppears(name);
+	            } else {
+	                graphAppears(name);
+	            }
+	    	}
+        }
+    }
+
+
+
+    private Set<WeightedTcProvider> getLowerWeightedProvider(
+            WeightedTcProvider newProvider) {
+        boolean referenceProviderPassed = false;
+        Set<WeightedTcProvider> lowerWeightedProviderList = new HashSet<WeightedTcProvider>();
+        for (WeightedTcProvider weightedProvider : providerList) {
+            if (referenceProviderPassed) {
+                lowerWeightedProviderList.add(weightedProvider);
+            } else if (newProvider.equals(weightedProvider)) {
+                referenceProviderPassed = true;
+            }
+        }
+        return lowerWeightedProviderList;
+    }
+
+    private void weightedProviderRemoved(WeightedTcProvider oldProvider,
+            Set<IRI> oldProvidedUris) {
+        for (IRI name : oldProvidedUris) {
+            final MGraphHolder holder = mGraphCache.get(name);
+            if ((holder != null) && (holder.getWeightedTcProvider() != null)
+                    && holder.getWeightedTcProvider().equals(oldProvider)) {
+                tcDisappears(name);
+                mGraphCache.remove(name);
+
+            	if (isCachingEnabled()) {
+	                // check if another WeightedTcProvider has the Graph.
+	                // And if so register as service.
+	                for (WeightedTcProvider provider : providerList) {
+	                    try {
+	                        Graph triples = provider.getGraph(name);
+	                        if (triples instanceof Graph) {
+	                       		mGraphCache.put(name, new MGraphHolder(provider, ensureLockable((Graph)triples)));
+	                            mGraphAppears(name);
+	                        } else {
+	                            graphAppears(name);
+	                        }
+	                        break;
+	                    } catch (NoSuchEntityException e) {
+	                        // continue;
+	                    }
+	                }
+            	}
+            }
+        }
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        for (TcProvider provider : providerList) {
+            try {
+                return provider.getImmutableGraph(name);
+            } catch (NoSuchEntityException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name)
+            throws NoSuchEntityException {
+        Graph result = getMGraphFromCache(name);
+        if (result == null) {
+            synchronized (this) {
+                result = getMGraphFromCache(name);
+                if (result == null) {
+                    result = getUnsecuredMGraphAndAddToCache(name);
+                }
+            }
+        }
+        return result;
+    }
+
+    private Graph getMGraphFromCache(IRI name) {
+        MGraphHolder holder = mGraphCache.get(name);
+        if (holder == null) {
+            return null;
+        }
+        return holder.getMGraph();
+    }
+
+    private Graph getUnsecuredMGraphAndAddToCache(IRI name)
+            throws NoSuchEntityException {
+        for (WeightedTcProvider provider : providerList) {
+            try {
+                Graph providedMGraph = provider.getMGraph(name);
+                Graph result = ensureLockable(providedMGraph);
+
+                if (isCachingEnabled()) {
+	                mGraphCache.put(name, new MGraphHolder(
+	                        provider, result));
+                }
+                return result;
+            } catch (NoSuchEntityException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name)
+            throws NoSuchEntityException {
+        Graph result;
+        for (WeightedTcProvider provider : providerList) {
+            try {
+                result = provider.getGraph(name);
+                if (result instanceof ImmutableGraph) {
+                    return result;
+                } else {
+                    // This is to ensure the Graph gets added to the cache
+                    return getMGraph(name);
+                }
+            } catch (NoSuchEntityException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name)
+            throws UnsupportedOperationException {
+
+        for (WeightedTcProvider provider : providerList) {
+            try {
+                Graph result = provider.createGraph(name);
+                // unregisters a possible ImmutableGraph or Graph service under this name
+                // provided by a WeightedTcProvider with a lower weight.
+                tcDisappears(name);
+                if (isCachingEnabled()) {
+                	mGraphCache.put(name, new MGraphHolder(provider, null));
+                }
+                mGraphAppears(name);
+                return result;
+            } catch (UnsupportedOperationException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        throw new UnsupportedOperationException(
+                "No provider could create Graph.");
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        for (WeightedTcProvider provider : providerList) {
+            try {
+                ImmutableGraph result = provider.createImmutableGraph(name, triples);
+
+                // unregisters a possible ImmutableGraph or Graph service under this name
+                // provided by a WeightedTcProvider with a lower weight.
+                tcDisappears(name);
+                if (isCachingEnabled()) {
+                	mGraphCache.put(name, new MGraphHolder(provider, null));
+                }
+                graphAppears(name);
+                return result;
+            } catch (UnsupportedOperationException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        throw new UnsupportedOperationException(
+                "No provider could create ImmutableGraph.");
+    }
+
+    @Override
+    public void deleteGraph(IRI name) {
+        for (TcProvider provider : providerList) {
+            try {
+                provider.deleteGraph(name);
+                final MGraphHolder holder = mGraphCache.get(name);
+                if ((holder != null)
+                        && (holder.getWeightedTcProvider() != null)
+                        && holder.getWeightedTcProvider().equals(provider)) {
+                    tcDisappears(name);
+                    mGraphCache.remove(name);
+                }
+                return;
+            } catch (UnsupportedOperationException e) {
+                // we do nothing and try our luck with the next provider
+            } catch (NoSuchEntityException e) {
+                //we do nothing and try our luck with the next provider
+            } catch (IllegalArgumentException e) {
+                //we do nothing and try our luck with the next provider
+            }
+        }
+        // this throws a NoSuchEntityException if the ImmutableGraph doesn't exist
+        getGraph(name);
+        // the entity exists but cannot be deleted
+        throw new UnsupportedOperationException(
+                "No provider could delete the entity.");
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        Set<IRI> result = new HashSet<IRI>();
+        for (TcProvider provider : providerList) {
+            result.addAll(provider.getNames(ImmutableGraph));
+        }
+        return result;
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        Set<IRI> result = new HashSet<IRI>();
+        for (TcProvider provider : providerList) {
+            result.addAll(provider.listGraphs());
+        }
+        return result;
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        Set<IRI> result = new HashSet<IRI>();
+        for (TcProvider provider : providerList) {
+            result.addAll(provider.listMGraphs());
+        }
+        return result;
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        Set<IRI> result = new HashSet<IRI>();
+        for (TcProvider provider : providerList) {
+            result.addAll(provider.listImmutableGraphs());
+        }
+        return result;
+    }
+
+    private Graph ensureLockable(Graph providedMGraph) {
+        //Graphs are alway locable now
+        return providedMGraph;
+    }
+
+    /**
+     * Contains an unsecured Graph, a ServiceRegistration and
+     * the WeightedTcProvider that generated the ImmutableGraph
+     */
+    private static class MGraphHolder {
+
+        private WeightedTcProvider tcProvider;
+        private WeakReference<Graph> mGraphReference;
+
+        MGraphHolder(WeightedTcProvider tcProvider, Graph graph) {
+            this.tcProvider = tcProvider;
+            this.mGraphReference = new WeakReference<Graph>(graph);
+        }
+
+        Graph getMGraph() {
+            return this.mGraphReference.get();
+        }
+
+        WeightedTcProvider getWeightedTcProvider() {
+            return this.tcProvider;
+        }
+    }
+
+    //methods for debuging / monitoring
+    public SortedSet<WeightedTcProvider> getProviderList() {
+        return providerList;
+    }
+
+    public boolean isCachingEnabled() {
+		return isCachingEnabled;
+	}
+    
+    public void setCachingEnabled(boolean isCachingEnabled) {
+		this.isCachingEnabled = isCachingEnabled;
+		
+		if (!isCachingEnabled()) {
+			mGraphCache.clear();
+		}
+	}
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/WeightedProviderComparator.java b/dataset/src/main/java/org/apache/clerezza/dataset/WeightedProviderComparator.java
new file mode 100644
index 0000000..66752f3
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/WeightedProviderComparator.java
@@ -0,0 +1,41 @@
+package org.apache.clerezza.dataset;
+/*
+ *
+ * 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 java.util.Comparator;
+
+/**
+ * Compares the WeightedTcManagementProviders, descending for weight and
+ * ascending by name
+ */
+public class WeightedProviderComparator implements Comparator<WeightedTcProvider> {
+
+    @Override
+    public int compare(WeightedTcProvider o1, WeightedTcProvider o2) {
+        int o1Weight = o1.getWeight();
+        int o2Weight = o2.getWeight();
+        if (o1Weight != o2Weight) {
+            return o2Weight - o1Weight;
+        }
+        return o1.getClass().toString().compareTo(o2.getClass().toString());
+    }
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/WeightedTcProvider.java b/dataset/src/main/java/org/apache/clerezza/dataset/WeightedTcProvider.java
new file mode 100644
index 0000000..e50514d
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/WeightedTcProvider.java
@@ -0,0 +1,36 @@
+/*
+ * 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.dataset;
+
+/**
+ * This interface is implemented by providers to which {@link TcManagerImpl}
+ * delegates.
+ *
+ * @author reto
+ */
+public interface WeightedTcProvider extends TcProvider {
+
+    /**
+     * Get the weight of this provider. {@link TcManager} will prioritize
+     * <code>TcProvider</code>s with greater weight.
+     * 
+     * @return a positive number indicating the weight of the provider
+     */
+    int getWeight();
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/package.html b/dataset/src/main/java/org/apache/clerezza/dataset/package.html
new file mode 100644
index 0000000..8d136ed
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/package.html
@@ -0,0 +1,56 @@
+
+	<!--
+/*
+ * 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.
+ */
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+	<head>
+		<title>org.apache.clerezza.dataset</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	</head>
+	<body>
+		<p>This package provides access to named {@link
+			org.apache.clerezza.api.ImmutableGraph}S and {@link
+			org.apache.clerezza.api.Graph}S that may originate from various
+			implementations.</p>
+		<h3>Accessing</h3>
+		<p>
+			If running in a dependency injection system you should get an instance
+			of
+			<code>TcManager</code>
+			by the framework, otherwise use the static method
+			<code>TcManager.getInstance</code>
+			.
+		</p>
+		<h3>Adding a provider</h3>
+		<p>A provider implements {@link WeightedTcProvider}.</p>
+		<p>
+			To work outside a component injection framework it contains a file
+			<code>META-INF/services/org.apache.clerezza.dataset.WeightedTcProvider</code>
+			containing the name of the implementing class.
+		</p>
+		<p>
+			To work in a OSGi-DS context the provider register a component
+			exposing
+			<code>org.apache.clerezza.dataset.WeightedTcProvider</code>
+			as service interface.
+		</p>
+	</body>
+</html>
\ No newline at end of file
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java
new file mode 100644
index 0000000..93b54ff
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcAccessController.java
@@ -0,0 +1,342 @@
+/*
+ * 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.dataset.security;
+
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.literal.LiteralFactory;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManager;
+import org.apache.clerezza.utils.security.PermissionParser;
+
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Controls the permissions needed to access a triple collection provided by
+ * <code>TcManager</code>.
+ *
+ * Clients with a ConfigureTcAcessPermission can set the permissions required to
+ * access a Graph. These permissions are stored persistently in an
+ * Graph named urn:x-localinstance:/graph-access.graph
+ *
+ * Clients should get an instance from TcManager.getTcAccessController()
+ * 
+ * @author reto
+ */
+public abstract class TcAccessController {
+
+    private final TcManager tcManager;
+    private final IRI permissionGraphName = new IRI("urn:x-localinstance:/graph-access.graph");
+    //we can't rely on ontology plugin in rdf core
+    private String ontologyNamespace = "http://clerezza.apache.org/2010/07/10/graphpermssions#";
+    private final IRI readPermissionListProperty = new IRI(ontologyNamespace + "readPermissionList");
+    private final IRI readWritePermissionListProperty = new IRI(ontologyNamespace + "readWritePermissionList");
+    /**
+     * The first item in the subject RDF list.
+     */
+    public static final IRI first = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+    /**
+     * The rest of the subject RDF list after the first item.
+     */
+    public static final IRI rest = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+    public static final IRI rdfNil = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+    private final Map<IRI, Collection<Permission>> readPermissionCache =
+            Collections.synchronizedMap(new HashMap<IRI, Collection<Permission>>());
+    private final Map<IRI, Collection<Permission>> readWritePermissionCache =
+            Collections.synchronizedMap(new HashMap<IRI, Collection<Permission>>());
+
+    /**
+     *
+     * @param tcManager the tcManager used to locate urn:x-localinstance:/graph-access.graph
+     */
+    public TcAccessController() {
+        this.tcManager = getTcManager();
+    }
+
+    public void checkReadPermission(IRI GraphUri) {
+        if (GraphUri.equals(permissionGraphName)) {
+            //This is world readable, as this prevents as from doingf things as
+            //priviledged during verfification
+            return;
+        }
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            //will AllPermissions the rest is obsolete
+            try {
+                AccessController.checkPermission(new AllPermission());
+            } catch (AccessControlException e) {
+                Collection<Permission> perms = getRequiredReadPermissions(GraphUri);
+                if (perms.size() > 0) {
+                    for (Permission permission : perms) {
+                        AccessController.checkPermission(permission);
+                    }
+                } else {
+                    AccessController.checkPermission(new TcPermission(
+                            GraphUri.getUnicodeString(), TcPermission.READ));
+                }
+            }
+        }
+    }
+
+    public void checkReadWritePermission(IRI GraphUri) {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            //will AllPermissions the rest is obsolete
+            try {
+                AccessController.checkPermission(new AllPermission());
+            } catch (AccessControlException e) {
+                if (GraphUri.equals(permissionGraphName)) {
+                    AccessController.checkPermission(new TcPermission(
+                            GraphUri.getUnicodeString(), TcPermission.READWRITE));
+                } else {
+                    Collection<Permission> perms = getRequiredReadWritePermissions(GraphUri);
+                    if (perms.size() > 0) {
+                        for (Permission permission : perms) {
+                            AccessController.checkPermission(permission);
+                        }
+                    } else {
+                        AccessController.checkPermission(new TcPermission(
+                                GraphUri.getUnicodeString(), TcPermission.READWRITE));
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Set the set of permissions required for read access to a triple-collection, if
+     * the set is non-empty the default TCPermisson is no longer required.
+     *
+     * @param GraphUri
+     * @param permissionDescriptions
+     */
+    public void setRequiredReadPermissionStrings(IRI GraphUri,
+            Collection<String> permissionDescriptions) {
+        readPermissionCache.remove(GraphUri);
+        final Graph permissionMGraph = getOrCreatePermisionGraph();
+        Lock l = permissionMGraph.getLock().writeLock();
+        l.lock();
+        try {
+            removeExistingRequiredReadPermissions(GraphUri, permissionMGraph);
+            final BlankNodeOrIRI permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
+            permissionMGraph.add(new TripleImpl(GraphUri,
+                    readPermissionListProperty, permissionList));
+        } finally {
+            l.unlock();
+        }
+    }
+
+    /**
+     * Set the set of permissions required for read access to a triple-collection, if
+     * the set is non-empty the default TCPermisson is no longer required.
+     *
+     * @param GraphUri
+     * @param permissionDescriptions
+     */
+    public void setRequiredReadPermissions(IRI GraphUri,
+            Collection<Permission> permissions) {
+        Collection<String> permissionStrings = new ArrayList<String>();
+        for (Permission permission : permissions) {
+            permissionStrings.add(permission.toString());
+        }
+        setRequiredReadPermissionStrings(GraphUri, permissionStrings);
+    }
+
+    /**
+     * Set the set of permissions required for read-write access to a
+     * triple-collection, if
+     * the set is non-empty the default TCPermisson is no longer required.
+     *
+     * @param GraphUri
+     * @param permissionDescriptions
+     */
+    public void setRequiredReadWritePermissionStrings(IRI GraphUri,
+            Collection<String> permissionDescriptions) {
+        readWritePermissionCache.remove(GraphUri);
+        final Graph permissionMGraph = getOrCreatePermisionGraph();
+        Lock l = permissionMGraph.getLock().writeLock();
+        l.lock();
+        try {
+            removeExistingRequiredReadPermissions(GraphUri, permissionMGraph);
+            final BlankNodeOrIRI permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
+            permissionMGraph.add(new TripleImpl(GraphUri,
+                    readWritePermissionListProperty, permissionList));
+        } finally {
+            l.unlock();
+        }
+    }
+
+    /**
+     * Set the set of permissions required for read-write access to a
+     * triple-collection, if
+     * the set is non-empty the default TCPermisson is no longer required.
+     *
+     * @param GraphUri
+     * @param permissionDescriptions
+     */
+    public void setRequiredReadWritePermissions(IRI GraphUri,
+            Collection<Permission> permissions) {
+        Collection<String> permissionStrings = new ArrayList<String>();
+        for (Permission permission : permissions) {
+            permissionStrings.add(permission.toString());
+        }
+        setRequiredReadWritePermissionStrings(GraphUri, permissionStrings);
+    }
+
+    /**
+     * Get the set of permissions required for read access to the
+     * triple-collection, the set may be empty meaning that the default
+     * TCPermission is required.
+     *
+     * @param GraphUri
+     * @return the collection of permissions
+     */
+    public Collection<Permission> getRequiredReadPermissions(IRI GraphUri) {
+        Collection<Permission> result = readPermissionCache.get(GraphUri);
+        if (result == null) {
+            result = new ArrayList<Permission>();
+            Collection<String> permissionStrings = getRequiredReadPermissionStrings(GraphUri);
+            for (String string : permissionStrings) {
+                result.add(PermissionParser.getPermission(string, getClass().getClassLoader()));
+            }
+            readPermissionCache.put(GraphUri, result);
+        }
+        return result;
+    }
+
+    /**
+     * Get the set of permissions required for read-write access to the
+     * triple-collection, the set may be empty meaning that the default
+     * TCPermission is required.
+     *
+     * @param GraphUri
+     * @return the collection of permissions
+     */
+    public Collection<Permission> getRequiredReadWritePermissions(IRI GraphUri) {
+        Collection<Permission> result = readWritePermissionCache.get(GraphUri);
+        if (result == null) {
+            result = new ArrayList<Permission>();
+            Collection<String> permissionStrings = getRequiredReadWritePermissionStrings(GraphUri);
+            for (String string : permissionStrings) {
+                result.add(PermissionParser.getPermission(string, getClass().getClassLoader()));
+            }
+            readWritePermissionCache.put(GraphUri, result);
+        }
+        return result;
+    }
+
+    private BlankNodeOrIRI createList(Iterator<String> iterator, Graph permissionMGraph) {
+        if (!iterator.hasNext()) {
+            return rdfNil;
+        }
+        final BlankNode result = new BlankNode();
+        permissionMGraph.add(new TripleImpl(result, first,
+                LiteralFactory.getInstance().createTypedLiteral(iterator.next())));
+        permissionMGraph.add(new TripleImpl(result, rest,
+                createList(iterator, permissionMGraph)));
+        return result;
+
+    }
+
+    //called withiong write-lock
+    private void removeExistingRequiredReadPermissions(IRI GraphUri,
+            Graph permissionMGraph) {
+        try {
+            Triple t = permissionMGraph.filter(GraphUri, readPermissionListProperty, null).next();
+            RDFTerm list = t.getObject();
+            removeList((BlankNodeOrIRI) list, permissionMGraph);
+            permissionMGraph.remove(t);
+        } catch (NoSuchElementException e) {
+            //There was no existing to remove
+        }
+    }
+
+    private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) {
+        try {
+            Triple t = permissionMGraph.filter(list, rest, null).next();
+            RDFTerm restList = t.getObject();
+            removeList((BlankNodeOrIRI) restList, permissionMGraph);
+            permissionMGraph.remove(t);
+            Iterator<Triple> iter = permissionMGraph.filter(list, first, null);
+            iter.next();
+            iter.remove();
+        } catch (NoSuchElementException e) {
+            //if it has no rest its rdf:NIL and has no first
+        }
+    }
+
+    private Collection<String> getRequiredReadWritePermissionStrings(final IRI GraphUri) {
+        return getRequiredPermissionStrings(GraphUri, readWritePermissionListProperty);
+    }
+    private Collection<String> getRequiredReadPermissionStrings(final IRI GraphUri) {
+        return getRequiredPermissionStrings(GraphUri, readPermissionListProperty);
+    }
+    private Collection<String> getRequiredPermissionStrings(final IRI GraphUri, IRI property) {
+        try {
+            final Graph permissionMGraph = tcManager.getMGraph(permissionGraphName);
+            Lock l = permissionMGraph.getLock().readLock();
+            l.lock();
+            try {
+                Triple t = permissionMGraph.filter(GraphUri, property, null).next();
+                BlankNodeOrIRI list = (BlankNodeOrIRI) t.getObject();
+                LinkedList<String> result = new LinkedList<String>();
+                readList(list, permissionMGraph, result);
+                return result;
+            } catch (NoSuchElementException e) {
+                return new ArrayList<String>(0);
+            } finally {
+                l.unlock();
+            }
+        } catch (NoSuchEntityException e) {
+            return new ArrayList<String>(0);
+        }
+    }
+
+    private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) {
+        if (list.equals(rdfNil)) {
+            return;
+        }
+        Triple restTriple = permissionMGraph.filter(list, rest, null).next();
+        BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject();
+        readList(restList, permissionMGraph, target);
+        Triple firstTriple = permissionMGraph.filter(list, first, null).next();
+        Literal firstValue = (Literal) firstTriple.getObject();
+        String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
+        target.addFirst(value);
+    }
+
+    private Graph getOrCreatePermisionGraph() {
+        try {
+            return tcManager.getMGraph(permissionGraphName);
+        } catch (NoSuchEntityException e) {
+            return tcManager.createGraph(permissionGraphName);
+        }
+    }
+
+    /**
+     * Note that this will only be invoked once
+     * @return 
+     */
+    protected abstract TcManager getTcManager();
+}
diff --git a/dataset/src/main/java/org/apache/clerezza/dataset/security/TcPermission.java b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcPermission.java
new file mode 100644
index 0000000..c218dd9
--- /dev/null
+++ b/dataset/src/main/java/org/apache/clerezza/dataset/security/TcPermission.java
@@ -0,0 +1,149 @@
+/*
+ * 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.dataset.security;
+
+import java.security.Permission;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/**
+ * A permission to access <code>Graph<code>s matching a specified 
+ * name pattern. A pattern is matched if and only if the pattern is equals
+ * to name of the <code>Graph<code> or the pattern ends with "/*" and
+ * the name of the <code>Graph<code> starts with the characters
+ * preceding the '*' in the pattern.
+ *
+ * @author reto, tsuy
+ */
+public class TcPermission extends Permission {
+    public final static String READWRITE = "readwrite";
+    public final static String READ = "read";
+
+    private String tcNamePattern;
+    /**
+     * true if readwrite granted false if only read
+     */
+    private boolean allowReadWrite = false;
+
+    final static Pattern actionPattern = Pattern.compile(",( *)");
+    /**
+     * Conststructs a TcPermission for a specified name pattern and a list of
+     * actions.
+     *
+     * @param tcNamePattern see class description
+     * @param actions a comma separated list of the strings "read" and "readwrite",
+     *        the canonical form is just "read" or "readwrite" as "readwrite"
+     *        implies "read".
+     */
+    public TcPermission(String tcNamePattern, String actions)  {
+        super(tcNamePattern);
+        this.tcNamePattern = tcNamePattern;
+        //check and set actions
+        final Set actionSet = new HashSet(Arrays.asList(actionPattern.split(actions)));
+        if (actionSet.remove(READWRITE)) {
+            allowReadWrite = true;
+        } else {
+            if (!actionSet.contains(READ)) {
+                throw new IllegalArgumentException("actions must be either \"read\" or \"readwrite\"");
+            }
+        }
+        actionSet.remove(READ);
+        if (actionSet.size() > 0) {
+            throw new IllegalArgumentException("actions must only contain \"read\" and \"readwrite\"");
+        }
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        if (permission instanceof TcPermission) {
+            TcPermission other = (TcPermission) permission;
+            if (!patternImplies(other.tcNamePattern)) {
+                return false;
+            }
+            if (!actionsImplies(other.allowReadWrite)) {
+                return false;
+            }
+            return true;
+            
+            
+        }
+        return false;
+    }
+
+    private boolean actionsImplies(boolean readwriteOther) {
+        if (!readwriteOther) {
+            return true;
+        } else {
+            return allowReadWrite;
+        }
+        
+    }
+
+    private boolean patternImplies(String tcNamePatternOther) {
+        if (tcNamePattern.equals(tcNamePatternOther)) {
+            return true;
+        }
+        if (tcNamePattern.endsWith("/*")) {
+            return tcNamePatternOther.startsWith(
+                    tcNamePattern.substring(0, tcNamePattern.length()-1));
+        }
+        return false;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TcPermission other = (TcPermission) obj;
+        if (this.tcNamePattern != other.tcNamePattern 
+                && (this.tcNamePattern == null
+                || !this.tcNamePattern.equals(other.tcNamePattern))) {
+            return false;
+        }
+        if (this.allowReadWrite != other.allowReadWrite) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 3;
+        hash = 97 * hash + (this.tcNamePattern != null ?
+            this.tcNamePattern.hashCode() : 0);
+        if (allowReadWrite) {
+            hash++;
+        }
+        return hash;
+    }
+
+    
+
+    @Override
+    public String getActions() {
+        return allowReadWrite ? READWRITE : READ;
+    }
+
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/SecurityTest.java b/dataset/src/test/java/org/apache/clerezza/dataset/SecurityTest.java
new file mode 100644
index 0000000..ffea930
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/SecurityTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.graph.ReadOnlyException;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.dataset.providers.WeightedA;
+import org.apache.clerezza.dataset.providers.WeightedDummy;
+import org.apache.clerezza.dataset.security.TcPermission;
+import org.junit.*;
+
+import java.io.FilePermission;
+import java.lang.reflect.ReflectPermission;
+import java.security.*;
+import java.util.Collections;
+import java.util.PropertyPermission;
+
+/**
+ *
+ * @author reto
+ */
+public class SecurityTest {
+    
+    public SecurityTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        ////needed to unbind because this is injected with META-INF/services - file
+        TcManager.getInstance().unbindWeightedTcProvider(new WeightedA());
+        TcManager.getInstance().bindWeightedTcProvider(new WeightedDummy());
+        TcManager.getInstance().createGraph(new IRI("http://example.org/ImmutableGraph/alreadyexists"));
+        TcManager.getInstance().createGraph(new IRI("http://example.org/read/ImmutableGraph"));
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() {
+        
+        Policy.setPolicy(new Policy() {
+
+            @Override
+            public PermissionCollection getPermissions(CodeSource codeSource) {
+                PermissionCollection result = new Permissions();
+                result.add(new TcPermission("http://example.org/permitted", "read"));
+                result.add(new TcPermission("http://example.org/ImmutableGraph/alreadyexists", "readwrite"));
+                result.add(new TcPermission("http://example.org/read/ImmutableGraph", "read"));
+                result.add(new TcPermission("http://example.org/area/allowed/*", "readwrite"));
+                result.add(new TcPermission("urn:x-localinstance:/graph-access.graph", "readwrite"));
+                //result.add(new AllPermission());
+                result.add(new RuntimePermission("*"));
+                result.add(new ReflectPermission("suppressAccessChecks"));
+                result.add(new PropertyPermission("*", "read"));
+                //(java.util.PropertyPermission line.separator read)
+                result.add(new FilePermission("/-", "read,write"));
+                return result;
+            }
+        });
+        System.setSecurityManager(new SecurityManager() {
+
+            @Override
+            public void checkPermission(Permission perm) {
+                //System.out.println("Checking "+perm);
+                super.checkPermission(perm);
+            }
+
+            @Override
+            public void checkPermission(Permission perm, Object context) {
+                //System.out.println("Checking "+perm);
+                super.checkPermission(perm, context);
+            }
+
+        });
+    }
+
+    @After
+    public void tearDown() {
+        System.setSecurityManager(null);
+    }
+
+
+    @Test(expected=NoSuchEntityException.class)
+    public void testAcessGraph() {        
+        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/permitted"));
+    }
+    
+    @Test(expected=AccessControlException.class)
+    public void testNoWildCard() {
+        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/permitted/subthing"));
+    }
+    
+    @Test(expected=NoSuchEntityException.class)
+    public void testAllowedArea() {
+        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/area/allowed/something"));
+    }
+    
+    @Test(expected=AccessControlException.class)
+    public void testAcessForbiddenGraph() {
+        TcManager.getInstance().getImmutableGraph(new IRI("http://example.org/forbidden"));
+    }
+
+    @Test(expected=NoSuchEntityException.class)
+    public void testCustomPermissions() {
+        IRI graphUri = new IRI("http://example.org/custom");
+        TcManager.getInstance().getTcAccessController().setRequiredReadPermissionStrings(graphUri,
+                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
+        //new FilePermission("/etc", "write").toString()));
+        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
+        System.out.print(ag.toString());
+        TcManager.getInstance().getMGraph(graphUri);
+    }
+
+    @Test(expected=AccessControlException.class)
+    public void testCustomPermissionsIncorrect() {
+        IRI graphUri = new IRI("http://example.org/custom");
+        TcManager.getInstance().getTcAccessController().setRequiredReadPermissionStrings(graphUri,
+                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
+        //new FilePermission("/etc", "write").toString()));
+        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
+        System.out.print(ag.toString());
+        TcManager.getInstance().createGraph(graphUri);
+    }
+
+    @Test
+    public void testCustomReadWritePermissions() {
+        IRI graphUri = new IRI("http://example.org/read-write-custom");
+        TcManager.getInstance().getTcAccessController().setRequiredReadWritePermissionStrings(graphUri,
+                Collections.singletonList("(java.io.FilePermission \"/etc\" \"write\")"));
+        //new FilePermission("/etc", "write").toString()));
+        Graph ag = TcManager.getInstance().getGraph(new IRI("urn:x-localinstance:/graph-access.graph"));
+        System.out.print(ag.toString());
+        TcManager.getInstance().createGraph(graphUri);
+    }
+    
+    @Test(expected=EntityAlreadyExistsException.class)
+    public void testCreateMGraph() {
+        TcManager.getInstance().createGraph(new IRI("http://example.org/ImmutableGraph/alreadyexists"));
+    }
+    @Test(expected=AccessControlException.class)
+    public void testCreateMGraphWithoutWritePermission() {
+        TcManager.getInstance().createGraph(new IRI("http://example.org/read/ImmutableGraph"));
+    }
+    @Test(expected=ReadOnlyException.class)
+    public void testAddTripleToMGraph() {
+        Graph graph = TcManager.getInstance().getMGraph(new IRI("http://example.org/read/ImmutableGraph"));
+        Triple triple = new TripleImpl(
+                new IRI("http://example.org/definition/isNonLiteral"),
+                new IRI("http://example.org/definition/isTest"),
+                new PlainLiteralImpl("test"));
+        graph.add(triple);
+    }
+}
\ No newline at end of file
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/TcManagerTest.java b/dataset/src/test/java/org/apache/clerezza/dataset/TcManagerTest.java
new file mode 100644
index 0000000..619e86a
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/TcManagerTest.java
@@ -0,0 +1,299 @@
+/*
+ * 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.dataset;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
+import org.apache.clerezza.dataset.providers.WeightedA;
+import org.apache.clerezza.dataset.providers.WeightedA1;
+import org.apache.clerezza.dataset.providers.WeightedAHeavy;
+import org.apache.clerezza.dataset.providers.WeightedBlight;
+import org.apache.clerezza.sparql.NoQueryEngineException;
+import org.apache.clerezza.sparql.QueryEngine;
+import org.apache.clerezza.sparql.query.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.lang.reflect.Field;
+import java.util.Iterator;
+
+import static org.junit.Assert.*;
+
+/**
+ * 
+ * @author reto
+ */
+public class TcManagerTest {
+
+	public static IRI uriRefAHeavy = new IRI("http://example.org/aHeavy");
+	public static IRI uriRefB = new IRI("http://example.org/b");;
+	public static final IRI uriRefA = new IRI("http://example.org/a");
+	public static final IRI uriRefA1 = new IRI("http://example.org/a1");
+	private TcManager graphAccess;
+	private QueryEngine queryEngine;
+	private final WeightedA weightedA = new WeightedA();
+	private final WeightedA1 weightedA1 = new WeightedA1();
+	private WeightedTcProvider weightedBlight = new WeightedBlight();
+
+	@Before
+	public void setUp() {
+		graphAccess = TcManager.getInstance();
+		graphAccess.bindWeightedTcProvider(weightedA);
+		graphAccess.bindWeightedTcProvider(weightedA1);
+		graphAccess.bindWeightedTcProvider(weightedBlight);
+
+		queryEngine = Mockito.mock(QueryEngine.class);
+	}
+
+	@After
+	public void tearDown() {
+		graphAccess = TcManager.getInstance();
+		graphAccess.unbindWeightedTcProvider(weightedA);
+		graphAccess.unbindWeightedTcProvider(weightedA1);
+		graphAccess.unbindWeightedTcProvider(weightedBlight);
+
+		queryEngine = null;
+	}
+
+	@Test
+	public void getGraphFromA() {
+		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
+		Iterator<Triple> iterator = graphA.iterator();
+		assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
+		assertFalse(iterator.hasNext());
+		Graph triplesA = graphAccess.getGraph(uriRefA);
+		iterator = triplesA.iterator();
+		assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
+		assertFalse(iterator.hasNext());
+	}
+
+	@Test
+	public void getGraphFromB() {
+		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefB);
+		Iterator<Triple> iterator = graphA.iterator();
+		assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+		assertFalse(iterator.hasNext());
+		Graph triplesA = graphAccess.getGraph(uriRefB);
+		iterator = triplesA.iterator();
+		assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
+		assertFalse(iterator.hasNext());
+	}
+
+	@Test
+	public void getGraphFromAAfterUnbinding() {
+		graphAccess.unbindWeightedTcProvider(weightedA);
+		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
+		Iterator<Triple> iterator = graphA.iterator();
+		assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1),
+				iterator.next());
+		assertFalse(iterator.hasNext());
+		Graph triplesA = graphAccess.getGraph(uriRefA);
+		iterator = triplesA.iterator();
+		assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1),
+				iterator.next());
+		assertFalse(iterator.hasNext());
+	}
+
+	@Test
+	public void getGraphFromAWithHeavy() {
+		final WeightedAHeavy weightedAHeavy = new WeightedAHeavy();
+		graphAccess.bindWeightedTcProvider(weightedAHeavy);
+		ImmutableGraph graphA = graphAccess.getImmutableGraph(uriRefA);
+		Iterator<Triple> iterator = graphA.iterator();
+		assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy),
+				iterator.next());
+		assertFalse(iterator.hasNext());
+		Graph triplesA = graphAccess.getGraph(uriRefA);
+		iterator = triplesA.iterator();
+		assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy),
+				iterator.next());
+		assertFalse(iterator.hasNext());
+		graphAccess.unbindWeightedTcProvider(weightedAHeavy);
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithString() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess.executeSparqlQuery("", new SimpleMGraph());
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess.executeSparqlQuery((Query) null, new SimpleMGraph());
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithSelectQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess.executeSparqlQuery((SelectQuery) null, new SimpleMGraph());
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithAskQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess.executeSparqlQuery((AskQuery) null, new SimpleMGraph());
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithDescribeQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess
+				.executeSparqlQuery((DescribeQuery) null, new SimpleMGraph());
+	}
+
+	@Test(expected = NoQueryEngineException.class)
+	public void executeSparqlQueryNoEngineWithConstructQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(null);
+
+		// Execute
+		graphAccess.executeSparqlQuery((ConstructQuery) null,
+				new SimpleMGraph());
+	}
+
+	@Test
+	public void executeSparqlQueryWithEngineWithString() throws Exception {
+		// Prepare
+		injectQueryEngine(queryEngine);
+		Graph Graph = new SimpleMGraph();
+
+		// Execute
+		graphAccess.executeSparqlQuery("", Graph);
+
+		// Verify
+		Mockito.verify(queryEngine).execute(graphAccess, Graph, "");
+//		Mockito.verify(queryEngine, Mockito.never()).execute(
+//				(TcManager) Mockito.anyObject(),
+//				(Graph) Mockito.anyObject(),
+//				Mockito.anyString());
+	}
+
+	@Test
+	public void executeSparqlQueryWithEngineWithSelectQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(queryEngine);
+		Graph Graph = new SimpleMGraph();
+		SelectQuery query = Mockito.mock(SelectQuery.class);
+
+		// Execute
+		graphAccess.executeSparqlQuery(query, Graph);
+
+		// Verify
+		Mockito.verify(queryEngine).execute(graphAccess, Graph,
+				query.toString());
+//		Mockito.verify(queryEngine, Mockito.never()).execute(
+//				(TcManager) Mockito.anyObject(),
+//				(Graph) Mockito.anyObject(), Mockito.anyString());
+	}
+
+	@Test
+	public void executeSparqlQueryWithEngineWithAskQuery() throws Exception {
+		// Prepare
+		injectQueryEngine(queryEngine);
+		Graph Graph = new SimpleMGraph();
+		AskQuery query = Mockito.mock(AskQuery.class);
+
+		Mockito.when(
+				queryEngine.execute((TcManager) Mockito.anyObject(),
+						(Graph) Mockito.anyObject(),
+						Mockito.anyString())).thenReturn(Boolean.TRUE);
+
+		// Execute
+		graphAccess.executeSparqlQuery(query, Graph);
+
+		// Verify
+		Mockito.verify(queryEngine).execute(graphAccess, Graph,
+				query.toString());
+//		Mockito.verify(queryEngine, Mockito.never()).execute(
+//				(TcManager) Mockito.anyObject(),
+//				(Graph) Mockito.anyObject(), Mockito.anyString());
+	}
+
+	@Test
+	public void executeSparqlQueryWithEngineWithDescribeQuery()
+			throws Exception {
+		// Prepare
+		injectQueryEngine(queryEngine);
+		Graph Graph = new SimpleMGraph();
+		DescribeQuery query = Mockito.mock(DescribeQuery.class);
+
+		// Execute
+		graphAccess.executeSparqlQuery(query, Graph);
+
+		// Verify
+		Mockito.verify(queryEngine).execute(graphAccess, Graph,
+				query.toString());
+//		Mockito.verify(queryEngine, Mockito.never()).execute(
+//				(TcManager) Mockito.anyObject(),
+//				(Graph) Mockito.anyObject(), Mockito.anyString());
+	}
+
+	@Test
+	public void executeSparqlQueryWithEngineWithConstructQuery()
+			throws Exception {
+		// Prepare
+		injectQueryEngine(queryEngine);
+		Graph Graph = new SimpleMGraph();
+		ConstructQuery query = Mockito.mock(ConstructQuery.class);
+
+		// Execute
+		graphAccess.executeSparqlQuery(query, Graph);
+
+		// Verify
+		Mockito.verify(queryEngine).execute(graphAccess, Graph,
+				query.toString());
+//		Mockito.verify(queryEngine, Mockito.never()).execute(
+//				(TcManager) Mockito.anyObject(),
+//				(Graph) Mockito.anyObject(), Mockito.anyString());
+	}
+
+	// ------------------------------------------------------------------------
+	// Implementing QueryableTcProvider
+	// ------------------------------------------------------------------------
+
+	private void injectQueryEngine(QueryEngine engine)
+			throws NoSuchFieldException, IllegalAccessException {
+		Field queryEngineField = TcManager.class
+				.getDeclaredField("queryEngine");
+		queryEngineField.setAccessible(true);
+		queryEngineField.set(graphAccess, engine);
+	}
+}
\ No newline at end of file
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA.java b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA.java
new file mode 100644
index 0000000..76b6f36
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA.java
@@ -0,0 +1,103 @@
+/*
+ * 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.dataset.providers;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
+import org.apache.clerezza.dataset.EntityUndeletableException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManagerTest;
+import org.apache.clerezza.dataset.WeightedTcProvider;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author reto
+ */
+public class WeightedA implements WeightedTcProvider {
+    private Set<IRI> mGraphList = new HashSet<IRI>();
+    @Override
+    public int getWeight() {
+        return 5;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        if (name.equals(TcManagerTest.uriRefA)) {
+            Graph mResult = new SimpleMGraph();
+            mResult.add(new TripleImpl(TcManagerTest.uriRefA, 
+                    TcManagerTest.uriRefA, TcManagerTest.uriRefA));
+            mGraphList.add(name);
+            return mResult.getImmutableGraph();
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name) throws NoSuchEntityException {
+        return getImmutableGraph(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteGraph(IRI name) throws NoSuchEntityException, 
+            EntityUndeletableException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        return Collections.singleton(TcManagerTest.uriRefA);
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        return mGraphList;
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        return listGraphs();
+    }
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA1.java b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA1.java
new file mode 100644
index 0000000..effd599
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedA1.java
@@ -0,0 +1,103 @@
+/*
+ * 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.dataset.providers;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
+import org.apache.clerezza.dataset.EntityUndeletableException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManagerTest;
+import org.apache.clerezza.dataset.WeightedTcProvider;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Same weight as WeightedA, but later in string-ordering
+ *
+ * @author reto
+ */
+public class WeightedA1 implements WeightedTcProvider {
+    private Set<IRI> mGraphList = new HashSet<IRI>();
+    @Override
+    public int getWeight() {
+        return 5;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        if (name.equals(TcManagerTest.uriRefA)) {
+            Graph mResult = new SimpleMGraph();
+            mResult.add(new TripleImpl(TcManagerTest.uriRefA1, 
+                    TcManagerTest.uriRefA1, TcManagerTest.uriRefA1));
+            mGraphList.add(name);
+            return mResult.getImmutableGraph();
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name) throws NoSuchEntityException {
+        return getImmutableGraph(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteGraph(IRI name) throws NoSuchEntityException, 
+            EntityUndeletableException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        return mGraphList;
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        return listMGraphs();
+    }
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedAHeavy.java b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedAHeavy.java
new file mode 100644
index 0000000..3cc1421
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedAHeavy.java
@@ -0,0 +1,101 @@
+/*
+ * 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.dataset.providers;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.dataset.EntityUndeletableException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManagerTest;
+import org.apache.clerezza.dataset.WeightedTcProvider;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author reto
+ */
+public class WeightedAHeavy implements WeightedTcProvider {
+
+    @Override
+    public int getWeight() {
+        return 20;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        if (name.equals(TcManagerTest.uriRefA)) {
+            Graph mResult = new SimpleGraph();
+            mResult.add(new TripleImpl(TcManagerTest.uriRefAHeavy, 
+                    TcManagerTest.uriRefAHeavy, TcManagerTest.uriRefAHeavy));
+            return mResult.getImmutableGraph();
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name) throws NoSuchEntityException {
+        return getImmutableGraph(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteGraph(IRI name) throws NoSuchEntityException, 
+            EntityUndeletableException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+    @Override
+    public Set<IRI> listGraphs() {
+        return Collections.singleton(TcManagerTest.uriRefA);
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        return new HashSet<IRI>();
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        return listGraphs();
+    }
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedBlight.java b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedBlight.java
new file mode 100644
index 0000000..161599b
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedBlight.java
@@ -0,0 +1,106 @@
+/*
+ * 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.dataset.providers;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.TripleImpl;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
+import org.apache.clerezza.dataset.EntityUndeletableException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.TcManagerTest;
+import org.apache.clerezza.dataset.WeightedTcProvider;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author reto
+ */
+public class WeightedBlight implements WeightedTcProvider {
+
+    @Override
+    public int getWeight() {
+        return 2;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        if (name.equals(TcManagerTest.uriRefB)) {
+            Graph mResult = new SimpleMGraph();
+            mResult.add(new TripleImpl(TcManagerTest.uriRefB, TcManagerTest.uriRefB, TcManagerTest.uriRefB));
+            return mResult.getImmutableGraph();
+        }
+        if (name.equals(TcManagerTest.uriRefA)) {
+            Graph mResult = new SimpleMGraph();
+            //empty ImmutableGraph
+            return mResult.getImmutableGraph();
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getGraph(IRI name) throws NoSuchEntityException {
+        return getImmutableGraph(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteGraph(IRI name) throws NoSuchEntityException, 
+            EntityUndeletableException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        return new HashSet<IRI>();
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        return listMGraphs();
+    }
+
+}
diff --git a/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedDummy.java b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedDummy.java
new file mode 100644
index 0000000..44ace0e
--- /dev/null
+++ b/dataset/src/test/java/org/apache/clerezza/dataset/providers/WeightedDummy.java
@@ -0,0 +1,155 @@
+/*
+ * 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.dataset.providers;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.graph.SimpleImmutableGraph;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
+import org.apache.clerezza.dataset.EntityAlreadyExistsException;
+import org.apache.clerezza.dataset.EntityUndeletableException;
+import org.apache.clerezza.dataset.NoSuchEntityException;
+import org.apache.clerezza.dataset.WeightedTcProvider;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author mir
+ */
+public class WeightedDummy implements WeightedTcProvider {
+
+    private Map<IRI, Graph> tripleMap = new HashMap<IRI, Graph>();
+
+    @Override
+    public ImmutableGraph createImmutableGraph(IRI name, Graph triples)
+            throws EntityAlreadyExistsException {
+        if ((name == null) || (name.getUnicodeString() == null)
+                || (name.getUnicodeString().trim().length() == 0)) {
+            throw new IllegalArgumentException("Name must not be null");
+        }
+
+        try {
+            // throws NoSuchEntityException if a Graph with that name
+            // already exists
+            this.getGraph(name);
+        } catch (NoSuchEntityException e) {
+            ImmutableGraph result;
+            if (ImmutableGraph.class.isAssignableFrom(triples.getClass())) {
+                result = (ImmutableGraph) triples;
+            } else {
+                result = new SimpleImmutableGraph(triples);
+            }
+            tripleMap.put(name, result);
+
+            return result;
+        }
+        throw new EntityAlreadyExistsException(name);
+    }
+
+    @Override
+    public Graph createGraph(IRI name) throws EntityAlreadyExistsException {
+        if ((name == null) || (name.getUnicodeString() == null)
+                || (name.getUnicodeString().trim().length() == 0)) {
+            throw new IllegalArgumentException("Name must not be null");
+        }
+
+        try {
+            // throws NoSuchEntityException if a Graph with that name
+            // already exists
+            this.getGraph(name);
+        } catch (NoSuchEntityException e) {
+            Graph result = new SimpleMGraph();
+            tripleMap.put(name, result);
+            return result;
+        }
+        throw new EntityAlreadyExistsException(name);
+    }
+
+    @Override
+    public void deleteGraph(IRI name)
+            throws NoSuchEntityException, EntityUndeletableException {
+        if (tripleMap.remove(name) == null) {
+            throw new NoSuchEntityException(name);
+        }
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
+        Graph Graph = tripleMap.get(name);
+        if (Graph == null) {
+            throw new NoSuchEntityException(name);
+        } else if (ImmutableGraph.class.isAssignableFrom(Graph.getClass())) {
+            return (ImmutableGraph) Graph;
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Graph getMGraph(IRI name) throws NoSuchEntityException {
+        Graph Graph = tripleMap.get(name);
+        if (Graph == null) {
+            throw new NoSuchEntityException(name);
+        } else if (Graph.class.isAssignableFrom(Graph.getClass())) {
+            return (Graph) Graph;
+        }
+        throw new NoSuchEntityException(name);
+    }
+
+    @Override
+    public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
+        throw new UnsupportedOperationException(
+                "Not supported yet. equals() has to be implemented first");
+    }
+
+    @Override
+    public Graph getGraph(IRI name)
+            throws NoSuchEntityException {
+        Graph Graph = tripleMap.get(name);
+        if (Graph == null) {
+            throw new NoSuchEntityException(name);
+        } else {
+            return Graph;
+        }
+    }
+
+    @Override
+    public int getWeight() {
+        return 1;
+    }
+
+    @Override
+    public Set<IRI> listImmutableGraphs() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Set<IRI> listMGraphs() {
+        return new HashSet<IRI>();
+    }
+
+    @Override
+    public Set<IRI> listGraphs() {
+        return listMGraphs();
+    }
+}


[clerezza] 36/45: CLEREZZA-1039: Remove website bundle

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 54e79ae19cf6ab5fc39aa4d189df6397e7381aa4
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 20:43:24 2019 +0100

    CLEREZZA-1039: Remove website bundle
---
 site/deploy.sh                                     |   9 -
 site/graph.nt                                      | 798 ---------------------
 site/pom.xml                                       | 109 ---
 site/readme.txt                                    |  13 -
 .../web-resources/architecture/images/image001.png | Bin 118873 -> 0 bytes
 .../web-resources/architecture/images/image003.png | Bin 60454 -> 0 bytes
 .../web-resources/architecture/images/image005.png | Bin 27808 -> 0 bytes
 .../web-resources/architecture/images/image007.png | Bin 66064 -> 0 bytes
 .../web-resources/architecture/images/image009.png | Bin 65568 -> 0 bytes
 .../web-resources/architecture/images/image011.png | Bin 86094 -> 0 bytes
 .../web-resources/architecture/images/image013.png | Bin 74533 -> 0 bytes
 .../web-resources/architecture/images/image015.png | Bin 70422 -> 0 bytes
 .../web-resources/architecture/images/image017.png | Bin 77195 -> 0 bytes
 .../web-resources/architecture/images/image019.png | Bin 117948 -> 0 bytes
 .../web-resources/architecture/images/image021.png | Bin 13442 -> 0 bytes
 .../web-resources/architecture/index.html          | 448 ------------
 .../CLEREZZA-INF/web-resources/images/feather.png  | Bin 16890 -> 0 bytes
 .../web-resources/images/footer-logo.png           | Bin 6539 -> 0 bytes
 .../CLEREZZA-INF/web-resources/images/logo.png     | Bin 5834 -> 0 bytes
 .../web-resources/images/sw-vert-w3c.png           | Bin 5979 -> 0 bytes
 .../web-resources/mailinglists/index.html          | 123 ----
 .../style/fonts/TitilliumText25L001.otf            | Bin 52736 -> 0 bytes
 .../style/fonts/TitilliumText25L003.otf            | Bin 52064 -> 0 bytes
 .../web-resources/style/fonts/TitilliumTitle20.otf | Bin 41144 -> 0 bytes
 .../web-resources/style/images/bg-bar.png          | Bin 199 -> 0 bytes
 .../web-resources/style/images/bg-divider.gif      | Bin 63 -> 0 bytes
 .../web-resources/style/images/icn-note.jpg        | Bin 1636 -> 0 bytes
 .../web-resources/style/images/logo-big.png        | Bin 5834 -> 0 bytes
 .../CLEREZZA-INF/web-resources/style/style.css     | 431 -----------
 .../CLEREZZA-INF/web-resources/thanks/index.html   | 100 ---
 site/src/main/scala/Activator.scala                |  91 ---
 site/src/main/scala/GlobalMenuRenderlet.scala      |  76 --
 site/src/main/scala/HeadedPageRenderlet.scala      | 129 ----
 site/src/main/scala/Ontology.scala                 |  12 -
 site/src/main/scala/TitledContentRenderlet.scala   | 139 ----
 site/troubleshooting.txt                           |  27 -
 36 files changed, 2505 deletions(-)

diff --git a/site/deploy.sh b/site/deploy.sh
deleted file mode 100644
index 45275be..0000000
--- a/site/deploy.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-svn co https://svn.apache.org/repos/asf/clerezza/site/production/ /tmp/site-production
-curl -u admin:admin "http://localhost:8080/admin/offline/download?baseUri=http://localhost:8080/&targetUri=http://clerezza.apache.org/&formatExtension=xhtml&formatExtension=rdf&formatExtension=png&formatExtension=html&formatExtension=js&formatExtension=jpeg&formatExtension=css"  > /tmp/site-production.zip
-cd ..
-mvn javadoc:aggregate
-cp -r ./target/site/apidocs /tmp/site-production/
-unzip -o /tmp/site-production.zip -d /tmp/site-production
-cd /tmp/site-production 
-svn add * --force
-svn commit -m "Auto commit by site deploy script" .
diff --git a/site/graph.nt b/site/graph.nt
deleted file mode 100644
index e7d1ab4..0000000
--- a/site/graph.nt
+++ /dev/null
@@ -1,798 +0,0 @@
-<http://localhost:8080/> <http://clerezza.org/2009/09/hierarchy#members> _:2d7f383e72651f1469e7dd5b4e9f08701 . 
-<http://localhost:8080/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/clerezza-uima/index-content-el/0> <http://discobits.org/ontology#infoBit> "<h3 xmlns=\"http://www.w3.org/1999/xhtml\">Introduction to Clerezza-UIMA integration</h3>\n<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://uima.apache.org\" target=\"_blank\">UIMA</a> is an <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=uima\" target=\"_blank\">OASIS</a> standard that allows the definition of analysis pipel [...]
-<http://localhost:8080/clerezza-uima/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/clerezza-uima/index-content-el/1> <http://discobits.org/ontology#infoBit> "<h3 xmlns=\"http://www.w3.org/1999/xhtml\">Clerezza-UIMA modules</h3>\n<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n  <li><b>uima.ontologies</b><div>an ontology, and the generated Java source code, for defining the UIMA CAS model classes.</div></li>\n  <li><b>uima.utils</b><div>base module which allows the usage of UIMA inside Clerezza.<br></br> It defines the way UIMA framework classes are  [...]
-<http://localhost:8080/clerezza-uima/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/clerezza-uima/index-content-el/2> <http://discobits.org/ontology#infoBit> "<h3 xmlns=\"http://www.w3.org/1999/xhtml\">Getting started</h3>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/clerezza-uima/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/clerezza-uima/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/clerezza-uima/index-content> <http://discobits.org/ontology#contains> _:0ce57d802fe1a2b2e7d8c85b21b365ac1 . 
-<http://localhost:8080/clerezza-uima/index-content> <http://discobits.org/ontology#contains> _:16102482a7b1bba35d2b4afbec13b0691 . 
-<http://localhost:8080/clerezza-uima/index-content> <http://discobits.org/ontology#contains> _:984ac2843763e208c2c2b990a6580fc81 . 
-<http://localhost:8080/clerezza-uima/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/clerezza-uima/index-title> <http://discobits.org/ontology#infoBit> "Clerezza integration with Apache UIMA"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/clerezza-uima/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/clerezza-uima/index> <http://discobits.org/ontology#contains> _:59e83e28db0053b861c9b0f671d4f21d1 . 
-<http://localhost:8080/clerezza-uima/index> <http://discobits.org/ontology#contains> _:982764bbd875cfb97ff34aced0f6549f1 . 
-<http://localhost:8080/clerezza-uima/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/content-el/0> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"column one-column\">\n\t\t\t\tClerezza is a service platform based on OSGi (Open Services Gateway initiative) which provides a set of functionality for management of semantically linked data accessible through RESTful Web Services and in a secured way.\n\t\t\t\tFurthermore, Clerezza allows to easily develop semantic web applications by providing tools to manip [...]
-<http://localhost:8080/content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/1-content-el/0> <http://discobits.org/ontology#infoBit> "Apache Clerezza allows to easily develop semantic web application by providing the following:<ul xmlns=\"http://www.w3.org/1999/xhtml\"><li>An API to access RDF Graphs</li><li>A Jax RS implementation</li><li>TypeHandlers: Jax-RS resources bound to an RDF type</li><li>Renderlets to create various represenattions from RDF resources, ScalaServerPages allow to easily write renderlets in Scala</li></ul> [...]
-<http://localhost:8080/content-el/1-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/1> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"column first-column\">\n\t\t\t\t<h2>Apache Clerezza in <strong>5 Bullet Points</strong></h2>\n\n\t\t\t\t<ul>\n\t\t\t\t\t<li><div>OSGi-based Platform</div></li>\n\t\t\t\t\t<li><div>RESTful Web Service Framework</div> </li>\n\t\t\t\t\t<li><div>Based on W3C Standard</div></li>\n\t\t\t\t\t<li><div>Database/Triple Store independent</div></li>\n\t\t\t\t\t<li><div>Sc [...]
-<http://localhost:8080/content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2-content-el/0> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\">Clerezza documentation is available on every clerezza instance for the active bundles at http://host:port/documentation, a copy is also available on this server: <a href=\"/documentation\">documentation</a></div>\n<div xmlns=\"http://www.w3.org/1999/xhtml\">Maven generated site: <a href=\"http://incubator.apache.org/clerezza/mvn-site\">http://incubator.ap [...]
-<http://localhost:8080/content-el/2-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2-content-el/1> <http://discobits.org/ontology#infoBit> "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"getting-started/\">Getting-Started</a>: A mini howto describing the compilation process and how to install a mini application"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/2-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2-content-el/2> <http://discobits.org/ontology#infoBit> "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"getting-started/shell/\">The Clerezza Shell</a>: An introduction to the Clerezza Shell"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/2-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2-content-el/3> <http://discobits.org/ontology#infoBit> "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"faq/\">FAQ</a>: Frequently asked question"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/2-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2-content> <http://discobits.org/ontology#contains> _:284ee1e895fd9ee9eb6361502439e04e1 . 
-<http://localhost:8080/content-el/2-content> <http://discobits.org/ontology#contains> _:4a0bbb095bdef313e8a2043ab94cd9971 . 
-<http://localhost:8080/content-el/2-content> <http://discobits.org/ontology#contains> _:56657a685a5b50b4e9508972931f7d9e1 . 
-<http://localhost:8080/content-el/2-content> <http://discobits.org/ontology#contains> _:de65fbe4beaab5a9e72c1b60c0dd13061 . 
-<http://localhost:8080/content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/content-el/2-title> <http://discobits.org/ontology#infoBit> "Documentation"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/2> <http://discobits.org/ontology#contains> _:acde0a583c16c0e2e7c2c46249c1cfbd1 . 
-<http://localhost:8080/content-el/2> <http://discobits.org/ontology#contains> _:c9f0cce906793436372a626d1a86dfa71 . 
-<http://localhost:8080/content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/content-el/3-content-el/0> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\">\nSubversion:  <a href=\"http://svn.apache.org/repos/asf/incubator/clerezza/\">http://svn.apache.org/repos/asf/incubator/clerezza/</a></div>\n<div xmlns=\"http://www.w3.org/1999/xhtml\">Clerezza proposal: <a href=\"http://wiki.apache.org/incubator/ClerezzaProposal\">http://wiki.apache.org/incubator/ClerezzaProposal</a></div>\n<div xmlns=\"http://www.w3.or [...]
-<http://localhost:8080/content-el/3-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/3-content> <http://discobits.org/ontology#contains> _:46f25a5b95c8a2141ea759b8180901041 . 
-<http://localhost:8080/content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/content-el/3-title> <http://discobits.org/ontology#infoBit> "Resources"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content-el/3> <http://discobits.org/ontology#contains> _:5ca21ef6ed2b0a61f84092d5acb069b21 . 
-<http://localhost:8080/content-el/3> <http://discobits.org/ontology#contains> _:5f205ab6f8dae0da9465dbd58ad68d221 . 
-<http://localhost:8080/content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/content-el/4> <http://discobits.org/ontology#infoBit> "<img xmlns=\"http://www.w3.org/1999/xhtml\" src=\"/images/sw-horz-w3c.png\"></img>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/content> <http://discobits.org/ontology#contains> _:2d2dd4da955307c130d124580f49a8be1 . 
-<http://localhost:8080/content> <http://discobits.org/ontology#contains> _:59617143e7ff5639ed7da28f51395da41 . 
-<http://localhost:8080/content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/contributing/index-content-el/0> <http://discobits.org/ontology#infoBit> "There are many ways to contribute to Apache Clerezza. This page is on <em xmlns=\"http://www.w3.org/1999/xhtml\">how</em> to contribute - for ideas on <em xmlns=\"http://www.w3.org/1999/xhtml\">what</em> you could contribute look for open issues in the <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://issues.apache.org/jira/browse/CLEREZZA\">issue tracker</a> or ask on the <a xmlns=\"ht [...]
-<http://localhost:8080/contributing/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/1-content> <http://discobits.org/ontology#infoBit> "If you find something that could be better or have a question on how something works post an issue (feature request, bug or question) in <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"ttp://issues.apache.org/jira/browse/CLEREZZA\">jira</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/1-title> <http://discobits.org/ontology#infoBit> "Open issues"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/1> <http://discobits.org/ontology#contains> _:2bbeb8a2ee0a04b74a96953d1a8a49371 . 
-<http://localhost:8080/contributing/index-content-el/1> <http://discobits.org/ontology#contains> _:7beb1dfa3466a988f3dceeff4c952d2e1 . 
-<http://localhost:8080/contributing/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/contributing/index-content-el/2-content> <http://discobits.org/ontology#infoBit> "Use the  <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://localhost:8080/mailinglists/\">mailing list</a> to discuss the future development of Clerezza, new ideas that aren't concrete enough to open issues or how Clerreza might be used for different use cases."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/2-title> <http://discobits.org/ontology#infoBit> "Discuss"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/2> <http://discobits.org/ontology#contains> _:43e99d3cb314092f00939e93755b7d071 . 
-<http://localhost:8080/contributing/index-content-el/2> <http://discobits.org/ontology#contains> _:f075d27152b68f372d949d51265439171 . 
-<http://localhost:8080/contributing/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/0> <http://discobits.org/ontology#infoBit> "The Clerezza codebase as well as the documentation and webiste grow patch by patch, every patch is associated to an issue. Patches can be added to trunk either following a Rewiev-Then-Commit or a Commit-Then-Review process. If you're not (yet) a committer  you should attach your patch to an issue and then either:<br xmlns=\"http://www.w3.org/1999/xhtml\"></br>\n<ul xmlns=\"http:/ [...]
-<http://localhost:8080/contributing/index-content-el/3-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/1-content> <http://discobits.org/ontology#infoBit> "A draft for coding guidelines is attached to issue CLEREZZA-435. A quick summary: CamelCase and use tabs for indentation."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/1-title> <http://discobits.org/ontology#infoBit> "Coding Guidelines"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/3-content-el/1> <http://discobits.org/ontology#contains> _:ee606632a8855c6a5279125200f5e6f11 . 
-<http://localhost:8080/contributing/index-content-el/3-content-el/1> <http://discobits.org/ontology#contains> _:fff3bde7c78fa045bd406417e0b7aef01 . 
-<http://localhost:8080/contributing/index-content-el/3-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/contributing/index-content-el/3-content> <http://discobits.org/ontology#contains> _:06631a3c3ad09806971115c4dcd65f601 . 
-<http://localhost:8080/contributing/index-content-el/3-content> <http://discobits.org/ontology#contains> _:bbca97c81d87e772ec12d55a1c9696f41 . 
-<http://localhost:8080/contributing/index-content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/contributing/index-content-el/3-title> <http://discobits.org/ontology#infoBit> "Contribute Patches"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/3> <http://discobits.org/ontology#contains> _:23c44138f71e0bf15391a46a9dad20cc1 . 
-<http://localhost:8080/contributing/index-content-el/3> <http://discobits.org/ontology#contains> _:65ff20a77d0e2e553d34e864c53f39951 . 
-<http://localhost:8080/contributing/index-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/contributing/index-content-el/4-content-el/0> <http://discobits.org/ontology#infoBit> "If you are a Clerezza committer your votes are binding and you can veto any code modification with a qualified -1, see the <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://www.apache.org/foundation/voting.html\">Apache Voting Process</a> for more information."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/4-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/4-content-el/1> <http://discobits.org/ontology#infoBit> "As the name suggests a committer has the right to commit changes to the repository. You may commit other people's as well as your own patches to trunk. You must only commit changes to trunk if these commits yield to an issue being closable and in the case that there has been no previous vote on the committed patch if you're ready to remove these commits in the event that they are [...]
-<http://localhost:8080/contributing/index-content-el/4-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/4-content-el/2> <http://discobits.org/ontology#infoBit> "As a committer you may also create issue branches which allows you to commit unfinished work to the repository and others to comment on it. if you want to discuss a patch or ask for a vote on it instead of attaching it to the issue you would typically point to the issue branch in <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"https://svn.apache.org/repos/asf/incubator/clerezza/ [...]
-<http://localhost:8080/contributing/index-content-el/4-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/4-content> <http://discobits.org/ontology#contains> _:186d4b4c53a1b799e755a4157bb133761 . 
-<http://localhost:8080/contributing/index-content-el/4-content> <http://discobits.org/ontology#contains> _:d042d1d55af2ac4b1e33c549b19b0cb81 . 
-<http://localhost:8080/contributing/index-content-el/4-content> <http://discobits.org/ontology#contains> _:e7b8957e2775fdbf90c5e5f6546969ef1 . 
-<http://localhost:8080/contributing/index-content-el/4-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/contributing/index-content-el/4-title> <http://discobits.org/ontology#infoBit> "Being a committer"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-content-el/4-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index-content-el/4> <http://discobits.org/ontology#contains> _:541d0348ba0a7acc9c8d11e3e348ab461 . 
-<http://localhost:8080/contributing/index-content-el/4> <http://discobits.org/ontology#contains> _:64709c684417ad8f092a63d4a06246cc1 . 
-<http://localhost:8080/contributing/index-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/contributing/index-content> <http://discobits.org/ontology#contains> _:3f651929743c97efcbc6abbeda3623601 . 
-<http://localhost:8080/contributing/index-content> <http://discobits.org/ontology#contains> _:b252ece001f146a1fc39cae6070dd1851 . 
-<http://localhost:8080/contributing/index-content> <http://discobits.org/ontology#contains> _:c1dc85b0112c14341800aa7fd5dc20f31 . 
-<http://localhost:8080/contributing/index-content> <http://discobits.org/ontology#contains> _:d6945d42f50336830304f1cc1f354cba1 . 
-<http://localhost:8080/contributing/index-content> <http://discobits.org/ontology#contains> _:dcb2b3e0ce07662a025622647c0a73821 . 
-<http://localhost:8080/contributing/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/contributing/index-title> <http://discobits.org/ontology#infoBit> "Contributing to Apache Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/contributing/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/contributing/index> <http://discobits.org/ontology#contains> _:56a811b868af8d68b333b10aa1ead9341 . 
-<http://localhost:8080/contributing/index> <http://discobits.org/ontology#contains> _:de277ab31392b4cc18815136ff0cda6c1 . 
-<http://localhost:8080/contributing/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/documentation/> <http://discobits.org/ontology#contains> _:994e3a90913f6cd82b0dac3e0be8be1e1 . 
-<http://localhost:8080/documentation/> <http://discobits.org/ontology#contains> _:c5438bf3ae898ce833947f48e69d90671 . 
-<http://localhost:8080/documentation/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/downloads/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/downloads/index-content-el/0> <http://discobits.org/ontology#infoBit> "<h2 xmlns=\"http://www.w3.org/1999/xhtml\">Releases</h2>\n<p xmlns=\"http://www.w3.org/1999/xhtml\"><br /><br />\n<table>\n<tbody><tr><th>Artifact</th><th>Description</th><th>Release Date</th><th>Download</th></tr>\n<tr><td>partial-release-201604</td><td>This is a bug-fix release that fixes the wrong handling of literals with language in stable-serializer as well as in jena bindings, it also upd [...]
-<http://localhost:8080/downloads/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/1-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n</p>\n<p xmlns=\"http://www.w3.org/1999/xhtml\">\nYou should verify the MD5 checksums of your downloaded archives. \n<br /><br />\nAll Apache Clerezza releases are signed. To verify the signature of a release, you have to download the project's <a href=\"https://www.apache.org/dist/clerezza/KEYS\" target=\"_blank\">GPG keys</a>.\n</p>"^^<http:/ [...]
-<http://localhost:8080/downloads/index-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/1-title> <http://discobits.org/ontology#infoBit> "Verify your Downloads"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/1> <http://discobits.org/ontology#contains> _:246c0c7e11739e614851f1e1f88954441 . 
-<http://localhost:8080/downloads/index-content-el/1> <http://discobits.org/ontology#contains> _:b77acb57bb31a839ce66119fb42a95b91 . 
-<http://localhost:8080/downloads/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/downloads/index-content-el/2-content> <http://discobits.org/ontology#infoBit> "Refer to <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://clerezza.apache.org/getting-started/launching-clerezza/\" target=\"_blank\">Launching Clerezza</a> for instructions on how to run Apache Clerezza."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/2-title> <http://discobits.org/ontology#infoBit> "Running Apache Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/2> <http://discobits.org/ontology#contains> _:8459fd758df0744434e8c2ff3e8747dc1 . 
-<http://localhost:8080/downloads/index-content-el/2> <http://discobits.org/ontology#contains> _:860735efae6fe059b65df5c03cca14cf1 . 
-<http://localhost:8080/downloads/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/downloads/index-content-el/3-content> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">\n</p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/3-title> <http://discobits.org/ontology#infoBit> " "^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/3> <http://discobits.org/ontology#contains> _:5ab5851d567cc4f9e6f6ac745bcba1191 . 
-<http://localhost:8080/downloads/index-content-el/3> <http://discobits.org/ontology#contains> _:fd41a9a33df321423ea3a2426895a79f1 . 
-<http://localhost:8080/downloads/index-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/downloads/index-content-el/4-content> <http://discobits.org/ontology#infoBit> "All Clerezza packages and Source Code is distributed under the terms of <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://www.apache.org/licenses/\" target=\"_blank\">The Apache Software License (Version 2.0)</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/4-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/4-title> <http://discobits.org/ontology#infoBit> "License"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-content-el/4-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index-content-el/4> <http://discobits.org/ontology#contains> _:4ea7f6acb02829aacad39ed5a3868fcd1 . 
-<http://localhost:8080/downloads/index-content-el/4> <http://discobits.org/ontology#contains> _:65160e4b15d45b390530dc168b3e3b691 . 
-<http://localhost:8080/downloads/index-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/downloads/index-content> <http://discobits.org/ontology#contains> _:36e20e98fa2d5dbc2a7843dee1584cbc1 . 
-<http://localhost:8080/downloads/index-content> <http://discobits.org/ontology#contains> _:a77a59dc07ed94c3afa8e04b3703d67f1 . 
-<http://localhost:8080/downloads/index-content> <http://discobits.org/ontology#contains> _:c0d0f4af3c852dc4c4a3fba3388956cc1 . 
-<http://localhost:8080/downloads/index-content> <http://discobits.org/ontology#contains> _:f118e9aa30176ede03dc116eec5111f21 . 
-<http://localhost:8080/downloads/index-content> <http://discobits.org/ontology#contains> _:f22b9c9cf6b73dae2fbc2a78631d13901 . 
-<http://localhost:8080/downloads/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/downloads/index-title> <http://discobits.org/ontology#infoBit> "Downloads"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/downloads/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/downloads/index> <http://discobits.org/ontology#contains> _:c7d7927eb415a8f9f189ce3cec49a5d61 . 
-<http://localhost:8080/downloads/index> <http://discobits.org/ontology#contains> _:d6888fc15bb88aa0399eb959c52ae63b1 . 
-<http://localhost:8080/downloads/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/faq/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/faq/index-content-el/0-content> <http://discobits.org/ontology#infoBit> "On the login-page there is a \"Forgot password\" link, however this only works if the admin user is configured with an email address and an smtp-server is configured for Clerezza to send mails.<br xmlns=\"http://www.w3.org/1999/xhtml\"></br>\nYou can reset the password on the Clerezza shell (which is accessible without password on the console on which Clerezza is started) withe the following c [...]
-<http://localhost:8080/faq/index-content-el/0-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/0-title> <http://discobits.org/ontology#infoBit> "I've forgot my admin password, how do I reset it?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/faq/index-content-el/0-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/0> <http://discobits.org/ontology#contains> _:2aac827f39c2f65b17d1d1c2866a54481 . 
-<http://localhost:8080/faq/index-content-el/0> <http://discobits.org/ontology#contains> _:d7c313ad903897cd324c48efebc963491 . 
-<http://localhost:8080/faq/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/faq/index-content-el/1-content> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\">You can download a launcher from the <a href=\"https://repository.apache.org/content/groups/snapshots/org/apache/clerezza/platform.launcher.tdb/0.5-incubating-SNAPSHOT/\" target=\"_blank\">Maven Repository</a>, learn more <a href=\"../downloads/\">here</a>.</div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/faq/index-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/1-title> <http://discobits.org/ontology#infoBit> "Where can I download a launcher?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/faq/index-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/1> <http://discobits.org/ontology#contains> _:4f76fa605a704c3c5c1bd8507e086aa41 . 
-<http://localhost:8080/faq/index-content-el/1> <http://discobits.org/ontology#contains> _:736e21459b8803e302b9c556c64f181b1 . 
-<http://localhost:8080/faq/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/faq/index-content-el/2-content> <http://discobits.org/ontology#infoBit> "All MGraphs returned by TcManager are LockableMgraphs, this graphs are\nthread-safe independently on whether the underlying provider is\nthread-safe or not. Note however that like the synchronized\ncollections returned by java.util.Collections a\nConcurrentModificationException may occur when the TripleCollection is\nmodified while iterating over it. To be sure that no other thread may\ndo any [...]
-<http://localhost:8080/faq/index-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/2-title> <http://discobits.org/ontology#infoBit> "Is the RDF API thread-safe?"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/faq/index-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index-content-el/2> <http://discobits.org/ontology#contains> _:0a41bff217c602298a96bc11adc9ae2b1 . 
-<http://localhost:8080/faq/index-content-el/2> <http://discobits.org/ontology#contains> _:651df1884f2f6a8eb23fb878a330260e1 . 
-<http://localhost:8080/faq/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/faq/index-content> <http://discobits.org/ontology#contains> _:29b107b5bfb536bf6d56fae79b2adc621 . 
-<http://localhost:8080/faq/index-content> <http://discobits.org/ontology#contains> _:6194923897ef1e7f15f7a0089703c4921 . 
-<http://localhost:8080/faq/index-content> <http://discobits.org/ontology#contains> _:68c310f391082b90761cda14a9fcf0011 . 
-<http://localhost:8080/faq/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/faq/index-title> <http://discobits.org/ontology#infoBit> "Frequently Asked Questions"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/faq/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/faq/index> <http://discobits.org/ontology#contains> _:098f006dbee0e41922a3c3022670f5dd1 . 
-<http://localhost:8080/faq/index> <http://discobits.org/ontology#contains> _:28504164672041f68381fd29ea0f455d1 . 
-<http://localhost:8080/faq/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/0> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"column one-column\">\t\t\t\t\n\n<p>The following instructions describes how to build Clerezza. If you don't want to build Clerezza yourself, you can download\n\t\t\t\t\ta launcher from <a href=\"../../downloads/\">here</a>.</p>\n\t\t\t\t<p>In order to build Clerezza you must have installed:</p>\n\t\t\t\t<ul>\n\t\t\t\t\t< [...]
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1-content> <http://discobits.org/ontology#infoBit> "<h3 xmlns=\"http://www.w3.org/1999/xhtml\">Build fails due to stack overflow (on Platform Account Control Panel Core)</h3>\n    <p xmlns=\"http://www.w3.org/1999/xhtml\">\n        There is a pending issue with the Scala compiler having a too low stack size (<a href=\"https://issues.apache.org/jira/browse/CLEREZZA-612\">CLEREZZA-612</a>). There is currently no way  [...]
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1-title> <http://discobits.org/ontology#infoBit> "Troubleshooting"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1> <http://discobits.org/ontology#contains> _:e7d12424bcf9a8af9febdbf27373a9ac1 . 
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1> <http://discobits.org/ontology#contains> _:f1ec94e30c5da6f5748dc72d0dd2d7941 . 
-<http://localhost:8080/getting-started/building-clerezza/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/building-clerezza/index-content> <http://discobits.org/ontology#contains> _:12dc8ccc758b49f9708f5d83cfa697d21 . 
-<http://localhost:8080/getting-started/building-clerezza/index-content> <http://discobits.org/ontology#contains> _:716a8c7071def93f7f6a6e95b35080c41 . 
-<http://localhost:8080/getting-started/building-clerezza/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/building-clerezza/index-title> <http://discobits.org/ontology#infoBit> "Building Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/building-clerezza/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/building-clerezza/index> <http://discobits.org/ontology#contains> _:8707e0d62abb3427fcbfe0f98583eca51 . 
-<http://localhost:8080/getting-started/building-clerezza/index> <http://discobits.org/ontology#contains> _:c1af318c5c0ac9177a51deb36f7231ff1 . 
-<http://localhost:8080/getting-started/building-clerezza/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/index-content-el/0> <http://discobits.org/ontology#infoBit> "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"column one-column\">\n<p>For first-time users, here are a few links that might get you started more quickly:</p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li><div><a href=\"../downloads/\">Downloads</a> - Download Clerezza.</div></li>\n\t\t\t\t\t<li><div><a href=\"building-clerezza/\">Building Clerezza</a> - Learn how to build Clerezza.</div></li>\n\n\t\ [...]
-<http://localhost:8080/getting-started/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/index-content> <http://discobits.org/ontology#contains> _:3fe4ba4c1c164d35f7105a74296c56f01 . 
-<http://localhost:8080/getting-started/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/index-title> <http://discobits.org/ontology#infoBit> "Getting Started"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/index> <http://discobits.org/ontology#contains> _:5a2b69e03101058343f572f66abe980b1 . 
-<http://localhost:8080/getting-started/index> <http://discobits.org/ontology#contains> _:fd0402effa446644b73b1110bb8037f81 . 
-<http://localhost:8080/getting-started/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/0> <http://discobits.org/ontology#infoBit> "The following describes ho to install Clerezza as a service, i.e. to start up in the background typically when the system is bootet. It is recommended to first try to start Clerezza manually following the instrcutions <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"/getting-started/launching-clerezza/\">here</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/0> <http://discobits.org/ontology#infoBit> "The following is known to work on recent Ubuntu Linux distributions."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/1> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">You need to place a clerezza.conf file in the directory /etc/init. The following is an example that assumes Clerezza is to be run as user reto in /home/reto/clerezza using the jar platform.launcher.jar therein.</p>\n/etc/init/clerezza.conf\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\"># Apache C [...]
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/0> <http://discobits.org/ontology#infoBit> "By default Clerezza listens to port 8080 for http requests and to port 8022 for ssh connections. As Clerezza is typically run as an unpriviledged user (user reto in the example above) it cannot listen to default ports like port 80 for the web."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/1> <http://discobits.org/ontology#infoBit> "One way to redirect the default web port 80 to port 8080 is to use xinetd. This is not installed by default."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/2> <http://discobits.org/ontology#infoBit> "Install xinetd with\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">sudo apt-get install xinetd\n</div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/3> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">For redirecting the http port 80 to 8080 you can place a file with following content into the directory /etc/xinet.d.</p>\n/etc/xinet.d/http\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">service http \n{\n disable = no\n flags = REUSE\n socket_type = stream\n protocol = tcp\n user = [...]
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/4> <http://discobits.org/ontology#infoBit> "Finally tell xinetd to reload the config with:\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">sudo /etc/init.d/xinetd reload\n</div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/5> <http://discobits.org/ontology#infoBit> "Alternatives to xinetd include inet.d and iptables"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:16242ea0a4ab7d474d5702c1e87536471 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:6591d0c771edfe7089247a7ecbaafe931 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:8542bfbd6e0a319cd645f4611e9da75e1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:8ab48dce36c9a6c17f942ce87cbf33021 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:8bf38a2592107ed88425b6c7a1ac52381 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://discobits.org/ontology#contains> _:f29c2ad7a7fc7b1137acb8ae5bec08181 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-title> <http://discobits.org/ontology#infoBit> "Forwarding ports"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2> <http://discobits.org/ontology#contains> _:030515b142590aeceb81b01e5316aaba1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2> <http://discobits.org/ontology#contains> _:090974e42842b8e1f4176800fcf1b5d91 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content> <http://discobits.org/ontology#contains> _:243137667a8dd8558ba9e7bc0f7dd1761 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content> <http://discobits.org/ontology#contains> _:6f732e270950e818cb5d4c783d1d963d1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content> <http://discobits.org/ontology#contains> _:882231d180792ca493da33463a3d8bb91 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-title> <http://discobits.org/ontology#infoBit> "On Ubuntu Linux"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1> <http://discobits.org/ontology#contains> _:02898d1df9a067ad4caaa02d55020a8c1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1> <http://discobits.org/ontology#contains> _:62ceb5a17ceeefb12fc4c11d2ef82b1f1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-content-el/0> <http://discobits.org/ontology#infoBit> "When running clerezza as service you should start it with the -NCS command line option as it otherwise attempts to open a shell on the console (which is not available to services)"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-content> <http://discobits.org/ontology#contains> _:30bc20643d1d3989dfcb901d2f6801321 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-title> <http://discobits.org/ontology#infoBit> "On other platforms"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2> <http://discobits.org/ontology#contains> _:30403e2bbf1159087fa29ce1c30078871 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2> <http://discobits.org/ontology#contains> _:f403a88bfccbaeab813b7712c19486781 . 
-<http://localhost:8080/getting-started/install-as-service/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/install-as-service/index-content> <http://discobits.org/ontology#contains> _:25a0a81f7f2e8b3443937088b1015f4a1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content> <http://discobits.org/ontology#contains> _:75c58f320de7aac372f897e0cc9f754e1 . 
-<http://localhost:8080/getting-started/install-as-service/index-content> <http://discobits.org/ontology#contains> _:f405b333cd8dd9582c42f882f510fae01 . 
-<http://localhost:8080/getting-started/install-as-service/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/install-as-service/index-title> <http://discobits.org/ontology#infoBit> "Installing Clerezza as a Service"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/install-as-service/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/install-as-service/index> <http://discobits.org/ontology#contains> _:44cf56bf916a2a948e57900904df73c61 . 
-<http://localhost:8080/getting-started/install-as-service/index> <http://discobits.org/ontology#contains> _:f74e17e2f67dfdc85b54b6c724b8d8c91 . 
-<http://localhost:8080/getting-started/install-as-service/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/0> <http://discobits.org/ontology#infoBit> "The following instructions describes how to start Clerezza. If you don't have downloaded the launcher go to <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"../../downloads/\">Downloads</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/1> <http://discobits.org/ontology#infoBit> "<p xmlns=\"http://www.w3.org/1999/xhtml\">In order to start Clerezza you must have installed Java 1.6.</p>\n\t\t\t\t<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t\t\t<ol>\n\t\t\t\t\t\t<li><div>Change working directory to org.apache.clerezza.platform.launcher.tdb/target or to the directory where you have downloaded the launcher</div></li>\n\n\t\t\t\t\t\t<li><div><pr [...]
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/2> <http://discobits.org/ontology#infoBit> "<span xmlns=\"http://www.w3.org/1999/xhtml\" class=\"note\">To start Clerezza as background process use the unix's tools <strong>screen</strong> or <strong>nohup</strong>.\n\t\t\t\tThese tools are also helpful on remote servers that Clerezza can continue working even when the ssh or telnet connection to the server is interrupted.\n\t\t\t\t</span>"^^<http://www.w3.org/199 [...]
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/3> <http://discobits.org/ontology#infoBit> "Clerezza is based on Apache Felix. Therefore, some further information is available on <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#\" target=\"_blank\">the Felix usage page</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/4> <http://discobits.org/ontology#infoBit> "<span xmlns=\"http://www.w3.org/1999/xhtml\" class=\"note\">When using <strong>nohup</strong>\n\t\t\t\tyou must start Clerezza with the command line option -NCS as it will otherwise stop when attempting to interact with the console.\n\t\t\t\t</span>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://discobits.org/ontology#contains> _:16a8cc18fa7457d4003effac3245e0dd1 . 
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://discobits.org/ontology#contains> _:1c41a43db89067a2981a0964c32e05ba1 . 
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://discobits.org/ontology#contains> _:45d699d7c69c21ee1170108b9dd486c71 . 
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://discobits.org/ontology#contains> _:59648f3f1011d9239e1ce4d5ad0379f41 . 
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://discobits.org/ontology#contains> _:7e8df2757134365f16373306f72eb0aa1 . 
-<http://localhost:8080/getting-started/launching-clerezza/index-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/launching-clerezza/index-title> <http://discobits.org/ontology#infoBit> "Launching Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/launching-clerezza/index-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/launching-clerezza/index> <http://discobits.org/ontology#contains> _:3106d287cde1088eb1deac6bcc8d66e51 . 
-<http://localhost:8080/getting-started/launching-clerezza/index> <http://discobits.org/ontology#contains> _:ca6bdeb7eb8cb97d673319a850f91b461 . 
-<http://localhost:8080/getting-started/launching-clerezza/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/getting-started/shell/content-el/0> <http://discobits.org/ontology#infoBit> "One way to interact with Clerezza is via the shell. The shell allows administrative tasks like installing bundles but it is also  support the Scala langauge providing a way to interactively invoke services as well as to run scripts."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/1-content-el/0> <http://discobits.org/ontology#infoBit> "An instance of org.apache.clerezza.shell.OsgiDsl is initialized and part of the default imports. This object allows access to the bundleContext. The following assigns the bundle 0 to a variable and prints its symbolic name to the shell output\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;val systemBundle = bundleContext.getBundle(0)\nsystemBundle: [...]
-<http://localhost:8080/getting-started/shell/content-el/1-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/1-content-el/1> <http://discobits.org/ontology#infoBit> "The OsgiDsl will be enhanced to support shortcuts for many frequent tasks, currently only a few are available.<br xmlns=\"http://www.w3.org/1999/xhtml\"></br>\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;ps\n0 - org.apache.felix.framework System Bundle\n1 - org.apache.clerezza.platform.security.conditions mvn:org.apache.clerezza/org.apache.clerez [...]
-<http://localhost:8080/getting-started/shell/content-el/1-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/1-content> <http://discobits.org/ontology#contains> _:849fc0307742bbc42ef9038dd89ec5231 . 
-<http://localhost:8080/getting-started/shell/content-el/1-content> <http://discobits.org/ontology#contains> _:fbb69762403e0a6c787c3236c8cacf3e1 . 
-<http://localhost:8080/getting-started/shell/content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/shell/content-el/1-title> <http://discobits.org/ontology#infoBit> "Interacting with the OSGi environment"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/1-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/1> <http://discobits.org/ontology#contains> _:7c5fe1fd03c5c8c30394a39592285add1 . 
-<http://localhost:8080/getting-started/shell/content-el/1> <http://discobits.org/ontology#contains> _:ee5f6d43c7bc696f453dd5b430e51b7b1 . 
-<http://localhost:8080/getting-started/shell/content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/content-el/2-content> <http://discobits.org/ontology#infoBit> "The shell provides a shortcut to access available services, the method $ with the service type as argument.\nThe following ste the inital bundle startlevel to 10:\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;import org.osgi.service.startlevel.StartLevel\nimport org.osgi.service.startlevel.StartLevel\nzz&gt;$[StartLevel] setInitialBundleStartLevel 10\n [...]
-<http://localhost:8080/getting-started/shell/content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/2-title> <http://discobits.org/ontology#infoBit> "Accessing Services"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/2> <http://discobits.org/ontology#contains> _:57d009a0cd9066b30355e669559042a21 . 
-<http://localhost:8080/getting-started/shell/content-el/2> <http://discobits.org/ontology#contains> _:9dd01269b0ab49a21885765528dadc311 . 
-<http://localhost:8080/getting-started/shell/content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/content-el/3-content-el/0> <http://discobits.org/ontology#infoBit> "The Clerezza Shell is based on the interactive Scala Shell and as such any line that does not start with a colon is evaluated as Scala:\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;def greet {\n     | out println \"hello world\"\n     | }\ngreet: Unit\nzz&gt;greet\nhello world\nzz&gt;\n</div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/3-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/3-content-el/1> <http://discobits.org/ontology#infoBit> "Commands by contrast are not interpreted as scala. Build in commands as well as commands provided by services are available. \n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;:help\nThis is a scala based console, it supports any Scala expression, as well as the command described below.\n...\n</div>\nServices exposing the org.apache.clerezza.shell.She [...]
-<http://localhost:8080/getting-started/shell/content-el/3-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/3-content> <http://discobits.org/ontology#contains> _:5b2b701360bced58eff7d77631a0c8a91 . 
-<http://localhost:8080/getting-started/shell/content-el/3-content> <http://discobits.org/ontology#contains> _:e85dffd0ef61c608ae47550ce85aacb31 . 
-<http://localhost:8080/getting-started/shell/content-el/3-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/shell/content-el/3-title> <http://discobits.org/ontology#infoBit> "Commands and Expressions"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/3-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/3> <http://discobits.org/ontology#contains> _:c59069f6c15050361444a3acaa0bcb231 . 
-<http://localhost:8080/getting-started/shell/content-el/3> <http://discobits.org/ontology#contains> _:e027a52d5e09cfa86237a052f386081d1 . 
-<http://localhost:8080/getting-started/shell/content-el/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/content-el/4-content-el/0> <http://discobits.org/ontology#infoBit> "All variables and objects created on the Shell are lost after a restart this is true also for objects registered as service. Nevertheless being able t o quickly create and register a service might often come in handy."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/4-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/4-content-el/1> <http://discobits.org/ontology#infoBit> "The following registers a \"hello world\" root resource at the uri-path /foo/bar\n<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"tx-blockcode\">\nzz&gt;import javax.ws.rs._\nimport javax.ws.rs._\nzz&gt;@Path(\"foo/bar\") class Foo { @GET def get() = { \"hello world\" } }\ndefined class Foo\nzz&gt;import scala.collection.JavaConversions.asDictionary\nimport scala.collectio [...]
-<http://localhost:8080/getting-started/shell/content-el/4-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/4-content> <http://discobits.org/ontology#contains> _:06dec04d3dc8ab370aa14193d98e36731 . 
-<http://localhost:8080/getting-started/shell/content-el/4-content> <http://discobits.org/ontology#contains> _:1d4089da0faae05919e86419a9a046481 . 
-<http://localhost:8080/getting-started/shell/content-el/4-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/shell/content-el/4-title> <http://discobits.org/ontology#infoBit> "Creating and Registering Services"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/content-el/4-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/getting-started/shell/content-el/4> <http://discobits.org/ontology#contains> _:1c2fb72151a5b5f4f51a543a328ad6321 . 
-<http://localhost:8080/getting-started/shell/content-el/4> <http://discobits.org/ontology#contains> _:43124f17d5c962c2c8578515fb88ff521 . 
-<http://localhost:8080/getting-started/shell/content-el/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/content> <http://discobits.org/ontology#contains> _:6fd11be27b3069dc42f9aaac3b708a9b1 . 
-<http://localhost:8080/getting-started/shell/content> <http://discobits.org/ontology#contains> _:74a9765ed4d4d669bdc0729de93028cf1 . 
-<http://localhost:8080/getting-started/shell/content> <http://discobits.org/ontology#contains> _:a3b5fb21971de500f85d7da22622847a1 . 
-<http://localhost:8080/getting-started/shell/content> <http://discobits.org/ontology#contains> _:ae884b491673ac56bf77d2221125c3a21 . 
-<http://localhost:8080/getting-started/shell/content> <http://discobits.org/ontology#contains> _:c1b434e553f1aa9e065f8f79dcd6b5cd1 . 
-<http://localhost:8080/getting-started/shell/content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-<http://localhost:8080/getting-started/shell/index> <http://discobits.org/ontology#contains> _:39ce10aed38a336241fbdd4d70d234161 . 
-<http://localhost:8080/getting-started/shell/index> <http://discobits.org/ontology#contains> _:e254ae7d8723fdd6a72672df7306f3801 . 
-<http://localhost:8080/getting-started/shell/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/getting-started/shell/title> <http://discobits.org/ontology#infoBit> "Getting started with the Clerezza Shell"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/getting-started/shell/title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<http://localhost:8080/images/> <http://clerezza.org/2009/09/hierarchy#members> _:79c11b3796e0b82ccc1b584a8ca6f2f91 . 
-<http://localhost:8080/images/> <http://purl.org/dc/terms/created> "2010-04-07T11:44:06.992+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/09/hierarchy#Collection> .
-<http://localhost:8080/images/> <http://xmlns.com/foaf/0.1/maker> _:928c1775f798252e185017bc5372f6201 . 
-<http://localhost:8080/images/logo-big-100x18.png> <http://discobits.org/ontology#infoBit> "iVBORw0KGgoAAAANSUhEUgAAAGQAAAASCAYAAACtmXuIAAAJs0lEQVR42u1Ze2xb5RVvKYwBWxmPMlYoK7C1Yx2srKxdB6H35Ws7paybyFTaRoBgE2JT1WmrkKY9Ats0IW0SoK3SuiHQhtjIHgya+JWH8/DjusraxvHbeTnx417HLW1KWdI87n7n2tdxHCcxe6j7o5Y+JfE93/nOOb/znd85NytW/Bc+jN3/Ga7JX0eLtQYfblDVy1Zc+ly8D0A4wNkjKtcSVXlHdMRsiV95KSoX8cPbIwcMXSOq6MnQSlwC5KIDEjtg6B5VjZKiGr3KJUD+p+XoneCmHRa/mbP0iTWW42v+E0AeaPLfwVrDRpQ4nrH03vqBDFHVlTW2k1uFZv/dCzjM6bxcsATv [...]
-<http://localhost:8080/images/logo-big-100x18.png> <http://discobits.org/ontology#mediaType> "image/png" .
-<http://localhost:8080/images/logo-big-100x18.png> <http://purl.org/dc/terms/created> "2010-04-08T17:01:08.781+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/logo-big-100x18.png> <http://purl.org/dc/terms/dateSubmitted> "2010-04-08T17:01:08.816+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/logo-big-100x18.png> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#InfoDiscoBit> .
-<http://localhost:8080/images/logo-big-100x18.png> <http://www.w3.org/2003/12/exif/ns#height> "18"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/logo-big-100x18.png> <http://www.w3.org/2003/12/exif/ns#width> "100"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/logo-big-100x18.png> <http://xmlns.com/foaf/0.1/maker> _:928c1775f798252e185017bc5372f6201 . 
-<http://localhost:8080/images/logo-big.png> <http://discobits.org/ontology#infoBit> "iVBORw0KGgoAAAANSUhEUgAAAKYAAAAeCAYAAACmEWVvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAExpJREFUeNrsXAu4XUV1npm9zzk35CVJmsQLSYCkCUrkpSFCEEKe0EA/DamCllalqCnISz5T/AQ+KeKnmFSB2tLwsggoiFRQ8iKRYqgmWgExkqSEV3LzAEIIJNx7z9l7pv9aM7PP3ufuc+6594Zq27s/JueevfesNbPmnzXrdZDGGNF/9V9/bFfYVwIzlm3oaZcS2pNo76m5/19ox6C19y/L/55rzRlH/XECsxeXEVK+LlUghJLp+7uFhv7WMd7o1+L9GvMPcBEoVbEoZFigb1XERhWhy53CxFH/yvQD8w+BTClkEApFwJQ [...]
-<http://localhost:8080/images/logo-big.png> <http://discobits.org/ontology#mediaType> "image/png" .
-<http://localhost:8080/images/logo-big.png> <http://discobits.org/ontology#thumbnail> <http://localhost:8080/images/logo-big-100x18.png> .
-<http://localhost:8080/images/logo-big.png> <http://purl.org/dc/terms/created> "2010-04-08T17:01:05.972+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/logo-big.png> <http://purl.org/dc/terms/dateSubmitted> "2010-04-08T17:01:06.043+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/logo-big.png> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#InfoDiscoBit> .
-<http://localhost:8080/images/logo-big.png> <http://www.w3.org/2003/12/exif/ns#height> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/logo-big.png> <http://www.w3.org/2003/12/exif/ns#width> "166"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/logo-big.png> <http://xmlns.com/foaf/0.1/maker> _:928c1775f798252e185017bc5372f6201 . 
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://discobits.org/ontology#infoBit> "iVBORw0KGgoAAAANSUhEUgAAAGQAAAATCAMAAABRG1gfAAADAFBMVEUAAAAAADMAAGYAAJkAAMwAAP8AMwAAMzMAM2YAM5kAM8wAM/8AZgAAZjMAZmYAZpkAZswAZv8AmQAAmTMAmWYAmZkAmcwAmf8AzAAAzDMAzGYAzJkAzMwAzP8A/wAA/zMA/2YA/5kA/8wA//8zAAAzADMzAGYzAJkzAMwzAP8zMwAzMzMzM2YzM5kzM8wzM/8zZgAzZjMzZmYzZpkzZswzZv8zmQAzmTMzmWYzmZkzmcwzmf8zzAAzzDMzzGYzzJkzzMwzzP8z/wAz/zMz/2Yz/5kz/8wz//9mAABmADNmAGZmAJlmAMxmAP9mMwBmMzNmM2ZmM5lmM8xmM/9mZgBmZ [...]
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://discobits.org/ontology#mediaType> "image/png" .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://purl.org/dc/terms/created> "2010-04-07T11:44:21.684+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://purl.org/dc/terms/dateSubmitted> "2010-04-07T11:44:21.749+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#InfoDiscoBit> .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://www.w3.org/2003/12/exif/ns#height> "19"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://www.w3.org/2003/12/exif/ns#width> "100"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/sw-horz-w3c-100x19.png> <http://xmlns.com/foaf/0.1/maker> _:928c1775f798252e185017bc5372f6201 . 
-<http://localhost:8080/images/sw-horz-w3c.png> <http://discobits.org/ontology#infoBit> "iVBORw0KGgoAAAANSUhEUgAAAPEAAAAwCAMAAAD3oWwqAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAtZQTFRFAFqcBF2eCF+fCmCgDGKhEGSiFGekGGqlHGynIG6pIG+oIhsKJHGqJR8OKHSsKSISLCYWLHatMCkZMHmvMy0dNHywNzAhN32xOH6yOjQlPIGzPjgpQIO1QTstRIa2SIm4TEY4TIu6T0k8UI67U01AVJC9VlFEV5K9V5K+WJO+WVRHXJbAYFtPYJjBZF9TZJvDZ2NXaJ3Ea2ZbbKDGbmpfcKLHcm1idKXJ [...]
-<http://localhost:8080/images/sw-horz-w3c.png> <http://discobits.org/ontology#mediaType> "image/png" .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://discobits.org/ontology#thumbnail> <http://localhost:8080/images/sw-horz-w3c-100x19.png> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://purl.org/dc/terms/created> "2010-04-07T11:44:07.104+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://purl.org/dc/terms/dateSubmitted> "2010-04-07T11:44:07.628+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://purl.org/dc/terms/modified> "2010-04-07T11:44:20.748+02:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#InfoDiscoBit> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://www.w3.org/2003/12/exif/ns#height> "48"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://www.w3.org/2003/12/exif/ns#width> "241"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://localhost:8080/images/sw-horz-w3c.png> <http://xmlns.com/foaf/0.1/maker> _:928c1775f798252e185017bc5372f6201 . 
-<http://localhost:8080/index> <http://discobits.org/ontology#contains> _:5b56c5df053e0603e94fd29182d967f01 . 
-<http://localhost:8080/index> <http://discobits.org/ontology#contains> _:f075920a3dd4e392cb6f6b9a29be9cb41 . 
-<http://localhost:8080/index> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<http://localhost:8080/title> <http://discobits.org/ontology#infoBit> "Welcome to Apache Clerezza"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<http://localhost:8080/title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-_:02898d1df9a067ad4caaa02d55020a8c1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content> . 
-_:02898d1df9a067ad4caaa02d55020a8c1 <http://discobits.org/ontology#pos> "1" . 
-_:02898d1df9a067ad4caaa02d55020a8c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:030515b142590aeceb81b01e5316aaba1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content> . 
-_:030515b142590aeceb81b01e5316aaba1 <http://discobits.org/ontology#pos> "1" . 
-_:030515b142590aeceb81b01e5316aaba1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:06631a3c3ad09806971115c4dcd65f601 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-content-el/1> . 
-_:06631a3c3ad09806971115c4dcd65f601 <http://discobits.org/ontology#pos> "1" . 
-_:06631a3c3ad09806971115c4dcd65f601 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:06dec04d3dc8ab370aa14193d98e36731 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/4-content-el/0> . 
-_:06dec04d3dc8ab370aa14193d98e36731 <http://discobits.org/ontology#pos> "0" . 
-_:06dec04d3dc8ab370aa14193d98e36731 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:090974e42842b8e1f4176800fcf1b5d91 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-title> . 
-_:090974e42842b8e1f4176800fcf1b5d91 <http://discobits.org/ontology#pos> "0" . 
-_:090974e42842b8e1f4176800fcf1b5d91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:098f006dbee0e41922a3c3022670f5dd1 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-title> . 
-_:098f006dbee0e41922a3c3022670f5dd1 <http://discobits.org/ontology#pos> "0" . 
-_:098f006dbee0e41922a3c3022670f5dd1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:0a41bff217c602298a96bc11adc9ae2b1 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/2-title> . 
-_:0a41bff217c602298a96bc11adc9ae2b1 <http://discobits.org/ontology#pos> "0" . 
-_:0a41bff217c602298a96bc11adc9ae2b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:0ce57d802fe1a2b2e7d8c85b21b365ac1 <http://discobits.org/ontology#holds> <http://localhost:8080/clerezza-uima/index-content-el/1> . 
-_:0ce57d802fe1a2b2e7d8c85b21b365ac1 <http://discobits.org/ontology#pos> "1" . 
-_:0ce57d802fe1a2b2e7d8c85b21b365ac1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:12dc8ccc758b49f9708f5d83cfa697d21 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-content-el/0> . 
-_:12dc8ccc758b49f9708f5d83cfa697d21 <http://discobits.org/ontology#pos> "0" . 
-_:12dc8ccc758b49f9708f5d83cfa697d21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:16102482a7b1bba35d2b4afbec13b0691 <http://discobits.org/ontology#holds> <http://localhost:8080/clerezza-uima/index-content-el/0> . 
-_:16102482a7b1bba35d2b4afbec13b0691 <http://discobits.org/ontology#pos> "0" . 
-_:16102482a7b1bba35d2b4afbec13b0691 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:16242ea0a4ab7d474d5702c1e87536471 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/3> . 
-_:16242ea0a4ab7d474d5702c1e87536471 <http://discobits.org/ontology#pos> "3" . 
-_:16242ea0a4ab7d474d5702c1e87536471 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:16a8cc18fa7457d4003effac3245e0dd1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content-el/0> . 
-_:16a8cc18fa7457d4003effac3245e0dd1 <http://discobits.org/ontology#pos> "0" . 
-_:16a8cc18fa7457d4003effac3245e0dd1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:186d4b4c53a1b799e755a4157bb133761 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4-content-el/1> . 
-_:186d4b4c53a1b799e755a4157bb133761 <http://discobits.org/ontology#pos> "1" . 
-_:186d4b4c53a1b799e755a4157bb133761 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:1c2fb72151a5b5f4f51a543a328ad6321 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/4-title> . 
-_:1c2fb72151a5b5f4f51a543a328ad6321 <http://discobits.org/ontology#pos> "0" . 
-_:1c2fb72151a5b5f4f51a543a328ad6321 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:1c41a43db89067a2981a0964c32e05ba1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content-el/2> . 
-_:1c41a43db89067a2981a0964c32e05ba1 <http://discobits.org/ontology#pos> "2" . 
-_:1c41a43db89067a2981a0964c32e05ba1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:1d4089da0faae05919e86419a9a046481 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/4-content-el/1> . 
-_:1d4089da0faae05919e86419a9a046481 <http://discobits.org/ontology#pos> "1" . 
-_:1d4089da0faae05919e86419a9a046481 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:23c44138f71e0bf15391a46a9dad20cc1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-content> . 
-_:23c44138f71e0bf15391a46a9dad20cc1 <http://discobits.org/ontology#pos> "1" . 
-_:23c44138f71e0bf15391a46a9dad20cc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:243137667a8dd8558ba9e7bc0f7dd1761 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/1> . 
-_:243137667a8dd8558ba9e7bc0f7dd1761 <http://discobits.org/ontology#pos> "1" . 
-_:243137667a8dd8558ba9e7bc0f7dd1761 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:246c0c7e11739e614851f1e1f88954441 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/1-content> . 
-_:246c0c7e11739e614851f1e1f88954441 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:246c0c7e11739e614851f1e1f88954441 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:25a0a81f7f2e8b3443937088b1015f4a1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/2> . 
-_:25a0a81f7f2e8b3443937088b1015f4a1 <http://discobits.org/ontology#pos> "2" . 
-_:25a0a81f7f2e8b3443937088b1015f4a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:284ee1e895fd9ee9eb6361502439e04e1 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-content-el/3> . 
-_:284ee1e895fd9ee9eb6361502439e04e1 <http://discobits.org/ontology#pos> "3" . 
-_:284ee1e895fd9ee9eb6361502439e04e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:28504164672041f68381fd29ea0f455d1 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content> . 
-_:28504164672041f68381fd29ea0f455d1 <http://discobits.org/ontology#pos> "1" . 
-_:28504164672041f68381fd29ea0f455d1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:29b107b5bfb536bf6d56fae79b2adc621 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/1> . 
-_:29b107b5bfb536bf6d56fae79b2adc621 <http://discobits.org/ontology#pos> "0" . 
-_:29b107b5bfb536bf6d56fae79b2adc621 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2aac827f39c2f65b17d1d1c2866a54481 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/0-title> . 
-_:2aac827f39c2f65b17d1d1c2866a54481 <http://discobits.org/ontology#pos> "0" . 
-_:2aac827f39c2f65b17d1d1c2866a54481 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2bbeb8a2ee0a04b74a96953d1a8a49371 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/1-title> . 
-_:2bbeb8a2ee0a04b74a96953d1a8a49371 <http://discobits.org/ontology#pos> "0" . 
-_:2bbeb8a2ee0a04b74a96953d1a8a49371 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2d2dd4da955307c130d124580f49a8be1 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/1> . 
-_:2d2dd4da955307c130d124580f49a8be1 <http://discobits.org/ontology#pos> "1" . 
-_:2d2dd4da955307c130d124580f49a8be1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:2d7f383e72651f1469e7dd5b4e9f08701 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://localhost:8080/images/> . 
-_:2d7f383e72651f1469e7dd5b4e9f08701 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . 
-_:30403e2bbf1159087fa29ce1c30078871 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/2-title> . 
-_:30403e2bbf1159087fa29ce1c30078871 <http://discobits.org/ontology#pos> "0" . 
-_:30403e2bbf1159087fa29ce1c30078871 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:30bc20643d1d3989dfcb901d2f6801321 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/2-content-el/0> . 
-_:30bc20643d1d3989dfcb901d2f6801321 <http://discobits.org/ontology#pos> "0" . 
-_:30bc20643d1d3989dfcb901d2f6801321 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:3106d287cde1088eb1deac6bcc8d66e51 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-title> . 
-_:3106d287cde1088eb1deac6bcc8d66e51 <http://discobits.org/ontology#pos> "0" . 
-_:3106d287cde1088eb1deac6bcc8d66e51 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:36e20e98fa2d5dbc2a7843dee1584cbc1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/0> . 
-_:36e20e98fa2d5dbc2a7843dee1584cbc1 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:36e20e98fa2d5dbc2a7843dee1584cbc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:39ce10aed38a336241fbdd4d70d234161 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/title> . 
-_:39ce10aed38a336241fbdd4d70d234161 <http://discobits.org/ontology#pos> "0" . 
-_:39ce10aed38a336241fbdd4d70d234161 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:3f651929743c97efcbc6abbeda3623601 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3> . 
-_:3f651929743c97efcbc6abbeda3623601 <http://discobits.org/ontology#pos> "3" . 
-_:3f651929743c97efcbc6abbeda3623601 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:3fe4ba4c1c164d35f7105a74296c56f01 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/index-content-el/0> . 
-_:3fe4ba4c1c164d35f7105a74296c56f01 <http://discobits.org/ontology#pos> "0" . 
-_:3fe4ba4c1c164d35f7105a74296c56f01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:410129d932f3068bdcf1a306d3ad97cb1 <http://clerezza.org/2009/06/custompropery#category> <http://clerezza.org/2008/10/permission#Role> . 
-_:410129d932f3068bdcf1a306d3ad97cb1 <http://clerezza.org/2009/06/custompropery#categoryproperty> "DefaultRole" . 
-_:410129d932f3068bdcf1a306d3ad97cb1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/06/custompropery#CustomFieldCollection> . 
-_:43124f17d5c962c2c8578515fb88ff521 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/4-content> . 
-_:43124f17d5c962c2c8578515fb88ff521 <http://discobits.org/ontology#pos> "1" . 
-_:43124f17d5c962c2c8578515fb88ff521 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:43e99d3cb314092f00939e93755b7d071 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/2-content> . 
-_:43e99d3cb314092f00939e93755b7d071 <http://discobits.org/ontology#pos> "1" . 
-_:43e99d3cb314092f00939e93755b7d071 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:44cf56bf916a2a948e57900904df73c61 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content> . 
-_:44cf56bf916a2a948e57900904df73c61 <http://discobits.org/ontology#pos> "1" . 
-_:44cf56bf916a2a948e57900904df73c61 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:45d699d7c69c21ee1170108b9dd486c71 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content-el/4> . 
-_:45d699d7c69c21ee1170108b9dd486c71 <http://discobits.org/ontology#pos> "3" . 
-_:45d699d7c69c21ee1170108b9dd486c71 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:46f25a5b95c8a2141ea759b8180901041 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/3-content-el/0> . 
-_:46f25a5b95c8a2141ea759b8180901041 <http://discobits.org/ontology#pos> "0" . 
-_:46f25a5b95c8a2141ea759b8180901041 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:4a0bbb095bdef313e8a2043ab94cd9971 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-content-el/0> . 
-_:4a0bbb095bdef313e8a2043ab94cd9971 <http://discobits.org/ontology#pos> "0" . 
-_:4a0bbb095bdef313e8a2043ab94cd9971 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:4ea7f6acb02829aacad39ed5a3868fcd1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/4-title> . 
-_:4ea7f6acb02829aacad39ed5a3868fcd1 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:4ea7f6acb02829aacad39ed5a3868fcd1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:4f76fa605a704c3c5c1bd8507e086aa41 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/1-content> . 
-_:4f76fa605a704c3c5c1bd8507e086aa41 <http://discobits.org/ontology#pos> "1" . 
-_:4f76fa605a704c3c5c1bd8507e086aa41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:521cc162a95efa1cfb290a25d07bea641 <http://clerezza.org/2009/06/custompropery#category> <http://clerezza.org/2008/10/permission#Role> . 
-_:521cc162a95efa1cfb290a25d07bea641 <http://clerezza.org/2009/06/custompropery#categoryproperty> "BasePermissionsRole" . 
-_:521cc162a95efa1cfb290a25d07bea641 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/06/custompropery#CustomFieldCollection> . 
-_:541d0348ba0a7acc9c8d11e3e348ab461 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4-title> . 
-_:541d0348ba0a7acc9c8d11e3e348ab461 <http://discobits.org/ontology#pos> "0" . 
-_:541d0348ba0a7acc9c8d11e3e348ab461 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:56657a685a5b50b4e9508972931f7d9e1 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-content-el/1> . 
-_:56657a685a5b50b4e9508972931f7d9e1 <http://discobits.org/ontology#pos> "1" . 
-_:56657a685a5b50b4e9508972931f7d9e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:56a811b868af8d68b333b10aa1ead9341 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content> . 
-_:56a811b868af8d68b333b10aa1ead9341 <http://discobits.org/ontology#pos> "1" . 
-_:56a811b868af8d68b333b10aa1ead9341 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:57274c2fa7afd3439e5c2269fe55330e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2010/01/concepts#ConceptProviderList> . 
-_:57274c2fa7afd3439e5c2269fe55330e1 <http://www.w3.org/2002/07/owl#sameAs> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . 
-_:57d009a0cd9066b30355e669559042a21 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/2-title> . 
-_:57d009a0cd9066b30355e669559042a21 <http://discobits.org/ontology#pos> "0" . 
-_:57d009a0cd9066b30355e669559042a21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:59617143e7ff5639ed7da28f51395da41 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/0> . 
-_:59617143e7ff5639ed7da28f51395da41 <http://discobits.org/ontology#pos> "0" . 
-_:59617143e7ff5639ed7da28f51395da41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:59648f3f1011d9239e1ce4d5ad0379f41 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content-el/1> . 
-_:59648f3f1011d9239e1ce4d5ad0379f41 <http://discobits.org/ontology#pos> "1" . 
-_:59648f3f1011d9239e1ce4d5ad0379f41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:59e83e28db0053b861c9b0f671d4f21d1 <http://discobits.org/ontology#holds> <http://localhost:8080/clerezza-uima/index-title> . 
-_:59e83e28db0053b861c9b0f671d4f21d1 <http://discobits.org/ontology#pos> "0" . 
-_:59e83e28db0053b861c9b0f671d4f21d1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5a2b69e03101058343f572f66abe980b1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/index-content> . 
-_:5a2b69e03101058343f572f66abe980b1 <http://discobits.org/ontology#pos> "1" . 
-_:5a2b69e03101058343f572f66abe980b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5ab5851d567cc4f9e6f6ac745bcba1191 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/3-content> . 
-_:5ab5851d567cc4f9e6f6ac745bcba1191 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:5ab5851d567cc4f9e6f6ac745bcba1191 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5b2b701360bced58eff7d77631a0c8a91 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/3-content-el/1> . 
-_:5b2b701360bced58eff7d77631a0c8a91 <http://discobits.org/ontology#pos> "1" . 
-_:5b2b701360bced58eff7d77631a0c8a91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5b56c5df053e0603e94fd29182d967f01 <http://discobits.org/ontology#holds> <http://localhost:8080/title> . 
-_:5b56c5df053e0603e94fd29182d967f01 <http://discobits.org/ontology#pos> "0" . 
-_:5b56c5df053e0603e94fd29182d967f01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5ca21ef6ed2b0a61f84092d5acb069b21 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/3-content> . 
-_:5ca21ef6ed2b0a61f84092d5acb069b21 <http://discobits.org/ontology#pos> "1" . 
-_:5ca21ef6ed2b0a61f84092d5acb069b21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:5f205ab6f8dae0da9465dbd58ad68d221 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/3-title> . 
-_:5f205ab6f8dae0da9465dbd58ad68d221 <http://discobits.org/ontology#pos> "0" . 
-_:5f205ab6f8dae0da9465dbd58ad68d221 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6194923897ef1e7f15f7a0089703c4921 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/0> . 
-_:6194923897ef1e7f15f7a0089703c4921 <http://discobits.org/ontology#pos> "2" . 
-_:6194923897ef1e7f15f7a0089703c4921 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:62ceb5a17ceeefb12fc4c11d2ef82b1f1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-title> . 
-_:62ceb5a17ceeefb12fc4c11d2ef82b1f1 <http://discobits.org/ontology#pos> "0" . 
-_:62ceb5a17ceeefb12fc4c11d2ef82b1f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:64709c684417ad8f092a63d4a06246cc1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4-content> . 
-_:64709c684417ad8f092a63d4a06246cc1 <http://discobits.org/ontology#pos> "1" . 
-_:64709c684417ad8f092a63d4a06246cc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:65160e4b15d45b390530dc168b3e3b691 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/4-content> . 
-_:65160e4b15d45b390530dc168b3e3b691 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:65160e4b15d45b390530dc168b3e3b691 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:651df1884f2f6a8eb23fb878a330260e1 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/2-content> . 
-_:651df1884f2f6a8eb23fb878a330260e1 <http://discobits.org/ontology#pos> "1" . 
-_:651df1884f2f6a8eb23fb878a330260e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6591d0c771edfe7089247a7ecbaafe931 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/2> . 
-_:6591d0c771edfe7089247a7ecbaafe931 <http://discobits.org/ontology#pos> "2" . 
-_:6591d0c771edfe7089247a7ecbaafe931 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:65ff20a77d0e2e553d34e864c53f39951 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-title> . 
-_:65ff20a77d0e2e553d34e864c53f39951 <http://discobits.org/ontology#pos> "0" . 
-_:65ff20a77d0e2e553d34e864c53f39951 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:68c310f391082b90761cda14a9fcf0011 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/2> . 
-_:68c310f391082b90761cda14a9fcf0011 <http://discobits.org/ontology#pos> "1" . 
-_:68c310f391082b90761cda14a9fcf0011 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6daa53f79bbe085d47a917ef0e84a2771 <http://clerezza.org/2009/06/custompropery#category> <http://clerezza.org/2008/10/permission#Role> . 
-_:6daa53f79bbe085d47a917ef0e84a2771 <http://clerezza.org/2009/06/custompropery#categoryproperty> "CommunityUser" . 
-_:6daa53f79bbe085d47a917ef0e84a2771 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://clerezza.org/2009/06/custompropery#CustomFieldCollection> . 
-_:6f732e270950e818cb5d4c783d1d963d1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2> . 
-_:6f732e270950e818cb5d4c783d1d963d1 <http://discobits.org/ontology#pos> "2" . 
-_:6f732e270950e818cb5d4c783d1d963d1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:6fd11be27b3069dc42f9aaac3b708a9b1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/4> . 
-_:6fd11be27b3069dc42f9aaac3b708a9b1 <http://discobits.org/ontology#pos> "4" . 
-_:6fd11be27b3069dc42f9aaac3b708a9b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:716a8c7071def93f7f6a6e95b35080c41 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-content-el/1> . 
-_:716a8c7071def93f7f6a6e95b35080c41 <http://discobits.org/ontology#pos> "1" . 
-_:716a8c7071def93f7f6a6e95b35080c41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:736e21459b8803e302b9c556c64f181b1 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/1-title> . 
-_:736e21459b8803e302b9c556c64f181b1 <http://discobits.org/ontology#pos> "0" . 
-_:736e21459b8803e302b9c556c64f181b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:74a9765ed4d4d669bdc0729de93028cf1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/0> . 
-_:74a9765ed4d4d669bdc0729de93028cf1 <http://discobits.org/ontology#pos> "0" . 
-_:74a9765ed4d4d669bdc0729de93028cf1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:75c58f320de7aac372f897e0cc9f754e1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1> . 
-_:75c58f320de7aac372f897e0cc9f754e1 <http://discobits.org/ontology#pos> "1" . 
-_:75c58f320de7aac372f897e0cc9f754e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://localhost:8080/images/sw-horz-w3c.png> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:79c11b3796e0b82ccc1b584a8ca6f2f94 . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f92 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://localhost:8080/images/logo-big-100x18.png> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f92 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f93 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://localhost:8080/images/logo-big.png> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f93 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:79c11b3796e0b82ccc1b584a8ca6f2f92 . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f94 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://localhost:8080/images/sw-horz-w3c-100x19.png> . 
-_:79c11b3796e0b82ccc1b584a8ca6f2f94 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:79c11b3796e0b82ccc1b584a8ca6f2f93 . 
-_:7beb1dfa3466a988f3dceeff4c952d2e1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/1-content> . 
-_:7beb1dfa3466a988f3dceeff4c952d2e1 <http://discobits.org/ontology#pos> "1" . 
-_:7beb1dfa3466a988f3dceeff4c952d2e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:7c5fe1fd03c5c8c30394a39592285add1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/1-title> . 
-_:7c5fe1fd03c5c8c30394a39592285add1 <http://discobits.org/ontology#pos> "0" . 
-_:7c5fe1fd03c5c8c30394a39592285add1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:7e8df2757134365f16373306f72eb0aa1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content-el/3> . 
-_:7e8df2757134365f16373306f72eb0aa1 <http://discobits.org/ontology#pos> "4" . 
-_:7e8df2757134365f16373306f72eb0aa1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8459fd758df0744434e8c2ff3e8747dc1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/2-title> . 
-_:8459fd758df0744434e8c2ff3e8747dc1 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:8459fd758df0744434e8c2ff3e8747dc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:849fc0307742bbc42ef9038dd89ec5231 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/1-content-el/0> . 
-_:849fc0307742bbc42ef9038dd89ec5231 <http://discobits.org/ontology#pos> "0" . 
-_:849fc0307742bbc42ef9038dd89ec5231 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8542bfbd6e0a319cd645f4611e9da75e1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/4> . 
-_:8542bfbd6e0a319cd645f4611e9da75e1 <http://discobits.org/ontology#pos> "4" . 
-_:8542bfbd6e0a319cd645f4611e9da75e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:860735efae6fe059b65df5c03cca14cf1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/2-content> . 
-_:860735efae6fe059b65df5c03cca14cf1 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:860735efae6fe059b65df5c03cca14cf1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8707e0d62abb3427fcbfe0f98583eca51 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-content> . 
-_:8707e0d62abb3427fcbfe0f98583eca51 <http://discobits.org/ontology#pos> "1" . 
-_:8707e0d62abb3427fcbfe0f98583eca51 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:882231d180792ca493da33463a3d8bb91 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/0> . 
-_:882231d180792ca493da33463a3d8bb91 <http://discobits.org/ontology#pos> "0" . 
-_:882231d180792ca493da33463a3d8bb91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8ab48dce36c9a6c17f942ce87cbf33021 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/0> . 
-_:8ab48dce36c9a6c17f942ce87cbf33021 <http://discobits.org/ontology#pos> "0" . 
-_:8ab48dce36c9a6c17f942ce87cbf33021 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:8bf38a2592107ed88425b6c7a1ac52381 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/1> . 
-_:8bf38a2592107ed88425b6c7a1ac52381 <http://discobits.org/ontology#pos> "1" . 
-_:8bf38a2592107ed88425b6c7a1ac52381 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:928c1775f798252e185017bc5372f6201 <http://clerezza.org/2009/08/platform#userName> "admin" . 
-_:982764bbd875cfb97ff34aced0f6549f1 <http://discobits.org/ontology#holds> <http://localhost:8080/clerezza-uima/index-content> . 
-_:982764bbd875cfb97ff34aced0f6549f1 <http://discobits.org/ontology#pos> "1" . 
-_:982764bbd875cfb97ff34aced0f6549f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:984ac2843763e208c2c2b990a6580fc81 <http://discobits.org/ontology#holds> <http://localhost:8080/clerezza-uima/index-content-el/2> . 
-_:984ac2843763e208c2c2b990a6580fc81 <http://discobits.org/ontology#pos> "2" . 
-_:984ac2843763e208c2c2b990a6580fc81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:994e3a90913f6cd82b0dac3e0be8be1e1 <http://discobits.org/ontology#holds> <http://localhost:8080/documentation/content> . 
-_:994e3a90913f6cd82b0dac3e0be8be1e1 <http://discobits.org/ontology#pos> "1" . 
-_:994e3a90913f6cd82b0dac3e0be8be1e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:9dd01269b0ab49a21885765528dadc311 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/2-content> . 
-_:9dd01269b0ab49a21885765528dadc311 <http://discobits.org/ontology#pos> "1" . 
-_:9dd01269b0ab49a21885765528dadc311 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:a3b5fb21971de500f85d7da22622847a1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/2> . 
-_:a3b5fb21971de500f85d7da22622847a1 <http://discobits.org/ontology#pos> "3" . 
-_:a3b5fb21971de500f85d7da22622847a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:a77a59dc07ed94c3afa8e04b3703d67f1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/3> . 
-_:a77a59dc07ed94c3afa8e04b3703d67f1 <http://discobits.org/ontology#pos> "3"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:a77a59dc07ed94c3afa8e04b3703d67f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:acde0a583c16c0e2e7c2c46249c1cfbd1 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-title> . 
-_:acde0a583c16c0e2e7c2c46249c1cfbd1 <http://discobits.org/ontology#pos> "0" . 
-_:acde0a583c16c0e2e7c2c46249c1cfbd1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:ae884b491673ac56bf77d2221125c3a21 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/1> . 
-_:ae884b491673ac56bf77d2221125c3a21 <http://discobits.org/ontology#pos> "2" . 
-_:ae884b491673ac56bf77d2221125c3a21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:b252ece001f146a1fc39cae6070dd1851 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/0> . 
-_:b252ece001f146a1fc39cae6070dd1851 <http://discobits.org/ontology#pos> "0" . 
-_:b252ece001f146a1fc39cae6070dd1851 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:b77acb57bb31a839ce66119fb42a95b91 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/1-title> . 
-_:b77acb57bb31a839ce66119fb42a95b91 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:b77acb57bb31a839ce66119fb42a95b91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:bbca97c81d87e772ec12d55a1c9696f41 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-content-el/0> . 
-_:bbca97c81d87e772ec12d55a1c9696f41 <http://discobits.org/ontology#pos> "0" . 
-_:bbca97c81d87e772ec12d55a1c9696f41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c0d0f4af3c852dc4c4a3fba3388956cc1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/4> . 
-_:c0d0f4af3c852dc4c4a3fba3388956cc1 <http://discobits.org/ontology#pos> "4"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:c0d0f4af3c852dc4c4a3fba3388956cc1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c1af318c5c0ac9177a51deb36f7231ff1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-title> . 
-_:c1af318c5c0ac9177a51deb36f7231ff1 <http://discobits.org/ontology#pos> "0" . 
-_:c1af318c5c0ac9177a51deb36f7231ff1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c1b434e553f1aa9e065f8f79dcd6b5cd1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/3> . 
-_:c1b434e553f1aa9e065f8f79dcd6b5cd1 <http://discobits.org/ontology#pos> "1" . 
-_:c1b434e553f1aa9e065f8f79dcd6b5cd1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c1dc85b0112c14341800aa7fd5dc20f31 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/2> . 
-_:c1dc85b0112c14341800aa7fd5dc20f31 <http://discobits.org/ontology#pos> "2" . 
-_:c1dc85b0112c14341800aa7fd5dc20f31 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c5438bf3ae898ce833947f48e69d90671 <http://discobits.org/ontology#holds> <http://localhost:8080/documentation/title> . 
-_:c5438bf3ae898ce833947f48e69d90671 <http://discobits.org/ontology#pos> "0" . 
-_:c5438bf3ae898ce833947f48e69d90671 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c59069f6c15050361444a3acaa0bcb231 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/3-title> . 
-_:c59069f6c15050361444a3acaa0bcb231 <http://discobits.org/ontology#pos> "0" . 
-_:c59069f6c15050361444a3acaa0bcb231 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c7d7927eb415a8f9f189ce3cec49a5d61 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-title> . 
-_:c7d7927eb415a8f9f189ce3cec49a5d61 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:c7d7927eb415a8f9f189ce3cec49a5d61 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:c9f0cce906793436372a626d1a86dfa71 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-content> . 
-_:c9f0cce906793436372a626d1a86dfa71 <http://discobits.org/ontology#pos> "1" . 
-_:c9f0cce906793436372a626d1a86dfa71 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:ca6bdeb7eb8cb97d673319a850f91b461 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/launching-clerezza/index-content> . 
-_:ca6bdeb7eb8cb97d673319a850f91b461 <http://discobits.org/ontology#pos> "1" . 
-_:ca6bdeb7eb8cb97d673319a850f91b461 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d042d1d55af2ac4b1e33c549b19b0cb81 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4-content-el/2> . 
-_:d042d1d55af2ac4b1e33c549b19b0cb81 <http://discobits.org/ontology#pos> "2" . 
-_:d042d1d55af2ac4b1e33c549b19b0cb81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d6888fc15bb88aa0399eb959c52ae63b1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content> . 
-_:d6888fc15bb88aa0399eb959c52ae63b1 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:d6888fc15bb88aa0399eb959c52ae63b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d6945d42f50336830304f1cc1f354cba1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/1> . 
-_:d6945d42f50336830304f1cc1f354cba1 <http://discobits.org/ontology#pos> "1" . 
-_:d6945d42f50336830304f1cc1f354cba1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:d7c313ad903897cd324c48efebc963491 <http://discobits.org/ontology#holds> <http://localhost:8080/faq/index-content-el/0-content> . 
-_:d7c313ad903897cd324c48efebc963491 <http://discobits.org/ontology#pos> "1" . 
-_:d7c313ad903897cd324c48efebc963491 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:dcb2b3e0ce07662a025622647c0a73821 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4> . 
-_:dcb2b3e0ce07662a025622647c0a73821 <http://discobits.org/ontology#pos> "4" . 
-_:dcb2b3e0ce07662a025622647c0a73821 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:de277ab31392b4cc18815136ff0cda6c1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-title> . 
-_:de277ab31392b4cc18815136ff0cda6c1 <http://discobits.org/ontology#pos> "0" . 
-_:de277ab31392b4cc18815136ff0cda6c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:de65fbe4beaab5a9e72c1b60c0dd13061 <http://discobits.org/ontology#holds> <http://localhost:8080/content-el/2-content-el/2> . 
-_:de65fbe4beaab5a9e72c1b60c0dd13061 <http://discobits.org/ontology#pos> "2" . 
-_:de65fbe4beaab5a9e72c1b60c0dd13061 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e027a52d5e09cfa86237a052f386081d1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/3-content> . 
-_:e027a52d5e09cfa86237a052f386081d1 <http://discobits.org/ontology#pos> "1" . 
-_:e027a52d5e09cfa86237a052f386081d1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e254ae7d8723fdd6a72672df7306f3801 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content> . 
-_:e254ae7d8723fdd6a72672df7306f3801 <http://discobits.org/ontology#pos> "1" . 
-_:e254ae7d8723fdd6a72672df7306f3801 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e7b8957e2775fdbf90c5e5f6546969ef1 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/4-content-el/0> . 
-_:e7b8957e2775fdbf90c5e5f6546969ef1 <http://discobits.org/ontology#pos> "0" . 
-_:e7b8957e2775fdbf90c5e5f6546969ef1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e7d12424bcf9a8af9febdbf27373a9ac1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-content-el/1-content> . 
-_:e7d12424bcf9a8af9febdbf27373a9ac1 <http://discobits.org/ontology#pos> "1" . 
-_:e7d12424bcf9a8af9febdbf27373a9ac1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:e85dffd0ef61c608ae47550ce85aacb31 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/3-content-el/0> . 
-_:e85dffd0ef61c608ae47550ce85aacb31 <http://discobits.org/ontology#pos> "0" . 
-_:e85dffd0ef61c608ae47550ce85aacb31 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:ee5f6d43c7bc696f453dd5b430e51b7b1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/1-content> . 
-_:ee5f6d43c7bc696f453dd5b430e51b7b1 <http://discobits.org/ontology#pos> "1" . 
-_:ee5f6d43c7bc696f453dd5b430e51b7b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:ee606632a8855c6a5279125200f5e6f11 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-content-el/1-title> . 
-_:ee606632a8855c6a5279125200f5e6f11 <http://discobits.org/ontology#pos> "0" . 
-_:ee606632a8855c6a5279125200f5e6f11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f075920a3dd4e392cb6f6b9a29be9cb41 <http://discobits.org/ontology#holds> <http://localhost:8080/content> . 
-_:f075920a3dd4e392cb6f6b9a29be9cb41 <http://discobits.org/ontology#pos> "1" . 
-_:f075920a3dd4e392cb6f6b9a29be9cb41 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f075d27152b68f372d949d51265439171 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/2-title> . 
-_:f075d27152b68f372d949d51265439171 <http://discobits.org/ontology#pos> "0" . 
-_:f075d27152b68f372d949d51265439171 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f118e9aa30176ede03dc116eec5111f21 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/2> . 
-_:f118e9aa30176ede03dc116eec5111f21 <http://discobits.org/ontology#pos> "2"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:f118e9aa30176ede03dc116eec5111f21 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f1ec94e30c5da6f5748dc72d0dd2d7941 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/building-clerezza/index-content-el/1-title> . 
-_:f1ec94e30c5da6f5748dc72d0dd2d7941 <http://discobits.org/ontology#pos> "0" . 
-_:f1ec94e30c5da6f5748dc72d0dd2d7941 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f22b9c9cf6b73dae2fbc2a78631d13901 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/1> . 
-_:f22b9c9cf6b73dae2fbc2a78631d13901 <http://discobits.org/ontology#pos> "1"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:f22b9c9cf6b73dae2fbc2a78631d13901 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f29c2ad7a7fc7b1137acb8ae5bec08181 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/1-content-el/2-content-el/5> . 
-_:f29c2ad7a7fc7b1137acb8ae5bec08181 <http://discobits.org/ontology#pos> "5" . 
-_:f29c2ad7a7fc7b1137acb8ae5bec08181 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f403a88bfccbaeab813b7712c19486781 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/2-content> . 
-_:f403a88bfccbaeab813b7712c19486781 <http://discobits.org/ontology#pos> "1" . 
-_:f403a88bfccbaeab813b7712c19486781 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f405b333cd8dd9582c42f882f510fae01 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-content-el/0> . 
-_:f405b333cd8dd9582c42f882f510fae01 <http://discobits.org/ontology#pos> "0" . 
-_:f405b333cd8dd9582c42f882f510fae01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:f74e17e2f67dfdc85b54b6c724b8d8c91 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/install-as-service/index-title> . 
-_:f74e17e2f67dfdc85b54b6c724b8d8c91 <http://discobits.org/ontology#pos> "0" . 
-_:f74e17e2f67dfdc85b54b6c724b8d8c91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:fbb69762403e0a6c787c3236c8cacf3e1 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/shell/content-el/1-content-el/1> . 
-_:fbb69762403e0a6c787c3236c8cacf3e1 <http://discobits.org/ontology#pos> "1" . 
-_:fbb69762403e0a6c787c3236c8cacf3e1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:fd0402effa446644b73b1110bb8037f81 <http://discobits.org/ontology#holds> <http://localhost:8080/getting-started/index-title> . 
-_:fd0402effa446644b73b1110bb8037f81 <http://discobits.org/ontology#pos> "0" . 
-_:fd0402effa446644b73b1110bb8037f81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:fd41a9a33df321423ea3a2426895a79f1 <http://discobits.org/ontology#holds> <http://localhost:8080/downloads/index-content-el/3-title> . 
-_:fd41a9a33df321423ea3a2426895a79f1 <http://discobits.org/ontology#pos> "0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> . 
-_:fd41a9a33df321423ea3a2426895a79f1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
-_:fff3bde7c78fa045bd406417e0b7aef01 <http://discobits.org/ontology#holds> <http://localhost:8080/contributing/index-content-el/3-content-el/1-content> . 
-_:fff3bde7c78fa045bd406417e0b7aef01 <http://discobits.org/ontology#pos> "1" . 
-_:fff3bde7c78fa045bd406417e0b7aef01 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . 
diff --git a/site/pom.xml b/site/pom.xml
deleted file mode 100644
index e5422e9..0000000
--- a/site/pom.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.clerezza</groupId>
-        <artifactId>clerezza</artifactId>
-        <version>8-SNAPSHOT</version>
-        <relativePath>../parent</relativePath>
-    </parent>
-    <artifactId>website</artifactId>
-    <version>0.3-SNAPSHOT</version>
-    <packaging>bundle</packaging>
-    <name>Clerezza - Website</name>
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.typerendering.core</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.typerendering.scala</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.graphprovider.content</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.ontologies</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.utils</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.scala.utils</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>osgi.services</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.scala-lang</groupId>
-            <artifactId>scala-library</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>jsr311-api</artifactId>
-        </dependency>
-    </dependencies>
-    <build>
-        <sourceDirectory>src/main/scala</sourceDirectory>
-    <testSourceDirectory>src/test/scala</testSourceDirectory>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-activator>org.apache.clerezza.site.Activator</Bundle-activator>
-                        <Export-Package>org.apache.clerezza.site</Export-Package>
-                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
-                    </instructions>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-eclipse-plugin</artifactId>
-                <configuration>
-                    <downloadSources>true</downloadSources>
-                    <downloadJavadocs>true</downloadJavadocs>
-                    <buildcommands>
-                        <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
-                    </buildcommands>
-                    <additionalProjectnatures>
-                        <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
-                    </additionalProjectnatures>
-                    <classpathContainers>
-                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER
-                        </classpathContainer>
-                        <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER
-                        </classpathContainer>
-                    </classpathContainers>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.scala-tools</groupId>
-                <artifactId>maven-scala-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>
-
-
diff --git a/site/readme.txt b/site/readme.txt
deleted file mode 100644
index 83e96c2..0000000
--- a/site/readme.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Editing and deploying the clerezza website
-
-- start the webiste luancher, provisioning/launchers/website-launcher
-
-- Go to http://localhost:8080/graph/upload-form and upload graph.nt to the content graph
-
-- change the site as needed, do not create pages ending with /, create a page ending with /index instead, the entry page is http://localhost:8080/index (you may add "?mode=edit" to edit a page)
-
-- retrieve the modified graph: curl 'http://localhost:8080/graph?name=urn%3Ax-localinstance%3A%2Fcontent.graph' -H 'Accept: application/n-triples' > graph.nt
-
-- commit the changed graph.nt to version control
-
-- execute the deploy.sh script (this requires a unix style system and will typically take several minutes)
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image001.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image001.png
deleted file mode 100644
index c597e9f..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image001.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image003.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image003.png
deleted file mode 100644
index 2f6de74..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image003.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image005.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image005.png
deleted file mode 100644
index d6f22a5..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image005.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image007.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image007.png
deleted file mode 100644
index 49a9cee..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image007.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image009.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image009.png
deleted file mode 100644
index 1521b13..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image009.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image011.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image011.png
deleted file mode 100644
index 4b915d6..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image011.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image013.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image013.png
deleted file mode 100644
index 0591ffd..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image013.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image015.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image015.png
deleted file mode 100644
index 1883a62..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image015.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image017.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image017.png
deleted file mode 100644
index edca8e8..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image017.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image019.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image019.png
deleted file mode 100644
index 30daab5..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image019.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image021.png b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image021.png
deleted file mode 100644
index f47d708..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/images/image021.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/index.html b/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/index.html
deleted file mode 100644
index 5d75aaf..0000000
--- a/site/src/main/resources/CLEREZZA-INF/web-resources/architecture/index.html
+++ /dev/null
@@ -1,448 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<title>Apache Clerezza Stack</title>
-		<link rel="stylesheet" href="../style/style.css" type="text/css"/>
-	</head>
-
-	<body>
-		<div class="zz-header">
-			<div class="bar"></div>
-			<div class="logo">
-				<a href="../" style=""><img src="../images/logo.png" alt="logo" /></a>
-			</div>
-		</div>
-		<div class="column nav">
-			<ul>
-				<li class="top-nav-entry"><div class="title">Documentation</div>
-					<ul class="nav-entries">
-						<li><a href="../getting-started/">Getting Started</a></li>
-						<li><a href="#" class="active">The Apache Clerezza Stack</a></li>
-						<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-						<li><a href="../faq/">FAQ</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Project Infos</div>
-					<ul  class="nav-entries">
-						<li><a href="../downloads/">Downloads</a></li>
-						<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-						<li><a href="../mailinglists/">Mailing lists</a></li>
-						<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-						<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Sponsorship</div>
-					<ul  class="nav-entries">
-						<li><a href="../thanks/">Thanks</a></li>
-						<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-						<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-					</ul>
-				</li>
-			</ul>
-		</div>
-		<div class="zz-content">
-			<div class="column one-column">
-				<h1>The Apache Clerezza Stack</h1>
-				<p>The OSGi (Open Services Gateway initiative) architecture is chosen as the underlying software architecture for the Apache Clerezza to achieve a service oriented and modular design of software components. The OSGi architecture is preferred compared to Service Component Architecture (SCA) · due to its maturity in implementation and support.
-
-Figure 1 presents the architectural components of Apache Clerezza. Interactions of those components are described in detail in subsequent sections. To perform a certain function, a component may use OSGi services provided by other components. OSGi services provided by a component can also be exposed as Web services, to be made accessible through the Web service framework.
-				</p>
-				<h3>Table of Content</h3>
-				<ol class="toc">
-					<li><a href="#scb">Smart Content Binding</a></li>
-					<li><a href="#rest">RESTful Web Service Framework</a></li>
-					<li><a href="#security">Security</a></li>
-					<li><a href="#user">User Management</a></li>
-				</ol>
-				<br/>
-				<img style="height: 600px;" src="images/image001.png"/>
-				<div class="figure-desc">Figure 1: Architectural components of Clerezza.</div>
-				<br/>
-				<br/>
-				<a name="scb"></a>
-				<h2>1. Smart Content Binding (SCB)</h2>
-				<p>SCB defines a technology-agnostic layer to access and modify triple stores. It provides a java implementation of the graph data model specified by W3C RDF and functionalities to operate on that data model. SCB offers a service interface to access multiple named graphs and it can use various weighted providers to manage RDF graphs in a technology specific manner, e.g., using Jena · or Sesame. It also provides for adaptors that allow an application to use Jena or Sesame APIs to proc [...]
-				</p>
-				<img src="images/image003.png"/>
-				<div class="figure-desc">Figure 2: Smart Content Binding</div>
-				<h3>1.1 Triple Collections</h3>
-				<p>A Triple Collection is a set of triples, and thus, does not contain duplicates. A Triple Collection can be seen as a database in Relational Database Management Systems. Each triple comprises a subject, an object, and a predicate which relates the subject to the object. Note that, this relation is a directed relation. Possible data types (classes) that a subject, a predicate, or an object can have, is defined in Table 1. Figure 3 depicts the class diagram of those data types, which [...]
-				</p>
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 40%;"></th>
-							<th class="center" style="width: 20%">Subject</th>
-							<th class="center" style="width: 20%">Predicate</th>
-							<th class="center" style="width: 20%">Object</th>
-						</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td class="first-col">Plain Literal</td>
-						<td class="center">-</td>
-						<td class="center">-</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">Typed Literal</td>
-						<td class="center">-</td>
-						<td class="center">-</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">Blank Node</td>
-						<td class="center">x</td>
-						<td class="center">-</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">URI Reference</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					</tbody>
-				</table>
-				<div class="figure-desc">Table 1: Data types for subject, predicate, and object of a triple.</div>
-				<br/>
-				<br/>
-				<img src="images/image005.png"/>
-				<div class="figure-desc">Figure 3: Class diagram of resources</div>
-				<p>The triples in a Triple Collection constitute a directed graph. Principally all triples can be placed within a single graph. However, it is practical to group triples and give them a name, resulting in a named graph. This name allows a graph to be referred to when accessing it. In many cases, it is useful to have graphs which are not modifiable, i.e., triples cannot be added to neither removed from the graph. Graphs which are not modifiable, are called Immutable Graphs (or just Gr [...]
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 40%;">Function</th>
-							<th style="width: 30%">Description</th>
-							<th style="width: 30%">Triple Collection</th>
-						</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td class="first-col">Filter</td>
-						<td >Given a triple pattern, this operation must return all triples that match the pattern.  </td>
-						<td>MGraphs and Graphs</td>
-					</tr>
-					<tr>
-						<td class="first-col">Add Listener</td>
-						<td >Register a listener which will be notified if there is a change in the MGraph which match the specified pattern.</td>
-						<td >MGraphs</td>
-					</tr>
-					<tr>
-						<td class="first-col">Remove Listener</td>
-						<td >Deregister a listener.</td>
-						<td >MGraphs</td>
-					</tr>
-					<tr>
-						<td class="first-col">Equals</td>
-						<td >Test on isomorphism of two graphs.</td>
-						<td >Graphs</td>
-					</tr>
-					</tbody>
-				</table>
-				<div class="figure-desc">Table 2: Main functions supported by MGraphs and Graphs.</div>
-				<p>In order to prevent concurrent modifications on an MGraph by different threads, a graph locking mechanism is required. Setting a read-lock on an MGraph prevents other threads from writing the MGraph, whereas setting a write-lock prevcnts other threads from reading and writing it.</p>
-				<h3>1.2 GraphNode</h3>
-				<p>A GraphNode is an object which represents a node (RDF resource) in a Triple Collection. It provides useful methods to obtain information about the node. Table 3 lists these methods and their descriptions.
-				</p>
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 40%;">Function</th>
-							<th style="width: 60%">Description</th>
-						</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td class="first-col">Get Node Context</td>
-						<td class="">The context of a node are the triples containing the node
-
- as subject or object and recursively the context of the blank nodes in any of these statements (triples). This method returns a Graph containing these triples. Blank nodes in this Graph are the same instances as in the original Triple Collection.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Delete Node Context</td>
-						<td class="">Delete the context of the node.</td>
-					<tr>
-						<td class="first-col">Get Objects</td>
-						<td class="">Get the objects of statements with this node as subject and a specified property as predicate.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Get Subjects</td>
-						<td class="">Get the subjects of statements with this node as object and a specified property as predicate.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Get Properties</td>
-						<td class="">Get all available properties of this node as subject.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Get Inverse Properties</td>
-						<td class="">Get all available properties of this node as object.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Add Property</td>
-						<td class="">Add a property to the node with the specified predicate and object.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Delete Properties</td>
-						<td class="">Delete all statement with the node as subject and the specified predicate.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Delete Property</td>
-						<td class="">Delete a statement with the node as subject, the specified property as predicate, and the specified resource as object.</td>
-					</tr>
-					</tbody>
-				</table>
-				<div class="figure-desc">Table 3: Main functions supported by MGraphs and Graphs.</div>
-				<h3>1.3 Triple Collection Providers</h3>
-				<p>A Triple Collection (TC) Provider provides a service to access and manipulate Triple Collections implemented in a specific technology. Table 4 lists the main functions that a TC Provider must support.
-				</p>
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 40%;">Function</th>
-							<th style="width: 60%">Description</th>
-						</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td class="first-col">Create Graph</td>
-						<td class="">Create a Graph for the specified name with triples of the specified Triple Collection.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Create MGraph</td>
-						<td class="">Create an MGraph for the specified name.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Delete Triple Collection</td>
-						<td class="">Delete a Triple Collection, i.e. a Graph or MGraph of the specified name.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Get Graph</td>
-						<td class="">Return a Graph of the specified name.</td>
-					</tr>
-					<tr>
-						<td class="first-col">Get MGraph</td>
-						<td class="">Return an MGraph of the specified name.</td>
-					</tr>
-					</tbody>
-				</table>
-				<div class="figure-desc">Table 4: Main functions supported by a TC Provider.</div>
-				<h3>1.4 Parser and Serializer</h3>
-				<p>A Parsing Provider provides the functionality to parse a Triple Collection from its serialized form into a Graph. Each Parsing Provider is characterized by its supported format. A Parser is a singleton that offers the parsing function by delegating it to registered Parsing Providers.
-				</p>
-				<p>A Serializing Provider provides the functionality to serialize a Triple Collection into the specified format. Each Serializing Provider is characterized by its supported format. A Serializer is a singleton that offers the serialization function by delegating it to registered Serializing Providers.
-				</p>
-				<h3>1.5 SPARQL Support</h3>
-				<p>SPARQL is a protocol and query language for RDF. The SCB architecture defines 4 components to support SPARQL: SPARQL Query, SPARQL Parser, SPARQL Serializer, and SPARQL Engine. In SPARQL Query, Java classes are defined to model the 4 forms of queries defined in SPARQL: Select, Construct, Ask, and Describe. The SPARQL Parser provides the functionality to parse a String into a Query object, whereas the SPARQL Serializer does the opposite. The SPARQL Engine provides a function to exe [...]
-				</p>
-				<h3>1.6 Triple Collection Manager</h3>
-				<p>The Triple Collection (TC) Manager is a singleton that provides access to Triple Collections through registered TC Providers. It also provides methods to execute SPARQL queries through a registered SPARQL Query Engine.
-				</p>
-				<br/>
-				<br/>
-				<a name="rest"></a>
-				<h2>2. RESTful Web Service Framework</h2>
-				<p>The main component of the framework is an implementation of the JSR-311 (JAX-RS) specification ·, a Java API for RESTful Web services. The specification enables easy implementation of RESTful Web services using JAX-RS annotations, based on Java annotation mechanism. There are several implementations of this specification available, but trialox implementation called Triaxrs provided extended functionality, especially Type Handling and Type Rendering, which are described in detail i [...]
-				</p>
-				<h3>2.1 JAX-RS Resources</h3>
-				<p>A Web request is handled by a certain method of an intance of a certain Java class. This Java class is called a JAX-RS resource (in JAX-RS terminology, it is called a resource class), and the method is called a resource method. JAX-RS resources and their resource methods are annotated with JAX-RS annotations in order to allow Triaxrs to find and instantiate the right JAX-RS resource and invoke the right resource method to process an incoming Web request. JAX-RS annotations are use [...]
-				</p>
-				<h3>2.2 JAX-RS Providers</h3>
-				<p>The functionality of a JAX-RS runtime is extended using application-supplied provider classes. JAX-RS specifies 3 types of providers: Entity Providers, Context Providers, and Exception Mapping Providers, as depicted in Figure 4. Entity providers supply mapping services between representations and their associated Java classes. There are 2 types of Entity Providers: Message Body Reader (MBR) and Message Body Writer (MBW). Context Providers supply context to resource classes and oth [...]
-				</p>
-				<img src="images/image007.png"/>
-				<div class="figure-desc">Figure 4: JAX-RS providers.</div>
-
-				<p>A number of MBRs and MBWs are to be implemented within the framework in order to support Java classes which are often used. They are listed in Table 5.</p>
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 60%;">Java Class</th>
-							<th class="center" style="width: 20%">MBR</th>
-							<th class="center" style="width: 20%">MBW</th>
-						</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td class="first-col">String</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">byte[]</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">java.io.File</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.ws.rs.core.MultivaluedMap<String, String>
-(defined by JAX-RS for HTML form's content type
-application/x-www-form-urlencoded)</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">java.io.InputStream</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">java.io.Reader</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.xml.transform.stream.StreamSource</td>
-						<td class="center">x</td>
-						<td class="center">-</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.xml.transform.sax.SAXSource</td>
-						<td class="center">x</td>
-						<td class="center">-</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.xml.transform.dom.DOMSource</td>
-						<td class="center">x</td>
-						<td class="center">-</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.xml.transform.Source</td>
-						<td class="center">-</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">javax.ws.rs.core.StreamingOutput</td>
-						<td class="center">-</td>
-						<td class="center">x</td>
-					</tr>
-					<tr>
-						<td class="first-col">org.apache.clerezza.jaxrs.utils.form.MultiPartBody
-(defined by apache clerezza for HTML form's content type multipart/form-data </td>
-						<td class="center">x</td>
-						<td class="center">-</td>
-					</tr>
-					<tr>
-						<td class="first-col">org.apache.clerezza.rdf.core.Graph
-(implemented within SCB)</td>
-						<td class="center">x</td>
-						<td class="center">x</td>
-					</tr>
-					</tbody>
-				</table>
-
-				<h3>2.3 Web Request Processing</h3>
-				<img src="images/image009.png"/>
-				<div class="figure-desc">Figure 5: Web request processing.</div>
-				<p>Figure 5 shows the typical sequence of interactions between various components involved in the processing of a Web request after delivered to the Triaxrs Core. The Triaxrs Core selects a resource method by matching annotated resource methods to the Web request. Before invoking the matched method, all parameters of the method are constructed by using relevant Context Providers and Message Body Readers. The result of the method invocation is a Java object (an instance of a certain J [...]
-				</p>
-
-				<h3>2.4 Type Handling</h3>
-				<p>In JAX-RS specification, the URL of a Web request determines candidate JAX-RS resources and methods, whereas RDF uses a URI Reference (which can also be used as URL) to identify a resource. Note that an RDF resource can also be a blank node, in which case it is not processable through Type Handling. Therefore, a Type Handler Space can be annotated to match any URL, and it can use the URL as the URI Reference of the RDF resource to be processed. However, this requires:
-				</p>
-				<ol>
-					<li><div>The URI Reference of an RDF resource must use the same scheme and authority part as the URL of the Web service.</div></li>
-					<li><div>A minor change in the resource matching algorithm in the JAX-RS Maintenance Release Specification 1.1, in order to ease the implementation of the Type Handling mechanism. This minor change was proposed to JSR 311 Project by trialox and received a positive feedback.</div></li>
-				</ol>
-				<img src="images/image011.png"/>
-				<div class="figure-desc">Figure 6: Web request processing involving a Type Handler.</div>
-				<p>The sequence of a Web request processing involving a Type Handler is depicted in Figure 6. The Type Handler Space matches any URL and returns a Type Handler supporting an RDF type of the RDF resource requested. In order to find the right Type Handler, the Type Handler Space needs to access the Triple Store which has the triple stating the RDF type of the requested RDF resource. Furthermore, Type Handlers are annotated with information on supported RDF types and a property denoting [...]
-				</p>
-				<h3>2.5 Type Rendering</h3>
-				<p>Similar to Type Handling a mechanism to map the RDF type of an RDF resource to a rendering definition will be useful. This mechanism is termed Type Rendering. A rendering definition stores the following information:
-				</p>
-				<ul>
-					<li><div>Rendering Specification: a template for rendering a GraphNode.</div></li>
-					<li><div>Renderlet: an object that provides the functionality to render a GraphNode based on the Rendering Specification</div></li>
-					<li><div>Media Type: the media type of the resulting document.</div></li>
-					<li><div>Rendering Mode: a parameter to configure the rendering behavior.</div></li>
-					<li><div>Rendered Type: the applicable RDF type.</div></li>
-				</ul>
-				<br/>
-				<p>In order to support Type Rendering in Triaxrs, a generic Message Body Writer for GraphNodes is required, which is annotated as being capable to produce any media type. Based on the accept header of the Web request, the optional query parameter “mode” in the Web request, and the RDF type of the GraphNode to be rendered, a matching rendering definition is selected. The renderlet is extracted from the rendering definition and its render method is invoked to render the GraphNode accor [...]
-				</p>
-				<img src="images/image013.png"/>
-				<div class="figure-desc">Figure 7: Web request processing involving a Type Handler.</div>
-				<br/>
-				<br/>
-				<a name="security"></a>
-				<h2>3. Security</h2>
-				<p>Some services provided by Apache Clerezza are restricted to specific users only. Therefore, Apache Clerezza must support user authentication and authorization. </p>
-				<h3>3.1 Authentication</h3>
-				<img src="images/image015.png"/>
-				<div class="figure-desc">Figure 8: Authentication.</div>
-				<p>Figure 8 shows the authentication process. Before a Web request is delivered to Triaxrs Core for processing, the user who submitted the Web request must first be authenticated. The Web Request Handler forwards the Web request received from the Web server to the Authentication component. This component invokes registered Authentication Methods in a sequence according to their priority (weight). Each Authentication Method extracts user credentials from the Web request and returns th [...]
-				<p>After the user (a.k.a subject in JAAS) is successfully authenticated, the Web request is delivered to the Triaxrs Core to be processed. This Web request processing is carried out within the method Subject.doAsPrivileged, a JAAS authorization mechanism. This method receives three parameters: a subject, an action, and an access control context. The specified action is carried out as the specified subject within the specified access control context. This means, Triaxrs Core processes [...]
-				</p>
-			
-				<h3>3.2 Authorization</h3>
-				<img src="images/image017.png"/>
-				<div class="figure-desc">Figure 9: A typical interaction of components involved in authorization.</div>
-				<p>Authorization in Apache Clerezza is based on JAAS. The following steps are performed to use JAAS for authorization:
-				</p>
-				<ul>
-					<li><div>A Security Manager must be activated. Apache Clerezza activates a default Security Manager provided by the Java Virtual Machine when Apache Clerezza starts.</div></li>
-					<li><div>A security policy must be set. The User-Based Authorization component of Apache Clerezza sets a security policy which implements the Java Policy API function getPermissions to deliver permissions (access rights) for a given subject. These permissions are stored in a specific Triple Collection in Apache Clerezza.</div></li>
-					<li><div>Before executing a code segment that requires an authorization, e.g., when a user wants to modify an MGraph, an access control is triggered by invoking the method  AccessController.checkPermission and passing the respective Java Permission object as the parameter (in this case, a Java Permission object for modifying an MGraph). Since the code segment is performed on behalf of the authenticated subject, JAAS consults (retrieve permissions of a subject from) currently install [...]
-				</ul>
-				<br/>
-				<br/>
-				<a name="user"></a>
-				<h2>4. User Management</h2>
-				<p>The User Manager provides a service to create users and roles, and assign permissions to them. A role represents a set of rights which are needed by a user having a certain function to perform her tasks. To describe users and roles, a set of ontologies is used as depicted in Figure 10. A user is defined as a FOAF Agent, and she can be assigned a set of roles. A user inherits the permissions of her roles. This means, assigning a user a certain role has the effect of assigning the p [...]
-				<p>Two own ontology namespaces are defined, as can be seen in Figure 10: PLATFORM and PERMISSION. This is due to the fact, that existing ontologies do not provide required properties and classes. Instead of FOAF name, the property userName, defined in own ontology termed PLATFORM, is used to identify a user, because unlike FOAF name, the value of userName must be unique. To allow usage of permission definitions besides Java-based permissions, the class Permission in the namespace PER [...]
-				</p>
-				<img src="images/image019.png"/>
-				<div class="figure-desc">Figure 10: Onotlogies for user and roles.</div>
-				<p>Apache Clerezza pre-defines two roles: base-role and default-role. The base-role has a set of permissions which allow a user having this role to use services made public by Apache Clerezza. This requires read access to various graphs and the following Java permission specification: (java.util.PropertyPermission "*" "read") and (org.osgi.framework.AdminPermission "*" "resource"). Any user implicitly has the base-role. A user with a default-role has additionally the permissions to c [...]
-			</div>
-		</div>
-		<div class="footer">
-			<div class="logos"><img src="../images/feather.png" /><img src="../images/sw-vert-w3c.png" /><img src="../images/footer-logo.png" /></div>
-			<div class="divider"></div>
-			<div class="dark">
-				<div class="sitemap">
-					<div class="sitemap-title">Sitemap</div>
-					<div class="sitemap-content">
-						<div class="sitemap-column">
-							<div class="title" >Documentation</div>
-							<ul>
-								<li><a href="../getting-started/">Getting Started</a></li>
-								<li><a href="../architecture/">The Apache Clerezza Stack</a></li>
-								<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-								<li><a href="../faq/">FAQ</a></li>
-							</ul>
-
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Project Infos</div>
-							<ul >
-								<li><a href="../downloads/">Downloads</a></li>
-								<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-								<li><a href="../mailinglists/">Mailing lists</a></li>
-								<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-								<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-							</ul>
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Sponsorship</div>
-							<ul>
-								<li><a href="../thanks/">Thanks</a></li>
-								<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-								<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-							</ul>
-						</div>
-					</div>
-
-				</div>
-				<div class="copyright">Apache Clerezza, Clerezza, Apache, the Apache feather logo, and the Apache Clerezza project logo are trademarks of The Apache Software Foundation. <br></br>&copy; 2011 The Apache Software Foundation.</div>
-			</div>
-		</div>
-	</body>
-</html>
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/images/feather.png b/site/src/main/resources/CLEREZZA-INF/web-resources/images/feather.png
deleted file mode 100644
index e139692..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/images/feather.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/images/footer-logo.png b/site/src/main/resources/CLEREZZA-INF/web-resources/images/footer-logo.png
deleted file mode 100644
index 2e88658..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/images/footer-logo.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/images/logo.png b/site/src/main/resources/CLEREZZA-INF/web-resources/images/logo.png
deleted file mode 100644
index e641b7d..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/images/logo.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/images/sw-vert-w3c.png b/site/src/main/resources/CLEREZZA-INF/web-resources/images/sw-vert-w3c.png
deleted file mode 100644
index ad3770d..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/images/sw-vert-w3c.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/mailinglists/index.html b/site/src/main/resources/CLEREZZA-INF/web-resources/mailinglists/index.html
deleted file mode 100644
index 597142f..0000000
--- a/site/src/main/resources/CLEREZZA-INF/web-resources/mailinglists/index.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<title>Apache Clerezza</title>
-		<link rel="stylesheet" href="../style/style.css" type="text/css"/>
-	</head>
-
-	<body>
-		<div class="zz-header">
-			<div class="bar"></div>
-			<div class="logo">
-				<a href="../" style=""><img src="../images/logo.png" alt="logo" /></a>
-			</div>
-		</div>
-		<div class="column nav">
-			<ul>
-				<li class="top-nav-entry"><div class="title">Documentation</div>
-					<ul class="nav-entries">
-						<li><a href="../getting-started/">Getting Started</a></li>
-						<li><a href="../architecture/">The Apache Clerezza Stack</a></li>
-						<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-						<li><a href="../faq/">FAQ</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Project Infos</div>
-					<ul  class="nav-entries">
-						<li><a href="../downloads/">Downloads</a></li>
-						<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-						<li><a href="#" class="active">Mailing lists</a></li>
-						<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-						<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Sponsorship</div>
-					<ul  class="nav-entries">
-						<li><a href="../thanks/">Thanks</a></li>
-						<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-						<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-					</ul>
-				</li>
-			</ul>
-		</div>
-		<div class="zz-content">
-			<div class="column one-column">
-				<h1>Mailing lists</h1>
-				The following mailing lists have been established for Apache Clerezza. For each list, there is a subscribe, unsubscribe, and archive link.
-				<br/>
-				<br/>
-				<br/>
-				<table class="">
-					<thead>
-						<tr>
-							<th class="first-col" style="width: 40%;">Name</th>
-							<th class="center" style="width: 20%">Subscribe</th>
-							<th class="center" style="width: 20%">Unsubscribe</th>
-							<th class="center" style="width: 20%">Archive</th>
-						</tr>
-					</thead>
-					
-					<tbody>
-					<tr>
-						<td class="first-col"><strong>Clerezza Developers</strong> - For people using and developing Clerezza:<br/>clerezza-dev at incubator.apache.org</td>
-						<td class="center"><a href="mailto:clerezza-dev-subscribe@incubator.apache.org" class="" >Subscribe</a></td>
-						<td class="center"><a href="mailto:clerezza-dev-unsubscribe@incubator.apache.org" class="" >Unsubscribe</a></td>
-						<td class="center"><a href="http://mail-archives.apache.org/mod_mbox/incubator-clerezza-dev/" class="" >Mail Archive</a></td>
-					</tr>
-					<tr>
-						<td class="first-col"><strong>Clerezza Commits</strong> - For people interested in code changes:<br/>clerezza-commits at incubator.apache.org</td>
-						<td class="center"><a href="mailto:clerezza-commits-subscribe@incubator.apache.org" class="" >Subscribe</a></td>
-						<td class="center"><a href="mailto:commits-unsubscribe@felix.apache.org" class="" >Unsubscribe</a></td>
-						<td class="center"><a href="http://mail-archives.apache.org/mod_mbox/incubator-clerezza-commits/" class="" >Mail Archive</a></td>
-					</tr>
-					</tbody>
-				</table>
-				<br/>
-				<br/>
-				<strong>Note:</strong> please don't send patches or attachments to any of the mailing lists. Patches are best handled via the Issue Tracking system. Otherwise, please upload the file to a public server and include the URL in the mail. 
-			</div>
-		</div>
-		<div class="footer">
-			<div class="logos"><img src="../images/feather.png" /><img src="../images/sw-vert-w3c.png" /><img src="../images/footer-logo.png" /></div>
-			<div class="divider"></div>
-			<div class="dark">
-				<div class="sitemap">
-					<div class="sitemap-title">Sitemap</div>
-					<div class="sitemap-content">
-						<div class="sitemap-column">
-							<div class="title" >Documentation</div>
-							<ul>
-								<li><a href="../getting-started/">Getting Started</a></li>
-								<li><a href="../architecture/">The Apache Clerezza Stack</a></li>
-								<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-								<li><a href="../faq/">FAQ</a></li>
-							</ul>
-
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Project Infos</div>
-							<ul >
-								<li><a href="../downloads/">Downloads</a></li>
-								<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-								<li><a href="../mailinglists/">Mailing lists</a></li>
-								<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-								<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-							</ul>
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Sponsorship</div>
-							<ul>
-								<li><a href="../thanks/">Thanks</a></li>
-								<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-								<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-							</ul>
-						</div>
-					</div>
-
-				</div>
-				<div class="copyright">Apache Clerezza, Clerezza, Apache, the Apache feather logo, and the Apache Clerezza project logo are trademarks of The Apache Software Foundation. <br></br>&copy; 2011 The Apache Software Foundation.</div>
-			</div>
-		</div>
-	</body>
-</html>
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L001.otf b/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L001.otf
deleted file mode 100644
index a99ce84..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L001.otf and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L003.otf b/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L003.otf
deleted file mode 100644
index dd4a6e5..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumText25L003.otf and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumTitle20.otf b/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumTitle20.otf
deleted file mode 100644
index 4ca3960..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/fonts/TitilliumTitle20.otf and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-bar.png b/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-bar.png
deleted file mode 100644
index ba97558..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-bar.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-divider.gif b/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-divider.gif
deleted file mode 100644
index 171e35e..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/bg-divider.gif and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/icn-note.jpg b/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/icn-note.jpg
deleted file mode 100644
index fb0f02f..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/icn-note.jpg and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/logo-big.png b/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/logo-big.png
deleted file mode 100644
index e641b7d..0000000
Binary files a/site/src/main/resources/CLEREZZA-INF/web-resources/style/images/logo-big.png and /dev/null differ
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/style/style.css b/site/src/main/resources/CLEREZZA-INF/web-resources/style/style.css
deleted file mode 100644
index af490cc..0000000
--- a/site/src/main/resources/CLEREZZA-INF/web-resources/style/style.css
+++ /dev/null
@@ -1,431 +0,0 @@
-@charset "UTF-8";
-
-@font-face {
-	font-family: Titillium Text;
-	src: url('fonts/TitilliumText25L003.otf') format("opentype");
-}
-
-@font-face {
-	font-family: Titillium Title;
-	src: url('fonts/TitilliumTitle20.otf') format("opentype");
-
-}
-
-@font-face { 
-	font-family: Titillium Bold;
-	src: url('fonts/TitilliumText25L001.otf') format("opentype");
-
-}
-
-
-.tx-blockcode {
-    background-color: #e9f4cd;
-    display: block;
-    margin: 1em;
-    padding: 0.5em;
-    white-space: pre;
-    font-family: monospace;
-    font-size: 1.2em;
-    -moz-border-radius: 5px;
-    border-radius: 5px;
-    overflow: auto;
-}
-
-.toc {
-	padding: 0em 2em;
-	background-color: white;
-}
-
-.toc li {
-	margin-bottom: 0;
-}
-
-body {
-	font-family: Arial, Helvetica;
-	margin-left: 0em;
-	margin-top:0em;
-	margin-right:0em;
-	color:#666666;
-	font-size: 0.85em;
-}
-
-table {
-	border-collapse: collapse;
-	border: none;
-}
-
-table th, table td {
-	padding: 0.25em;
-	border: 1px solid #9a9a9a;
-	border-right: none;
-	border-top: none;
-}
-
-th {
-	text-align: left;
-	font-family: Titillium Bold, Arial, Helvetica;
-}
-
-td {
-	font-size: 0.85em;
-}
-
-.first-col {
-	border-left: none;
-}
-
-.center {
-	text-align: center;
-}
-
-h1 {
-	font-family: Titillium Title, Arial, Helvetica;
-	margin-top: 0em;
-	padding-bottom: 0.5em;
-	border-bottom: 1px solid #A5A5A5;
-	color:#000000;
-}
-
-h2 {
-	font-family: Titillium Title, Arial, Helvetica;
-	padding-bottom: 0.5em;
-	border-bottom: 1px solid #A5A5A5;
-	color:#000000;
-}
-
-h3 {
-	font-family: Titillium Title, Arial, Helvetica;
-	margin-bottom: 0.25em;
-	color: #000000;
-}
-
-h4 {
-	font-family: Titillium Title, Arial, Helvetica;
-	margin-bottom: 0.05em;
-}
-
-h1 strong {
-	font-family: Titillium Bold, Arial, Helvetica;
-	color:#000000;
-}
-
-h2 strong {
-	font-family: Titillium Bold, Arial, Helvetica;
-	color:#000000;
-}
-
-h3 strong {
-	font-family: Titillium Bold, Arial, Helvetica;
-	color:#000000;
-}
-
-h4 strong {
-	font-family: Titillium Bold, Arial, Helvetica;
-	color:#000000;
-}
-
-span.note {
-	background-image: url('images/icn-note.jpg');
-	background-repeat: no-repeat;
-	background-position: 0 0.5em;
-	padding-left: 40px;
-	display: block;
-	margin: 1em;
-}
-
-.green {
-	color:#98bf0e;
-}
-
-a {
-    color: #98bf0e;
-    text-decoration: none;
-}
-
-a:hover {
-	text-decoration: underline;
-}
-
-ol li {
-	list-style-type:decimal;
-	color:#98bf0e;
-	margin-bottom: 0.738em;
-}
-
-ul li {
-	list-style-type:disc;
-	color:#98bf0e;
-	margin-bottom: 0.738em;
-}
-
-li div,span {
-	color:#666666;
-}
-
-.bar {
-	height: 38px;
-	background-color:#98bf0e;
-	background-image: url('images/bg-bar.png');
-	background-repeat: repeat-x;
-	width: 100%;
-}
-
-.logo {
-	position: absolute;
-	top: 0em;
-	left: 4em;
-}
-
-.logo img{
-	border: 0em;
-}
-
-.nav {
-	margin-top:14em;
-	margin-left:5em;
-	width:192px;
-}
-
-.nav ul {
-	margin-top:0em;
-	padding-left:0em;
-	font-size: 110%;
-}
-
-.nav > ul > li.top-nav-entry {
-	list-style-type: none;
-	margin-bottom: 2em;
-    padding-bottom: 0.4em;
-	/*border-bottom: 1px solid #666666;*/
-}
-
-.nav > ul > li .title {
-	font-family: Titillium Text, Arial, Helvetica;
-	font-size:1.4em;
-	color: #98bf0e;
-	padding-bottom: 0.6em;
-	border-bottom: 2px solid #98bf0e;
-}
-
-.top-nav-entry ul > li {
-	margin-top: 0.525em;
-	margin-bottom: 0em;
-	list-style-type: none;
-}
-
-.top-nav-entry ul > li a {
-	font-size: 0.85em;
-	color:#666666;
-}
-
-.top-nav-entry ul > li a.active {
-	color: #98bf0e;
-	text-decoration:underline;
-}
-
-.top-nav-entry ul > li a:hover {
-	color: #98bf0e;
-	text-decoration:underline;
-}
-
-.nav-entries {
-	border-bottom: 1px solid #a5a5a5;
-	padding-bottom: 0.8em;
-}
-
-.zz-control {
-	float: right;
-	margin-top:50px;
-}
-
-.zz-control .actions {
-	margin-top:14em;
-	color: #666666
-}
-
-.zz-control .actions a {
-	color: #666666
-}
-
-.zz-content {
-	margin-top:14em;
-	margin-left:25em;
-	/*width:70%;*/
-	max-width:600px;
-	line-height: 1.5em;
-	
-}
-
-.zz-content img {
-	max-width: 600px;
-	/** border: 1px solid #666666; */
-	margin: 0.5em;
-	padding: 0.25em;
-}
-
-.zz-content ul {
-	padding-left: 1.3em;
-}
-
-.zz-content .figure-desc {
-	margin-left: 0.5em;
-	font-size: 0.85em;
-	font-style: italic;
-}
-
-.column {
-	float:left;
-	padding-bottom: 3.125em;
-}
-
-.zz-content .column {
-/*	font-size: 0.85em;*/
-}
-
-.one-column {
-	width:100%;
-	min-width: 200px;
-}
-
-.first-column {
-	width:48%;
-	min-width: 200px;
-	padding-right: 4%;
-}
-
-.second-column {
-	min-width: 200px;
-	width:48%;
-}
-
-.dark {
-	background-color:#53534b;
-	float:left;
-	width:100%;
-}
-
-.footer {
-	float:left;
-	width:100%;
-}
-
-.footer .logos {
-	margin-left: 22.25em;
-	margin-bottom: 1.875em;
-}
-
-.footer img {
-	float:none;
-	border: none;
-	padding-right: 2em;
-}
-
-.footer .copyright {
-	color:#a4a49c;
-	float: left;
-	font-size:0.65em;
-	text-align: center;
-	width: 100%;
-	margin: 32px 0px;
-	line-height: 1.5em;
-}
-
-.footer .sitemap {
-    background-image: url('images/bg-divider.gif'); 
-    background-repeat: repeat-x;       
-	width: 100%;
-}
-
-.footer .sitemap-title {
-	font-family: Titillium Text, Arial, Helvetica;
-	float:left;
-	margin-left: 4em;
-	padding-top: 1.875em;
-	padding-bottom: 0.9em;
-	text-transform: uppercase;
-	color: #ffffff;
-	width: 19em;
-	border-bottom: 1px solid #706f6b;
-}
-
-.footer .sitemap-content {
-	margin-left: 22.25em;
-	padding-top: 1.875em;
-	color: #a4a49c;
-}
-
-.footer .sitemap-column {
-	float:left;	
-	width: 12.6em;
-}
-
-/*.footer .title-line {
-	border-bottom: 1px solid #a4a49c;
-    height: 3em;
-    margin-left: 3.125em;
-    margin-top: 1.125em;
-    position: absolute;
-    width: 100%;
-	max-width: 960px;
-}*/
-
-.footer .sitemap-column .title {
-	font-family: Titillium Text, Arial, Helvetica;
-	margin-bottom: 1.325em;
-	border-bottom: 1px solid #706f6b;
-	padding-bottom: 0.9em;
-	text-transform: uppercase;
-}
-
-.footer .sitemap-column ul {
-	margin-top:0em;
-	padding-left:0em;
-}
-
-.footer .sitemap-column ul li {
-	list-style-type:none;
-	padding-left:0em;
-	font-size: 0.75em;
-
-}
-
-.footer .sitemap-column a {
-	color: #a4a49c;
-}
-
-.footer .sitemap-column a:hover {
-	color: #98bf0e;
-	text-decoration:underline;
-}
-
-.footer .divider {
-    height: 0.375em; 
-	background-color:#98bf0e;
-	width:22.25em;
-}
-
-div .module-info {
-	/*margin-left:22.25em;*/
-	position: absolute;
-	left: 22.25em;
-}
-div .module-info div ol {
-	height: 2em;
-}
-
-div .module-info div ol li {
-	list-style: none outside none;
-	float: left;
-	margin: 0 0.14em;
-	padding: 0 0.14em;
-	border: 1px solid #9a9a9a;
-	border-top: none;
-	border-bottom: none;
-	vertical-align: top;
-}
-
-div .module-info div ol li a {
-	color: #a4a49c;
-}
-
-/* Localized */
\ No newline at end of file
diff --git a/site/src/main/resources/CLEREZZA-INF/web-resources/thanks/index.html b/site/src/main/resources/CLEREZZA-INF/web-resources/thanks/index.html
deleted file mode 100644
index b9856d0..0000000
--- a/site/src/main/resources/CLEREZZA-INF/web-resources/thanks/index.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<title>Apache Clerezza Special Thanks</title>
-		<link rel="stylesheet" href="../style/style.css" type="text/css"/>
-	</head>
-
-	<body>
-		<div class="zz-header">
-			<div class="bar"></div>
-			<div class="logo">
-				<a href="../" style=""><img src="../images/logo.png" alt="logo" /></a>
-			</div>
-		</div>
-		<div class="column nav">
-			<ul>
-				<li class="top-nav-entry"><div class="title">Documentation</div>
-					<ul class="nav-entries">
-						<li><a href="../getting-started/">Getting Started</a></li>
-						<li><a href="../architecture/">The Apache Clerezza Stack</a></li>
-						<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-						<li><a href="../faq/">FAQ</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Project Infos</div>
-					<ul  class="nav-entries">
-						<li><a href="../downloads/" >Downloads</a></li>
-						<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-						<li><a href="../mailinglists/">Mailing lists</a></li>
-						<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-						<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-					</ul>
-				</li>
-				<li class="top-nav-entry"><div class="title">Sponsorship</div>
-					<ul  class="nav-entries">
-						<li><a href="#" class="active">Thanks</a></li>
-						<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-						<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-					</ul>
-				</li>
-			</ul>
-		</div>
-		<div class="zz-content">
-			<div class="column one-column">
-				<h1>Thanks</h1>
-				<p>To all who have helped to make Apache Clerezza a reality. Specially we want to thank to:</p>
-				<ul>
-					<li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Apache Software Foundation Sponsors</li>
-					<li><div><a href="http://www.kti.admin.ch/" target="_blank">Confederation’s innovation promotion agency</a> for financing research </div></li>
-					<li><div><a href="http://www.getunik.com/" target="_blank">getunik AG</a> for sponsoring the Clerezza T-Shirts and initial financial donations</div></li>
-					<li><div><a href="http://www.unknown.de/" target="_blank">unknown?</a> for sponsoring the Clerezza Website Theme and Logo</div></li>
-				</ul>
-				</p>
-
-			</div>
-		</div>
-		<div class="footer">
-			<div class="logos"><img src="../images/feather.png" /><img src="../images/sw-vert-w3c.png" /><img src="../images/footer-logo.png" /></div>
-			<div class="divider"></div>
-			<div class="dark">
-				<div class="sitemap">
-					<div class="sitemap-title">Sitemap</div>
-					<div class="sitemap-content">
-						<div class="sitemap-column">
-							<div class="title" >Documentation</div>
-							<ul>
-								<li><a href="../getting-started/">Getting Started</a></li>
-								<li><a href="../architecture/">The Apache Clerezza Stack</a></li>
-								<li><a href="http://incubator.apache.org/clerezza/mvn-site" target="_blank">API docs</a></li>
-								<li><a href="../faq/">FAQ</a></li>
-							</ul>
-
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Project Infos</div>
-							<ul >
-								<li><a href="../downloads/">Downloads</a></li>
-								<li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-								<li><a href="../mailinglists/">Mailing lists</a></li>
-								<li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-								<li><a href="http://svn.apache.org/viewvc/incubator/clerezza/trunk/" target="_blank">Source Repository</a></li>
-							</ul>
-						</div>
-						<div class="sitemap-column">
-							<div class="title" >Sponsorship</div>
-							<ul>
-								<li><a href="#">Thanks</a></li>
-								<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-								<li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-							</ul>
-						</div>
-					</div>
-
-				</div>
-				<div class="copyright">Apache Clerezza, Clerezza, Apache, the Apache feather logo, and the Apache Clerezza project logo are trademarks of The Apache Software Foundation. <br></br>&copy; 2011 The Apache Software Foundation.</div>
-			</div>
-		</div>
-	</body>
-</html>
diff --git a/site/src/main/scala/Activator.scala b/site/src/main/scala/Activator.scala
deleted file mode 100644
index cc28730..0000000
--- a/site/src/main/scala/Activator.scala
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.clerezza.site
-
-import org.osgi.framework.{BundleActivator, BundleContext, ServiceRegistration}
-import scala.collection.JavaConversions.asJavaDictionary
-import org.apache.clerezza.platform.typerendering.{TypeRenderlet, RenderletManager}
-//import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider
-import org.apache.clerezza.rdf.core.access.TcManager
-import org.apache.clerezza.osgi.services.ServicesDsl
-import org.apache.clerezza.platform.Constants
-//import org.apache.clerezza.rdf.core.event.{GraphEvent, FilterTriple, GraphListener}
-import org.apache.clerezza.rdf.core.serializedform.{Serializer, SupportedFormat, Parser}
-import java.io.{FileOutputStream, FileInputStream, File}
-
-/**
- * Activator for a bundle using Apache Clerezza.
- */
-class Activator extends BundleActivator {
-
-  var renderletRegistration, 
-  titledContentRenderletRegistration,
-  globalMenuRenderletRegistration: ServiceRegistration[TypeRenderlet] = null
-  //var graphListenerOption: Option[GraphListener] = null
-
-  /**
-   * called when the bundle is started, this method initializes the provided service
-   */
-  def start(context: BundleContext) {
-    val servicesDsl = new ServicesDsl(context)
-    import servicesDsl._
-
-    val renderlet = new HeadedPageRenderlet
-    renderletRegistration = context.registerService(classOf[TypeRenderlet],
-                          renderlet, null)
-    titledContentRenderletRegistration = context.registerService(classOf[TypeRenderlet],
-                          new TitledContentRenderlet, null)
-    globalMenuRenderletRegistration = context.registerService(classOf[TypeRenderlet],
-                          new GlobalMenuRenderlet, null)
-    //context.installBundle("mvn:org.apache.clerezza/rdf.stable.serializer").start();
-    //context.installBundle("mvn:org.apache.clerezza/tools.offline").start();
-    val path = {
-      val bl = context.getBundle.getLocation
-      bl.substring(bl.indexOf(':')+1)
-    }
-    /*val graphFile = new File(new File(path), "graph.nt");
-    doWith {
-      (tcManager: TcManager, parser: Parser) =>  {
-        val contentGraph = tcManager.getGraph(Constants.CONTENT_GRAPH_URI)
-        val fileGraph = parser.parse(new FileInputStream(graphFile), SupportedFormat.N_TRIPLE)
-        if (contentGraph.size > fileGraph.size) {
-          println("content graph if bigger than the graph from file, not replacing with the content from file and not " +
-            "writing any data to the file, you should manually either write the content graph to the file or clear " +
-            "the content graph. Restart this bundle after resolving the issue.")
-          graphListenerOption = None
-        } else {
-          contentGraph.clear
-          contentGraph.addAll(fileGraph)
-          println("the content graph has been replaced with "+graphFile)
-          object graphListener extends GraphListener {
-            val serializer = $[Serializer]
-            override def graphChanged(events: java.util.List[GraphEvent]) {
-              serializer.serialize(new FileOutputStream(graphFile), contentGraph,SupportedFormat.N_TRIPLE)
-            }
-          }
-          contentGraph.addGraphListener(graphListener, new FilterTriple(null, null, null), 2000)
-          graphListenerOption = Some(graphListener)
-          println("A GraphListener has been added that writes changes to the content graph to graph.nt")
-        }
-      }
-    }*/
-  }
-
-
-  /**
-   * called when the bundle is stopped, this method unregisters the provided service
-   */
-  def stop(context: BundleContext) {
-    renderletRegistration.unregister()
-    titledContentRenderletRegistration.unregister()
-    globalMenuRenderletRegistration.unregister()
-    val servicesDsl = new ServicesDsl(context)
-    import servicesDsl._
-    val tcManager = $[TcManager]
-    val contentGraph = tcManager.getGraph(Constants.CONTENT_GRAPH_URI)
-    /*graphListenerOption match {
-      case Some(l) => contentGraph.removeGraphListener(l)
-      case None => ;
-    }*/
-    println("bye")
-  }
-
-}
diff --git a/site/src/main/scala/GlobalMenuRenderlet.scala b/site/src/main/scala/GlobalMenuRenderlet.scala
deleted file mode 100644
index 2ac82f5..0000000
--- a/site/src/main/scala/GlobalMenuRenderlet.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.clerezza.site
-
-import javax.ws.rs.core.MediaType
-import org.apache.clerezza.platform.typerendering._
-import org.apache.clerezza.commons.rdf.IRI
-import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.ontologies._
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.utils._
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.typerendering.scala._
-import org.apache.clerezza.rdf.ontologies.DC
-
-/**
- * A Renderlet for the menu
- */
-class GlobalMenuRenderlet extends SRenderlet {
-
-  val getRdfType = RDFS.Resource
-
-  override def getModePattern = "menu"
-
-  override def renderedPage(arguments: XmlResult.Arguments) = {
-    new XmlResult(arguments) {
-      def menuLink(href: String, label: String) =
-        if ((res*).endsWith(href) || (res*).endsWith(href + "index")) {
-          <a href={ href } class="active">{ label }</a>
-        } else {
-          <a href={ href }>{ label }</a>
-        }
-      override def content = {
-        def menu(s: Any) = new IRI("http://clerezza.org/2009/11/global-menu#" + s)
-        def rdfs(s: Any) = new IRI("http://www.w3.org/2000/01/rdf-schema#" + s)
-        def platform(s: Any) = new IRI("http://clerezza.org/2009/08/platform#" + s)
-        def dct(s: Any) = new IRI("http://purl.org/dc/terms/" + s)
-
-        resultDocModifier.addScriptReference("/style/scripts/login.js");
-
-        <div class="column nav">
-          <ul>
-            {
-              ifx((res / menu("globalMenu")).length > 0) {
-                for (menuItem <- res / menu("globalMenu")!!) 
-                  yield <li class="top-nav-entry">
-                    <div class="title">
-                      {
-                        if ((menuItem / menu("path")).length > 0) {
-                          <a href={ menuItem / menu("path")* }>{ (menuItem / rdfs("label")*) }</a>
-                        } else {
-                          <a href="#" onclick="return false">{ (menuItem / rdfs("label")*) }</a>
-                        }
-                      }
-                    </div>
-                    {
-                      ifx((menuItem / menu("children")).length > 0) {
-                        <div>
-                          <ul class="nav-entries">
-                            {
-                              for (childMenuItem <- menuItem / menu("children")!!) yield {
-                                <li><a href={ childMenuItem / menu("path")* }>{ childMenuItem / rdfs("label")* }</a><span>{ childMenuItem / dct("description")* }</span></li>
-                              }
-                            }
-                          </ul>
-                        </div>
-                      }
-                    }
-                        </li>
-              }
-            }
-          </ul>
-        </div>
-      }
-
-    }
-  }
-}
diff --git a/site/src/main/scala/HeadedPageRenderlet.scala b/site/src/main/scala/HeadedPageRenderlet.scala
deleted file mode 100644
index 6583c75..0000000
--- a/site/src/main/scala/HeadedPageRenderlet.scala
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.apache.clerezza.site
-
-import javax.ws.rs.core.MediaType
-import org.apache.clerezza.platform.typerendering._
-import org.apache.clerezza.commons.rdf.IRI
-import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.ontologies._
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.utils._
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.typerendering.scala._
-import org.apache.clerezza.rdf.ontologies.DC
-
-/**
- * A Renderlet for the menu
- */
-class HeadedPageRenderlet extends SRenderlet {
-
-  val getRdfType = PLATFORM.HeadedPage
-
-  override def getModePattern = "(?!.*naked).*"
-
-  override def renderedPage(arguments: XmlResult.Arguments) = {
-    new XmlResult(arguments) {
-      def menuLink(href: String, label: String) =
-      if ((res*).endsWith(href) || (res*).endsWith(href+"index")) {
-         <a href={href} class="active">{label}</a>
-      } else {
-         <a href={href}>{label}</a>
-      }
-      override def content = {
-        resultDocModifier.addStyleSheet("/style/style.css");
-resultDocModifier.addScriptReference("/jquery/jquery-1.3.2.min.js");
-/*resultDocModifier.addScriptReference("/jquery/jquery.menu.js");
-resultDocModifier.addScriptReference("/jquery/jquery.panel.js");
-resultDocModifier.addScriptReference("/style/scripts/panel.js");*/
-resultDocModifier.addScriptReference("/scripts/modification-status.js");
-resultDocModifier.addScriptReference("/scripts/status-message.js");
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    {(res/DISCOBITS.contains).find(e => ((e/DISCOBITS.pos*) == "0")) match {
-        case Some(e) => <title>{render(e/DISCOBITS.holds, "naked")}</title>
-        case None => <title>An incomplete titled content {res/DISCOBITS.contains*}</title>
-      }
-    }
-  </head>
-  <body>
-    <div class="zz-header">
-      <div class="bar"></div>
-      <div class="logo">
-        <a href="http://clerezza.apache.org/" style=""><img src="/images/logo.png" alt="logo" /></a>
-      </div>
-      <div class="module-info">
-        <span id="tx-module">
-          <div id="tx-page-actions">
-            <ol id="tx-page-actions-ol">
-            </ol>
-          </div>
-        </span>
-        <div id="tx-module-tabs">
-          <ol id="tx-module-tabs-ol">
-          </ol>
-          
-        </div>
-      </div>
-      
-      <div class="zz-control">
-        <div class="login">
-            {
-              def platform(s: Any) = new IRI("http://clerezza.org/2009/08/platform#"+s)
-              val username = (context/platform("user")/platform("userName")*)
-              if((username).equals("anonymous")) {
-                <span>
-                  <a href="#" id="tx-login-button">login</a>
-                </span>
-              } else {
-                <span><a href={"/user/" + username + "/control-panel"}>{username}</a>|<a href="/logout">logout</a></span>
-              }
-            }
-      </div>
-        <div class="actions" id="tx-contextual-buttons">
-            <ol id="tx-contextual-buttons-ol">
-            </ol>
-          </div>
-        <div id="tx-module-options">
-          <ol id="tx-module-options-ol">
-          </ol>
-        </div>
-        
-        
-        <div class="tx-panel" id="tx-panel">
-          <div id="tx-panel-title"><h3></h3></div>
-          <div class="tx-panel-window">
-            <div class="tx-panel-tab-buttons" id="tx-panel-tab-buttons">
-              <ol id="tx-panel-tab-buttons-ol">
-              </ol>
-            </div>
-            <div class="tx-panel-tabs" id="tx-panel-tabs"></div>
-          </div>
-        </div>
-        
-      </div>
-    </div>
-    {render(context,"menu")}
-    <div class="zz-content">
-    {
-      if (mode == null) {
-        render(res, "naked")
-      } else {
-        render(res, mode + "-naked")
-      }
-    }
-    </div>
-            <div class="footer">
-              <div class="logos"><img src="/images/feather.png" /><img src="/images/sw-vert-w3c.png" /><img src="/images/footer-logo.png" /></div>
-
-              <div class="divider"></div>
-              <div class="dark">
-                <div class="copyright">Apache Clerezza, Clerezza, Apache, the Apache feather logo, and the Apache Clerezza project logo are trademarks of The Apache Software Foundation. <br></br>© 2011 The Apache Software Foundation.</div>
-              </div>
-            </div>
-  </body>
-</html>
-      
-      }
-    }
-  }
-
-}
diff --git a/site/src/main/scala/Ontology.scala b/site/src/main/scala/Ontology.scala
deleted file mode 100644
index 3a2b94d..0000000
--- a/site/src/main/scala/Ontology.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package skeleton
-
-import org.apache.clerezza.commons.rdf.IRI
-
-object Ontology {
-
-  /**
-   * The uri for the RDF type of HelloWordMessage
-   */
-  val HelloWordMessageType = new IRI("http://example.org/skeleton#HelloWordMessage")
-
-}
diff --git a/site/src/main/scala/TitledContentRenderlet.scala b/site/src/main/scala/TitledContentRenderlet.scala
deleted file mode 100644
index fbf783d..0000000
--- a/site/src/main/scala/TitledContentRenderlet.scala
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.apache.clerezza.site
-
-import javax.ws.rs.core.MediaType
-import org.apache.clerezza.platform.typerendering._
-import org.apache.clerezza.commons.rdf.IRI
-import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.ontologies._
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.utils._
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.typerendering.scala._
-import org.apache.clerezza.rdf.ontologies.DC
-
-/**
- * A Renderlet for the menu
- */
-class TitledContentRenderlet extends SRenderlet {
-
-  val getRdfType = DISCOBITS.TitledContent
-
-  override def getModePattern = null
-
-  override def renderedPage(arguments: XmlResult.Arguments) = {
-    new XmlResult(arguments) {
-      def menuLink(href: String, label: String) =
-      if ((res*).endsWith(href) || (res*).endsWith(href+"index")) {
-         <a href={href} class="active">{label}</a>
-      } else {
-         <a href={href}>{label}</a>
-      }
-      override def content = {
-        <html xmlns="http://www.w3.org/1999/xhtml">
-          <head>
-            <link type="text/css" href="/style/style.css" rel="stylesheet" />
-            {(res/DISCOBITS.contains).find(e => ((e/DISCOBITS.pos*) == "0")) match {
-                case Some(e) => <title>{render(e/DISCOBITS.holds, "naked")}</title>
-                case None => <title>An incomplete titled content {res/DISCOBITS.contains*}</title>
-              }
-            }
-          </head>
-          <body>
-            <div class="zz-header">
-
-              <div class="bar"></div>
-              <div class="logo">
-                <a href="http://clerezza.apache.org/" style=""><img src="/images/logo.png" alt="logo" /></a>
-              </div>
-            </div>
-            <div class="column nav">
-              <ul>
-                <li class="top-nav-entry"><div class="title">Documentation</div>
-
-                  <ul class="nav-entries">
-                    <li>{menuLink("/getting-started/","Getting Started")}</li>
-                    <li>{menuLink("/architecture/","The Apache Clerezza Stack")}</li>
-                    <li><a href="http://clerezza.apache.org/apidocs/" target="_blank">API docs</a></li>
-                    <li>{menuLink("/faq/","FAQ")}</li>
-                  </ul>
-                </li>
-
-                <li class="top-nav-entry"><div class="title">Project Infos</div>
-                  <ul  class="nav-entries">
-                    <li>{menuLink("/downloads/","Downloads")}</li>
-                    <li>{menuLink("/contributing/", "Contributing")}</li>
-                    <li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-                    <li>{menuLink("/mailinglists/","Mailing lists")}</li>
-                    <li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-
-                    <li><a href="https://git-wip-us.apache.org/repos/asf?p=clerezza.git" target="_blank">Source Repository</a></li>
-                  </ul>
-                </li>
-                <li class="top-nav-entry"><div class="title">Sponsorship</div>
-                  <ul  class="nav-entries">
-                    <li><a href="/thanks/">Thanks</a></li>
-                    <li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-                    <li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-                  </ul>
-                </li>
-              </ul>
-            </div>
-
-            <div class="zz-content">
-              {render(res, "naked")}
-            </div>
-            <div class="footer">
-              <div class="logos"><img src="/images/feather.png" /><img src="/images/sw-vert-w3c.png" /><img src="/images/footer-logo.png" /></div>
-
-              <div class="divider"></div>
-              <div class="dark">
-                <div class="sitemap">
-                  <div class="sitemap-title">Sitemap</div>
-                  <div class="sitemap-content">
-                    <div class="sitemap-column">
-                      <div class="title" >Documentation</div>
-                      <ul>
-
-                        <li><a href="/getting-started/">Getting Started</a></li>
-                        <li><a href="/architecture/">The Apache Clerezza Stack</a></li>
-                        <li><a href="http://clerezza,apache.org/apidocs/" target="_blank">API docs</a></li>
-                        <li><a href="/faq/">FAQ</a></li>
-                      </ul>
-
-                    </div>
-                    <div class="sitemap-column">
-
-                      <div class="title" >Project Infos</div>
-                      <ul >
-                        <li><a href="/downloads/">Downloads</a></li>
-                        <li><a href="/contributing/">Contributing</a></li>
-                        <li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
-                        <li><a href="mailinglists/">Mailing lists</a></li>
-                        <li><a href="http://issues.apache.org/jira/browse/CLEREZZA" target="_blank">Issue Tracker</a></li>
-
-                        <li><a href="https://git-wip-us.apache.org/repos/asf?p=clerezza.git" target="_blank">Source Repository</a></li>
-                      </ul>
-                    </div>
-                    <div class="sitemap-column">
-                      <div class="title" >Sponsorship</div>
-                      <ul>
-                        <li><a href="/thanks/">Thanks</a></li>
-                        <li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Become a Sponsor</a></li>
-                        <li><a href="http://www.apache.org/foundation/buy_stuff.html" target="_blank">Buy Stuff</a></li>
-                      </ul>
-                    </div>
-                  </div>
-
-                </div>
-                <div class="copyright">Apache Clerezza, Clerezza, Apache, the Apache feather logo, and the Apache Clerezza project logo are trademarks of The Apache Software Foundation. <br></br>© 2011 The Apache Software Foundation.</div>
-              </div>
-            </div>
-
-
-          </body>
-        </html>
-      }
-    }
-  }
-
-}
diff --git a/site/troubleshooting.txt b/site/troubleshooting.txt
deleted file mode 100644
index 0711866..0000000
--- a/site/troubleshooting.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Troubleshooting
-
-If things don't just work as described in the readme.
-
-Getting the content graph manually:
-- curl -u admin:admin -H "Accept: application/n-triples" http://localhost:8080/graph?name=urn:x-localinstance:/content.graph > graph.nt
-
-Manually deploying:
-- retrieve a zipped offline version from http://localhost:8080/admin/offline/download?baseUri=http://localhost:8080/&targetUri=http://incubator.apache.org/clerezza/&formatExtension=xhtml&formatExtension=rdf&formatExtension=png&formatExtension=html&formatExtension=js&formatExtension=jpeg&rootLinkPrefix=/clerezza
-- scp site<id>.zip  people.apache.org:/www/incubator.apache.org/clerezza
-- on people.apache.org: unzip -o site<id>.zip
-
-
-NOTES:
-- as the documentation at /documentation is not a resource in rdf it wasn't
-contained in the oflline site, so I added a resource with that URI
-- to have the content of index-resources displayed on localhost you need to create the respective collection, otherwise the resource can only be accessed with the URI ending with "/index". This can be done on the clerzza shell as follows:
-
-
-import rdf.core._
-import rdf.core.impl._
-import rdf.ontologies._
-import platform.graphprovider.content.ContentGraphProvider
-val cgp = $[ContentGraphProvider]
-val cg = cgp.getContentGraph
-cg.add(new TripleImpl(new UriRef("http://localhost:8080/downloads/"), RDF.`type`, HIERARCHY.Collection))
-


[clerezza] 26/45: CLEREZZA-1032: Add ontology classes FOAF, OWL, RDF, and RDFS to ontologies module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit e41e0bc704e9194caae29724d8fd3c14ddd6a2a2
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 01:07:30 2019 +0100

    CLEREZZA-1032: Add ontology classes FOAF, OWL, RDF, and RDFS to ontologies module
---
 ontologies/pom.xml                                 |  44 ++
 .../java/org/apache/clerezza/ontologies/FOAF.java  | 460 +++++++++++++++++++++
 .../java/org/apache/clerezza/ontologies/OWL.java   | 223 ++++++++++
 .../java/org/apache/clerezza/ontologies/RDF.java   | 106 +++++
 .../java/org/apache/clerezza/ontologies/RDFS.java  | 107 +++++
 5 files changed, 940 insertions(+)

diff --git a/ontologies/pom.xml b/ontologies/pom.xml
new file mode 100644
index 0000000..615bd92
--- /dev/null
+++ b/ontologies/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
+        <version>8-SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ontologies</artifactId>
+    <packaging>bundle</packaging>
+    <version>8-SNAPSHOT</version>
+    <name>Clerezza - Ontologies</name>
+    <description>Ontology classes</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/FOAF.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/FOAF.java
new file mode 100644
index 0000000..bd2e44b
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/FOAF.java
@@ -0,0 +1,460 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class FOAF {
+	// Classes
+
+	/**
+	 * comment: An agent (eg. person, group, software or physical artifact).
+
+	 */
+	public static final IRI Agent = new IRI("http://xmlns.com/foaf/0.1/Agent");
+
+	/**
+	 * comment: A document.
+
+	 */
+	public static final IRI Document = new IRI("http://xmlns.com/foaf/0.1/Document");
+
+	/**
+	 * comment: A class of Agents.
+
+	 */
+	public static final IRI Group = new IRI("http://xmlns.com/foaf/0.1/Group");
+
+	/**
+	 * comment: An image.
+
+	 */
+	public static final IRI Image = new IRI("http://xmlns.com/foaf/0.1/Image");
+
+	/**
+	 * comment: A foaf:LabelProperty is any RDF property with texual values that serve as labels.
+
+	 */
+	public static final IRI LabelProperty = new IRI("http://xmlns.com/foaf/0.1/LabelProperty");
+
+	/**
+	 * comment: An online account.
+
+	 */
+	public static final IRI OnlineAccount = new IRI("http://xmlns.com/foaf/0.1/OnlineAccount");
+
+	/**
+	 * comment: An online chat account.
+
+	 */
+	public static final IRI OnlineChatAccount = new IRI("http://xmlns.com/foaf/0.1/OnlineChatAccount");
+
+	/**
+	 * comment: An online e-commerce account.
+
+	 */
+	public static final IRI OnlineEcommerceAccount = new IRI("http://xmlns.com/foaf/0.1/OnlineEcommerceAccount");
+
+	/**
+	 * comment: An online gaming account.
+
+	 */
+	public static final IRI OnlineGamingAccount = new IRI("http://xmlns.com/foaf/0.1/OnlineGamingAccount");
+
+	/**
+	 * comment: An organization.
+
+	 */
+	public static final IRI Organization = new IRI("http://xmlns.com/foaf/0.1/Organization");
+
+	/**
+	 * comment: A person.
+
+	 */
+	public static final IRI Person = new IRI("http://xmlns.com/foaf/0.1/Person");
+
+	/**
+	 * comment: A personal profile RDF document.
+
+	 */
+	public static final IRI PersonalProfileDocument = new IRI("http://xmlns.com/foaf/0.1/PersonalProfileDocument");
+
+	/**
+	 * comment: A project (a collective endeavour of some kind).
+
+	 */
+	public static final IRI Project = new IRI("http://xmlns.com/foaf/0.1/Project");
+
+	// Properties
+
+	/**
+	 * comment: Indicates an account held by this agent.
+
+	 */
+	public static final IRI account = new IRI("http://xmlns.com/foaf/0.1/account");
+
+	/**
+	 * comment: Indicates the name (identifier) associated with this online account.
+
+	 */
+	public static final IRI accountName = new IRI("http://xmlns.com/foaf/0.1/accountName");
+
+	/**
+	 * comment: Indicates a homepage of the service provide for this online account.
+
+	 */
+	public static final IRI accountServiceHomepage = new IRI("http://xmlns.com/foaf/0.1/accountServiceHomepage");
+
+	/**
+	 * comment: The age in years of some agent.
+
+	 */
+	public static final IRI age = new IRI("http://xmlns.com/foaf/0.1/age");
+
+	/**
+	 * comment: An AIM chat ID
+
+	 */
+	public static final IRI aimChatID = new IRI("http://xmlns.com/foaf/0.1/aimChatID");
+
+	/**
+	 * comment: A location that something is based near, for some broadly human notion of near.
+
+	 */
+	public static final IRI based_near = new IRI("http://xmlns.com/foaf/0.1/based_near");
+
+	/**
+	 * comment: The birthday of this Agent, represented in mm-dd string form, eg. '12-31'.
+
+	 */
+	public static final IRI birthday = new IRI("http://xmlns.com/foaf/0.1/birthday");
+
+	/**
+	 * comment: A current project this person works on.
+
+	 */
+	public static final IRI currentProject = new IRI("http://xmlns.com/foaf/0.1/currentProject");
+
+	/**
+	 * comment: A depiction of some thing.
+
+	 */
+	public static final IRI depiction = new IRI("http://xmlns.com/foaf/0.1/depiction");
+
+	/**
+	 * comment: A thing depicted in this representation.
+
+	 */
+	public static final IRI depicts = new IRI("http://xmlns.com/foaf/0.1/depicts");
+
+	/**
+	 * comment: A checksum for the DNA of some thing. Joke.
+
+	 */
+	public static final IRI dnaChecksum = new IRI("http://xmlns.com/foaf/0.1/dnaChecksum");
+
+	/**
+	 * comment: The family name of some person.
+
+	 */
+	public static final IRI familyName = new IRI("http://xmlns.com/foaf/0.1/familyName");
+
+	/**
+	 * comment: The family name of some person.
+
+	 */
+	public static final IRI family_name = new IRI("http://xmlns.com/foaf/0.1/family_name");
+
+	/**
+	 * comment: The first name of a person.
+
+	 */
+	public static final IRI firstName = new IRI("http://xmlns.com/foaf/0.1/firstName");
+
+	/**
+	 * comment: An organization funding a project or person.
+
+	 */
+	public static final IRI fundedBy = new IRI("http://xmlns.com/foaf/0.1/fundedBy");
+
+	/**
+	 * comment: A textual geekcode for this person, see http://www.geekcode.com/geek.html
+
+	 */
+	public static final IRI geekcode = new IRI("http://xmlns.com/foaf/0.1/geekcode");
+
+	/**
+	 * comment: The gender of this Agent (typically but not necessarily 'male' or 'female').
+
+	 */
+	public static final IRI gender = new IRI("http://xmlns.com/foaf/0.1/gender");
+
+	/**
+	 * comment: The given name of some person.
+
+	 */
+	public static final IRI givenName = new IRI("http://xmlns.com/foaf/0.1/givenName");
+
+	/**
+	 * comment: The given name of some person.
+
+	 */
+	public static final IRI givenname = new IRI("http://xmlns.com/foaf/0.1/givenname");
+
+	/**
+	 * comment: Indicates an account held by this agent.
+
+	 */
+	public static final IRI holdsAccount = new IRI("http://xmlns.com/foaf/0.1/holdsAccount");
+
+	/**
+	 * comment: A homepage for some thing.
+
+	 */
+	public static final IRI homepage = new IRI("http://xmlns.com/foaf/0.1/homepage");
+
+	/**
+	 * comment: An ICQ chat ID
+
+	 */
+	public static final IRI icqChatID = new IRI("http://xmlns.com/foaf/0.1/icqChatID");
+
+	/**
+	 * comment: An image that can be used to represent some thing (ie. those depictions which are particularly representative of something, eg. one's photo on a homepage).
+
+	 */
+	public static final IRI img = new IRI("http://xmlns.com/foaf/0.1/img");
+
+	/**
+	 * comment: A page about a topic of interest to this person.
+
+	 */
+	public static final IRI interest = new IRI("http://xmlns.com/foaf/0.1/interest");
+
+	/**
+	 * comment: A document that this thing is the primary topic of.
+
+	 */
+	public static final IRI isPrimaryTopicOf = new IRI("http://xmlns.com/foaf/0.1/isPrimaryTopicOf");
+
+	/**
+	 * comment: A jabber ID for something.
+
+	 */
+	public static final IRI jabberID = new IRI("http://xmlns.com/foaf/0.1/jabberID");
+
+	/**
+	 * comment: A person known by this person (indicating some level of reciprocated interaction between the parties).
+
+	 */
+	public static final IRI knows = new IRI("http://xmlns.com/foaf/0.1/knows");
+
+	/**
+	 * comment: The last name of a person.
+
+	 */
+	public static final IRI lastName = new IRI("http://xmlns.com/foaf/0.1/lastName");
+
+	/**
+	 * comment: A logo representing some thing.
+
+	 */
+	public static final IRI logo = new IRI("http://xmlns.com/foaf/0.1/logo");
+
+	/**
+	 * comment: Something that was made by this agent.
+
+	 */
+	public static final IRI made = new IRI("http://xmlns.com/foaf/0.1/made");
+
+	/**
+	 * comment: An agent that  made this thing.
+
+	 */
+	public static final IRI maker = new IRI("http://xmlns.com/foaf/0.1/maker");
+
+	/**
+	 * comment: A  personal mailbox, ie. an Internet mailbox associated with exactly one owner, the first owner of this mailbox. This is a 'static inverse functional property', in that  there is (across time and change) at most one individual that ever has any particular value for foaf:mbox.
+
+	 */
+	public static final IRI mbox = new IRI("http://xmlns.com/foaf/0.1/mbox");
+
+	/**
+	 * comment: The sha1sum of the URI of an Internet mailbox associated with exactly one owner, the  first owner of the mailbox.
+
+	 */
+	public static final IRI mbox_sha1sum = new IRI("http://xmlns.com/foaf/0.1/mbox_sha1sum");
+
+	/**
+	 * comment: Indicates a member of a Group
+
+	 */
+	public static final IRI member = new IRI("http://xmlns.com/foaf/0.1/member");
+
+	/**
+	 * comment: Indicates the class of individuals that are a member of a Group
+
+	 */
+	public static final IRI membershipClass = new IRI("http://xmlns.com/foaf/0.1/membershipClass");
+
+	/**
+	 * comment: An MSN chat ID
+
+	 */
+	public static final IRI msnChatID = new IRI("http://xmlns.com/foaf/0.1/msnChatID");
+
+	/**
+	 * comment: A Myers Briggs (MBTI) personality classification.
+
+	 */
+	public static final IRI myersBriggs = new IRI("http://xmlns.com/foaf/0.1/myersBriggs");
+
+	/**
+	 * comment: A name for some thing.
+
+	 */
+	public static final IRI name = new IRI("http://xmlns.com/foaf/0.1/name");
+
+	/**
+	 * comment: A short informal nickname characterising an agent (includes login identifiers, IRC and other chat nicknames).
+
+	 */
+	public static final IRI nick = new IRI("http://xmlns.com/foaf/0.1/nick");
+
+	/**
+	 * comment: An OpenID for an Agent.
+
+	 */
+	public static final IRI openid = new IRI("http://xmlns.com/foaf/0.1/openid");
+
+	/**
+	 * comment: A page or document about this thing.
+
+	 */
+	public static final IRI page = new IRI("http://xmlns.com/foaf/0.1/page");
+
+	/**
+	 * comment: A project this person has previously worked on.
+
+	 */
+	public static final IRI pastProject = new IRI("http://xmlns.com/foaf/0.1/pastProject");
+
+	/**
+	 * comment: A phone,  specified using fully qualified tel: URI scheme (refs: http://www.w3.org/Addressing/schemes.html#tel).
+
+	 */
+	public static final IRI phone = new IRI("http://xmlns.com/foaf/0.1/phone");
+
+	/**
+	 * comment: A .plan comment, in the tradition of finger and '.plan' files.
+
+	 */
+	public static final IRI plan = new IRI("http://xmlns.com/foaf/0.1/plan");
+
+	/**
+	 * comment: The primary topic of some page or document.
+
+	 */
+	public static final IRI primaryTopic = new IRI("http://xmlns.com/foaf/0.1/primaryTopic");
+
+	/**
+	 * comment: A link to the publications of this person.
+
+	 */
+	public static final IRI publications = new IRI("http://xmlns.com/foaf/0.1/publications");
+
+	/**
+	 * comment: A homepage of a school attended by the person.
+
+	 */
+	public static final IRI schoolHomepage = new IRI("http://xmlns.com/foaf/0.1/schoolHomepage");
+
+	/**
+	 * comment: A sha1sum hash, in hex.
+
+	 */
+	public static final IRI sha1 = new IRI("http://xmlns.com/foaf/0.1/sha1");
+
+	/**
+	 * comment: A Skype ID
+
+	 */
+	public static final IRI skypeID = new IRI("http://xmlns.com/foaf/0.1/skypeID");
+
+	/**
+	 * comment: A string expressing what the user is happy for the general public (normally) to know about their current activity.
+
+	 */
+	public static final IRI status = new IRI("http://xmlns.com/foaf/0.1/status");
+
+	/**
+	 * comment: The surname of some person.
+
+	 */
+	public static final IRI surname = new IRI("http://xmlns.com/foaf/0.1/surname");
+
+	/**
+	 * comment: A theme.
+
+	 */
+	public static final IRI theme = new IRI("http://xmlns.com/foaf/0.1/theme");
+
+	/**
+	 * comment: A derived thumbnail image.
+
+	 */
+	public static final IRI thumbnail = new IRI("http://xmlns.com/foaf/0.1/thumbnail");
+
+	/**
+	 * comment: A tipjar document for this agent, describing means for payment and reward.
+
+	 */
+	public static final IRI tipjar = new IRI("http://xmlns.com/foaf/0.1/tipjar");
+
+	/**
+	 * comment: Title (Mr, Mrs, Ms, Dr. etc)
+
+	 */
+	public static final IRI title = new IRI("http://xmlns.com/foaf/0.1/title");
+
+	/**
+	 * comment: A topic of some page or document.
+
+	 */
+	public static final IRI topic = new IRI("http://xmlns.com/foaf/0.1/topic");
+
+	/**
+	 * comment: A thing of interest to this person.
+
+	 */
+	public static final IRI topic_interest = new IRI("http://xmlns.com/foaf/0.1/topic_interest");
+
+	/**
+	 * comment: A weblog of some thing (whether person, group, company etc.).
+
+	 */
+	public static final IRI weblog = new IRI("http://xmlns.com/foaf/0.1/weblog");
+
+	/**
+	 * comment: A work info homepage of some person; a page about their work for some organization.
+
+	 */
+	public static final IRI workInfoHomepage = new IRI("http://xmlns.com/foaf/0.1/workInfoHomepage");
+
+	/**
+	 * comment: A workplace homepage of some person; the homepage of an organization they work for.
+
+	 */
+	public static final IRI workplaceHomepage = new IRI("http://xmlns.com/foaf/0.1/workplaceHomepage");
+
+	/**
+	 * comment: A Yahoo chat ID
+
+	 */
+	public static final IRI yahooChatID = new IRI("http://xmlns.com/foaf/0.1/yahooChatID");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI THIS_ONTOLOGY = new IRI("http://xmlns.com/foaf/0.1/");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/OWL.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/OWL.java
new file mode 100644
index 0000000..fe54461
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/OWL.java
@@ -0,0 +1,223 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class OWL {
+	// Classes
+
+	/**
+	 * 
+	 */
+	public static final IRI AllDifferent = new IRI("http://www.w3.org/2002/07/owl#AllDifferent");
+
+	/**
+	 * 
+	 */
+	public static final IRI AnnotationProperty = new IRI("http://www.w3.org/2002/07/owl#AnnotationProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI Class = new IRI("http://www.w3.org/2002/07/owl#Class");
+
+	/**
+	 * 
+	 */
+	public static final IRI DataRange = new IRI("http://www.w3.org/2002/07/owl#DataRange");
+
+	/**
+	 * 
+	 */
+	public static final IRI DatatypeProperty = new IRI("http://www.w3.org/2002/07/owl#DatatypeProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI DeprecatedClass = new IRI("http://www.w3.org/2002/07/owl#DeprecatedClass");
+
+	/**
+	 * 
+	 */
+	public static final IRI DeprecatedProperty = new IRI("http://www.w3.org/2002/07/owl#DeprecatedProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI FunctionalProperty = new IRI("http://www.w3.org/2002/07/owl#FunctionalProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI InverseFunctionalProperty = new IRI("http://www.w3.org/2002/07/owl#InverseFunctionalProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI Nothing = new IRI("http://www.w3.org/2002/07/owl#Nothing");
+
+	/**
+	 * 
+	 */
+	public static final IRI ObjectProperty = new IRI("http://www.w3.org/2002/07/owl#ObjectProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI Ontology = new IRI("http://www.w3.org/2002/07/owl#Ontology");
+
+	/**
+	 * 
+	 */
+	public static final IRI OntologyProperty = new IRI("http://www.w3.org/2002/07/owl#OntologyProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI Restriction = new IRI("http://www.w3.org/2002/07/owl#Restriction");
+
+	/**
+	 * 
+	 */
+	public static final IRI SymmetricProperty = new IRI("http://www.w3.org/2002/07/owl#SymmetricProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI Thing = new IRI("http://www.w3.org/2002/07/owl#Thing");
+
+	/**
+	 * 
+	 */
+	public static final IRI TransitiveProperty = new IRI("http://www.w3.org/2002/07/owl#TransitiveProperty");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI allValuesFrom = new IRI("http://www.w3.org/2002/07/owl#allValuesFrom");
+
+	/**
+	 * 
+	 */
+	public static final IRI backwardCompatibleWith = new IRI("http://www.w3.org/2002/07/owl#backwardCompatibleWith");
+
+	/**
+	 * 
+	 */
+	public static final IRI cardinality = new IRI("http://www.w3.org/2002/07/owl#cardinality");
+
+	/**
+	 * 
+	 */
+	public static final IRI complementOf = new IRI("http://www.w3.org/2002/07/owl#complementOf");
+
+	/**
+	 * 
+	 */
+	public static final IRI differentFrom = new IRI("http://www.w3.org/2002/07/owl#differentFrom");
+
+	/**
+	 * 
+	 */
+	public static final IRI disjointWith = new IRI("http://www.w3.org/2002/07/owl#disjointWith");
+
+	/**
+	 * 
+	 */
+	public static final IRI distinctMembers = new IRI("http://www.w3.org/2002/07/owl#distinctMembers");
+
+	/**
+	 * 
+	 */
+	public static final IRI equivalentClass = new IRI("http://www.w3.org/2002/07/owl#equivalentClass");
+
+	/**
+	 * 
+	 */
+	public static final IRI equivalentProperty = new IRI("http://www.w3.org/2002/07/owl#equivalentProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI hasValue = new IRI("http://www.w3.org/2002/07/owl#hasValue");
+
+	/**
+	 * 
+	 */
+	public static final IRI imports = new IRI("http://www.w3.org/2002/07/owl#imports");
+
+	/**
+	 * 
+	 */
+	public static final IRI incompatibleWith = new IRI("http://www.w3.org/2002/07/owl#incompatibleWith");
+
+	/**
+	 * 
+	 */
+	public static final IRI intersectionOf = new IRI("http://www.w3.org/2002/07/owl#intersectionOf");
+
+	/**
+	 * 
+	 */
+	public static final IRI inverseOf = new IRI("http://www.w3.org/2002/07/owl#inverseOf");
+
+	/**
+	 * 
+	 */
+	public static final IRI maxCardinality = new IRI("http://www.w3.org/2002/07/owl#maxCardinality");
+
+	/**
+	 * 
+	 */
+	public static final IRI minCardinality = new IRI("http://www.w3.org/2002/07/owl#minCardinality");
+
+	/**
+	 * 
+	 */
+	public static final IRI onProperty = new IRI("http://www.w3.org/2002/07/owl#onProperty");
+
+	/**
+	 * 
+	 */
+	public static final IRI oneOf = new IRI("http://www.w3.org/2002/07/owl#oneOf");
+
+	/**
+	 * 
+	 */
+	public static final IRI priorVersion = new IRI("http://www.w3.org/2002/07/owl#priorVersion");
+
+	/**
+	 * 
+	 */
+	public static final IRI sameAs = new IRI("http://www.w3.org/2002/07/owl#sameAs");
+
+	/**
+	 * 
+	 */
+	public static final IRI someValuesFrom = new IRI("http://www.w3.org/2002/07/owl#someValuesFrom");
+
+	/**
+	 * 
+	 */
+	public static final IRI unionOf = new IRI("http://www.w3.org/2002/07/owl#unionOf");
+
+	/**
+	 * 
+	 */
+	public static final IRI versionInfo = new IRI("http://www.w3.org/2002/07/owl#versionInfo");
+
+	// Properties
+
+	/**
+	 * comment: This file specifies in RDF Schema format the
+    built-in classes and properties that together form the basis of
+    the RDF/XML syntax of OWL Full, OWL DL and OWL Lite.
+    We do not expect people to import this file
+    explicitly into their ontology. People that do import this file
+    should expect their ontology to be an OWL Full ontology. 
+  
+
+	 */
+	public static final IRI owl = new IRI("http://www.w3.org/2002/07/owl");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/RDF.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/RDF.java
new file mode 100644
index 0000000..0060f3f
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/RDF.java
@@ -0,0 +1,106 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class RDF {
+	// Classes
+
+	/**
+	 * comment: The class of containers of alternatives.
+
+	 */
+	public static final IRI Alt = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt");
+
+	/**
+	 * comment: The class of unordered containers.
+
+	 */
+	public static final IRI Bag = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag");
+
+	/**
+	 * comment: The class of RDF Lists.
+
+	 */
+	public static final IRI List = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#List");
+
+	/**
+	 * comment: The class of RDF properties.
+
+	 */
+	public static final IRI Property = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Property");
+
+	/**
+	 * comment: The class of ordered containers.
+
+	 */
+	public static final IRI Seq = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq");
+
+	/**
+	 * comment: The class of RDF statements.
+
+	 */
+	public static final IRI Statement = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement");
+
+	/**
+	 * comment: The class of XML literal values.
+
+	 */
+	public static final IRI XMLLiteral = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
+
+	// Properties
+
+	/**
+	 * comment: The first item in the subject RDF list.
+
+	 */
+	public static final IRI first = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+
+	/**
+	 * comment: The object of the subject RDF statement.
+
+	 */
+	public static final IRI object = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#object");
+
+	/**
+	 * comment: The predicate of the subject RDF statement.
+
+	 */
+	public static final IRI predicate = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate");
+
+	/**
+	 * comment: The rest of the subject RDF list after the first item.
+
+	 */
+	public static final IRI rest = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+
+	/**
+	 * comment: The subject of the subject RDF statement.
+
+	 */
+	public static final IRI subject = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject");
+
+	/**
+	 * comment: The subject is an instance of a class.
+
+	 */
+	public static final IRI type = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+	/**
+	 * comment: Idiomatic property used for structured values.
+
+	 */
+	public static final IRI value = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#value");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI THIS_ONTOLOGY = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+
+	/**
+	 * comment: The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it.
+
+	 */
+	public static final IRI nil = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+}
diff --git a/ontologies/src/main/java/org/apache/clerezza/ontologies/RDFS.java b/ontologies/src/main/java/org/apache/clerezza/ontologies/RDFS.java
new file mode 100644
index 0000000..9c5a863
--- /dev/null
+++ b/ontologies/src/main/java/org/apache/clerezza/ontologies/RDFS.java
@@ -0,0 +1,107 @@
+package org.apache.clerezza.ontologies;
+
+import org.apache.clerezza.api.IRI;
+
+public class RDFS {
+	// Classes
+
+	/**
+	 * comment: The class of classes.
+
+	 */
+	public static final IRI Class = new IRI("http://www.w3.org/2000/01/rdf-schema#Class");
+
+	/**
+	 * comment: The class of RDF containers.
+
+	 */
+	public static final IRI Container = new IRI("http://www.w3.org/2000/01/rdf-schema#Container");
+
+	/**
+	 * comment: The class of container membership properties, rdf:_1, rdf:_2, ...,
+                    all of which are sub-properties of 'member'.
+
+	 */
+	public static final IRI ContainerMembershipProperty = new IRI("http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty");
+
+	/**
+	 * comment: The class of RDF datatypes.
+
+	 */
+	public static final IRI Datatype = new IRI("http://www.w3.org/2000/01/rdf-schema#Datatype");
+
+	/**
+	 * comment: The class of literal values, eg. textual strings and integers.
+
+	 */
+	public static final IRI Literal = new IRI("http://www.w3.org/2000/01/rdf-schema#Literal");
+
+	/**
+	 * comment: The class resource, everything.
+
+	 */
+	public static final IRI Resource = new IRI("http://www.w3.org/2000/01/rdf-schema#Resource");
+
+	// Properties
+
+	/**
+	 * comment: A description of the subject resource.
+
+	 */
+	public static final IRI comment = new IRI("http://www.w3.org/2000/01/rdf-schema#comment");
+
+	/**
+	 * comment: A domain of the subject property.
+
+	 */
+	public static final IRI domain = new IRI("http://www.w3.org/2000/01/rdf-schema#domain");
+
+	/**
+	 * comment: The defininition of the subject resource.
+
+	 */
+	public static final IRI isDefinedBy = new IRI("http://www.w3.org/2000/01/rdf-schema#isDefinedBy");
+
+	/**
+	 * comment: A human-readable name for the subject.
+
+	 */
+	public static final IRI label = new IRI("http://www.w3.org/2000/01/rdf-schema#label");
+
+	/**
+	 * comment: A member of the subject resource.
+
+	 */
+	public static final IRI member = new IRI("http://www.w3.org/2000/01/rdf-schema#member");
+
+	/**
+	 * comment: A range of the subject property.
+
+	 */
+	public static final IRI range = new IRI("http://www.w3.org/2000/01/rdf-schema#range");
+
+	/**
+	 * comment: Further information about the subject resource.
+
+	 */
+	public static final IRI seeAlso = new IRI("http://www.w3.org/2000/01/rdf-schema#seeAlso");
+
+	/**
+	 * comment: The subject is a subclass of a class.
+
+	 */
+	public static final IRI subClassOf = new IRI("http://www.w3.org/2000/01/rdf-schema#subClassOf");
+
+	/**
+	 * comment: The subject is a subproperty of a property.
+
+	 */
+	public static final IRI subPropertyOf = new IRI("http://www.w3.org/2000/01/rdf-schema#subPropertyOf");
+
+	// Properties
+
+	/**
+	 * 
+	 */
+	public static final IRI THIS_ONTOLOGY = new IRI("http://www.w3.org/2000/01/rdf-schema#");
+}


[clerezza] 07/45: CLEREZZA-1026: Bump maven-surefire-plugin in parent pom to 2.22.1 and set useSystemClassLoader to false

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit e153faa0c78629b033ea7e8f128dd04d2cb6dcbb
Author: Hasan <ha...@apache.org>
AuthorDate: Mon Nov 5 00:08:27 2018 +0100

    CLEREZZA-1026: Bump maven-surefire-plugin in parent pom to 2.22.1 and set useSystemClassLoader to false
---
 parent/pom.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 9094112..2607b41 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -140,7 +140,10 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.15</version>
+                    <version>2.22.1</version>
+                    <configuration>
+                        <useSystemClassLoader>false</useSystemClassLoader>
+                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.codehaus.xsite</groupId>


[clerezza] 22/45: CLEREZZA-1035: Remove TcProviderTest from test.utils to avoid cyclic dependency with dataset

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 624edf019766efca7bba39a5a5d53a7088e498d8
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 10 16:09:34 2019 +0100

    CLEREZZA-1035: Remove TcProviderTest from test.utils to avoid cyclic dependency with dataset
---
 test.utils/pom.xml                                 |   9 +-
 .../apache/clerezza/test/utils/TcProviderTest.java | 479 ---------------------
 2 files changed, 2 insertions(+), 486 deletions(-)

diff --git a/test.utils/pom.xml b/test.utils/pom.xml
index 0b14eae..f7c4bc5 100644
--- a/test.utils/pom.xml
+++ b/test.utils/pom.xml
@@ -31,8 +31,8 @@
     <artifactId>test.utils</artifactId>
     <packaging>jar</packaging>
     <version>8-SNAPSHOT</version>
-    <name>Clerezza - Test Utilities</name>
-    <description>Utilities to test Clerezza API and dataset implementations</description>
+    <name>Clerezza - API Test Utilities</name>
+    <description>Utilities to test Clerezza API implementations</description>
 
     <dependencies>
         <dependency>
@@ -50,11 +50,6 @@
             <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>dataset</artifactId>
-            <version>8-SNAPSHOT</version>
-        </dependency>
-        <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
         </dependency>
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java
deleted file mode 100644
index 48ae397..0000000
--- a/test.utils/src/main/java/org/apache/clerezza/test/utils/TcProviderTest.java
+++ /dev/null
@@ -1,479 +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.test.utils;
-
-import org.apache.clerezza.api.*;
-import org.apache.clerezza.api.impl.TripleImpl;
-import org.apache.clerezza.api.impl.graph.SimpleGraph;
-import org.apache.clerezza.dataset.EntityAlreadyExistsException;
-import org.apache.clerezza.dataset.NoSuchEntityException;
-import org.apache.clerezza.dataset.TcProvider;
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
-/**
- * 
- * @author mir,rbn
- */
-public abstract class TcProviderTest {
-
-    protected final IRI uriRefA = generateUri("a");
-    protected final IRI uriRefA1 = generateUri("a1");
-    protected final IRI uriRefB = generateUri("b");
-    protected final IRI uriRefB1 = generateUri("b1");
-    protected final IRI uriRefC = generateUri("c");
-
-    protected final IRI graphIRI = generateUri("myGraph");
-    protected final IRI otherGraphIRI = new IRI(graphIRI.getUnicodeString());
-
-    @Test
-    public void testCreateImmutableGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-
-        ImmutableGraph createdGraph = simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-
-        Iterator<Triple> iteratorInput = mGraph.iterator();
-        Iterator<Triple> iteratorCreated = createdGraph.iterator();
-        assertEquals(iteratorInput.next(), iteratorCreated.next());
-        assertFalse(iteratorCreated.hasNext());
-
-        try {
-            simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-            assertTrue(false);
-        } catch (EntityAlreadyExistsException e) {
-            assertTrue(true);
-        }
-        simpleTcmProvider.deleteGraph(uriRefA);
-    }
-
-    @Test
-    public void testCreateGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
-        assertTrue(mGraph.isEmpty());
-
-        try {
-            simpleTcmProvider.createGraph(uriRefA);
-            assertTrue(false);
-        } catch (EntityAlreadyExistsException e) {
-            assertTrue(true);
-        }
-        simpleTcmProvider.deleteGraph(uriRefA);
-    }
-
-    @Test
-    public void testGetImmutableGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        simpleTcmProvider.createImmutableGraph(uriRefA1, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-        simpleTcmProvider.createImmutableGraph(uriRefB1, mGraph);
-
-        ImmutableGraph bGraph = simpleTcmProvider.getImmutableGraph(uriRefB);
-        Iterator<Triple> iterator = bGraph.iterator();
-        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-    }
-
-    @Test
-    public void testGetGraph() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = simpleTcmProvider.createGraph(uriRefA);
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        mGraph = simpleTcmProvider.createGraph(uriRefA1);
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        mGraph = simpleTcmProvider.createGraph(uriRefB);
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
-        assertEquals(1, mGraph.size());
-        mGraph = simpleTcmProvider.createGraph(uriRefB1);
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-
-        Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
-        Iterator<Triple> iterator = bGraph.iterator();
-        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-        
-    }
-
-    @Test
-    public void testGetTriples() {
-        TcProvider simpleTcmProvider = getInstance();
-        // add Graphs
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        simpleTcmProvider.createImmutableGraph(uriRefA, mGraph);
-        mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-        simpleTcmProvider.createImmutableGraph(uriRefB, mGraph);
-        // add Graphs
-        mGraph = simpleTcmProvider.createGraph(uriRefA1);
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        mGraph = simpleTcmProvider.createGraph(uriRefB1);
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-
-        // get a ImmutableGraph
-        Graph tripleCollection = simpleTcmProvider.getGraph(uriRefA);
-        // get a Graph
-        Graph tripleCollection2 = simpleTcmProvider.getGraph(uriRefB1);
-
-        Iterator<Triple> iterator = tripleCollection.iterator();
-        assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
-        assertFalse(iterator.hasNext());
-
-        iterator = tripleCollection2.iterator();
-        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
-        assertFalse(iterator.hasNext());
-        simpleTcmProvider.deleteGraph(uriRefA);
-        simpleTcmProvider.deleteGraph(uriRefA1);
-        simpleTcmProvider.deleteGraph(uriRefB);
-        simpleTcmProvider.deleteGraph(uriRefB1);
-    }
-
-    @Test
-    public void testDeleteEntity() {
-        TcProvider simpleTcmProvider = getInstance();
-        Graph mGraph = new SimpleGraph();
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        ImmutableGraph graph = mGraph.getImmutableGraph();
-        simpleTcmProvider.createImmutableGraph(uriRefA, graph);
-        simpleTcmProvider.createImmutableGraph(uriRefC, graph);
-
-        simpleTcmProvider.deleteGraph(uriRefA);
-        try {
-            simpleTcmProvider.getGraph(uriRefA);
-            assertTrue(false);
-        } catch (NoSuchEntityException e) {
-            assertTrue(true);
-        }
-
-        // Check that graph is still available under uriRefC
-        ImmutableGraph cGraph = simpleTcmProvider.getImmutableGraph(uriRefC);
-        assertNotNull(cGraph);
-        simpleTcmProvider.deleteGraph(uriRefC);
-    }
-
-    /**
-     * Subclasses implement this method to provide implementation instances of
-     * <code>TcProvider</code>. The first call within a test method has to
-     * return a empty TcProvider. Subsequent calls within the test method
-     * should instantiate a new provider, but load the previously added data from
-     * its "persistent" store.
-     *
-     * @return a TcProvider of the implementation to be tested.
-     */
-    protected abstract TcProvider getInstance();
-
-//    @Test
-//    public void testGetNames() {
-//        Graph mGraph = new SimpleGraph();
-//        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
-//        simpleTcmProvider.createGraph(uriRefB, mGraph.getGraph());
-//        
-//        mGraph = new SimpleGraph();
-//        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-//        ImmutableGraph graph = mGraph.getGraph();
-//        simpleTcmProvider.createGraph(uriRefA, graph);
-//        simpleTcmProvider.createGraph(uriRefC, graph);
-//
-//        Set<IRI> names = simpleTcmProvider.getNames(graph);
-//
-//        assertTrue(names.contains(uriRefA));
-//        assertTrue(names.contains(uriRefC));
-//        assertEquals(2, names.size());
-//
-//        assertFalse(names.contains(uriRefB));
-//    }
-
-    @Test
-    public void testCreateGraphExtended() throws Exception {
-
-        TcProvider provider = getInstance();
-        Graph graph = provider.createGraph(graphIRI);
-        assertNotNull(graph);
-        //get a new provider and check that graph is there
-        provider = getInstance();
-        graph = provider.getGraph(graphIRI);
-        assertNotNull(graph);
-        //check that there is no such graph, but only the mgraph
-        boolean expThrown = false;
-        try {
-            ImmutableGraph g = provider.getImmutableGraph(graphIRI);
-        } catch(NoSuchEntityException e) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateImmutableGraphExtended() throws Exception {
-
-        TcProvider provider = getInstance();
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
-
-        assertNotNull(graph);
-
-        //get a new provider and check that graph is there
-        provider = getInstance();
-        graph = provider.getImmutableGraph(graphIRI);
-        assertNotNull(graph);
-
-        //check that there is no such mgraph, but only the graph
-        boolean expThrown = false;
-
-        try {
-            Graph g = provider.getMGraph(graphIRI);
-        } catch(NoSuchEntityException e) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphNoDuplicateNames() throws Exception {
-
-        TcProvider provider = getInstance();
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, null);
-        assertNotNull(graph);
-        boolean expThrown = false;
-        try {
-            ImmutableGraph other = provider.createImmutableGraph(otherGraphIRI, null);
-        } catch(EntityAlreadyExistsException eaee) {
-            expThrown = true;
-        }
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphNoDuplicateNames2() throws Exception {
-
-        TcProvider provider = getInstance();
-        Graph graph = provider.createGraph(graphIRI);
-        assertNotNull(graph);
-        boolean expThrown = false;
-        try {
-            Graph other = provider.createGraph(otherGraphIRI);
-        } catch(EntityAlreadyExistsException eaee) {
-            expThrown = true;
-        }
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testCreateGraphWithInitialCollection() throws Exception {
-
-        Triple t1 = createTestTriple();
-
-        TcProvider provider = getInstance();
-
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
-
-        assertEquals(1, graph.size());
-        assertTrue(graph.contains(t1));
-        provider.deleteGraph(graphIRI);
-    }
-
-    @Test
-    public void testGraphIsNotMutable() throws Exception {
-
-        Triple t1 = createTestTriple();
-        Set<Triple> t = new HashSet<Triple>();
-        t.add(t1);
-
-        TcProvider provider = getInstance();
-
-        ImmutableGraph graph = provider.createImmutableGraph(graphIRI, createTestTripleCollection(t1));
-
-        boolean expThrown = false;
-
-        try {
-            graph.add(t1);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        expThrown = false;
-
-        try {
-            graph.remove(t1);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        expThrown = false;
-
-        try {
-            graph.addAll(t);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-
-        expThrown = false;
-
-        try {
-            graph.clear();
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-
-        expThrown = false;
-
-        try {
-            graph.removeAll(t);
-        } catch(UnsupportedOperationException uoe) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(graphIRI);
-    }
-
-//    This tests can not pass, because equals in AbstractGraph is not implemented
-//    yet.
-//    @Test
-//    public void testGraphHasName() throws Exception {
-//
-//        TcProvider provider = getInstance();
-//
-//        Graph triples = createTestTripleCollection(createTestTriple());
-//        ImmutableGraph graph = provider.createGraph(graphIRI, triples);
-//
-//        provider = getInstance();
-//        Set<IRI> names = provider.getNames(graph);
-//        assertTrue(names.contains(graphIRI));
-//    }
-//
-//    @Test
-//    public void testCreateSameGraphWithDifferentNames() throws Exception {
-//
-//        Graph triples = createTestTripleCollection(createTestTriple());
-//
-//        TcProvider provider = getInstance();
-//        IRI name1 = new IRI("http://myGraph1");
-//        ImmutableGraph graph = provider.createGraph(name1, triples);
-//
-//        IRI name2 = new IRI("http://myGraph2");
-//        ImmutableGraph secondGraph = provider.createGraph(name2, triples);
-//
-//        Set<IRI> names = provider.getNames(graph);
-//        assertNotNull(names);
-//        assertEquals(2, names.size());
-//    }
-
-    @Test
-    public void testGraphDeletion() throws Exception {
-
-        Graph triples = createTestTripleCollection(createTestTriple());
-
-        TcProvider provider = getInstance();
-        IRI name1 = new IRI("http://myGraph1");
-        ImmutableGraph graph = provider.createImmutableGraph(name1, triples);
-
-        IRI name2 = new IRI("http://myGraph2");
-        ImmutableGraph secondGraph = provider.createImmutableGraph(name2, triples);
-
-        //if we delete graph with name1, the second graph should still be there
-        provider.deleteGraph(name1);
-
-        provider = getInstance();
-        ImmutableGraph firstGraph = provider.getImmutableGraph(name2);
-        assertNotNull(firstGraph);
-
-        //check second name is not there
-        boolean expThrown = false;
-
-        try {
-            ImmutableGraph g = provider.getImmutableGraph(name1);
-        } catch(NoSuchEntityException nses) {
-            expThrown = true;
-        }
-
-        assertTrue(expThrown);
-        provider.deleteGraph(name2);
-    }
-
-
-
-    @Test
-    public void testGetTriplesGraph() throws Exception {
-        TcProvider provider = getInstance();
-
-        Graph graph = provider.createGraph(graphIRI);
-
-        Graph tc = provider.getGraph(graphIRI);
-        assertNotNull(tc);
-        provider.deleteGraph(graphIRI);
-    }
-
-    private Triple createTestTriple() {
-        BlankNodeOrIRI subject = new BlankNode() {};
-        IRI predicate = new IRI("http://test.com/");
-        BlankNodeOrIRI object = new IRI("http://test.com/myObject");
-        return new TripleImpl(subject, predicate, object);
-    }
-
-    private Graph createTestTripleCollection(Triple t) {
-        Set<Triple> ts = new HashSet<Triple>();
-        ts.add(t);
-        return new SimpleGraph(ts);
-    }
-
-    protected IRI generateUri(String name) {
-        return new IRI("http://example.org/" + name);
-    }
-    
-}


[clerezza] 41/45: CLEREZZA-1036: Refactor jaxrs.rdf.providers to use api and api.impl module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit b10c9a18f3b898d6a9bc491575d94df86b181680
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 21:38:11 2019 +0100

    CLEREZZA-1036: Refactor jaxrs.rdf.providers to use api and api.impl module
---
 jaxrs.rdf.providers/pom.xml                        |  81 +++--
 .../jaxrs/rdf/providers/GraphNodeWriter.java       |  84 +++--
 .../clerezza/jaxrs/rdf/providers/GraphReader.java  |  58 ++-
 .../clerezza/jaxrs/rdf/providers/GraphWriter.java  |  67 ++--
 .../jaxrs/rdf/providers/ImmutableGraphReader.java  |  61 ++--
 .../providers/ResultSetCsvMessageBodyWriter.java   | 386 ++++++++++----------
 .../providers/ResultSetJsonMessageBodyWriter.java  | 258 +++++++------
 .../providers/ResultSetTsvMessageBodyWriter.java   | 400 ++++++++++-----------
 .../providers/ResultSetXmlMessageBodyWriter.java   | 328 +++++++++--------
 9 files changed, 846 insertions(+), 877 deletions(-)

diff --git a/jaxrs.rdf.providers/pom.xml b/jaxrs.rdf.providers/pom.xml
index ac431c3..4156840 100644
--- a/jaxrs.rdf.providers/pom.xml
+++ b/jaxrs.rdf.providers/pom.xml
@@ -1,55 +1,57 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!--
+  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
 
- 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.
+    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.
 -->
-
-    <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
         <version>8-SNAPSHOT</version>
-        <relativePath>../parent</relativePath>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <groupId>org.apache.clerezza</groupId>
+    <modelVersion>4.0.0</modelVersion>
+
     <artifactId>jaxrs.rdf.providers</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>8-SNAPSHOT</version>
     <name>Clerezza - JAX-RS MessageBodyProviders for RDF</name>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin> 
-        </plugins>
-    </build>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>1.0.1</version>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.utils</artifactId>
-            <version>1.0.0</version>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>representation</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.utils</artifactId>
+            <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.googlecode.json-simple</groupId>
@@ -65,4 +67,13 @@
             <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
     </dependencies>
-</project>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
index 4455ba0..27f5f7b 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
@@ -1,34 +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
+ * 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.
+ * 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.jaxrs.rdf.providers;
 
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.api.utils.GraphNode;
+import org.apache.clerezza.representation.Serializer;
+import org.apache.clerezza.representation.SupportedFormat;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -38,38 +36,36 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
 
 /**
  * By default this returns a serialization of the context of the GraphNode.
- *
+ * <p>
  * The expansion can be widened by using the query parameters xPropObj and
  * xProSubj. These parameters specify property uris (both parameters might be
  * repeated). For the specified properties their objects respectively subjects
  * are expanded as if they were bnodes.
  *
- * 
  * @author reto
  */
 
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Provider
 @Produces({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
-    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
-    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
+        SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
+        SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
 
     public static final String OBJ_EXP_PARAM = "xPropObj";
     public static final String SUBJ_EXP_PARAM = "xPropSubj";
-    
+
     private Serializer serializer;
     private UriInfo uriInfo;
 
@@ -86,21 +82,21 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
 
     @Override
     public boolean isWriteable(Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
+                               Annotation[] annotations, MediaType mediaType) {
         return GraphNode.class.isAssignableFrom(type);
     }
 
     @Override
     public long getSize(GraphNode n, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
+                        Annotation[] annotations, MediaType mediaType) {
         return -1;
     }
 
     @Override
     public void writeTo(GraphNode node, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, Object> httpHeaders,
-            OutputStream entityStream) throws IOException, WebApplicationException {
+                        Annotation[] annotations, MediaType mediaType,
+                        MultivaluedMap<String, Object> httpHeaders,
+                        OutputStream entityStream) throws IOException, WebApplicationException {
         serializer.serialize(entityStream, getExpandedContext(node), mediaType.toString());
     }
 
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
index d569c7b..dcf58bc 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
@@ -1,48 +1,46 @@
 /*
- * 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
+ * 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.
+ * 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.jaxrs.rdf.providers;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Objects;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.impl.graph.SimpleGraph;
+import org.apache.clerezza.representation.Parser;
+import org.apache.clerezza.representation.SupportedFormat;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Objects;
 
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-
-
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Provider
 @Consumes({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
-    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
-    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
+        SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
+        SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class GraphReader implements MessageBodyReader<Graph> {
 
     private Parser parser;
@@ -60,7 +58,7 @@ public class GraphReader implements MessageBodyReader<Graph> {
 
     @Override
     public boolean isReadable(Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
+                              Annotation[] annotations, MediaType mediaType) {
         return type.isAssignableFrom(Graph.class);
     }
 
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
index 6f54992..a9842f3 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
@@ -1,48 +1,45 @@
 /*
- * 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
+ * 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.
+ * 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.jaxrs.rdf.providers;
 
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.representation.Serializer;
+import org.apache.clerezza.representation.SupportedFormat;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Objects;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Objects;
 
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-
-
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Provider
 @Produces({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
-    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
-    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
+        SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
+        SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class GraphWriter implements MessageBodyWriter<Graph> {
 
     private Serializer serializer;
@@ -59,22 +56,22 @@ public class GraphWriter implements MessageBodyWriter<Graph> {
     }
 
     @Override
-    public boolean isWriteable(Class<?> type, Type genericType, 
-            Annotation[] annotations, MediaType mediaType) {
+    public boolean isWriteable(Class<?> type, Type genericType,
+                               Annotation[] annotations, MediaType mediaType) {
         return Graph.class.isAssignableFrom(type);
     }
 
     @Override
-    public long getSize(Graph t, Class<?> type, Type genericType, 
-            Annotation[] annotations, MediaType mediaType) {
+    public long getSize(Graph t, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType) {
         return -1;
     }
 
     @Override
     public void writeTo(Graph t, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, Object> httpHeaders,
-            OutputStream entityStream) throws IOException, WebApplicationException {
+                        Annotation[] annotations, MediaType mediaType,
+                        MultivaluedMap<String, Object> httpHeaders,
+                        OutputStream entityStream) throws IOException, WebApplicationException {
         serializer.serialize(entityStream, t, mediaType.toString());
     }
 }
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
index eb45e52..45c28e0 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
@@ -1,46 +1,45 @@
 /*
- * 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
+ * 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.
+ * 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.jaxrs.rdf.providers;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Objects;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.representation.Parser;
+import org.apache.clerezza.representation.SupportedFormat;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Objects;
 
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Provider
 @Consumes({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
-    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
-    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
+        SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
+        SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
 public class ImmutableGraphReader implements MessageBodyReader<ImmutableGraph> {
 
     private Parser parser;
@@ -58,15 +57,15 @@ public class ImmutableGraphReader implements MessageBodyReader<ImmutableGraph> {
 
     @Override
     public boolean isReadable(Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
+                              Annotation[] annotations, MediaType mediaType) {
         return type.isAssignableFrom(ImmutableGraph.class);
     }
 
     @Override
     public ImmutableGraph readFrom(Class<ImmutableGraph> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, String> httpHeaders,
-            InputStream entityStream)
+                                   Annotation[] annotations, MediaType mediaType,
+                                   MultivaluedMap<String, String> httpHeaders,
+                                   InputStream entityStream)
             throws IOException, WebApplicationException {
         return parser.parse(entityStream, mediaType.toString());
     }
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
index 0bd3974..c215020 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
@@ -1,29 +1,31 @@
 /*
- * 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.
- */
+ * 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.jaxrs.sparql.providers;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.ResultSet;
+import org.apache.clerezza.sparql.SolutionMapping;
+import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -31,196 +33,184 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.osgi.service.component.annotations.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
 
 /**
  * MessageBodyWirter for <code>ResultSet</code>. Resulting output is csv and
  * conforms to:
  * http://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/#csv
- * 
+ * <p>
  * Also see: http://tools.ietf.org/html/rfc4180
- * 
+ *
  * @author misl
  */
-@Component(service=Object.class, property={"javax.ws.rs=true"})
-@Produces( { "text/csv" } )
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
+@Produces({"text/csv"})
 @Provider
 public class ResultSetCsvMessageBodyWriter implements MessageBodyWriter<ResultSet> {
 
-  private static final Logger logger = LoggerFactory
-      .getLogger( ResultSetCsvMessageBodyWriter.class );
-
-  private String textEncoding = "UTF-8";
-  private byte[] separator;
-  
-  public ResultSetCsvMessageBodyWriter() {
-    try {
-      buildSeparatorConformEncoding( textEncoding );
-    } catch( UnsupportedEncodingException e ) {
-      logger.error( "Developer error", e );
+    private static final Logger logger = LoggerFactory
+            .getLogger(ResultSetCsvMessageBodyWriter.class);
+
+    private String textEncoding = "UTF-8";
+    private byte[] separator;
+
+    public ResultSetCsvMessageBodyWriter() {
+        try {
+            buildSeparatorConformEncoding(textEncoding);
+        } catch (UnsupportedEncodingException e) {
+            logger.error("Developer error", e);
+        }
     }
-  }
-  
-  // --------------------------------------------------------------------------
-  // Implementing MessageBodyWriter
-  // --------------------------------------------------------------------------
-  
-  @Override
-  public boolean isWriteable( Class<?> type, Type genericType, Annotation[] annotations,
-      MediaType mediaType ) {
-    return ResultSet.class.isAssignableFrom( type );
-  }
-
-  @Override
-  public long getSize( ResultSet t, Class<?> type, Type genericType, Annotation[] annotations,
-      MediaType mediaType ) {
-    return -1;
-  }
-
-  @Override
-  public void writeTo( ResultSet resultSet, Class<?> type, Type genericType,
-      Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
-      OutputStream entityStream ) throws IOException, WebApplicationException {
-
-    // According to spec header is mandatory.
-    writeCsvHeader( entityStream, resultSet.getResultVars() );
-    while( resultSet.hasNext() ) {
-      writeCsvLine( entityStream, resultSet.getResultVars(), resultSet.next() );
+
+    // --------------------------------------------------------------------------
+    // Implementing MessageBodyWriter
+    // --------------------------------------------------------------------------
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+                               MediaType mediaType) {
+        return ResultSet.class.isAssignableFrom(type);
     }
-  }
-
-  // --------------------------------------------------------------------------
-  // Public interface
-  // --------------------------------------------------------------------------
-  
-  /**
-   * Sets the text encoding for the resource. This setting must only used 
-   * if the resource response represents text.
-   * 
-   * @param textEncoding
-   *            character encoding of text body
-   * @throws UnsupportedEncodingException when the given encoding is not supported.
-   */
-  public void setTextEncoding(String textEncoding) throws UnsupportedEncodingException {
-    buildSeparatorConformEncoding( textEncoding );
-    this.textEncoding = textEncoding;
-  }
-
-  /**
-   * @return text encoding for resource
-   */
-  protected String getTextEncoding() {
-    return textEncoding;
-  }
-
-  // --------------------------------------------------------------------------
-  // Private methods
-  // --------------------------------------------------------------------------
-
-  /**
-   * Builds the column separator according to the given text encoding.
-   * 
-   * @param encoding the text encoding to be used.
-   * @throws UnsupportedEncodingException when the given encoding is not supported.
-   */  
-  private void buildSeparatorConformEncoding( String encoding ) throws UnsupportedEncodingException {
-    separator = ",".getBytes( encoding );
-  }
-
-  /**
-   * Write resultset header to the given output stream.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param headers
-   *          the headers to write.
-   * @throws IOException
-   */
-  private void writeCsvHeader( OutputStream outputStream, List<String> headers ) throws IOException {
-    boolean first = true;
-    for( String header : headers ) {
-      if( !first ) {
-        outputStream.write( separator );
-      }
-      writeEscaped( outputStream, header );
-      first = false;
+
+    @Override
+    public long getSize(ResultSet t, Class<?> type, Type genericType, Annotation[] annotations,
+                        MediaType mediaType) {
+        return -1;
     }
-    outputStream.write( "\n".getBytes( textEncoding ) );
-  }
-
-  /**
-   * Write a single csv line using the given line data.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param headers
-   *          the headers to write line data for.
-   * @param lineData
-   *          the line data to write.
-   * @throws IOException
-   */
-  private void writeCsvLine( OutputStream outputStream, List<String> headers,
-      SolutionMapping lineData ) throws IOException {
-    boolean first = true;
-    for( String header : headers ) {
-      if( !first ) {
-        outputStream.write( separator );
-      }
-      RDFTerm resource = lineData.get( header );
-      if( resource != null ) {
-        writeEscaped( outputStream, getResourceValue( resource ) );
-      }
-      first = false;
+
+    @Override
+    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
+                        OutputStream entityStream) throws IOException, WebApplicationException {
+
+        // According to spec header is mandatory.
+        writeCsvHeader(entityStream, resultSet.getResultVars());
+        while (resultSet.hasNext()) {
+            writeCsvLine(entityStream, resultSet.getResultVars(), resultSet.next());
+        }
     }
-    outputStream.write( "\n".getBytes( textEncoding ) );
-  }
-
-  /**
-   * Helper to get the proper string representation for the given RDFTerm.
-   */
-  private String getResourceValue( RDFTerm resource ) {
-    StringBuilder value = new StringBuilder();
-    if( resource instanceof IRI ) {
-      value.append(((IRI) resource).getUnicodeString() );
-    } else if( resource instanceof Literal ) {
-      value.append( ((Literal) resource).getLexicalForm() );
-    } else if( resource instanceof BlankNode ) {
-      value.append( "/" );
-    } else {
-      value.append( resource.toString() );
+
+    // --------------------------------------------------------------------------
+    // Public interface
+    // --------------------------------------------------------------------------
+
+    /**
+     * Sets the text encoding for the resource. This setting must only used
+     * if the resource response represents text.
+     *
+     * @param textEncoding character encoding of text body
+     * @throws UnsupportedEncodingException when the given encoding is not supported.
+     */
+    public void setTextEncoding(String textEncoding) throws UnsupportedEncodingException {
+        buildSeparatorConformEncoding(textEncoding);
+        this.textEncoding = textEncoding;
     }
-    return value.toString();
-  }
-
-  /**
-   * Write the given string to the output stream and escape the output where
-   * necessary.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param text
-   *          the text to write.
-   * @throws IOException
-   */
-  private void writeEscaped( OutputStream outputStream, String text ) throws IOException {
-    String line = text;
-    if( text.contains( "\r" ) || text.contains( "\n" ) || text.contains( "," )
-        || text.contains( "\"" ) ) {
-      StringBuilder builder = new StringBuilder();
-      builder.append( '"' );
-      builder.append( text.replaceAll( "\"", "\"\"" ) );
-      builder.append( '"' );
-      line = builder.toString();
+
+    /**
+     * @return text encoding for resource
+     */
+    protected String getTextEncoding() {
+        return textEncoding;
+    }
+
+    // --------------------------------------------------------------------------
+    // Private methods
+    // --------------------------------------------------------------------------
+
+    /**
+     * Builds the column separator according to the given text encoding.
+     *
+     * @param encoding the text encoding to be used.
+     * @throws UnsupportedEncodingException when the given encoding is not supported.
+     */
+    private void buildSeparatorConformEncoding(String encoding) throws UnsupportedEncodingException {
+        separator = ",".getBytes(encoding);
+    }
+
+    /**
+     * Write resultset header to the given output stream.
+     *
+     * @param outputStream stream to write to.
+     * @param headers      the headers to write.
+     * @throws IOException
+     */
+    private void writeCsvHeader(OutputStream outputStream, List<String> headers) throws IOException {
+        boolean first = true;
+        for (String header : headers) {
+            if (!first) {
+                outputStream.write(separator);
+            }
+            writeEscaped(outputStream, header);
+            first = false;
+        }
+        outputStream.write("\n".getBytes(textEncoding));
+    }
+
+    /**
+     * Write a single csv line using the given line data.
+     *
+     * @param outputStream stream to write to.
+     * @param headers      the headers to write line data for.
+     * @param lineData     the line data to write.
+     * @throws IOException
+     */
+    private void writeCsvLine(OutputStream outputStream, List<String> headers,
+                              SolutionMapping lineData) throws IOException {
+        boolean first = true;
+        for (String header : headers) {
+            if (!first) {
+                outputStream.write(separator);
+            }
+            RDFTerm resource = lineData.get(header);
+            if (resource != null) {
+                writeEscaped(outputStream, getResourceValue(resource));
+            }
+            first = false;
+        }
+        outputStream.write("\n".getBytes(textEncoding));
+    }
+
+    /**
+     * Helper to get the proper string representation for the given RDFTerm.
+     */
+    private String getResourceValue(RDFTerm resource) {
+        StringBuilder value = new StringBuilder();
+        if (resource instanceof IRI) {
+            value.append(((IRI) resource).getUnicodeString());
+        } else if (resource instanceof Literal) {
+            value.append(((Literal) resource).getLexicalForm());
+        } else if (resource instanceof BlankNode) {
+            value.append("/");
+        } else {
+            value.append(resource.toString());
+        }
+        return value.toString();
+    }
+
+    /**
+     * Write the given string to the output stream and escape the output where
+     * necessary.
+     *
+     * @param outputStream stream to write to.
+     * @param text         the text to write.
+     * @throws IOException
+     */
+    private void writeEscaped(OutputStream outputStream, String text) throws IOException {
+        String line = text;
+        if (text.contains("\r") || text.contains("\n") || text.contains(",")
+                || text.contains("\"")) {
+            StringBuilder builder = new StringBuilder();
+            builder.append('"');
+            builder.append(text.replaceAll("\"", "\"\""));
+            builder.append('"');
+            line = builder.toString();
+        }
+        outputStream.write(line.getBytes(textEncoding));
     }
-    outputStream.write( line.getBytes( textEncoding ) );
-  }
 }
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
index c7a2c0c..0b71d2d 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
@@ -1,29 +1,31 @@
 /*
- * 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.
- */
+ * 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.jaxrs.sparql.providers;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Set;
+import org.apache.clerezza.api.*;
+import org.apache.clerezza.sparql.ResultSet;
+import org.apache.clerezza.sparql.SolutionMapping;
+import org.apache.clerezza.sparql.query.Variable;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -31,135 +33,125 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.osgi.service.component.annotations.Component;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
 
 /**
  * MessageBodyWirter for <code>ResultSet</code>.
  * Resulting output conforms to:
  * http://www.w3.org/TR/2007/NOTE-rdf-sparql-json-res-20070618/
- * 
+ *
  * @author misl
  */
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Produces({"application/json", "application/sparql-results+json"})
 @Provider
 @SuppressWarnings("unchecked")
 public class ResultSetJsonMessageBodyWriter implements MessageBodyWriter<ResultSet> {
 
-	final Logger logger = LoggerFactory.getLogger(ResultSetJsonMessageBodyWriter.class);
+    final Logger logger = LoggerFactory.getLogger(ResultSetJsonMessageBodyWriter.class);
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+                               MediaType mediaType) {
+        return ResultSet.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public long getSize(ResultSet t, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType) {
+        return -1;
+    }
 
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
-			MediaType mediaType) {
-		return ResultSet.class.isAssignableFrom(type);
-	}
+    @Override
+    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
+            Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
 
-	@Override
-	public long getSize(ResultSet t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
+        JSONObject json = toJsonSource(resultSet);
+        entityStream.write(json.toJSONString().getBytes("UTF-8"));
+    }
 
-	@Override
-	public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
-			Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+    /**
+     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
+     * json object.
+     *
+     * @param queryResult
+     */
+    private JSONObject toJsonSource(ResultSet queryResult) {
+        JSONObject root = new JSONObject();
+        JSONObject head = new JSONObject();
+        root.put("head", head);
+        createVariables(queryResult.getResultVars(), head);
 
-		JSONObject json = toJsonSource(resultSet);
-		entityStream.write(json.toJSONString().getBytes("UTF-8"));
-	}
+        JSONObject results = new JSONObject();
+        root.put("results", results);
 
-	/**
-	 * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
-	 * json object.
-	 *
-	 * @param queryResult
-	 */
-	private JSONObject toJsonSource(ResultSet queryResult) {
-		JSONObject root = new JSONObject();
-		JSONObject head = new JSONObject();
-		root.put("head", head);
-		createVariables(queryResult.getResultVars(), head);
-		
-		JSONObject results = new JSONObject();
-		root.put("results", results);
-		
-		JSONArray bindings = null;
-		while (queryResult.hasNext()) {
-			if (bindings == null) {
-				bindings = new JSONArray();
-				results.put("bindings", bindings);
-			}
-			bindings.add(createResult(queryResult.next()));				
-		}
+        JSONArray bindings = null;
+        while (queryResult.hasNext()) {
+            if (bindings == null) {
+                bindings = new JSONArray();
+                results.put("bindings", bindings);
+            }
+            bindings.add(createResult(queryResult.next()));
+        }
 
-		return root;
-	}
+        return root;
+    }
 
-	/**
-	 * Helper: creates value element from {@link RDFTerm} depending on its
-	 * class
-	 *
-	 */
-	private JSONObject createResultElement(RDFTerm resource) {
-		JSONObject element = new JSONObject();
-		if (resource instanceof IRI) {
-			element.put("type", "uri");
-			element.put("value", IRI.class.cast(resource).getUnicodeString());
-		} else if (resource instanceof Literal) {
-			element.put("type", "literal");
-			element.put("value", Literal.class.cast(resource).getLexicalForm());
-			Language lang = Literal.class.cast(resource).getLanguage();
-			if (lang != null) {
-				element.put("xml:lang", lang.toString());
-			}
-		} else if (resource instanceof Literal) {
-			element.put("type", "typed-literal");
-			element.put("datatype", Literal.class.cast(resource).getDataType().getUnicodeString());
-			element.put("value", Literal.class.cast(resource).getLexicalForm());
-		} else if (resource instanceof BlankNode) {
-			element.put("type", "bnode");
-			element.put("value", "/");
-		} else {
-			element = null;
-		}
-		return element;
-	}
+    /**
+     * Helper: creates value element from {@link RDFTerm} depending on its
+     * class
+     */
+    private JSONObject createResultElement(RDFTerm resource) {
+        JSONObject element = new JSONObject();
+        if (resource instanceof IRI) {
+            element.put("type", "uri");
+            element.put("value", IRI.class.cast(resource).getUnicodeString());
+        } else if (resource instanceof Literal) {
+            element.put("type", "literal");
+            element.put("value", Literal.class.cast(resource).getLexicalForm());
+            Language lang = Literal.class.cast(resource).getLanguage();
+            if (lang != null) {
+                element.put("xml:lang", lang.toString());
+            }
+        } else if (resource instanceof Literal) {
+            element.put("type", "typed-literal");
+            element.put("datatype", Literal.class.cast(resource).getDataType().getUnicodeString());
+            element.put("value", Literal.class.cast(resource).getLexicalForm());
+        } else if (resource instanceof BlankNode) {
+            element.put("type", "bnode");
+            element.put("value", "/");
+        } else {
+            element = null;
+        }
+        return element;
+    }
 
-	/**
-	 * Helper: creates results element from ResultSet
-	 *
-	 */
-	private JSONObject createResult(SolutionMapping solutionMap) {
-		JSONObject result = new JSONObject();
-		Set<Variable> keys = solutionMap.keySet();
-		for (Variable key : keys) {
-			result.put(key.getName(), createResultElement((RDFTerm) solutionMap.get(key)));
-		}
-		return result;
-	}
+    /**
+     * Helper: creates results element from ResultSet
+     */
+    private JSONObject createResult(SolutionMapping solutionMap) {
+        JSONObject result = new JSONObject();
+        Set<Variable> keys = solutionMap.keySet();
+        for (Variable key : keys) {
+            result.put(key.getName(), createResultElement((RDFTerm) solutionMap.get(key)));
+        }
+        return result;
+    }
 
-	private void createVariables(List<String> variables, JSONObject head) {
-		JSONArray vars = null;
-		for (String variable : variables) {
-			if (vars == null) {
-				vars = new JSONArray();
-				head.put("vars", vars);
-			}
-			vars.add(variable);
-		}
-	}
+    private void createVariables(List<String> variables, JSONObject head) {
+        JSONArray vars = null;
+        for (String variable : variables) {
+            if (vars == null) {
+                vars = new JSONArray();
+                head.put("vars", vars);
+            }
+            vars.add(variable);
+        }
+    }
 }
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
index bd53d3c..d4b4db0 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
@@ -1,29 +1,31 @@
 /*
- * 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.
- */
+ * 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.jaxrs.sparql.providers;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.ResultSet;
+import org.apache.clerezza.sparql.SolutionMapping;
+import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -31,207 +33,195 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.osgi.service.component.annotations.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
 
 /**
  * MessageBodyWirter for <code>ResultSet</code>. Resulting output is tsv and
  * conforms to:
  * http://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/#tsv
- * 
+ * <p>
  * Also see: http://www.iana.org/assignments/media-types/text/tab-separated-values
- * 
+ *
  * @author misl
  */
-@Component(service=Object.class, property={"javax.ws.rs=true"})
-@Produces( { "text/tab-separated-values" } )
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
+@Produces({"text/tab-separated-values"})
 @Provider
 public class ResultSetTsvMessageBodyWriter implements MessageBodyWriter<ResultSet> {
 
-  private static final Logger logger = LoggerFactory
-      .getLogger( ResultSetTsvMessageBodyWriter.class );
-
-  private String textEncoding = "UTF-8";
-  private byte[] separator;
-  
-  public ResultSetTsvMessageBodyWriter() {
-    try {
-      buildSeparatorConformEncoding( textEncoding );
-    } catch( UnsupportedEncodingException e ) {
-      logger.error( "Developer error", e );
+    private static final Logger logger = LoggerFactory
+            .getLogger(ResultSetTsvMessageBodyWriter.class);
+
+    private String textEncoding = "UTF-8";
+    private byte[] separator;
+
+    public ResultSetTsvMessageBodyWriter() {
+        try {
+            buildSeparatorConformEncoding(textEncoding);
+        } catch (UnsupportedEncodingException e) {
+            logger.error("Developer error", e);
+        }
+    }
+
+    // --------------------------------------------------------------------------
+    // Implementing MessageBodyWriter
+    // --------------------------------------------------------------------------
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+                               MediaType mediaType) {
+        return ResultSet.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public long getSize(ResultSet t, Class<?> type, Type genericType, Annotation[] annotations,
+                        MediaType mediaType) {
+        return -1;
     }
-  }
-  
-  // --------------------------------------------------------------------------
-  // Implementing MessageBodyWriter
-  // --------------------------------------------------------------------------
-
-  @Override
-  public boolean isWriteable( Class<?> type, Type genericType, Annotation[] annotations,
-      MediaType mediaType ) {
-    return ResultSet.class.isAssignableFrom( type );
-  }
-
-  @Override
-  public long getSize( ResultSet t, Class<?> type, Type genericType, Annotation[] annotations,
-      MediaType mediaType ) {
-    return -1;
-  }
-
-  @Override
-  public void writeTo( ResultSet resultSet, Class<?> type, Type genericType,
-      Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
-      OutputStream entityStream ) throws IOException, WebApplicationException {
-
-    // According to spec header is mandatory.
-    writeTsvHeader( entityStream, resultSet.getResultVars() );
-    while( resultSet.hasNext() ) {
-      writeTsvLine( entityStream, resultSet.getResultVars(), resultSet.next() );
+
+    @Override
+    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
+                        OutputStream entityStream) throws IOException, WebApplicationException {
+
+        // According to spec header is mandatory.
+        writeTsvHeader(entityStream, resultSet.getResultVars());
+        while (resultSet.hasNext()) {
+            writeTsvLine(entityStream, resultSet.getResultVars(), resultSet.next());
+        }
     }
-  }
-
-  // --------------------------------------------------------------------------
-  // Public interface
-  // --------------------------------------------------------------------------
-  
-  /**
-   * Sets the text encoding for the resource. This setting must only used 
-   * if the resource response represents text.
-   * 
-   * @param textEncoding
-   *            character encoding of text body
-   * @throws UnsupportedEncodingException when the given encoding is not supported.
-   */
-  public void setTextEncoding(String textEncoding) throws UnsupportedEncodingException {
-    buildSeparatorConformEncoding( textEncoding );
-    this.textEncoding = textEncoding;
-  }
-
-  /**
-   * @return text encoding for resource
-   */
-  protected String getTextEncoding() {
-    return textEncoding;
-  }
-
-  // --------------------------------------------------------------------------
-  // Private methods
-  // --------------------------------------------------------------------------
-
-  /**
-   * Builds the column separator according to the given text encoding.
-   * 
-   * @param encoding the text encoding to be used.
-   * @throws UnsupportedEncodingException when the given encoding is not supported.
-   */  
-  private void buildSeparatorConformEncoding( String encoding ) throws UnsupportedEncodingException {
-    separator = ",".getBytes( encoding );
-  }
-
-  /**
-   * Write resultset header to the given output stream.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param headers
-   *          the headers to write.
-   * @throws IOException
-   */
-  private void writeTsvHeader( OutputStream outputStream, List<String> headers ) throws IOException {
-    boolean first = true;
-    for( String header : headers ) {
-      if( !first ) {
-        outputStream.write( separator );
-      }
-      writeEscaped( outputStream, header );
-      first = false;
+
+    // --------------------------------------------------------------------------
+    // Public interface
+    // --------------------------------------------------------------------------
+
+    /**
+     * Sets the text encoding for the resource. This setting must only used
+     * if the resource response represents text.
+     *
+     * @param textEncoding character encoding of text body
+     * @throws UnsupportedEncodingException when the given encoding is not supported.
+     */
+    public void setTextEncoding(String textEncoding) throws UnsupportedEncodingException {
+        buildSeparatorConformEncoding(textEncoding);
+        this.textEncoding = textEncoding;
+    }
+
+    /**
+     * @return text encoding for resource
+     */
+    protected String getTextEncoding() {
+        return textEncoding;
     }
-    outputStream.write( "\n".getBytes( textEncoding ) );
-  }
-
-  /**
-   * Write a single tsv line using the given line data.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param headers
-   *          the headers to write line data for.
-   * @param lineData
-   *          the line data to write.
-   * @throws IOException
-   */
-  private void writeTsvLine( OutputStream outputStream, List<String> headers,
-      SolutionMapping lineData ) throws IOException {
-    boolean first = true;
-    for( String header : headers ) {
-      if( !first ) {
-        outputStream.write( separator );
-      }
-      RDFTerm resource = lineData.get( header );
-      if( resource != null ) {
-        writeEscaped( outputStream, getResourceValue( resource ) );
-      }
-      first = false;
+
+    // --------------------------------------------------------------------------
+    // Private methods
+    // --------------------------------------------------------------------------
+
+    /**
+     * Builds the column separator according to the given text encoding.
+     *
+     * @param encoding the text encoding to be used.
+     * @throws UnsupportedEncodingException when the given encoding is not supported.
+     */
+    private void buildSeparatorConformEncoding(String encoding) throws UnsupportedEncodingException {
+        separator = ",".getBytes(encoding);
     }
-    outputStream.write( "\n".getBytes( textEncoding ) );
-  }
-
-  /**
-   * Helper to get the proper string representation for the given RDFTerm.
-   */
-  private String getResourceValue( RDFTerm resource ) {
-    StringBuilder value = new StringBuilder();
-    if( resource instanceof IRI ) {
-      value.append( resource.toString() );
-    } else if( resource instanceof Literal ) {
-      value.append( "\"" );
-      value.append( escapedDQuotes(((Literal) resource).getLexicalForm()) );
-      value.append( "\"" );
-    } else if( resource instanceof BlankNode ) {
-      value.append( "/" );
-    } else {
-      value.append( resource.toString() );
+
+    /**
+     * Write resultset header to the given output stream.
+     *
+     * @param outputStream stream to write to.
+     * @param headers      the headers to write.
+     * @throws IOException
+     */
+    private void writeTsvHeader(OutputStream outputStream, List<String> headers) throws IOException {
+        boolean first = true;
+        for (String header : headers) {
+            if (!first) {
+                outputStream.write(separator);
+            }
+            writeEscaped(outputStream, header);
+            first = false;
+        }
+        outputStream.write("\n".getBytes(textEncoding));
     }
-    return value.toString();
-  }
-
-  /**
-   * Write the given string to the output stream and escape the output where
-   * necessary.
-   * 
-   * @param outputStream
-   *          stream to write to.
-   * @param text
-   *          the text to write.
-   * @throws IOException
-   */
-  private void writeEscaped( OutputStream outputStream, String text ) throws IOException {
-    String line = text;
-    if( text.contains( "\r" ) ) {
-      line = text.replaceAll( "\r", "\\r" );
+
+    /**
+     * Write a single tsv line using the given line data.
+     *
+     * @param outputStream stream to write to.
+     * @param headers      the headers to write line data for.
+     * @param lineData     the line data to write.
+     * @throws IOException
+     */
+    private void writeTsvLine(OutputStream outputStream, List<String> headers,
+                              SolutionMapping lineData) throws IOException {
+        boolean first = true;
+        for (String header : headers) {
+            if (!first) {
+                outputStream.write(separator);
+            }
+            RDFTerm resource = lineData.get(header);
+            if (resource != null) {
+                writeEscaped(outputStream, getResourceValue(resource));
+            }
+            first = false;
+        }
+        outputStream.write("\n".getBytes(textEncoding));
     }
-    if( text.contains( "\n" ) ) {
-      line = text.replaceAll( "\n", "\\n" );
+
+    /**
+     * Helper to get the proper string representation for the given RDFTerm.
+     */
+    private String getResourceValue(RDFTerm resource) {
+        StringBuilder value = new StringBuilder();
+        if (resource instanceof IRI) {
+            value.append(resource.toString());
+        } else if (resource instanceof Literal) {
+            value.append("\"");
+            value.append(escapedDQuotes(((Literal) resource).getLexicalForm()));
+            value.append("\"");
+        } else if (resource instanceof BlankNode) {
+            value.append("/");
+        } else {
+            value.append(resource.toString());
+        }
+        return value.toString();
     }
-    if( text.contains( "\t" ) ) {
-      line = text.replaceAll( "\t", "\\t" );
+
+    /**
+     * Write the given string to the output stream and escape the output where
+     * necessary.
+     *
+     * @param outputStream stream to write to.
+     * @param text         the text to write.
+     * @throws IOException
+     */
+    private void writeEscaped(OutputStream outputStream, String text) throws IOException {
+        String line = text;
+        if (text.contains("\r")) {
+            line = text.replaceAll("\r", "\\r");
+        }
+        if (text.contains("\n")) {
+            line = text.replaceAll("\n", "\\n");
+        }
+        if (text.contains("\t")) {
+            line = text.replaceAll("\t", "\\t");
+        }
+        outputStream.write(line.getBytes(textEncoding));
     }
-    outputStream.write( line.getBytes( textEncoding ) );
-  }
 
-  private String escapedDQuotes( String text ) {
-    String line = text;
-    if( text.contains( "\"" ) ) {
-      line = text.replaceAll( "\"", "\"\"" );
+    private String escapedDQuotes(String text) {
+        String line = text;
+        if (text.contains("\"")) {
+            line = text.replaceAll("\"", "\"\"");
+        }
+        return line;
     }
-    return line;
-  }
 }
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
index 59a7063..1b50088 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
@@ -1,29 +1,34 @@
 /*
- * 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.
- */
+ * 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.jaxrs.sparql.providers;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Set;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.ResultSet;
+import org.apache.clerezza.sparql.SolutionMapping;
+import org.apache.clerezza.sparql.query.Variable;
+import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -39,158 +44,149 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
-
-import org.apache.clerezza.commons.rdf.Language;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.osgi.service.component.annotations.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
 
 /**
  * MessageBodyWirter for <code>ResultSet</code>.
  * Resulting output conforms to:
  * http://www.w3.org/TR/2008/REC-rdf-sparql-XMLres-20080115/
- * 
+ *
  * @author mir, reto
  */
-@Component(service=Object.class, property={"javax.ws.rs=true"})
+@Component(service = Object.class, property = {"javax.ws.rs=true"})
 @Produces({"application/xml", "text/xml", "application/sparql-results+xml"})
 @Provider
 public class ResultSetXmlMessageBodyWriter implements MessageBodyWriter<ResultSet> {
 
-	private Providers providers;
-
-	final Logger logger = LoggerFactory.getLogger(ResultSetXmlMessageBodyWriter.class);
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
-			MediaType mediaType) {
-		return ResultSet.class.isAssignableFrom(type);
-	}
-
-	@Override
-	public long getSize(ResultSet t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
-			Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
-
-		Source source = toXmlSource(resultSet);
-		MessageBodyWriter<Source> sourceMessageBodyWriter = 
-				providers.getMessageBodyWriter(Source.class, null, null, mediaType);
-		sourceMessageBodyWriter.writeTo(source, Source.class, null, null, mediaType,
-				httpHeaders, entityStream);
-	}
-
-	@Context
-	public void setProviders(Providers providers) {
-		this.providers = providers;
-	}
-
-	/**
-	 * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
-	 * {@link DOMSource}
-	 *
-	 * @param queryResult
-	 * @param query
-	 * @param applyStyle
-	 */
-	private Source toXmlSource(ResultSet queryResult) {
-		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-		try {
-			Document doc = dbf.newDocumentBuilder().newDocument();
-			// adding root element
-			Element root = doc.createElement("sparql");
-			root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
-			doc.appendChild(root);
-			Element head = doc.createElement("head");
-			createVariables(queryResult.getResultVars(), head, doc);
-			root.appendChild(head);
-
-			Element results = doc.createElement("results");
-			while (queryResult.hasNext()) {
-				createResultElement(queryResult.next(), results, doc);				
-			}
-			root.appendChild(results);
-
-			DOMSource source = new DOMSource(doc);
-			return source;
-
-		} catch (ParserConfigurationException e) {
-			throw createWebApplicationException(e);
-		}
-	}
-
-	/**
-	 * Creates a WebApplicationexception and prints a logger entry
-	 */
-	private WebApplicationException createWebApplicationException(Exception e) {
-		return new WebApplicationException(Response.status(Status.BAD_REQUEST)
-				.entity(e.getMessage().replace("<", "&lt;").replace("\n",
-						"<br/>")).build());
-	}
-
-
-	/**
-	 * Helper: creates value element from {@link RDFTerm} depending on its
-	 * class
-	 *
-	 */
-	private Element createValueElement(RDFTerm resource, Document doc) {
-		Element value = null;
-		if (resource instanceof IRI) {
-			value = doc.createElement("uri");
-			value.appendChild(doc.createTextNode(((IRI) resource)
-					.getUnicodeString()));
-		} else if (resource instanceof Literal) {
-			value = doc.createElement("literal");
-			value.appendChild(doc.createTextNode(((Literal) resource)
-					.getLexicalForm()));
-			value.setAttribute("datatype", (((Literal) resource)
-					.getDataType().getUnicodeString()));
-			Language lang = ((Literal) resource).getLanguage();
-			if (lang != null) {
-				value.setAttribute("xml:lang", (lang.toString()));
-			}
-		} else {
-			value = doc.createElement("bnode");
-			value.appendChild(doc.createTextNode("/"));
-		}
-		return value;
-	}
-
-	/**
-	 * Helper: creates results element from ResultSet
-	 *
-	 */
-	private void createResultElement(SolutionMapping solutionMap, Element results, Document doc) {
-		Set<Variable> keys = solutionMap.keySet();
-		Element result = doc.createElement("result");
-		results.appendChild(result);
-		for (Variable key : keys) {
-			Element bindingElement = doc.createElement("binding");
-			bindingElement.setAttribute("name", key.getName());
-			bindingElement.appendChild(createValueElement((RDFTerm) solutionMap.get(key), doc));
-			result.appendChild(bindingElement);
-		}
-	}
-
-	private void createVariables(List<String> variables, Element head, Document doc) {
-		for (String variable : variables) {
-			Element varElement = doc.createElement("variable");
-			varElement.setAttribute("name", variable);
-			head.appendChild(varElement);
-		}
-	}
+    private Providers providers;
+
+    final Logger logger = LoggerFactory.getLogger(ResultSetXmlMessageBodyWriter.class);
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+                               MediaType mediaType) {
+        return ResultSet.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public long getSize(ResultSet t, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
+                        Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
+            Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+
+        Source source = toXmlSource(resultSet);
+        MessageBodyWriter<Source> sourceMessageBodyWriter =
+                providers.getMessageBodyWriter(Source.class, null, null, mediaType);
+        sourceMessageBodyWriter.writeTo(source, Source.class, null, null, mediaType,
+                httpHeaders, entityStream);
+    }
+
+    @Context
+    public void setProviders(Providers providers) {
+        this.providers = providers;
+    }
+
+    /**
+     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
+     * {@link DOMSource}
+     *
+     * @param queryResult
+     * @param query
+     * @param applyStyle
+     */
+    private Source toXmlSource(ResultSet queryResult) {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        try {
+            Document doc = dbf.newDocumentBuilder().newDocument();
+            // adding root element
+            Element root = doc.createElement("sparql");
+            root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
+            doc.appendChild(root);
+            Element head = doc.createElement("head");
+            createVariables(queryResult.getResultVars(), head, doc);
+            root.appendChild(head);
+
+            Element results = doc.createElement("results");
+            while (queryResult.hasNext()) {
+                createResultElement(queryResult.next(), results, doc);
+            }
+            root.appendChild(results);
+
+            DOMSource source = new DOMSource(doc);
+            return source;
+
+        } catch (ParserConfigurationException e) {
+            throw createWebApplicationException(e);
+        }
+    }
+
+    /**
+     * Creates a WebApplicationexception and prints a logger entry
+     */
+    private WebApplicationException createWebApplicationException(Exception e) {
+        return new WebApplicationException(Response.status(Status.BAD_REQUEST)
+                .entity(e.getMessage().replace("<", "&lt;").replace("\n",
+                        "<br/>")).build());
+    }
+
+
+    /**
+     * Helper: creates value element from {@link RDFTerm} depending on its
+     * class
+     */
+    private Element createValueElement(RDFTerm resource, Document doc) {
+        Element value = null;
+        if (resource instanceof IRI) {
+            value = doc.createElement("uri");
+            value.appendChild(doc.createTextNode(((IRI) resource)
+                    .getUnicodeString()));
+        } else if (resource instanceof Literal) {
+            value = doc.createElement("literal");
+            value.appendChild(doc.createTextNode(((Literal) resource)
+                    .getLexicalForm()));
+            value.setAttribute("datatype", (((Literal) resource)
+                    .getDataType().getUnicodeString()));
+            Language lang = ((Literal) resource).getLanguage();
+            if (lang != null) {
+                value.setAttribute("xml:lang", (lang.toString()));
+            }
+        } else {
+            value = doc.createElement("bnode");
+            value.appendChild(doc.createTextNode("/"));
+        }
+        return value;
+    }
+
+    /**
+     * Helper: creates results element from ResultSet
+     */
+    private void createResultElement(SolutionMapping solutionMap, Element results, Document doc) {
+        Set<Variable> keys = solutionMap.keySet();
+        Element result = doc.createElement("result");
+        results.appendChild(result);
+        for (Variable key : keys) {
+            Element bindingElement = doc.createElement("binding");
+            bindingElement.setAttribute("name", key.getName());
+            bindingElement.appendChild(createValueElement((RDFTerm) solutionMap.get(key), doc));
+            result.appendChild(bindingElement);
+        }
+    }
+
+    private void createVariables(List<String> variables, Element head, Document doc) {
+        for (String variable : variables) {
+            Element varElement = doc.createElement("variable");
+            varElement.setAttribute("name", variable);
+            head.appendChild(varElement);
+        }
+    }
 }


[clerezza] 14/45: CLEREZZA-1026: Update version in sparql module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 55c58cd7d46d7d421c71196039f7bbe704d2a2f4
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 3 18:29:03 2019 +0100

    CLEREZZA-1026: Update version in sparql module
---
 sparql/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sparql/pom.xml b/sparql/pom.xml
index 10e64ad..4b93faa 100644
--- a/sparql/pom.xml
+++ b/sparql/pom.xml
@@ -31,7 +31,7 @@
 
     <artifactId>sparql</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>8-SNAPSHOT</version>
     <name>Clerezza - SPARQL</name>
     <description>Model SPARQL query and update</description>
 


[clerezza] 17/45: CLEREZZA-1031: Add representation and dataset module to reactor pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 3fd7cbe4a86ee26d9473f430c891fdf5ad08ebb8
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Feb 3 18:54:12 2019 +0100

    CLEREZZA-1031: Add representation and dataset module to reactor pom.xml
---
 pom.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pom.xml b/pom.xml
index 6e43739..6262f90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,8 @@
         <module>api</module>
         <module>api.impl</module>
         <module>sparql</module>
+        <module>representation</module>
+        <module>dataset</module>
         <module>impl.sparql</module>
         <module>jaxrs.rdf.providers</module>
         <module>parent</module>


[clerezza] 05/45: CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 566be34b226ba1d0f35ec59591ad4cd062a34b27
Author: Hasan <ha...@apache.org>
AuthorDate: Sun Nov 4 23:45:28 2018 +0100

    CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml
---
 api.impl/pom.xml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/api.impl/pom.xml b/api.impl/pom.xml
index 871beb6..1107f60 100644
--- a/api.impl/pom.xml
+++ b/api.impl/pom.xml
@@ -60,6 +60,14 @@
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.22.1</version>
+                <configuration>
+                    <useSystemClassLoader>false</useSystemClassLoader>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 


[clerezza] 06/45: Revert "CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml"

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 1ac8b3aed3b66bb4820d1eb8c056f196adc671c1
Author: Hasan <ha...@apache.org>
AuthorDate: Mon Nov 5 00:05:03 2018 +0100

    Revert "CLEREZZA-1026: Add maven-surefire-plugin in api.impl pom.xml"
    
    This reverts commit 53ffa575f679c44510a1fa71e4db447ca29bf41d.
---
 api.impl/pom.xml | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/api.impl/pom.xml b/api.impl/pom.xml
index 1107f60..871beb6 100644
--- a/api.impl/pom.xml
+++ b/api.impl/pom.xml
@@ -60,14 +60,6 @@
                     </instructions>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.22.1</version>
-                <configuration>
-                    <useSystemClassLoader>false</useSystemClassLoader>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 


[clerezza] 09/45: CLEREZZA-1026: Introduce GraphStore to remove dependency to TcProvider and refactor sparql

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit ca800183edfd494a8a3fbd5051ac58ebc6832515
Author: Hasan <ha...@apache.org>
AuthorDate: Wed Nov 14 04:03:36 2018 +0100

    CLEREZZA-1026: Introduce GraphStore to remove dependency to TcProvider and refactor sparql
---
 sparql/pom.xml                                     |  133 +
 .../org/apache/clerezza/sparql/GraphStore.java     |   22 +
 .../clerezza/sparql/NoQueryEngineException.java    |   42 +
 .../org/apache/clerezza/sparql/QueryEngine.java    |   45 +
 .../org/apache/clerezza/sparql/QueryParser.java    |   71 +
 .../java/org/apache/clerezza/sparql/ResultSet.java |   39 +
 .../apache/clerezza/sparql/SolutionMapping.java    |   51 +
 .../apache/clerezza/sparql/SparqlPreParser.java    |  160 ++
 .../clerezza/sparql/StringQuerySerializer.java     |   90 +
 .../clerezza/sparql/query/AbstractOperation.java   |   41 +
 .../sparql/query/AlternativeGraphPattern.java      |   38 +
 .../org/apache/clerezza/sparql/query/AskQuery.java |   29 +
 .../clerezza/sparql/query/BasicGraphPattern.java   |   38 +
 .../clerezza/sparql/query/BinaryOperation.java     |   46 +
 .../sparql/query/BinaryPropertyPathOperation.java  |   44 +
 .../apache/clerezza/sparql/query/BuiltInCall.java  |   47 +
 .../clerezza/sparql/query/ConstructQuery.java      |   41 +
 .../org/apache/clerezza/sparql/query/DataSet.java  |   47 +
 .../clerezza/sparql/query/DescribeQuery.java       |   50 +
 .../apache/clerezza/sparql/query/Expression.java   |   42 +
 .../apache/clerezza/sparql/query/FunctionCall.java |   49 +
 .../clerezza/sparql/query/GraphGraphPattern.java   |   42 +
 .../apache/clerezza/sparql/query/GraphPattern.java |   30 +
 .../clerezza/sparql/query/GroupGraphPattern.java   |   70 +
 .../apache/clerezza/sparql/query/InlineData.java   |   32 +
 .../clerezza/sparql/query/LiteralExpression.java   |   40 +
 .../clerezza/sparql/query/MinusGraphPattern.java   |   40 +
 .../sparql/query/OptionalGraphPattern.java         |   45 +
 .../clerezza/sparql/query/OrderCondition.java      |   37 +
 .../query/PathSupportedBasicGraphPattern.java      |   43 +
 .../sparql/query/PatternExistenceCondition.java    |   66 +
 .../clerezza/sparql/query/PredicatePath.java       |   38 +
 .../sparql/query/PropertyPathExpression.java       |   29 +
 .../query/PropertyPathExpressionOrVariable.java    |  104 +
 .../clerezza/sparql/query/PropertyPathPattern.java |   46 +
 .../apache/clerezza/sparql/query/PropertySet.java  |   44 +
 .../org/apache/clerezza/sparql/query/Query.java    |   59 +
 .../sparql/query/QueryWithSolutionModifier.java    |   68 +
 .../clerezza/sparql/query/ResourceOrVariable.java  |  106 +
 .../sparql/query/RhsListBinaryOperation.java       |   47 +
 .../apache/clerezza/sparql/query/SelectQuery.java  |   70 +
 .../clerezza/sparql/query/ServiceGraphPattern.java |   41 +
 .../apache/clerezza/sparql/query/SparqlUnit.java   |   51 +
 .../clerezza/sparql/query/TriplePattern.java       |   44 +
 .../clerezza/sparql/query/UnaryOperation.java      |   38 +
 .../sparql/query/UnaryPropertyPathOperation.java   |   37 +
 .../clerezza/sparql/query/UriRefExpression.java    |   39 +
 .../clerezza/sparql/query/UriRefOrVariable.java    |   43 +
 .../org/apache/clerezza/sparql/query/Variable.java |   86 +
 .../query/impl/SimpleAlternativeGraphPattern.java  |   60 +
 .../clerezza/sparql/query/impl/SimpleAskQuery.java |   33 +
 .../sparql/query/impl/SimpleBasicGraphPattern.java |   49 +
 .../sparql/query/impl/SimpleConstructQuery.java    |   51 +
 .../clerezza/sparql/query/impl/SimpleDataSet.java  |   52 +
 .../sparql/query/impl/SimpleDescribeQuery.java     |   61 +
 .../sparql/query/impl/SimpleGraphGraphPattern.java |   55 +
 .../sparql/query/impl/SimpleGroupGraphPattern.java |  221 ++
 .../sparql/query/impl/SimpleInlineData.java        |   54 +
 .../sparql/query/impl/SimpleMinusGraphPattern.java |   67 +
 .../query/impl/SimpleOptionalGraphPattern.java     |   68 +
 .../sparql/query/impl/SimpleOrderCondition.java    |   47 +
 .../impl/SimplePathSupportedBasicGraphPattern.java |   49 +
 .../query/impl/SimplePropertyPathPattern.java      |  132 +
 .../clerezza/sparql/query/impl/SimpleQuery.java    |   76 +
 .../impl/SimpleQueryWithSolutionModifier.java      |   93 +
 .../sparql/query/impl/SimpleSelectQuery.java       |   80 +
 .../query/impl/SimpleServiceGraphPattern.java      |   66 +
 .../sparql/query/impl/SimpleSparqlUnit.java        |   65 +
 .../query/impl/SimpleStringQuerySerializer.java    |  295 +++
 .../sparql/query/impl/SimpleTriplePattern.java     |  136 ++
 .../org/apache/clerezza/sparql/update/Update.java  |   52 +
 .../clerezza/sparql/update/UpdateOperation.java    |   57 +
 .../clerezza/sparql/update/impl/AddOperation.java  |   29 +
 .../sparql/update/impl/BaseUpdateOperation.java    |   86 +
 .../sparql/update/impl/ClearOperation.java         |   26 +
 .../sparql/update/impl/ClearOrDropOperation.java   |   61 +
 .../clerezza/sparql/update/impl/CopyOperation.java |   26 +
 .../sparql/update/impl/CreateOperation.java        |   55 +
 .../sparql/update/impl/DeleteDataOperation.java    |   26 +
 .../sparql/update/impl/DeleteWhereOperation.java   |   26 +
 .../clerezza/sparql/update/impl/DropOperation.java |   26 +
 .../sparql/update/impl/InsertDataOperation.java    |   26 +
 .../clerezza/sparql/update/impl/LoadOperation.java |   39 +
 .../sparql/update/impl/ModifyOperation.java        |  112 +
 .../clerezza/sparql/update/impl/MoveOperation.java |   26 +
 .../apache/clerezza/sparql/update/impl/Quad.java   |   43 +
 .../clerezza/sparql/update/impl/SimpleUpdate.java  |   52 +
 .../sparql/update/impl/SimpleUpdateOperation.java  |   77 +
 .../update/impl/UpdateOperationWithQuads.java      |   79 +
 .../clerezza/sparql/JavaCCGeneratedQueryParser.jj  | 1285 ++++++++++
 .../sparql/JavaCCGeneratedSparqlPreParser.jj       | 2557 ++++++++++++++++++++
 .../QueryParserSerializerCombinationTest.java      |  135 ++
 .../apache/clerezza/sparql/QueryParserTest.java    |  367 +++
 .../clerezza/sparql/QuerySerializerTest.java       |  303 +++
 .../clerezza/sparql/SparqlPreParserTest.java       |  511 ++++
 95 files changed, 10492 insertions(+)

diff --git a/sparql/pom.xml b/sparql/pom.xml
new file mode 100644
index 0000000..10e64ad
--- /dev/null
+++ b/sparql/pom.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+   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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>8-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>sparql</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.2-SNAPSHOT</version>
+    <name>Clerezza - SPARQL</name>
+    <description>Model SPARQL query and update</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>javacc-maven-plugin</artifactId>
+                <version>2.5</version>
+                <executions>
+                    <execution>
+                        <id>javacc</id>
+                        <goals>
+                            <goal>javacc</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.xsite</groupId>
+                <artifactId>xsite-maven-plugin</artifactId>
+                <configuration>
+                    <sourceDirectoryPath>${basedir}/src/site/xsite</sourceDirectoryPath>
+                    <sitemapPath>content/sitemap.xml</sitemapPath>
+                    <skinPath>templates/skin.html</skinPath>
+                    <outputDirectoryPath>${basedir}/target/site/documentation</outputDirectoryPath>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>site</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.clerezza.sparql.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-scr-scrdescriptor</id>
+                        <goals>
+                            <goal>scr</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/GraphStore.java b/sparql/src/main/java/org/apache/clerezza/sparql/GraphStore.java
new file mode 100644
index 0000000..34113b9
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/GraphStore.java
@@ -0,0 +1,22 @@
+package org.apache.clerezza.sparql;
+
+import org.apache.clerezza.api.IRI;
+
+import java.util.Set;
+
+public interface GraphStore {
+
+    /**
+     * Lists the name of the <Code>Graph</code>s available through this <code>GraphStore</code>.
+     *
+     * @return the list of <Code>Graph</code>s
+     */
+    Set<IRI> listGraphs();
+
+    /**
+     * Lists the name of the named <Code>Graph</code>s available through this <code>GraphStore</code>.
+     *
+     * @return the list of named <Code>Graph</code>s
+     */
+    Set<IRI> listNamedGraphs();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/NoQueryEngineException.java b/sparql/src/main/java/org/apache/clerezza/sparql/NoQueryEngineException.java
new file mode 100644
index 0000000..37547ef
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/NoQueryEngineException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.sparql;
+
+/**
+ * Indicates that there is no available query engine for resolving a query.
+ *
+ * @author rbn
+ */
+public class NoQueryEngineException extends RuntimeException {
+
+    /**
+     * Creates a new instance of <code>NoQueryEngineException</code> without detail message.
+     */
+    public NoQueryEngineException() {
+    }
+
+
+    /**
+     * Constructs an instance of <code>NoQueryEngineException</code> with the specified detail message.
+     * @param msg the detail message.
+     */
+    public NoQueryEngineException(String msg) {
+        super(msg);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/QueryEngine.java b/sparql/src/main/java/org/apache/clerezza/sparql/QueryEngine.java
new file mode 100644
index 0000000..1592fa7
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/QueryEngine.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.sparql.query.Query;
+
+/**
+ * A QueryEngine can process SPARQL queries against an arbitrary set of graphs.
+ * 
+ * @author rbn
+ */
+public interface QueryEngine {
+
+	/**
+	 * Executes any sparql query. The type of the result object will vary
+	 * depending on the type of the query.
+	 * 
+	 * @param graphStore
+	 *            where the query originates.
+	 * @param defaultGraph
+	 *            the default ImmutableGraph against which to execute the query if no
+	 *            FROM clause is present
+	 * @param query
+	 *            string to be executed.
+	 * @return the resulting ResultSet, ImmutableGraph or Boolean value
+	 */
+	public Object execute(GraphStore graphStore, Graph defaultGraph, String query);
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/QueryParser.java b/sparql/src/main/java/org/apache/clerezza/sparql/QueryParser.java
new file mode 100644
index 0000000..259d282
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/QueryParser.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.sparql;
+
+import org.apache.clerezza.sparql.query.Query;
+import org.osgi.service.component.annotations.Component;
+
+import java.io.StringReader;
+
+/**
+ * This class implements an OSGi service to provide a method to parse a
+ * SPARQL query and generate a {@link Query} object.
+ *
+ * @author hasan
+ */
+
+@Component(service = QueryParser.class)
+public class QueryParser {
+
+    private static volatile QueryParser instance;
+    public QueryParser() {
+        QueryParser.instance = this;
+    }
+
+    /**
+     * Returns an instance of this class.
+     * This method is provided due to backward compatibility.
+     */
+    public static QueryParser getInstance() {
+        if (instance == null) {
+            synchronized (QueryParser.class) {
+                if (instance == null) {
+                    new QueryParser();
+                }
+            }
+        }
+        return instance;
+    }
+
+    /**
+     * Parses a SPARQL query string into a {@link Query} object.
+     *
+     * @param queryString
+     *        SPARQL query string
+     * @return
+     *        {@link Query} object corresponding to the specified query string
+     *
+     * @throws org.apache.clerezza.sparql.ParseException
+     */
+    public Query parse(final String queryString) throws ParseException {
+        JavaCCGeneratedQueryParser parser = new JavaCCGeneratedQueryParser(
+                new StringReader(queryString));
+        return parser.parse();
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/ResultSet.java b/sparql/src/main/java/org/apache/clerezza/sparql/ResultSet.java
new file mode 100644
index 0000000..bf5ae89
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/ResultSet.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sparql;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * The reult of a sparql SELECT-query. This corresponds to a Solution Sequence
+ * as per section 12.1.6 of http://www.w3.org/TR/rdf-sparql-query/.
+ *
+ * Note that the scope of blank nodes is the reult set and not the
+ * Graph from where they originate.
+ *
+ * @author rbn
+ */
+public interface ResultSet extends Iterator<SolutionMapping> {
+
+    /** Iterate over the variable names (strings) in this QuerySolution.
+     * @return Iterator of strings
+     */ 
+    public List<String> getResultVars() ;
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/SolutionMapping.java b/sparql/src/main/java/org/apache/clerezza/sparql/SolutionMapping.java
new file mode 100644
index 0000000..0831d0b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/SolutionMapping.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.query.Variable;
+
+import java.util.Map;
+
+/**
+ * A set of mapping from variable names to solutions.
+ *
+ * a variable name has the form: ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9]
+ * | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
+ * where PN_CHARS_U =      [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6]
+ * | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D]
+ * | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
+ * | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] | '_'
+ *
+ *
+ * @author rbn
+ */
+public interface SolutionMapping extends Map<Variable, RDFTerm> {
+
+    /**
+     * Should be the equivalent to this:
+     * public Resource get(String name) {
+     *    return get(new Variable(name));
+     * }
+     *
+     * @param name
+     * @return
+     */
+    public RDFTerm get(String name);
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/SparqlPreParser.java b/sparql/src/main/java/org/apache/clerezza/sparql/SparqlPreParser.java
new file mode 100644
index 0000000..eb34511
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/SparqlPreParser.java
@@ -0,0 +1,160 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.query.*;
+import org.apache.clerezza.sparql.update.Update;
+
+import java.io.StringReader;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This class implements an OSGi service to provide a method to obtain referred Graphs in a SPARQL Query or Update.
+ *
+ * @author hasan
+ */
+
+
+public class SparqlPreParser {
+
+    GraphStore graphStore;
+
+    public SparqlPreParser() {
+    }
+
+    public SparqlPreParser(GraphStore graphStore) {
+        this.graphStore = graphStore;
+    }
+
+    /**
+     * This returns the graphs targeted by the queryString. These are the 
+     * triple collections explicitly referred in FROM and FROM NAMED clauses, 
+     * and if the queryString contains no FROM clause the defaultGraph.
+     * 
+     * For queries that are not limited to a specified set of graphs, null is returned.
+     * 
+     * @param queryString
+     * @param defaultGraph
+     * @return 
+     * @throws ParseException 
+     */
+    public Set<IRI> getReferredGraphs(String queryString, IRI defaultGraph) throws ParseException {
+        Set<IRI> referredGraphs;
+        JavaCCGeneratedSparqlPreParser parser = new JavaCCGeneratedSparqlPreParser(new StringReader(queryString));
+        SparqlUnit sparqlUnit;
+        sparqlUnit = parser.parse();
+        boolean referringVariableNamedGraph = false;
+        if (sparqlUnit.isQuery()) {
+            Query q = sparqlUnit.getQuery();
+            DataSet dataSet = q.getDataSet();
+            if (dataSet != null) {
+                referredGraphs = dataSet.getDefaultGraphs();
+                referredGraphs.addAll(dataSet.getNamedGraphs());
+            } else {
+                referredGraphs = new HashSet<IRI>();
+            }
+            GroupGraphPattern queryPattern = q.getQueryPattern();
+            if (queryPattern != null) {
+                Set<GraphPattern> graphPatterns = queryPattern.getGraphPatterns();
+                for (GraphPattern graphPattern : graphPatterns) {
+                }
+            }
+//            referringVariableNamedGraph = q.referringVariableNamedGraph();
+            referringVariableNamedGraph = referringVariableNamedGraph(q);
+        } else {
+            Update u = sparqlUnit.getUpdate();
+            referredGraphs = u.getReferredGraphs(defaultGraph, graphStore);
+        }
+        if (referredGraphs.isEmpty()) {
+            if (referringVariableNamedGraph) {
+                return null;
+            }
+            referredGraphs.add(defaultGraph);
+        }
+        return referredGraphs;
+    }
+
+    private boolean referringVariableNamedGraph(Query query) {
+        GroupGraphPattern queryPattern = query.getQueryPattern();
+        if (queryPattern == null) {
+            return false;
+        }
+        Set<GraphPattern> graphPatterns = queryPattern.getGraphPatterns();
+        return referringVariableNamedGraph(graphPatterns);
+    }
+
+    private boolean referringVariableNamedGraph(Set<GraphPattern> graphPatterns) {
+        boolean referringVariableNamedGraph = false;
+        for (GraphPattern graphPattern : graphPatterns) {
+            if (referringVariableNamedGraph(graphPattern)) {
+                referringVariableNamedGraph = true;
+                break;
+            }
+        }
+        return referringVariableNamedGraph;
+    }
+
+    private boolean referringVariableNamedGraph(GraphPattern graphPattern) {
+        if (graphPattern instanceof GraphGraphPattern) {
+            return ((GraphGraphPattern) graphPattern).getGraph().isVariable();
+        }
+        if (graphPattern instanceof AlternativeGraphPattern) {
+            List<GroupGraphPattern> alternativeGraphPatterns =
+                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
+            boolean referringVariableNamedGraph = false;
+            for (GroupGraphPattern groupGraphPattern : alternativeGraphPatterns) {
+                if (referringVariableNamedGraph(groupGraphPattern)) {
+                    referringVariableNamedGraph = true;
+                    break;
+                }
+            }
+            return referringVariableNamedGraph;
+        }
+        if (graphPattern instanceof OptionalGraphPattern) {
+            GraphPattern mainGraphPattern = ((OptionalGraphPattern) graphPattern).getMainGraphPattern();
+            if (referringVariableNamedGraph(mainGraphPattern)) {
+                return true;
+            }
+            GroupGraphPattern optionalGraphPattern = ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern();
+            return referringVariableNamedGraph(optionalGraphPattern);
+        }
+        if (graphPattern instanceof MinusGraphPattern) {
+            GraphPattern minuendGraphPattern = ((MinusGraphPattern) graphPattern).getMinuendGraphPattern();
+            if (referringVariableNamedGraph(minuendGraphPattern)) {
+                return true;
+            }
+            GroupGraphPattern subtrahendGraphPattern = ((MinusGraphPattern) graphPattern).getSubtrahendGraphPattern();
+            return referringVariableNamedGraph(subtrahendGraphPattern);
+        }
+        if (graphPattern instanceof GroupGraphPattern) {
+            GroupGraphPattern groupGraphPattern = (GroupGraphPattern) graphPattern;
+            if (groupGraphPattern.isSubSelect()) {
+                Query query = ((GroupGraphPattern) graphPattern).getSubSelect();
+                return referringVariableNamedGraph(query);
+            } else {
+                Set<GraphPattern> graphPatterns = ((GroupGraphPattern) graphPattern).getGraphPatterns();
+                return referringVariableNamedGraph(graphPatterns);
+            }
+        }
+        return false;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/StringQuerySerializer.java b/sparql/src/main/java/org/apache/clerezza/sparql/StringQuerySerializer.java
new file mode 100644
index 0000000..54c548a
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/StringQuerySerializer.java
@@ -0,0 +1,90 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.sparql.query.*;
+
+/**
+ * This abstract class provides a method to generate a {@link String}
+ * representation of a {@link Query}.
+ *
+ * @author hasan
+ */
+public abstract class StringQuerySerializer {
+
+    /**
+     * Serializes a {@link Query} object to a {@link String}.
+     *
+     * @param query
+     *        the Query object to be serialized
+     * @return
+     *        a String representation of the specified Query object.
+     */
+    public String serialize(Query query) {
+        if (query instanceof SelectQuery) {
+            return serialize((SelectQuery) query);
+        } else if (query instanceof ConstructQuery) {
+            return serialize((ConstructQuery) query);
+        } else if (query instanceof DescribeQuery) {
+            return serialize((DescribeQuery) query);
+        } else {
+            return serialize((AskQuery) query);
+        }
+    }
+
+    /**
+     * Serializes a {@link SelectQuery} object to a {@link String}.
+     *
+     * @param selectQuery
+     *        the SelectQuery object to be serialized
+     * @return
+     *        a String representation of the specified SelectQuery object.
+     */
+    public abstract String serialize(SelectQuery selectQuery);
+
+    /**
+     * Serializes a {@link ConstructQuery} object to a {@link String}.
+     *
+     * @param constructQuery
+     *        the ConstructQuery object to be serialized
+     * @return
+     *        a String representation of the specified ConstructQuery object.
+     */
+    public abstract String serialize(ConstructQuery constructQuery);
+
+    /**
+     * Serializes a {@link DescribeQuery} object to a {@link String}.
+     *
+     * @param describeQuery
+     *        the DescribeQuery object to be serialized
+     * @return
+     *        a String representation of the specified DescribeQuery object.
+     */
+    public abstract String serialize(DescribeQuery describeQuery);
+
+    /**
+     * Serializes an {@link AskQuery} object to a {@link String}.
+     *
+     * @param askQuery
+     *        the AskQuery object to be serialized
+     * @return
+     *        a String representation of the specified AskQuery object.
+     */
+    public abstract String serialize(AskQuery askQuery);
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/AbstractOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/AbstractOperation.java
new file mode 100644
index 0000000..8e76209
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/AbstractOperation.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.clerezza.sparql.query;
+
+/**
+ * Defines an operation in an {@link Expression}. An operation has an operator
+ * and one or more operands.
+ *
+ * @author hasan
+ */
+public abstract class AbstractOperation implements Expression {
+    private String operator;
+
+    public AbstractOperation(String operator) {
+        this.operator = operator;
+    }
+
+    /**
+     * A string representation of the operator
+     * @return The operator as a string
+     */
+    public String getOperatorString() {
+        return operator;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/AlternativeGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/AlternativeGraphPattern.java
new file mode 100644
index 0000000..f42f317
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/AlternativeGraphPattern.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * Defines alternative ImmutableGraph patterns.
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#alternatives">
+ * SPARQL Query Language: 7 Matching Alternatives</a>
+ *
+ * @author hasan
+ */
+public interface AlternativeGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return
+     *        a list of alternative {@link GroupGraphPattern}s
+     */
+    public List<GroupGraphPattern> getAlternativeGraphPatterns();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/AskQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/AskQuery.java
new file mode 100644
index 0000000..8bdb9fa
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/AskQuery.java
@@ -0,0 +1,29 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * <p>This interface represents a SPARQL ASK query.</p>
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#ask">
+ * SPARQL Query Language: 10.3 ASK</a>
+ *
+ * @author hasan
+ */
+public interface AskQuery extends Query {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/BasicGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/BasicGraphPattern.java
new file mode 100644
index 0000000..7f0bf4c
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/BasicGraphPattern.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sparql.query;
+
+import java.util.Set;
+
+/**
+ * Defines a basic ImmutableGraph pattern.
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#BasicGraphPatterns">
+ * SPARQL Query Language: 5.1 Basic ImmutableGraph Patterns</a>
+ *
+ * @author hasan
+ */
+public interface BasicGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return a set of all triple patterns to match.
+     */
+    public Set<TriplePattern> getTriplePatterns();
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryOperation.java
new file mode 100644
index 0000000..2c06cdc
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryOperation.java
@@ -0,0 +1,46 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Defines an operation with two operands: a left hand side and a right hand side
+ * operand.
+ *
+ * @author hasan
+ */
+public class BinaryOperation extends AbstractOperation {
+
+    private Expression lhsOperand;
+    private Expression rhsOperand;
+
+    public BinaryOperation(String operator,
+            Expression lhsOperand, Expression rhsOperand) {
+        super(operator);
+        this.lhsOperand = lhsOperand;
+        this.rhsOperand = rhsOperand;
+    }
+
+    public Expression getLhsOperand() {
+        return lhsOperand;
+    }
+
+    public Expression getRhsOperand() {
+        return rhsOperand;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryPropertyPathOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryPropertyPathOperation.java
new file mode 100644
index 0000000..d3847fb
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/BinaryPropertyPathOperation.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sparql.query;
+
+/**
+ *
+ * @author hasan
+ */
+public class BinaryPropertyPathOperation implements PropertyPathExpression {
+    private String operator;
+    private PropertyPathExpression lhsOperand;
+    private PropertyPathExpression rhsOperand;
+
+    public BinaryPropertyPathOperation(String operator, PropertyPathExpression lhsOperand, PropertyPathExpression rhsOperand) {
+        this.operator = operator;
+        this.lhsOperand = lhsOperand;
+        this.rhsOperand = rhsOperand;
+    }
+
+    public PropertyPathExpression getLhsOperand() {
+        return lhsOperand;
+    }
+
+    public PropertyPathExpression getRhsOperand() {
+        return rhsOperand;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/BuiltInCall.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/BuiltInCall.java
new file mode 100644
index 0000000..81b9905
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/BuiltInCall.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * Defines a built-in call which is one form of {@link Expression}.
+ * A built-in call has a name of type String and a list of arguments,
+ * where each argument is an {@link Expression}.
+ *
+ * @author hasan
+ */
+public class BuiltInCall implements Expression {
+
+    protected String name;
+    private final List<Expression> arguments;
+
+    public BuiltInCall(String name, List<Expression> arguments) {
+        this.name = name;
+        this.arguments = arguments;
+    }
+
+    public String getName() {
+        return name;
+    };
+
+    public List<Expression> getArguements() {
+        return arguments;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/ConstructQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/ConstructQuery.java
new file mode 100644
index 0000000..53bb293
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/ConstructQuery.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.clerezza.sparql.query;
+
+import java.util.Set;
+
+/**
+ * <p>This interface represents a SPARQL CONSTRUCT query.</p>
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">
+ * SPARQL Query Language: 10.2 CONSTRUCT</a>
+ *
+ * @author hasan
+ */
+public interface ConstructQuery extends QueryWithSolutionModifier {
+
+    /**
+     * <p>Gets the template for constructing triples in a CONSTRUCT query.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">
+     * SPARQL Query Language: 10.2 CONSTRUCT</a>
+     * @return a template as a set of triple patterns for constructing
+     *         new triples.
+     */
+    public Set<TriplePattern> getConstructTemplate();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/DataSet.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/DataSet.java
new file mode 100644
index 0000000..c1c9ae3
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/DataSet.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+import java.util.Set;
+
+/**
+ * This interface definition is not yet stable and may change in future.
+ * 
+ * @author hasan
+ */
+public interface DataSet {
+
+    /**
+     * 
+     * @return
+     *        an empty set if no default ImmutableGraph is specified,
+     *        otherwise a set of their UriRefs
+     */
+    public Set<IRI> getDefaultGraphs();
+
+    /**
+     *
+     * @return
+     *        an empty set if no named ImmutableGraph is specified,
+     *        otherwise a set of their UriRefs
+     */
+    public Set<IRI> getNamedGraphs();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/DescribeQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/DescribeQuery.java
new file mode 100644
index 0000000..313c2a1
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/DescribeQuery.java
@@ -0,0 +1,50 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * <p>This interface represents a SPARQL SELECT query.</p>
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
+ * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
+ *
+ * @author hasan
+ */
+public interface DescribeQuery extends QueryWithSolutionModifier {
+
+    /**
+     * <p>Tests if all variables in the query should be described.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
+     * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
+     * @return <code>true</code> if the query should return all variables.
+     */
+    public boolean isDescribeAll();
+
+    /**
+     * <p>Gets the list of {@link ResourceOrVariable}s to describe.
+     * If {@link #isDescribeAll()} returns <code>true</code> then
+     * this list contains all the variables from the query.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#describe">
+     * SPARQL Query Language: 10.4 DESCRIBE (Informative)</a>
+     * @return A list of {@link ResourceOrVariable}s to describe.
+     */
+    public List<ResourceOrVariable> getResourcesToDescribe();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/Expression.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/Expression.java
new file mode 100644
index 0000000..0bc9422
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/Expression.java
@@ -0,0 +1,42 @@
+/*
+ * 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.sparql.query;
+
+import java.io.Serializable;
+
+/**
+ * This interface models logical, relational, and numeric expression.
+ * This includes terms and factors in mathematical formulas which can contain
+ * variables, literals, and function calls.
+ * In a SPARQL query, expressions can occur in an ORDER BY clause or
+ * a FILTER constraint.
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
+ * SPARQL Query Language: 9.1 ORDER BY</a>
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#termConstraint">
+ * SPARQL Query Language: 3 RDF Term Constraints (Informative)</a>
+ * 
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#evaluation">
+ * SPARQL Query Language: 11.2 Filter Evaluation</a>
+ *
+ * @author hasan
+ */
+public interface Expression extends Serializable {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/FunctionCall.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/FunctionCall.java
new file mode 100644
index 0000000..8190dec
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/FunctionCall.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+import java.util.List;
+
+/**
+ * Defines a function call which is one form of {@link Expression}.
+ * A function call has a name of type {@link IRI} and a list of arguments,
+ * where each argument is an {@link Expression}.
+ *
+ * @author hasan
+ */
+public class FunctionCall implements Expression {
+
+    private final IRI name;
+    private final List<Expression> arguments;
+
+    public FunctionCall(IRI name, List<Expression> arguments) {
+        this.name = name;
+        this.arguments = arguments;
+    }
+
+    public IRI getName() {
+        return name;
+    };
+
+    public List<Expression> getArguements() {
+        return arguments;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphGraphPattern.java
new file mode 100644
index 0000000..86f1a97
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphGraphPattern.java
@@ -0,0 +1,42 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Defines a ImmutableGraph ImmutableGraph pattern.
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#queryDataset">
+ * SPARQL Query Language: 8.3 Querying the Dataset</a>
+ *
+ * @author hasan
+ */
+public interface GraphGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return a {@link UriRefOrVariable} which specifies the ImmutableGraph
+     *        against which the pattern should match.
+     */
+    public UriRefOrVariable getGraph();
+
+    /**
+     * 
+     * @return the pattern to match.
+     */
+    public GroupGraphPattern getGroupGraphPattern();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphPattern.java
new file mode 100644
index 0000000..048bb84
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/GraphPattern.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.clerezza.sparql.query;
+
+/**
+ * This is the generic interface for all types of ImmutableGraph patterns:
+ * {@link BasicGraphPattern}, {@link PathSupportedBasicGraphPattern}, {@link GroupGraphPattern},
+ * {@link GraphGraphPattern}, {@link AlternativeGraphPattern}, and
+ * {@link OptionalGraphPattern}
+ *
+ * @author hasan
+ */
+public interface GraphPattern {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/GroupGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/GroupGraphPattern.java
new file mode 100644
index 0000000..4025e03
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/GroupGraphPattern.java
@@ -0,0 +1,70 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Defines a group ImmutableGraph pattern.
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#GroupPatterns">
+ * SPARQL Query Language: 5.2 Group ImmutableGraph Patterns</a>
+ *
+ * @author hasan
+ */
+public interface GroupGraphPattern extends GraphPattern {
+
+	/**
+	 *
+	 * @return 
+     *      true if it wraps a {@link SelectQuery}, false otherwise.
+	 */
+	public boolean isSubSelect();
+
+	/**
+	 *
+	 * @return 
+     *      the wrapped subselect if it wraps a {@link SelectQuery}, null otherwise.
+	 */
+	public SelectQuery getSubSelect();
+
+	/**
+	 *
+	 * @return
+     *      null if it wraps a {@link SelectQuery}, otherwise
+     *      a set of all patterns, ANDed together.
+	 */
+	public Set<GraphPattern> getGraphPatterns();
+
+    /**
+     * 
+     * @return
+     *      all graphs referred in this ImmutableGraph pattern.
+     */
+    public Set<IRI> getReferredGraphs();
+
+    /**
+	 * @return 
+     *      null if it wraps a {@link SelectQuery}, otherwise
+	 *		a list of filter expressions for all patterns in the group if any.
+	 */
+	public List<Expression> getFilter();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/InlineData.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/InlineData.java
new file mode 100644
index 0000000..6bd4377
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/InlineData.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.clerezza.sparql.query;
+
+import org.apache.clerezza.api.RDFTerm;
+
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public interface InlineData extends GraphPattern {
+    public List<Variable> getVariables();
+    public List<List<RDFTerm>> getValues();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/LiteralExpression.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/LiteralExpression.java
new file mode 100644
index 0000000..9532908
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/LiteralExpression.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.Literal;
+
+/**
+ * Wraps a {@link Literal} in an {@link Expression}.
+ *
+ * @author hasan
+ */
+public class LiteralExpression implements Expression {
+
+    private final Literal literal;
+
+    public LiteralExpression(Literal literal) {
+        this.literal = literal;
+    }
+
+    public Literal getLiteral() {
+        return literal;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/MinusGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/MinusGraphPattern.java
new file mode 100644
index 0000000..5696fab
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/MinusGraphPattern.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * 
+ * @author hasan
+ */
+public interface MinusGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return
+     *        the minuend ImmutableGraph pattern to match
+     */
+    public GraphPattern getMinuendGraphPattern();
+
+    /**
+     *
+     * @return
+     *        the subtrahend ImmutableGraph pattern to match
+     */
+    public GroupGraphPattern getSubtrahendGraphPattern();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/OptionalGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/OptionalGraphPattern.java
new file mode 100644
index 0000000..ae09193
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/OptionalGraphPattern.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Specifying an optional ImmutableGraph pattern implies the existence of a main ImmutableGraph
+ * pattern.
+ * The main ImmutableGraph pattern is an empty group pattern if it is not specified.
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#optionals">
+ * SPARQL Query Language: 6 Including Optional Values</a>
+ * 
+ * @author hasan
+ */
+public interface OptionalGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return
+     *        the main ImmutableGraph pattern to match
+     */
+    public GraphPattern getMainGraphPattern();
+
+    /**
+     *
+     * @return
+     *        the optional ImmutableGraph pattern to match
+     */
+    public GroupGraphPattern getOptionalGraphPattern();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/OrderCondition.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/OrderCondition.java
new file mode 100644
index 0000000..5c5ace5
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/OrderCondition.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.clerezza.sparql.query;
+
+/**
+ * Defines an order condition in an ORDER BY clause.
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
+ * SPARQL Query Language: 9.1 ORDER BY</a>
+ *
+ * @author hasan
+ */
+public interface OrderCondition {
+
+    public Expression getExpression();
+
+    /**
+     * @return <code>true</code> if ascending, <code>false</code> if descending
+     */
+    public boolean isAscending();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PathSupportedBasicGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PathSupportedBasicGraphPattern.java
new file mode 100644
index 0000000..535bdd5
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PathSupportedBasicGraphPattern.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.clerezza.sparql.query;
+
+import java.util.Set;
+
+/**
+ * Defines a basic ImmutableGraph pattern that supports property path expressions.
+ * A {@link PathSupportedBasicGraphPattern} is a set of {@link PropertyPathPattern}s.
+ * A {@link PropertyPathPattern} is a generalization of a {@link TriplePattern} to include
+ * a {@link PropertyPathExpression} in the property position.
+ * Therefore, a {@link PathSupportedBasicGraphPattern} can be seen as a generalization of a {@link BasicGraphPattern}
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlBasicGraphPatterns">
+ * SPARQL 1.1 Query Language: 18.1.6 Basic ImmutableGraph Patterns</a>
+ * and <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlPropertyPaths">
+ * SPARQL 1.1 Query Language: 18.1.7 Property Path Patterns</a>
+ *
+ * @author hasan
+ */
+public interface PathSupportedBasicGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return a set of all property path patterns to match.
+     */
+    public Set<PropertyPathPattern> getPropertyPathPatterns();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PatternExistenceCondition.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PatternExistenceCondition.java
new file mode 100644
index 0000000..fb0aa2b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PatternExistenceCondition.java
@@ -0,0 +1,66 @@
+/*
+ * 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.sparql.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This expression is intended to be used as a filter expression to test whether a ImmutableGraph pattern matches 
+ * the dataset or not, given the values of variables in the group ImmutableGraph pattern in which the filter occurs.
+ * It does not generate any additional bindings.
+ * 
+ * @see <a href="http://www.w3.org/TR/sparql11-query/#neg-pattern">SPARQL 1.1 Query Language: 8.1 Filtering Using ImmutableGraph Patterns</a>
+ * 
+ * @author hasan
+ */
+public class PatternExistenceCondition extends BuiltInCall {
+    private boolean negated = false;
+    private GroupGraphPattern pattern;
+
+    public PatternExistenceCondition() {
+        super("EXISTS", new ArrayList<Expression>());
+    }
+
+    public PatternExistenceCondition(String name, List<Expression> arguments) {
+        super(name, new ArrayList<Expression>());
+        if (!(name.equalsIgnoreCase("EXISTS") || name.equalsIgnoreCase("NOT EXISTS"))) {
+            throw new RuntimeException("Unsupported name: " + name);
+        } else {
+            this.negated = name.equalsIgnoreCase("NOT EXISTS");
+        }
+    }
+
+    public boolean isExistenceTest() {
+        return !negated;
+    }
+
+    public GroupGraphPattern getPattern() {
+        return pattern;
+    }
+
+    public void setExistenceTest(boolean existenceTest) {
+        this.negated = !existenceTest;
+        this.name = existenceTest ? "EXISTS" : "NOT EXISTS";
+    }
+
+    public void setPattern(GroupGraphPattern pattern) {
+        this.pattern = pattern;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PredicatePath.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PredicatePath.java
new file mode 100644
index 0000000..a63e227
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PredicatePath.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ *
+ * @author hasan
+ */
+public class PredicatePath implements PropertyPathExpression {
+    private IRI predicatePath;
+
+    public PredicatePath(IRI predicatePath) {
+        this.predicatePath = predicatePath;
+    }
+
+    public IRI getPredicatePath() {
+        return predicatePath;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpression.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpression.java
new file mode 100644
index 0000000..905aa71
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpression.java
@@ -0,0 +1,29 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * This interface models property path expressions.
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#propertypaths">
+ * SPARQL 1.1 Query Language: 9 Property Paths</a>
+ * 
+ * @author hasan
+ */
+public interface PropertyPathExpression {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpressionOrVariable.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpressionOrVariable.java
new file mode 100644
index 0000000..552f8a4
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathExpressionOrVariable.java
@@ -0,0 +1,104 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Wraps either a {@link PropertyPathExpression} or a {@link Variable}
+ *
+ * @author hasan
+ */
+public class PropertyPathExpressionOrVariable {
+
+    private final PropertyPathExpression propertyPathExpression;
+    private final Variable variable;
+
+    public PropertyPathExpressionOrVariable(PropertyPathExpression propertyPathExpression) {
+        if (propertyPathExpression == null) {
+            throw new IllegalArgumentException("Invalid propertyPathExpression: null");
+        }
+        this.propertyPathExpression = propertyPathExpression;
+        variable = null;
+    }
+
+    public PropertyPathExpressionOrVariable(Variable variable) {
+        if (variable == null) {
+            throw new IllegalArgumentException("Invalid variable: null");
+        }
+        this.variable = variable;
+        propertyPathExpression = null;
+    }
+
+    /**
+     *
+     * @return
+     *        true if it is a {@link Variable}, false if it is a {@link PropertyPathExpression}
+     */
+    public boolean isVariable() {
+        return propertyPathExpression == null;
+    }
+
+    /**
+     * 
+     * @return
+     *        the wrapped PropertyPathExpression if it is a PropertyPathExpression, null otherwise
+     */
+    public PropertyPathExpression getPropertyPathExpression() {
+        return propertyPathExpression;
+    }
+    
+    /**
+     * 
+     * @return
+     *        the wrapped Variable if it is a Variable, null otherwise
+     */
+    public Variable getVariable() {
+        return variable;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof PropertyPathExpressionOrVariable)) {
+            return false;
+        }
+        final PropertyPathExpressionOrVariable other = (PropertyPathExpressionOrVariable) obj;
+        if (this.isVariable() != other.isVariable()) {
+            return false;
+        }
+        if (this.isVariable()) {
+            if (!this.getVariable().equals(other.getVariable())) {
+                return false;
+            }
+        } else {
+            if (!this.getPropertyPathExpression().equals(other.getPropertyPathExpression())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (isVariable()
+                ? 13 * getVariable().hashCode() + 17
+                : 13 * getPropertyPathExpression().hashCode() + 17);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathPattern.java
new file mode 100644
index 0000000..9c15a36
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertyPathPattern.java
@@ -0,0 +1,46 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Defines a property path pattern consisting of a subject, a property path expression, and an object.
+ * The subject and object are of type {@link ResourceOrVariable}, whereas
+ * the predicate is of type {@link PropertyPathExpressionOrVariable}.
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlPropertyPaths">
+ * SPARQL 1.1 Query Language: 18.1.7 Property Path Patterns</a>
+ *
+ * @author hasan
+ */
+public interface PropertyPathPattern {
+
+    /**
+     * @return the subject
+     */
+    public ResourceOrVariable getSubject();
+
+    /**
+     * @return the property path expression
+     */
+    public PropertyPathExpressionOrVariable getPropertyPathExpression();
+
+    /**
+     * @return the object
+     */
+    public ResourceOrVariable getObject();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertySet.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertySet.java
new file mode 100644
index 0000000..fc7e122
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/PropertySet.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sparql.query;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A property set is intended to store only predicate paths and inverse predicate paths.
+ *
+ * @author hasan
+ */
+public class PropertySet implements PropertyPathExpression {
+    private Set<PropertyPathExpression> propertySet = new HashSet<PropertyPathExpression>();
+
+    /**
+     * 
+     * @param propertyPathExpression expected value is a predicate path or an inverse predicate path
+     */
+    public void addElement(PropertyPathExpression propertyPathExpression) {
+        this.propertySet.add(propertyPathExpression);
+    }
+
+    public Set<PropertyPathExpression> getPropertySet() {
+        return propertySet;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/Query.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/Query.java
new file mode 100644
index 0000000..2bb5e42
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/Query.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.clerezza.sparql.query;
+
+/**
+ * <p>This interface represents a SPARQL query.</p>
+ * <p>There are four types of SPARQL queries: {@link SelectQuery},
+ * {@link ConstructQuery}, {@link DescribeQuery}, and {@link AskQuery}.</p>
+ *
+ * @author hasan
+ */
+public interface Query {
+
+    /**
+     * <p>Gets {@link DataSet} containing the specification of the default
+     * ImmutableGraph and named graphs, if any.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#specifyingDataset">
+     * SPARQL Query Language: 8.2 Specifying RDF Datasets</a>
+     * @return
+     *        null if no data set is specified, indicating the use of
+     *        system default ImmutableGraph. Otherwise a {@link DataSet} object is returned.
+     */
+    public DataSet getDataSet();
+
+    /**
+     * <p>Gets the query pattern of the WHERE clause for the query.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#GraphPattern">
+     * SPARQL Query Language: 5 ImmutableGraph Patterns</a>
+     * @return
+     *        the {@link GroupGraphPattern} of the WHERE clause for this query.
+     *        If the WHERE clause is not specified, null is returned.
+     */
+    public GroupGraphPattern getQueryPattern();
+    
+    public InlineData getInlineData();
+
+    /**
+     * 
+     * @return A valid String representation of the query.
+     */
+    @Override
+    public abstract String toString();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/QueryWithSolutionModifier.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/QueryWithSolutionModifier.java
new file mode 100644
index 0000000..45db17b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/QueryWithSolutionModifier.java
@@ -0,0 +1,68 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * <p>This interface represents a SPARQL query which contains a specification
+ * of solution modifiers: GROUP BY, HAVING, ORDER BY, OFFSET, and LIMIT.</p>
+ *
+ * @see <a href="http://www.w3.org/TR/sparql11-query/#aggregates">
+ * SPARQL 1.1 Query Language: 11 Aggregates</a>
+ * and
+ * @see <a href="http://www.w3.org/TR/sparql11-query/#solutionModifiers">
+ * SPARQL 1.1 Query Language: 15 Solution Sequences and Modifiers</a>
+ *
+ * @author hasan
+ */
+public interface QueryWithSolutionModifier extends Query {
+
+    public List<Expression> getGroupConditions();
+
+    public List<Expression> getHavingConditions();
+
+    /**
+     * <p>Gets the list of required ordering conditions in decreasing ordering
+     * priority.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOrderBy">
+     * SPARQL Query Language: 9.1 ORDER BY</a>
+     * @return A list of {@link OrderCondition}s, in order of priority.
+     */
+    public List<OrderCondition> getOrderConditions();
+
+    /**
+     * <p>Gets the numeric offset of the first row to be returned by the query. 
+     * The default offset is 0, meaning to start at the beginning.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modOffset">
+     * SPARQL Query Language: 9.4 OFFSET</a>
+     * @return The number of rows to skip in the result.
+     */
+    public int getOffset();
+
+    /**
+     * <p>Gets the maximum number of results to be returned by the query. 
+     * A limit of -1 means no limit (return all results).
+     * A limit of 0 means that no results should be returned.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modResultLimit">
+     * SPARQL Query Language: 9.5 LIMIT</a>
+     * @return The maximum number of rows to returned by the query.
+     */
+    public int getLimit();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/ResourceOrVariable.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/ResourceOrVariable.java
new file mode 100644
index 0000000..6e8b258
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/ResourceOrVariable.java
@@ -0,0 +1,106 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.RDFTerm;
+
+/**
+ * Wraps either a {@link RDFTerm} or a {@link Variable}
+ *
+ * @author hasan
+ */
+public class ResourceOrVariable {
+
+    private final RDFTerm resource;
+    private final Variable variable;
+
+    public ResourceOrVariable(RDFTerm resource) {
+        if (resource == null) {
+            throw new IllegalArgumentException("Invalid resource: null");
+        }
+        this.resource = resource;
+        variable = null;
+    }
+
+    public ResourceOrVariable(Variable variable) {
+        if (variable == null) {
+            throw new IllegalArgumentException("Invalid variable: null");
+        }
+        this.variable = variable;
+        resource = null;
+    }
+
+    /**
+     *
+     * @return
+     *        true if it is a {@link Variable}, false if it is a {@link RDFTerm}
+     */
+    public boolean isVariable() {
+        return resource == null;
+    }
+
+    /**
+     * 
+     * @return
+     *        the wrapped Resource if it is a Resource, null otherwise
+     */
+    public RDFTerm getResource() {
+        return resource;
+    }
+    
+    /**
+     * 
+     * @return
+     *        the wrapped Variable if it is a Variable, null otherwise
+     */
+    public Variable getVariable() {
+        return variable;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof ResourceOrVariable)) {
+            return false;
+        }
+        final ResourceOrVariable other = (ResourceOrVariable) obj;
+        if (this.isVariable() != other.isVariable()) {
+            return false;
+        }
+        if (this.isVariable()) {
+            if (!this.getVariable().equals(other.getVariable())) {
+                return false;
+            }
+        } else {
+            if (!this.getResource().equals(other.getResource())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (isVariable()
+                ? 13 * getVariable().hashCode() + 7
+                : 13 * getResource().hashCode() + 7);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/RhsListBinaryOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/RhsListBinaryOperation.java
new file mode 100644
index 0000000..a2224ec
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/RhsListBinaryOperation.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * Defines an operation with two operands: a left hand side and a right hand side operand
+ * where the right hand side operand is a list.
+ *
+ * @author hasan
+ */
+public class RhsListBinaryOperation extends AbstractOperation {
+
+	private Expression lhsOperand;
+    private List<Expression> rhsOperand;
+
+	public RhsListBinaryOperation(String operator, Expression lhsOperand, List<Expression> rhsOperand) {
+		super(operator);
+		this.lhsOperand = lhsOperand;
+		this.rhsOperand = rhsOperand;
+	}
+
+	public Expression getLhsOperand() {
+		return lhsOperand;
+	}
+
+	public List<Expression> getRhsOperand() {
+		return rhsOperand;
+	}
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/SelectQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/SelectQuery.java
new file mode 100644
index 0000000..9760f19
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/SelectQuery.java
@@ -0,0 +1,70 @@
+/*
+ * 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.sparql.query;
+
+import java.util.List;
+
+/**
+ * <p>This interface represents a SPARQL SELECT query.</p>
+ *
+ * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#select">
+ * SPARQL Query Language: 10.1 SELECT</a>
+ *
+ * @author hasan
+ */
+public interface SelectQuery extends QueryWithSolutionModifier {
+
+    /**
+     * <p>Tests if this query should return distinct results.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modDistinct">
+     * SPARQL Query Language: 9.3.1 DISTINCT</a>
+     * @return <code>true</code> if the query should return distinct results.
+     */
+    public boolean isDistinct();
+
+    /**
+     * <p>Tests if this query should return reduced results.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modReduced">
+     * SPARQL Query Language: 9.3.2 REDUCED</a>
+     * @return <code>true</code> if the query should return reduced results.
+     */
+    public boolean isReduced();
+
+    /**
+     * <p>Tests if this query returns all its variables, and not a projected subset.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#solutionModifiers">
+     * SPARQL Query Language: 9 Solution Sequences and Modifiers</a>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modProjection">
+     * SPARQL Query Language: 9.2 Projection</a>
+     * @return <code>true</code> if the query should return all variables.
+     */
+    public boolean isSelectAll();
+
+    /**
+     * <p>Gets the list of {@link Variable}s to project the solution to.
+     * If {@link #isSelectAll()} returns <code>true</code> then
+     * this list contains all the variables from the query.</p>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#select">
+     * SPARQL Query Language: 10.1 SELECT</a>
+     * @see <a href="http://www.w3.org/TR/rdf-sparql-query/#modProjection">
+     * SPARQL Query Language: 9.2 Projection</a>
+     * @return A list of {@link Variable}s to return from the query.
+     */
+    public List<Variable> getSelection();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/ServiceGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/ServiceGraphPattern.java
new file mode 100644
index 0000000..973de90
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/ServiceGraphPattern.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.clerezza.sparql.query;
+
+/**
+ * Defines a service ImmutableGraph pattern.
+ * @see <a href="http://www.w3.org/TR/sparql11-federated-query/">
+ * SPARQL 1.1 Federated Query</a>
+ *
+ * @author hasan
+ */
+public interface ServiceGraphPattern extends GraphPattern {
+
+    /**
+     *
+     * @return a {@link UriRefOrVariable} which specifies the service endpoint.
+     */
+    public UriRefOrVariable getService();
+
+    /**
+     * 
+     * @return the pattern to match.
+     */
+    public GroupGraphPattern getGroupGraphPattern();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/SparqlUnit.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/SparqlUnit.java
new file mode 100644
index 0000000..b0ab668
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/SparqlUnit.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.sparql.update.Update;
+
+/**
+ * <p>This interface represents a SPARQL Query or Update.</p>
+ *
+ * @author hasan
+ */
+public interface SparqlUnit {
+
+    /**
+     * 
+	 * @return
+	 *		true if it is a {@link Query}, false if it is an {@link Update}
+     */
+    public boolean isQuery();
+
+    /**
+     * 
+	 * @return
+	 *		the wrapped Query if it is a {@link Query}, null otherwise
+     */
+	public Query getQuery();
+
+    /**
+     * 
+	 * @return
+	 *		the wrapped Update if it is an {@link Update}, null otherwise
+     */
+	public Update getUpdate();
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/TriplePattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/TriplePattern.java
new file mode 100644
index 0000000..37cdf32
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/TriplePattern.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Defines a triple pattern consisting of a subject, a predicate, and an object.
+ * The subject and object are of type {@link ResourceOrVariable}, whereas
+ * the predicate is of type {@link UriRefOrVariable}.
+ *
+ * @author hasan
+ */
+public interface TriplePattern {
+
+    /**
+     * @return the subject
+     */
+    public ResourceOrVariable getSubject();
+
+    /**
+     * @return the predicate
+     */
+    public UriRefOrVariable getPredicate();
+
+    /**
+     * @return the object
+     */
+    public ResourceOrVariable getObject();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryOperation.java
new file mode 100644
index 0000000..4101870
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryOperation.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sparql.query;
+
+/**
+ * Defines an operation with a single operand.
+ *
+ * @author hasan
+ */
+public class UnaryOperation extends AbstractOperation {
+
+    private Expression operand;
+
+    public UnaryOperation(String operator, Expression operand) {
+        super(operator);
+        this.operand = operand;
+    }
+
+    public Expression getOperand() {
+        return operand;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryPropertyPathOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryPropertyPathOperation.java
new file mode 100644
index 0000000..0126c2f
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/UnaryPropertyPathOperation.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.clerezza.sparql.query;
+
+/**
+ *
+ * @author hasan
+ */
+public class UnaryPropertyPathOperation implements PropertyPathExpression {
+    private String operator;
+    private PropertyPathExpression operand;
+
+    public UnaryPropertyPathOperation(String operator, PropertyPathExpression operand) {
+        this.operator = operator;
+        this.operand = operand;
+    }
+
+    public PropertyPathExpression getOperand() {
+        return operand;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefExpression.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefExpression.java
new file mode 100644
index 0000000..98a1aba
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefExpression.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * Wraps a {@link IRI} in an {@link Expression}.
+ *
+ * @author hasan
+ */
+public class UriRefExpression implements Expression {
+
+    private final IRI uriRef;
+
+    public UriRefExpression(IRI uriRef) {
+        this.uriRef = uriRef;
+    }
+
+    public IRI getUriRef() {
+        return uriRef;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefOrVariable.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefOrVariable.java
new file mode 100644
index 0000000..22c1a1f
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/UriRefOrVariable.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.clerezza.sparql.query;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * Wraps either a {@link IRI} or a {@link Variable}.
+ *
+ * @author rbn
+ */
+public class UriRefOrVariable extends ResourceOrVariable {
+
+    public UriRefOrVariable(Variable variable) {
+        super(variable);
+    }
+
+    public UriRefOrVariable(IRI resource) {
+        super(resource);
+    }
+
+    @Override
+    public IRI getResource() {
+        return (IRI)super.getResource();
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/Variable.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/Variable.java
new file mode 100644
index 0000000..ba0317c
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/Variable.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.clerezza.sparql.query;
+
+import java.util.UUID;
+
+/**
+ * Defines a Variable. A Variable can occur in an {@link Expression} and is
+ * itself an {@link Expression}.
+ * 
+ * @author hasan
+ */
+public class Variable implements Expression {
+
+	private String name;
+	private Expression boundExpression;
+
+	public Variable() {
+		this.name = UUID.randomUUID().toString();
+	}
+
+	/**
+	 * Creates a variable with the specified name
+	 *
+	 * @param name
+	 */
+	public Variable(String name) {
+		if (name == null) {
+			throw new IllegalArgumentException("name may not be null");
+		}
+		this.name = name;
+	}
+
+	public Variable(String name, Expression boundExpression) {
+		this.name = name;
+		this.boundExpression = boundExpression;
+	}
+
+	/**
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	public Expression getBoundExpression() {
+		return boundExpression;
+	}
+
+	public void setBoundExpression(Expression boundExpression) {
+		this.boundExpression = boundExpression;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (obj == null) {
+			return false;
+		}
+		if (getClass() != obj.getClass()) {
+			return false;
+		}
+		final Variable other = (Variable) obj;
+		return name.equals(other.name);
+	}
+
+	@Override
+	public int hashCode() {
+		return name.hashCode();
+	}
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAlternativeGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAlternativeGraphPattern.java
new file mode 100644
index 0000000..eb2362b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAlternativeGraphPattern.java
@@ -0,0 +1,60 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.AlternativeGraphPattern;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleAlternativeGraphPattern implements AlternativeGraphPattern {
+
+    private List<GroupGraphPattern> alternativeGraphPatterns;
+
+    public SimpleAlternativeGraphPattern(
+            List<GroupGraphPattern> alternativeGraphPatterns) {
+        this.alternativeGraphPatterns = (alternativeGraphPatterns == null)
+                ? new ArrayList<GroupGraphPattern>()
+                : alternativeGraphPatterns;
+
+        this.alternativeGraphPatterns = alternativeGraphPatterns;
+    }
+
+    public SimpleAlternativeGraphPattern(GroupGraphPattern... groupGraphPatterns) {
+        alternativeGraphPatterns = new ArrayList<GroupGraphPattern>();
+        GroupGraphPattern[] g = groupGraphPatterns;
+        for (int i = 0; i < g.length; i++) {
+            alternativeGraphPatterns.add(g[i]);
+        }
+    }
+
+    @Override
+    public List<GroupGraphPattern> getAlternativeGraphPatterns() {
+        return alternativeGraphPatterns;
+    }
+
+    public void addAlternativeGraphPattern(GroupGraphPattern groupGraphPattern) {
+        alternativeGraphPatterns.add(groupGraphPattern);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAskQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAskQuery.java
new file mode 100644
index 0000000..93d05f6
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleAskQuery.java
@@ -0,0 +1,33 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.AskQuery;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleAskQuery extends SimpleQueryWithSolutionModifier implements AskQuery {
+
+    @Override
+    public String toString() {
+        return (new SimpleStringQuerySerializer()).serialize(this);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleBasicGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleBasicGraphPattern.java
new file mode 100644
index 0000000..1a8d549
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleBasicGraphPattern.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.BasicGraphPattern;
+import org.apache.clerezza.sparql.query.TriplePattern;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleBasicGraphPattern implements BasicGraphPattern {
+
+    private Set<TriplePattern> triplePatterns;
+
+    public SimpleBasicGraphPattern(Set<TriplePattern> triplePatterns) {
+        this.triplePatterns = (triplePatterns == null)
+                ? new LinkedHashSet<TriplePattern>()
+                : triplePatterns;
+    }
+
+    @Override
+    public Set<TriplePattern> getTriplePatterns() {
+        return triplePatterns;
+    }
+
+    public void addTriplePatterns(Set<TriplePattern> triplePatterns) {
+        this.triplePatterns.addAll(triplePatterns);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleConstructQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleConstructQuery.java
new file mode 100644
index 0000000..6cffd65
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleConstructQuery.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.ConstructQuery;
+import org.apache.clerezza.sparql.query.TriplePattern;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleConstructQuery extends SimpleQueryWithSolutionModifier
+        implements ConstructQuery {
+
+    private Set<TriplePattern> triplePatterns;
+
+    public SimpleConstructQuery(Set<TriplePattern> triplePatterns) {
+        this.triplePatterns = (triplePatterns == null)
+                ? new LinkedHashSet<TriplePattern>()
+                : triplePatterns;
+    }
+
+    @Override
+    public Set<TriplePattern> getConstructTemplate() {
+        return triplePatterns;
+    }
+
+    @Override
+    public String toString() {
+        return (new SimpleStringQuerySerializer()).serialize(this);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDataSet.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDataSet.java
new file mode 100644
index 0000000..2e64bff
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDataSet.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.query.DataSet;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleDataSet implements DataSet {
+    private Set<IRI> defaultGraphs = new HashSet<IRI>();
+    private Set<IRI> namedGraphs = new HashSet<IRI>();
+
+    @Override
+    public Set<IRI> getDefaultGraphs() {
+        return defaultGraphs;
+    }
+
+    @Override
+    public Set<IRI> getNamedGraphs() {
+        return namedGraphs;
+    }
+
+    public void addDefaultGraph(IRI defaultGraph) {
+        defaultGraphs.add(defaultGraph);
+    }
+
+    public void addNamedGraph(IRI namedGraph) {
+        namedGraphs.add(namedGraph);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDescribeQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDescribeQuery.java
new file mode 100644
index 0000000..030a05a
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleDescribeQuery.java
@@ -0,0 +1,61 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.DescribeQuery;
+import org.apache.clerezza.sparql.query.ResourceOrVariable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleDescribeQuery extends SimpleQueryWithSolutionModifier
+        implements DescribeQuery {
+
+    private boolean describeAll;
+    private List<ResourceOrVariable> resourcesToDescribe =
+            new ArrayList<ResourceOrVariable>();
+
+    @Override
+    public boolean isDescribeAll() {
+        return describeAll;
+    }
+
+    @Override
+    public List<ResourceOrVariable> getResourcesToDescribe() {
+        return resourcesToDescribe;
+    }
+
+    public void setDescribeAll() {
+        assert resourcesToDescribe.isEmpty();
+        describeAll = true;
+    }
+
+    public void addResourceToDescribe(ResourceOrVariable node) {
+        resourcesToDescribe.add(node);
+    }
+
+    @Override
+    public String toString() {
+        return (new SimpleStringQuerySerializer()).serialize(this);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGraphGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGraphGraphPattern.java
new file mode 100644
index 0000000..567d2ad
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGraphGraphPattern.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.clerezza.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.GraphGraphPattern;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleGraphGraphPattern implements GraphGraphPattern {
+
+    private UriRefOrVariable ImmutableGraph;
+    private GroupGraphPattern groupGraphPattern;
+
+    public SimpleGraphGraphPattern(UriRefOrVariable ImmutableGraph,
+            GroupGraphPattern groupGraphPattern) {
+        if (ImmutableGraph == null) {
+            throw new IllegalArgumentException("ImmutableGraph may not be null");
+        }
+        if (groupGraphPattern == null) {
+            throw new IllegalArgumentException("Group ImmutableGraph Pattern may not be null");
+        }
+        this.ImmutableGraph = ImmutableGraph;
+        this.groupGraphPattern = groupGraphPattern;
+    }
+
+    @Override
+    public UriRefOrVariable getGraph() {
+        return ImmutableGraph;
+    }
+
+    @Override
+    public GroupGraphPattern getGroupGraphPattern() {
+        return groupGraphPattern;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGroupGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGroupGraphPattern.java
new file mode 100644
index 0000000..89beff9
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleGroupGraphPattern.java
@@ -0,0 +1,221 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.query.*;
+
+import java.util.*;
+
+/**
+ * This class implements {@link GroupGraphPattern}.
+ *
+ * @author hasan
+ */
+public class SimpleGroupGraphPattern implements GroupGraphPattern {
+
+	private List<Expression> constraints = new ArrayList<Expression>();
+	private List<GraphPattern> graphPatterns = new ArrayList<GraphPattern>();
+    private SelectQuery subSelect = null;
+    private boolean lastBasicGraphPatternIsComplete = true;
+
+    @Override
+    public boolean isSubSelect() {
+        return subSelect != null;
+    }
+
+    @Override
+    public SelectQuery getSubSelect() {
+        return subSelect;
+    }
+
+    @Override
+	public Set<GraphPattern> getGraphPatterns() {
+		return subSelect == null ? new LinkedHashSet(graphPatterns) : null;
+	}
+
+	@Override
+	public List<Expression> getFilter() {
+		return subSelect == null ? constraints : null;
+	}
+
+    public void setSubSelect(SelectQuery subSelect) {
+        this.subSelect = subSelect;
+    }
+
+    /**
+	 * Adds a {@link GraphPattern} to the group.
+	 *
+	 * @param graphPattern
+	 *		the GraphPattern to be added.
+	 */
+	public void addGraphPattern(GraphPattern graphPattern) {
+        subSelect = null;
+        graphPatterns.add(graphPattern);
+        lastBasicGraphPatternIsComplete =
+                !(graphPattern instanceof BasicGraphPattern || graphPattern instanceof PathSupportedBasicGraphPattern);
+	}
+
+	/**
+	 * Adds a constraint to the {@link GroupGraphPattern}.
+	 *
+	 * @param constraint
+	 *		an {@link Expression} as the constraint to be added.
+	 */
+	public void addConstraint(Expression constraint) {
+        subSelect = null;
+		constraints.add(constraint);
+	}
+
+    public void endLastBasicGraphPattern() {
+        lastBasicGraphPatternIsComplete = true;
+    }
+
+    /**
+	 * If the last {@link GraphPattern} added to the group is not a 
+	 * {@link SimplePathSupportedBasicGraphPattern}, then creates one containing the 
+	 * specified {@link PropertyPathPattern}s and adds it to the group.
+	 * Otherwise, adds the specified {@link PropertyPathPattern}s to the last
+	 * added {@link SimplePathSupportedBasicGraphPattern} in the group.
+	 * 
+	 * @param propertyPathPatterns
+	 *		a set of {@link PropertyPathPattern}s to be added into a 
+	 *		{@link SimplePathSupportedBasicGraphPattern} of the group.
+	 */
+	public void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns) {
+        subSelect = null;
+        if (lastBasicGraphPatternIsComplete) {
+            graphPatterns.add(new SimplePathSupportedBasicGraphPattern(propertyPathPatterns));
+            lastBasicGraphPatternIsComplete = false;
+        } else {
+            GraphPattern prevGraphPattern;
+        	int size = graphPatterns.size();
+			prevGraphPattern = graphPatterns.get(size-1);
+            if (prevGraphPattern instanceof SimplePathSupportedBasicGraphPattern) {
+                ((SimplePathSupportedBasicGraphPattern) prevGraphPattern).addPropertyPathPatterns(propertyPathPatterns);
+            }
+        }
+	}
+
+	/**
+	 * If the last {@link GraphPattern} added to the group is not a 
+	 * {@link SimpleBasicGraphPattern}, then creates one containing the 
+	 * specified {@link TriplePattern}s and adds it to the group.
+	 * Otherwise, adds the specified {@link TriplePattern}s to the last
+	 * added {@link SimpleBasicGraphPattern} in the group.
+	 * 
+	 * @param triplePatterns
+	 *		a set of {@link TriplePattern}s to be added into a 
+	 *		{@link SimpleBasicGraphPattern} of the group.
+	 */
+	public void addTriplePatterns(Set<TriplePattern> triplePatterns) {
+        subSelect = null;
+        GraphPattern prevGraphPattern;
+		int size = graphPatterns.size();
+		if (!lastBasicGraphPatternIsComplete && (size > 0)) {
+			prevGraphPattern = graphPatterns.get(size-1);
+			if (prevGraphPattern instanceof SimpleBasicGraphPattern) {
+				((SimpleBasicGraphPattern) prevGraphPattern)
+						.addTriplePatterns(triplePatterns);
+				return;
+			}
+		}
+		graphPatterns.add(new SimpleBasicGraphPattern(triplePatterns));
+        lastBasicGraphPatternIsComplete = false;
+	}
+
+	/**
+	 * Adds an {@link OptionalGraphPattern} to the group consisting of
+	 * a main ImmutableGraph pattern and the specified {@link GroupGraphPattern} as
+	 * the optional pattern.
+	 * The main ImmutableGraph pattern is taken from the last added {@link GraphPattern}
+	 * in the group, if it exists. Otherwise, the main ImmutableGraph pattern is null.
+	 *
+	 * @param optional
+	 *		a {@link GroupGraphPattern} as the optional pattern of
+	 *		an {@link OptionalGraphPattern}.
+	 */
+	public void addOptionalGraphPattern(GroupGraphPattern optional) {
+        subSelect = null;
+		GraphPattern prevGraphPattern = null;
+		int size = graphPatterns.size();
+		if (size > 0) {
+			prevGraphPattern = graphPatterns.remove(size-1);
+		}
+		graphPatterns.add(new SimpleOptionalGraphPattern(prevGraphPattern, optional));
+        lastBasicGraphPatternIsComplete = true;
+	}
+
+    public void addMinusGraphPattern(GroupGraphPattern subtrahend) {
+        subSelect = null;
+		GraphPattern prevGraphPattern = null;
+		int size = graphPatterns.size();
+		if (size > 0) {
+			prevGraphPattern = graphPatterns.remove(size-1);
+		}
+		graphPatterns.add(new SimpleMinusGraphPattern(prevGraphPattern, subtrahend));
+        lastBasicGraphPatternIsComplete = true;
+	}
+
+    @Override
+    public Set<IRI> getReferredGraphs() {
+        Set<IRI> referredGraphs = new HashSet<IRI>();
+        if (subSelect != null) {
+            GroupGraphPattern queryPattern = subSelect.getQueryPattern();
+            referredGraphs.addAll(queryPattern.getReferredGraphs());
+        } else {
+            for (GraphPattern graphPattern : graphPatterns) {
+                referredGraphs.addAll(getReferredGraphs(graphPattern));
+            }
+        }
+        return referredGraphs;
+    }
+
+    private Set<IRI> getReferredGraphs(GraphPattern graphPattern) {
+        Set<IRI> referredGraphs = new HashSet<IRI>();
+        if (graphPattern instanceof GraphGraphPattern) {
+            GraphGraphPattern graphGraphPattern = (GraphGraphPattern) graphPattern;
+            UriRefOrVariable ImmutableGraph = graphGraphPattern.getGraph();
+            if (!ImmutableGraph.isVariable()) {
+                referredGraphs.add(ImmutableGraph.getResource());
+            }
+            referredGraphs.addAll(graphGraphPattern.getGroupGraphPattern().getReferredGraphs());
+        } else if (graphPattern instanceof AlternativeGraphPattern) {
+            List<GroupGraphPattern> alternativeGraphPatterns =
+                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
+            for (GroupGraphPattern groupGraphPattern : alternativeGraphPatterns) {
+                referredGraphs.addAll(groupGraphPattern.getReferredGraphs());
+            }
+        } else if (graphPattern instanceof OptionalGraphPattern) {
+            GraphPattern mainGraphPattern = ((OptionalGraphPattern) graphPattern).getMainGraphPattern();
+            referredGraphs.addAll(getReferredGraphs(mainGraphPattern));
+            GroupGraphPattern optionalGraphPattern = ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern();
+            referredGraphs.addAll(optionalGraphPattern.getReferredGraphs());
+        } else if (graphPattern instanceof MinusGraphPattern) {
+            GraphPattern minuendGraphPattern = ((MinusGraphPattern) graphPattern).getMinuendGraphPattern();
+            referredGraphs.addAll(getReferredGraphs(minuendGraphPattern));
+            GroupGraphPattern subtrahendGraphPattern = ((MinusGraphPattern) graphPattern).getSubtrahendGraphPattern();
+            referredGraphs.addAll(subtrahendGraphPattern.getReferredGraphs());
+        } else if (graphPattern instanceof GroupGraphPattern) {
+            GroupGraphPattern groupGraphPattern = (GroupGraphPattern) graphPattern;
+            referredGraphs.addAll(groupGraphPattern.getReferredGraphs());
+        }
+        return referredGraphs;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleInlineData.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleInlineData.java
new file mode 100644
index 0000000..e5ecbc7
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleInlineData.java
@@ -0,0 +1,54 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.query.InlineData;
+import org.apache.clerezza.sparql.query.Variable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleInlineData implements InlineData {
+
+    private List<Variable> variables = new ArrayList<Variable>();
+    private List<List<RDFTerm>> values = new ArrayList<List<RDFTerm>>();
+
+    @Override
+    public List<Variable> getVariables() {
+        return variables;
+    }
+
+    @Override
+    public List<List<RDFTerm>> getValues() {
+        return values;
+    }
+
+    public void addVariable(Variable variable) {
+        variables.add(variable);
+    }
+
+    public void addValues(List<RDFTerm> values) {
+        this.values.add(values);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleMinusGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleMinusGraphPattern.java
new file mode 100644
index 0000000..a93071d
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleMinusGraphPattern.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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.GraphPattern;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.MinusGraphPattern;
+
+/**
+ * This class implements {@link MinusGraphPattern}.
+ *
+ * @author hasan
+ */
+public class SimpleMinusGraphPattern implements MinusGraphPattern {
+
+    private GraphPattern minuendGraphPattern;
+    private GroupGraphPattern subtrahendGraphPattern;
+
+    /**
+     * Constructs a {@link MinusGraphPattern} out of a {@link GraphPattern}
+     * as the minuend ImmutableGraph pattern and a {@link GroupGraphPattern} as the 
+     * subtrahend pattern.
+     * 
+     * @param minuendGraphPattern
+     *        a {@link GraphPattern} specifying the minuend pattern.
+     * @param subtrahendGraphPattern
+     *        a {@link GroupGraphPattern} specifying the subtrahend pattern.
+     */
+    public SimpleMinusGraphPattern(GraphPattern minuendGraphPattern, GroupGraphPattern subtrahendGraphPattern) {
+        if (subtrahendGraphPattern == null) {
+            throw new IllegalArgumentException("Subtrahend ImmutableGraph pattern may not be null");
+        }
+        if (minuendGraphPattern == null) {
+            this.minuendGraphPattern = new SimpleGroupGraphPattern();
+        } else {
+            this.minuendGraphPattern = minuendGraphPattern;
+        }
+        this.subtrahendGraphPattern = subtrahendGraphPattern;
+    }
+
+    @Override
+    public GraphPattern getMinuendGraphPattern() {
+        return minuendGraphPattern;
+    }
+
+    @Override
+    public GroupGraphPattern getSubtrahendGraphPattern() {
+        return subtrahendGraphPattern;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOptionalGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOptionalGraphPattern.java
new file mode 100644
index 0000000..8f489e3
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOptionalGraphPattern.java
@@ -0,0 +1,68 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.GraphPattern;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.OptionalGraphPattern;
+
+/**
+ * This class implements {@link OptionalGraphPattern}.
+ *
+ * @author hasan
+ */
+public class SimpleOptionalGraphPattern implements OptionalGraphPattern {
+
+    private GraphPattern mainGraphPattern;
+    private GroupGraphPattern optionalGraphPattern;
+
+    /**
+     * Constructs an {@link OptionalGraphPattern} out of a {@link GraphPattern}
+     * as the main ImmutableGraph pattern and a {@link GroupGraphPattern} as the 
+     * optional pattern.
+     * 
+     * @param mainGraphPattern
+     *        a {@link GraphPattern} specifying the main pattern.
+     * @param optionalGraphPattern
+     *        a {@link GroupGraphPattern} specifying the optional pattern.
+     */
+    public SimpleOptionalGraphPattern(GraphPattern mainGraphPattern,
+            GroupGraphPattern optionalGraphPattern) {
+        if (optionalGraphPattern == null) {
+            throw new IllegalArgumentException("Optional ImmutableGraph pattern may not be null");
+        }
+        if (mainGraphPattern == null) {
+            this.mainGraphPattern = new SimpleGroupGraphPattern();
+        } else {
+            this.mainGraphPattern = mainGraphPattern;
+        }
+        this.optionalGraphPattern = optionalGraphPattern;
+    }
+
+    @Override
+    public GraphPattern getMainGraphPattern() {
+        return mainGraphPattern;
+    }
+
+    @Override
+    public GroupGraphPattern getOptionalGraphPattern() {
+        return optionalGraphPattern;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOrderCondition.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOrderCondition.java
new file mode 100644
index 0000000..2111137
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleOrderCondition.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.Expression;
+import org.apache.clerezza.sparql.query.OrderCondition;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleOrderCondition implements OrderCondition {
+    private Expression expression;
+    private boolean ascending;
+
+    public SimpleOrderCondition(Expression expression, boolean ascending) {
+        this.expression = expression;
+        this.ascending = ascending;
+    }
+
+    @Override
+    public Expression getExpression() {
+        return expression;
+    }
+
+    @Override
+    public boolean isAscending() {
+        return ascending;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java
new file mode 100644
index 0000000..a7aaf55
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePathSupportedBasicGraphPattern.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.PathSupportedBasicGraphPattern;
+import org.apache.clerezza.sparql.query.PropertyPathPattern;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimplePathSupportedBasicGraphPattern implements PathSupportedBasicGraphPattern {
+
+    private Set<PropertyPathPattern> propertyPathPatterns;
+
+    public SimplePathSupportedBasicGraphPattern(Set<PropertyPathPattern> propertyPathPatterns) {
+        this.propertyPathPatterns = (propertyPathPatterns == null)
+                ? new LinkedHashSet<PropertyPathPattern>()
+                : propertyPathPatterns;
+    }
+
+    @Override
+    public Set<PropertyPathPattern> getPropertyPathPatterns() {
+        return propertyPathPatterns;
+    }
+
+    public void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns) {
+        this.propertyPathPatterns.addAll(propertyPathPatterns);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePropertyPathPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePropertyPathPattern.java
new file mode 100644
index 0000000..cb79bfb
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimplePropertyPathPattern.java
@@ -0,0 +1,132 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.query.*;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimplePropertyPathPattern implements PropertyPathPattern {
+
+    private ResourceOrVariable subject;
+    private PropertyPathExpressionOrVariable propertyPathExpression;
+    private ResourceOrVariable object;
+
+    public SimplePropertyPathPattern(ResourceOrVariable subject,
+            PropertyPathExpressionOrVariable propertyPathExpression,
+            ResourceOrVariable object) {
+        if (subject == null) {
+            throw new IllegalArgumentException("Invalid subject: null");
+        }
+        if (propertyPathExpression == null) {
+            throw new IllegalArgumentException("Invalid property path expression: null");
+        }
+        if (object == null) {
+            throw new IllegalArgumentException("Invalid object: null");
+        }
+        this.subject = subject;
+        this.propertyPathExpression = propertyPathExpression;
+        this.object = object;
+    }
+
+    public SimplePropertyPathPattern(Variable subject, Variable propertyPathExpression, Variable object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(BlankNodeOrIRI subject, Variable propertyPathExpression, Variable object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(Variable subject, Variable propertyPathExpression, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(BlankNodeOrIRI subject, Variable propertyPathExpression, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(Variable subject, PropertyPathExpression propertyPathExpression, Variable object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(BlankNodeOrIRI subject, PropertyPathExpression propertyPathExpression, Variable object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(Variable subject, PropertyPathExpression propertyPathExpression, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    public SimplePropertyPathPattern(BlankNodeOrIRI subject, PropertyPathExpression propertyPathExpression, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new PropertyPathExpressionOrVariable(propertyPathExpression),
+                new ResourceOrVariable(object));
+    }
+
+    @Override
+    public ResourceOrVariable getSubject() {
+        return subject;
+    }
+
+    @Override
+    public PropertyPathExpressionOrVariable getPropertyPathExpression() {
+        return propertyPathExpression;
+    }
+
+    @Override
+    public ResourceOrVariable getObject() {
+        return object;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof PropertyPathPattern)) {
+            return false;
+        }
+        final PropertyPathPattern other = (PropertyPathPattern) obj;
+        if (!this.subject.equals(other.getSubject())) {
+            return false;
+        }
+        if (!this.propertyPathExpression.equals(other.getPropertyPathExpression())) {
+            return false;
+        }
+        if (!this.object.equals(other.getObject())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (subject.hashCode() >> 1) ^ propertyPathExpression.hashCode() ^ (object.hashCode() << 1);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQuery.java
new file mode 100644
index 0000000..3c1ba0b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQuery.java
@@ -0,0 +1,76 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.query.DataSet;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.InlineData;
+import org.apache.clerezza.sparql.query.Query;
+
+/**
+ *
+ * @author hasan
+ */
+public abstract class SimpleQuery implements Query {
+
+    private SimpleDataSet dataSet = null;
+    private GroupGraphPattern queryPattern = null;
+    private InlineData inlineData = null;
+
+    @Override
+    public DataSet getDataSet() {
+        return dataSet;
+    }
+
+    @Override
+    public GroupGraphPattern getQueryPattern() {
+        return queryPattern;
+    }
+
+    @Override
+    public InlineData getInlineData() {
+        return inlineData;
+    }
+
+    public void addDefaultGraph(IRI defaultGraph) {
+        if (dataSet == null) {
+            dataSet = new SimpleDataSet();
+        }
+        dataSet.addDefaultGraph(defaultGraph);
+    }
+
+    public void addNamedGraph(IRI namedGraph) {
+        if (dataSet == null) {
+            dataSet = new SimpleDataSet();
+        }
+        dataSet.addNamedGraph(namedGraph);
+    }
+
+    public void setQueryPattern(GroupGraphPattern queryPattern) {
+        this.queryPattern = queryPattern;
+    }
+
+    public void setInlineData(InlineData inlineData) {
+        this.inlineData = inlineData;
+    }
+
+    @Override
+    public abstract String toString();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQueryWithSolutionModifier.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQueryWithSolutionModifier.java
new file mode 100644
index 0000000..aea83f6
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleQueryWithSolutionModifier.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.clerezza.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.Expression;
+import org.apache.clerezza.sparql.query.OrderCondition;
+import org.apache.clerezza.sparql.query.QueryWithSolutionModifier;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public abstract class SimpleQueryWithSolutionModifier extends SimpleQuery
+        implements QueryWithSolutionModifier {
+
+    private List<Expression> groupConditions = new ArrayList<Expression>();
+    private List<Expression> havingConditions = new ArrayList<Expression>();
+    private List<OrderCondition> orderConditions = new ArrayList<OrderCondition>();
+
+    /**
+     * Result offset. 0 means no offset.
+     */
+    private int offset = 0;
+
+    /**
+     * Result limit. -1 means no limit.
+     */
+    private int limit = -1;
+
+    @Override
+    public List<Expression> getGroupConditions() {
+        return groupConditions;
+    }
+
+    @Override
+    public List<Expression> getHavingConditions() {
+        return havingConditions;
+    }
+
+    @Override
+    public List<OrderCondition> getOrderConditions() {
+        return orderConditions;
+    }
+
+    @Override
+    public int getOffset() {
+        return offset;
+    }
+
+    @Override
+    public int getLimit() {
+        return limit;
+    }
+
+    public void addGroupCondition(Expression groupCondition) {
+        groupConditions.add(groupCondition);
+    }
+
+    public void addHavingCondition(Expression havingCondition) {
+        havingConditions.add(havingCondition);
+    }
+
+    public void addOrderCondition(OrderCondition orderCondition) {
+        orderConditions.add(orderCondition);
+    }
+
+    public void setOffset(int offset) {
+        this.offset = offset;
+    }
+
+    public void setLimit(int limit) {
+        this.limit = limit;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSelectQuery.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSelectQuery.java
new file mode 100644
index 0000000..fb4d5dc
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSelectQuery.java
@@ -0,0 +1,80 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.SelectQuery;
+import org.apache.clerezza.sparql.query.Variable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleSelectQuery extends SimpleQueryWithSolutionModifier
+        implements SelectQuery {
+
+    private boolean distinct;
+    private boolean reduced;
+    private boolean selectAll;
+    private List<Variable> variables = new ArrayList<Variable>();
+
+    @Override
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    @Override
+    public boolean isReduced() {
+        return reduced;
+    }
+
+    @Override
+    public boolean isSelectAll() {
+        return selectAll;
+    }
+
+    @Override
+    public List<Variable> getSelection() {
+        return variables;
+    }
+
+    public void setDistinct() {
+        distinct = true;
+    }
+
+    public void setReduced() {
+        reduced = true;
+    }
+
+    public void setSelectAll() {
+        assert variables.isEmpty();
+        selectAll = true;
+    }
+
+    public void addSelection(Variable var) {
+        variables.add(var);
+    }
+
+    @Override
+    public String toString() {
+        return (new SimpleStringQuerySerializer()).serialize(this);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleServiceGraphPattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleServiceGraphPattern.java
new file mode 100644
index 0000000..b527d52
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleServiceGraphPattern.java
@@ -0,0 +1,66 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.ServiceGraphPattern;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleServiceGraphPattern implements ServiceGraphPattern {
+
+    private UriRefOrVariable service;
+    private GroupGraphPattern groupGraphPattern;
+    private boolean silent;
+
+    public SimpleServiceGraphPattern(UriRefOrVariable service,
+            GroupGraphPattern groupGraphPattern) {
+        if (service == null) {
+            throw new IllegalArgumentException("Service endpoint may not be null");
+        }
+        if (groupGraphPattern == null) {
+            throw new IllegalArgumentException("Group ImmutableGraph Pattern may not be null");
+        }
+        this.service = service;
+        this.groupGraphPattern = groupGraphPattern;
+        this.silent = false;
+    }
+
+    @Override
+    public UriRefOrVariable getService() {
+        return service;
+    }
+
+    @Override
+    public GroupGraphPattern getGroupGraphPattern() {
+        return groupGraphPattern;
+    }
+
+    public void setSilent(boolean silent) {
+        this.silent = silent;
+    }
+
+    public boolean isSilent() {
+        return silent;
+    }
+
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSparqlUnit.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSparqlUnit.java
new file mode 100644
index 0000000..d1fe59a
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleSparqlUnit.java
@@ -0,0 +1,65 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.sparql.query.Query;
+import org.apache.clerezza.sparql.query.SparqlUnit;
+import org.apache.clerezza.sparql.update.Update;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleSparqlUnit implements SparqlUnit {
+
+    private final Query query;
+	private final Update update;
+
+	public SimpleSparqlUnit(Query query) {
+		if (query == null) {
+			throw new IllegalArgumentException("Invalid query: null");
+		}
+		this.query = query;
+		update = null;
+	}
+
+	public SimpleSparqlUnit(Update update) {
+		if (update == null) {
+			throw new IllegalArgumentException("Invalid update: null");
+		}
+		this.update = update;
+		query = null;
+	}
+
+
+    @Override
+    public boolean isQuery() {
+        return update == null;
+    }
+
+    @Override
+    public Query getQuery() {
+        return query;
+    }
+
+    @Override
+    public Update getUpdate() {
+        return update;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleStringQuerySerializer.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleStringQuerySerializer.java
new file mode 100644
index 0000000..d268dbc
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleStringQuerySerializer.java
@@ -0,0 +1,295 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.StringQuerySerializer;
+import org.apache.clerezza.sparql.query.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This class implements abstract methods of {@link StringQuerySerializer}
+ * to serialize specific {@link Query} types.
+ *
+ * @author hasan
+ */
+public class SimpleStringQuerySerializer extends StringQuerySerializer {
+
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Override
+    public String serialize(SelectQuery selectQuery) {
+        StringBuffer s = new StringBuffer("SELECT ");
+        if (selectQuery.isDistinct()) {
+            s.append("DISTINCT\n");
+        }
+        if (selectQuery.isReduced()) {
+            s.append("REDUCED\n");
+        }
+        if (selectQuery.isSelectAll()) {
+            s.append("*");
+        } else {
+            for (Variable v : selectQuery.getSelection()) {
+                appendVariable(s, v);
+                s.append(" ");
+            }
+        }
+        s.append("\n");
+
+        appendDataSet(s, (SimpleQuery) selectQuery);
+        appendWhere(s, (SimpleQuery) selectQuery);
+        appendModifier(s, (SimpleQueryWithSolutionModifier) selectQuery);
+
+        return s.toString();
+    }
+
+    private void appendVariable(StringBuffer s, Variable v) {
+        s.append("?").append(v.getName());
+    }
+
+    private void appendDataSet(StringBuffer s, SimpleQuery q) {
+        DataSet dataSet = q.getDataSet();
+        if (dataSet != null) {
+            for (IRI dg : dataSet.getDefaultGraphs()) {
+                s.append("FROM ").append(dg.toString()).append("\n");
+            }
+            for (IRI ng : dataSet.getNamedGraphs()) {
+                s.append("FROM NAMED ").append(ng.toString()).append("\n");
+            }
+        }
+    }
+
+    private void appendWhere(StringBuffer s, SimpleQuery q) {
+        GroupGraphPattern queryPattern = q.getQueryPattern();
+        if (queryPattern == null) {
+            return;
+        }
+        s.append("WHERE\n");
+        appendGroupGraphPattern(s, q.getQueryPattern());
+    }
+
+    private void appendGroupGraphPattern(StringBuffer s,
+            GroupGraphPattern groupGraphPattern) {
+
+        s.append("{ ");
+        for (GraphPattern graphPattern : groupGraphPattern.getGraphPatterns()) {
+            appendGraphPattern(s, graphPattern);
+        }
+        for (Expression e : groupGraphPattern.getFilter()) {
+            boolean brackettedExpr = !((e instanceof BuiltInCall)
+                    || (e instanceof FunctionCall));
+            s.append("FILTER ");
+            if (brackettedExpr) {
+                s.append("(");
+            }
+            appendExpression(s, e);
+            if (brackettedExpr) {
+                s.append(")");
+            }
+            s.append("\n");
+        }
+        s.append("} ");
+    }
+
+    private void appendGraphPattern(StringBuffer s, GraphPattern graphPattern) {
+        if (graphPattern instanceof BasicGraphPattern) {
+            appendTriplePatterns(s,
+                    ((BasicGraphPattern) graphPattern).getTriplePatterns());
+        } else if (graphPattern instanceof GroupGraphPattern) {
+            appendGroupGraphPattern(s, (GroupGraphPattern) graphPattern);
+        } else if (graphPattern instanceof OptionalGraphPattern) {
+            appendGraphPattern(s,
+                    ((OptionalGraphPattern) graphPattern).getMainGraphPattern());
+            s.append(" OPTIONAL ");
+            appendGroupGraphPattern(s,
+                    ((OptionalGraphPattern) graphPattern).getOptionalGraphPattern());
+        } else if (graphPattern instanceof AlternativeGraphPattern) {
+            List<GroupGraphPattern> alternativeGraphPatterns =
+                    ((AlternativeGraphPattern) graphPattern).getAlternativeGraphPatterns();
+            if ((alternativeGraphPatterns != null) &&
+                    (!alternativeGraphPatterns.isEmpty())) {
+                appendGroupGraphPattern(s, alternativeGraphPatterns.get(0));
+                int size = alternativeGraphPatterns.size();
+                int i = 1;
+                while (i < size) {
+                    s.append(" UNION ");
+                    appendGroupGraphPattern(s, alternativeGraphPatterns.get(i));
+                    i++;
+                }
+            }
+        } else if (graphPattern instanceof GraphGraphPattern) {
+            s.append("ImmutableGraph ");
+            appendResourceOrVariable(s, ((GraphGraphPattern) graphPattern).getGraph());
+            s.append(" ");
+            appendGroupGraphPattern(s, ((GraphGraphPattern) graphPattern).getGroupGraphPattern());
+        } else {
+            logger.warn("Unsupported GraphPattern {}", graphPattern.getClass());
+        }
+    }
+
+    private void appendTriplePatterns(StringBuffer s,
+            Set<TriplePattern> triplePatterns) {
+
+        for (TriplePattern p : triplePatterns) {
+            appendResourceOrVariable(s, p.getSubject());
+            s.append(" ");
+            appendResourceOrVariable(s, p.getPredicate());
+            s.append(" ");
+            appendResourceOrVariable(s, p.getObject());
+            s.append(" .\n");
+        }
+    }
+
+    private void appendResourceOrVariable(StringBuffer s, ResourceOrVariable n) {
+        if (n.isVariable()) {
+            appendVariable(s, n.getVariable());
+        } else {
+            RDFTerm r = n.getResource();
+            if (r instanceof BlankNode) {
+                s.append("_:").append(r.toString().replace("@", "."));
+            } else {
+                s.append(r.toString());
+            }
+        }
+    }
+
+    private void appendExpression(StringBuffer s, Expression e) {
+        if (e instanceof Variable) {
+            appendVariable(s, (Variable) e);
+        } else if (e instanceof BinaryOperation) {
+            BinaryOperation bo = (BinaryOperation) e;
+            s.append("(");
+            appendExpression(s, bo.getLhsOperand());
+            s.append(") ").append(bo.getOperatorString()).append(" (");
+            appendExpression(s, bo.getRhsOperand());
+            s.append(")");
+        } else if (e instanceof UnaryOperation) {
+            UnaryOperation uo = (UnaryOperation) e;
+            s.append(uo.getOperatorString()).append(" (");
+            appendExpression(s, uo.getOperand());
+            s.append(")");
+        } else if (e instanceof BuiltInCall) {
+            BuiltInCall b = (BuiltInCall) e;
+            appendCall(s, b.getName(), b.getArguements());
+        } else if (e instanceof FunctionCall) {
+            FunctionCall f = (FunctionCall) e;
+            appendCall(s, f.getName().getUnicodeString(), f.getArguements());
+        } else if (e instanceof LiteralExpression) {
+            appendLiteralExpression(s, (LiteralExpression) e);
+        } else if (e instanceof UriRefExpression) {
+            s.append(((UriRefExpression) e).getUriRef().toString());
+        }
+    }
+
+    private void appendCall(StringBuffer s, String name, List<Expression> expr) {
+        s.append(name).append("(");
+        for (Expression e : expr) {
+            appendExpression(s, e);
+            s.append(",");
+        }
+        if (expr.isEmpty()) {
+            s.append(")");
+        } else {
+            s.setCharAt(s.length()-1, ')');
+        }
+    }
+
+    private void appendLiteralExpression(StringBuffer s, LiteralExpression le) {
+        s.append(le.getLiteral().toString());
+    }
+
+    private void appendModifier(StringBuffer s, SimpleQueryWithSolutionModifier q) {
+        List<OrderCondition> orderConditions = q.getOrderConditions();
+        if ((orderConditions != null) && (!orderConditions.isEmpty())) {
+            s.append("ORDER BY ");
+            for (OrderCondition oc : orderConditions) {
+                appendOrderCondition(s, oc);
+                s.append("\n");
+            }
+        }
+        if (q.getOffset() > 0) {
+            s.append("OFFSET ").append(q.getOffset()).append("\n");
+        }
+        if (q.getLimit() >= 0) {
+            s.append("LIMIT ").append(q.getLimit()).append("\n");
+        }
+    }
+
+    private void appendOrderCondition(StringBuffer s, OrderCondition oc) {
+        if (!oc.isAscending()) {
+            s.append("DESC(");
+        }
+        appendExpression(s, oc.getExpression());
+        if (!oc.isAscending()) {
+            s.append(")");
+        }
+        s.append(" ");
+    }
+
+    @Override
+    public String serialize(ConstructQuery constructQuery) {
+        StringBuffer s = new StringBuffer("CONSTRUCT\n");
+        Set<TriplePattern> triplePatterns = constructQuery.getConstructTemplate();
+        s.append("{ ");
+        if (triplePatterns != null && !triplePatterns.isEmpty()) {
+            appendTriplePatterns(s, triplePatterns);
+        }
+        s.append("}\n");
+
+        appendDataSet(s, (SimpleQuery) constructQuery);
+        appendWhere(s, (SimpleQuery) constructQuery);
+        appendModifier(s, (SimpleQueryWithSolutionModifier) constructQuery);
+
+        return s.toString();
+    }
+
+    @Override
+    public String serialize(DescribeQuery describeQuery) {
+        StringBuffer s = new StringBuffer("DESCRIBE\n");
+
+        if (describeQuery.isDescribeAll()) {
+            s.append("*");
+        } else {
+            for (ResourceOrVariable n : describeQuery.getResourcesToDescribe()) {
+                appendResourceOrVariable(s, n);
+                s.append(" ");
+            }
+        }
+        appendDataSet(s, (SimpleQuery) describeQuery);
+        appendWhere(s, (SimpleQuery) describeQuery);
+        appendModifier(s, (SimpleQueryWithSolutionModifier) describeQuery);
+
+        return s.toString();
+    }
+
+    @Override
+    public String serialize(AskQuery askQuery) {
+        StringBuffer s = new StringBuffer("ASK\n");
+        appendDataSet(s, (SimpleQuery) askQuery);
+        appendWhere(s, (SimpleQuery) askQuery);
+
+        return s.toString();
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleTriplePattern.java b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleTriplePattern.java
new file mode 100644
index 0000000..ca91b57
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/query/impl/SimpleTriplePattern.java
@@ -0,0 +1,136 @@
+/*
+ * 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.sparql.query.impl;
+
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.query.ResourceOrVariable;
+import org.apache.clerezza.sparql.query.TriplePattern;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+import org.apache.clerezza.sparql.query.Variable;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleTriplePattern implements TriplePattern {
+
+    private ResourceOrVariable subject;
+    private UriRefOrVariable predicate;
+    private ResourceOrVariable object;
+
+    public SimpleTriplePattern(ResourceOrVariable subject,
+            UriRefOrVariable predicate,
+            ResourceOrVariable object) {
+        if (subject == null) {
+            throw new IllegalArgumentException("Invalid subject: null");
+        }
+        if (predicate == null) {
+            throw new IllegalArgumentException("Invalid predicate: null");
+        }
+        if (object == null) {
+            throw new IllegalArgumentException("Invalid object: null");
+        }
+        this.subject = subject;
+        this.predicate = predicate;
+        this.object = object;
+    }
+
+    public SimpleTriplePattern(Variable subject, Variable predicate, Variable object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(BlankNodeOrIRI subject, Variable predicate, Variable object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(Variable subject, IRI predicate, Variable object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(BlankNodeOrIRI subject, IRI predicate, Variable object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(Variable subject, Variable predicate, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(BlankNodeOrIRI subject, Variable predicate, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(Variable subject, IRI predicate, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    public SimpleTriplePattern(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
+                new ResourceOrVariable(object));
+    }
+
+    @Override
+    public ResourceOrVariable getSubject() {
+        return subject;
+    }
+
+    @Override
+    public UriRefOrVariable getPredicate() {
+        return predicate;
+    }
+
+    @Override
+    public ResourceOrVariable getObject() {
+        return object;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof TriplePattern)) {
+            return false;
+        }
+        final TriplePattern other = (TriplePattern) obj;
+        if (!this.subject.equals(other.getSubject())) {
+            return false;
+        }
+        if (!this.predicate.equals(other.getPredicate())) {
+            return false;
+        }
+        if (!this.object.equals(other.getObject())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (subject.hashCode() >> 1) ^ subject.hashCode() ^ (subject.hashCode() << 1);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/Update.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/Update.java
new file mode 100644
index 0000000..73616a8
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/Update.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sparql.update;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+
+import java.util.Set;
+
+/**
+ * <p>This interface represents a SPARQL Update.</p>
+ *
+ * @author hasan
+ */
+public interface Update {
+
+    /**
+     * 
+     * @param defaultGraph
+     *      if default graph is referred either implicitly or explicitly in a SPARQL {@link Update}
+     *      the specified defaultGraph should be returned in the resulting set.
+     * @param graphStore
+     *      the specified tcProvider is used to get the named graphs referred in the SPARQL {@link Update}.
+     * @return a set of graphs referred in the {@link Update}.
+     */
+    public Set<IRI> getReferredGraphs(IRI defaultGraph, GraphStore graphStore);
+
+    public void addOperation(UpdateOperation updateOperation);
+
+    /**
+     *
+     * @return A valid String representation of the {@link Update}.
+     */
+    @Override
+    public abstract String toString();
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/UpdateOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/UpdateOperation.java
new file mode 100644
index 0000000..990967e
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/UpdateOperation.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.clerezza.sparql.update;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+
+import java.util.Set;
+
+/**
+ * SPARQL Update Operation
+ *
+ * @author hasan
+ */
+public interface UpdateOperation {
+    public enum GraphSpec {
+        GRAPH, DEFAULT, NAMED, ALL
+    }
+
+    /**
+     * 
+     * @param defaultGraph
+     *      if default graph is referred either implicitly or explicitly as an input graph in this operation
+     *      the specified defaultGraph should be returned in the resulting set.
+     * @param graphStore
+     *      the specified tcProvider is used to get the named graphs referred as input graphs in this operation.
+     * @return a set of graphs referred as input graphs in this operation.
+     */
+    public Set<IRI> getInputGraphs(IRI defaultGraph, GraphStore graphStore);
+
+    /**
+     * 
+     * @param defaultGraph
+     *      if default graph is referred either implicitly or explicitly as a destination graph in this operation
+     *      the specified defaultGraph should be returned in the resulting set.
+     * @param graphStore
+     *      the specified tcProvider is used to get the named graphs referred as destination graphs in this operation.
+     * @return a set of graphs referred as destination graphs in this operation.
+     */
+    public Set<IRI> getDestinationGraphs(IRI defaultGraph, GraphStore graphStore);
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/AddOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/AddOperation.java
new file mode 100644
index 0000000..d13e9f7
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/AddOperation.java
@@ -0,0 +1,29 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ * The ADD operation is a shortcut for inserting all data from an input ImmutableGraph into a destination ImmutableGraph. 
+ * Data from the input ImmutableGraph is not affected, and initial data from the destination ImmutableGraph, if any, is kept intact.
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#add">SPARQL 1.1 Update: 3.2.5 ADD</a>
+ * 
+ * @author hasan
+ */
+public class AddOperation extends SimpleUpdateOperation {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/BaseUpdateOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/BaseUpdateOperation.java
new file mode 100644
index 0000000..e782458
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/BaseUpdateOperation.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.clerezza.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public abstract class BaseUpdateOperation implements UpdateOperation {
+
+    protected Set<IRI> inputGraphs = new HashSet<IRI>();
+    protected Set<IRI> destinationGraphs = new HashSet<IRI>();
+    protected GraphSpec inputGraphSpec = GraphSpec.GRAPH;
+    protected GraphSpec destinationGraphSpec = GraphSpec.GRAPH;
+
+    public void setInputGraphSpec(GraphSpec inputGraphSpec) {
+        this.inputGraphSpec = inputGraphSpec;
+    }
+
+    public GraphSpec getInputGraphSpec() {
+        return inputGraphSpec;
+    }
+
+    public void setDestinationGraphSpec(GraphSpec destinationGraphSpec) {
+        this.destinationGraphSpec = destinationGraphSpec;
+    }
+
+    public GraphSpec getDestinationGraphSpec() {
+        return destinationGraphSpec;
+    }
+
+    @Override
+    public Set<IRI> getInputGraphs(IRI defaultGraph, GraphStore graphStore) {
+        return getGraphs(defaultGraph, graphStore, inputGraphSpec, inputGraphs);
+    }
+
+    private Set<IRI> getGraphs(IRI defaultGraph, GraphStore graphStore, GraphSpec graphSpec, Set<IRI> graphs) {
+        switch (graphSpec) {
+            case DEFAULT:
+                Set<IRI> result = new HashSet<IRI>();
+                result.add(defaultGraph);
+                return result;
+            case NAMED:
+            case ALL:
+                return graphStore.listGraphs();
+            default:
+                return graphs;
+        }
+    }
+
+    @Override
+    public Set<IRI> getDestinationGraphs(IRI defaultGraph, GraphStore graphStore) {
+        return getGraphs(defaultGraph, graphStore, destinationGraphSpec, destinationGraphs);
+    }
+
+    public void addInputGraph(IRI ImmutableGraph) {
+        inputGraphs.add(ImmutableGraph);
+    }
+
+    public void addDestinationGraph(IRI ImmutableGraph) {
+        destinationGraphs.add(ImmutableGraph);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOperation.java
new file mode 100644
index 0000000..f3972a7
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class ClearOperation extends ClearOrDropOperation {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOrDropOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOrDropOperation.java
new file mode 100644
index 0000000..ae4a1c8
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ClearOrDropOperation.java
@@ -0,0 +1,61 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class ClearOrDropOperation extends BaseUpdateOperation {
+    private boolean silent;
+
+    public ClearOrDropOperation() {
+        this.silent = false;
+        destinationGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
+    }
+
+    public void setSilent(boolean silent) {
+        this.silent = silent;
+    }
+
+    public boolean isSilent() {
+        return silent;
+    }
+
+    public void setDestinationGraph(IRI destination) {
+        destinationGraphSpec = UpdateOperation.GraphSpec.GRAPH;
+        destinationGraphs.clear();
+        destinationGraphs.add(destination);
+    }
+
+    public IRI getDestinationGraph(IRI defaultGraph, GraphStore graphStore) {
+        Set<IRI> result = getDestinationGraphs(defaultGraph, graphStore);
+        if (result.isEmpty()) {
+            return null;
+        } else {
+            return result.iterator().next();
+        }
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CopyOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CopyOperation.java
new file mode 100644
index 0000000..9ec5b7b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CopyOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class CopyOperation extends SimpleUpdateOperation {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CreateOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CreateOperation.java
new file mode 100644
index 0000000..7b2a46c
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/CreateOperation.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.clerezza.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ *
+ * @author hasan
+ */
+public class CreateOperation extends BaseUpdateOperation {
+
+    private boolean silent;
+
+    public CreateOperation() {
+        this.silent = false;
+    }
+
+    public void setSilent(boolean silent) {
+        this.silent = silent;
+    }
+
+    public boolean isSilent() {
+        return silent;
+    }
+
+    public void setDestinationGraph(IRI destination) {
+        destinationGraphs.clear();
+        destinationGraphs.add(destination);
+    }
+
+    public IRI getDestinationGraph() {
+        if (destinationGraphs.isEmpty()) {
+            return null;
+        } else {
+            return destinationGraphs.iterator().next();
+        }
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteDataOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteDataOperation.java
new file mode 100644
index 0000000..f1f59f0
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteDataOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class DeleteDataOperation extends UpdateOperationWithQuads {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteWhereOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteWhereOperation.java
new file mode 100644
index 0000000..8614b7b
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DeleteWhereOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class DeleteWhereOperation extends UpdateOperationWithQuads {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DropOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DropOperation.java
new file mode 100644
index 0000000..9e79ab1
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/DropOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class DropOperation extends ClearOrDropOperation {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/InsertDataOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/InsertDataOperation.java
new file mode 100644
index 0000000..dbc3b93
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/InsertDataOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class InsertDataOperation extends UpdateOperationWithQuads {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/LoadOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/LoadOperation.java
new file mode 100644
index 0000000..1020d77
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/LoadOperation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+
+/**
+ * The LOAD operation reads an RDF document from a IRI and inserts its triples into the specified ImmutableGraph in the ImmutableGraph Store. 
+ * If the destination ImmutableGraph already exists, then no data in that ImmutableGraph will be removed.
+ * If no destination ImmutableGraph IRI is provided to load the triples into, then the data will be loaded into the default ImmutableGraph.
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#load">SPARQL 1.1 Update: 3.1.4 LOAD</a>
+ * @author hasan
+ */
+public class LoadOperation extends SimpleUpdateOperation {
+
+    public void setSource(IRI source) {
+        setInputGraph(source);
+    }
+
+    public IRI getSource() {
+        return getInputGraph(null);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ModifyOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ModifyOperation.java
new file mode 100644
index 0000000..f4f5134
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/ModifyOperation.java
@@ -0,0 +1,112 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleDataSet;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * This ModifyOperation is a DELETE/INSERT operation.
+ * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#deleteInsert">SPARQL 1.1 Update: 3.1.3 DELETE/INSERT</a>
+ * 
+ * The DELETE/INSERT operation can be used to remove or add triples from/to the ImmutableGraph Store based on bindings 
+ * for a query pattern specified in a WHERE clause.
+ * 
+ * @author hasan
+ */
+public class ModifyOperation implements UpdateOperation {
+    private IRI fallbackGraph = null;
+    private UpdateOperationWithQuads deleteOperation = null;
+    private UpdateOperationWithQuads insertOperation = null;
+    private SimpleDataSet dataSet = null;
+    private GroupGraphPattern queryPattern = null;
+
+    public void setFallbackGraph(IRI fallbackGraph) {
+        this.fallbackGraph = fallbackGraph;
+    }
+
+    public void setDeleteOperation(UpdateOperationWithQuads deleteOperation) {
+        this.deleteOperation = deleteOperation;
+    }
+
+    public void setInsertOperation(UpdateOperationWithQuads insertOperation) {
+        this.insertOperation = insertOperation;
+    }
+
+    public void setDataSet(SimpleDataSet dataSet) {
+        this.dataSet = dataSet;
+    }
+
+    public void addGraphToDataSet(IRI ImmutableGraph) {
+        if (dataSet == null) {
+            dataSet = new SimpleDataSet();
+        }
+        dataSet.addDefaultGraph(ImmutableGraph);
+    }
+
+    public void addNamedGraphToDataSet(IRI namedGraph) {
+        if (dataSet == null) {
+            dataSet = new SimpleDataSet();
+        }
+        dataSet.addNamedGraph(namedGraph);
+    }
+
+    public void setQueryPattern(GroupGraphPattern queryPattern) {
+        this.queryPattern = queryPattern;
+    }
+
+    @Override
+    public Set<IRI> getInputGraphs(IRI defaultGraph, GraphStore graphStore) {
+        Set<IRI> graphs = new HashSet<IRI>();
+        if (dataSet != null) {
+            graphs.addAll(dataSet.getDefaultGraphs());
+            graphs.addAll(dataSet.getNamedGraphs());
+        } else {
+            if (fallbackGraph != null) {
+                graphs.add(fallbackGraph);
+            }
+        }
+        if (graphs.isEmpty()) {
+            graphs.add(defaultGraph);
+        }
+        if (queryPattern != null) {
+            graphs.addAll(queryPattern.getReferredGraphs());
+        }
+        return graphs;
+    }
+
+    @Override
+    public Set<IRI> getDestinationGraphs(IRI defaultGraph, GraphStore graphStore) {
+        Set<IRI> graphs = new HashSet<IRI>();
+        IRI dfltGraph = (fallbackGraph != null) ? fallbackGraph : defaultGraph;
+        if (deleteOperation != null) {
+            graphs.addAll(deleteOperation.getDestinationGraphs(dfltGraph, graphStore));
+        }
+        if (insertOperation != null) {
+            graphs.addAll(insertOperation.getDestinationGraphs(dfltGraph, graphStore));
+        }
+        return graphs;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/MoveOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/MoveOperation.java
new file mode 100644
index 0000000..1447c04
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/MoveOperation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.sparql.update.impl;
+
+/**
+ *
+ * @author hasan
+ */
+public class MoveOperation extends SimpleUpdateOperation {
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/Quad.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/Quad.java
new file mode 100644
index 0000000..d402429
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/Quad.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.clerezza.sparql.update.impl;
+
+import org.apache.clerezza.sparql.query.TriplePattern;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+import org.apache.clerezza.sparql.query.impl.SimpleBasicGraphPattern;
+
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class Quad extends SimpleBasicGraphPattern {
+
+    private UriRefOrVariable ImmutableGraph = null;
+
+    public Quad(UriRefOrVariable ImmutableGraph, Set<TriplePattern> triplePatterns) {
+        super(triplePatterns);
+        this.ImmutableGraph = ImmutableGraph;
+    }
+
+    public UriRefOrVariable getGraph() {
+        return this.ImmutableGraph;
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdate.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdate.java
new file mode 100644
index 0000000..ce27266
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdate.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+import org.apache.clerezza.sparql.update.Update;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleUpdate implements Update {
+    protected List<UpdateOperation> operations = new ArrayList<UpdateOperation>();
+
+    @Override
+    public Set<IRI> getReferredGraphs(IRI defaultGraph, GraphStore graphStore) {
+        Set<IRI> referredGraphs = new HashSet<IRI>();
+        for (UpdateOperation operation : operations) {
+            referredGraphs.addAll(operation.getInputGraphs(defaultGraph, graphStore));
+            referredGraphs.addAll(operation.getDestinationGraphs(defaultGraph, graphStore));
+        }
+        return referredGraphs;
+    }
+
+    @Override
+    public void addOperation(UpdateOperation updateOperation) {
+        operations.add(updateOperation);
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdateOperation.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdateOperation.java
new file mode 100644
index 0000000..b613088
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/SimpleUpdateOperation.java
@@ -0,0 +1,77 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class SimpleUpdateOperation extends BaseUpdateOperation {
+
+    private boolean silent;
+
+    public SimpleUpdateOperation() {
+        this.silent = false;
+        inputGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
+        destinationGraphSpec = UpdateOperation.GraphSpec.DEFAULT;
+    }
+
+    public void setSilent(boolean silent) {
+        this.silent = silent;
+    }
+
+    public boolean isSilent() {
+        return silent;
+    }
+
+    public void setInputGraph(IRI source) {
+        inputGraphSpec = UpdateOperation.GraphSpec.GRAPH;
+        inputGraphs.clear();
+        inputGraphs.add(source);
+    }
+
+    public IRI getInputGraph(IRI defaultGraph) {
+        Set<IRI> result = getInputGraphs(defaultGraph, null);
+        if (result.isEmpty()) {
+            return null;
+        } else {
+            return result.iterator().next();
+        }
+    }
+
+    public void setDestinationGraph(IRI destination) {
+        destinationGraphSpec = UpdateOperation.GraphSpec.GRAPH;
+        destinationGraphs.clear();
+        destinationGraphs.add(destination);
+    }
+
+    public IRI getDestinationGraph(IRI defaultGraph) {
+        Set<IRI> result = getDestinationGraphs(defaultGraph, null);
+        if (result.isEmpty()) {
+            return null;
+        } else {
+            return result.iterator().next();
+        }
+    }
+}
diff --git a/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/UpdateOperationWithQuads.java b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/UpdateOperationWithQuads.java
new file mode 100644
index 0000000..e24fbb7
--- /dev/null
+++ b/sparql/src/main/java/org/apache/clerezza/sparql/update/impl/UpdateOperationWithQuads.java
@@ -0,0 +1,79 @@
+/*
+ * 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.sparql.update.impl;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.sparql.GraphStore;
+import org.apache.clerezza.sparql.query.TriplePattern;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * @author hasan
+ */
+public class UpdateOperationWithQuads implements UpdateOperation {
+
+    private Quad defaultQuad = null;
+    private List<Quad> quads = new ArrayList<Quad>();
+
+    public UpdateOperationWithQuads() {
+    }
+
+    public void addQuad(Set<TriplePattern> triplePatterns) {
+        if (defaultQuad == null) {
+            defaultQuad = new Quad(null, triplePatterns);
+        } else {
+            defaultQuad.addTriplePatterns(triplePatterns);
+        }
+    }
+
+    public void addQuad(UriRefOrVariable ImmutableGraph, Set<TriplePattern> triplePatterns) {
+        if (ImmutableGraph == null) {
+            addQuad(triplePatterns);
+        } else {
+            quads.add(new Quad(ImmutableGraph, triplePatterns));
+        }
+    }
+
+    @Override
+    public Set<IRI> getInputGraphs(IRI defaultGraph, GraphStore graphStore) {
+        return new HashSet<IRI>();
+    }
+
+    @Override
+    public Set<IRI> getDestinationGraphs(IRI defaultGraph, GraphStore graphStore) {
+        Set<IRI> graphs = new HashSet<IRI>();
+        if (defaultQuad != null) {
+            graphs.add(defaultGraph);
+        }
+        for (Quad quad : quads) {
+            UriRefOrVariable ImmutableGraph = quad.getGraph();
+            if (!ImmutableGraph.isVariable()) {
+                graphs.add(ImmutableGraph.getResource());
+            }
+        }
+        return graphs;
+    }
+}
diff --git a/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedQueryParser.jj b/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedQueryParser.jj
new file mode 100644
index 0000000..7771c07
--- /dev/null
+++ b/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedQueryParser.jj
@@ -0,0 +1,1285 @@
+/*
+ * 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.
+ */
+options
+{
+   STATIC=false;
+   SUPPORT_CLASS_VISIBILITY_PUBLIC=false;
+   UNICODE_INPUT=true;
+   IGNORE_CASE=false;
+   JAVA_UNICODE_ESCAPE=false;
+   DEBUG_PARSER=false;
+   JDK_VERSION="1.6";
+}
+
+PARSER_BEGIN(JavaCCGeneratedQueryParser)
+
+package org.apache.clerezza.sparql;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.impl.literal.LiteralFactory;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.literal.TypedLiteralImpl;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.BinaryOperation;
+import org.apache.clerezza.sparql.query.Variable;
+import org.apache.clerezza.sparql.query.ResourceOrVariable;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+import org.apache.clerezza.sparql.query.FunctionCall;
+import org.apache.clerezza.sparql.query.TriplePattern;
+import org.apache.clerezza.sparql.query.Query;
+import org.apache.clerezza.sparql.query.LiteralExpression;
+import org.apache.clerezza.sparql.query.AlternativeGraphPattern;
+import org.apache.clerezza.sparql.query.BuiltInCall;
+import org.apache.clerezza.sparql.query.Expression;
+import org.apache.clerezza.sparql.query.UriRefExpression;
+import org.apache.clerezza.sparql.query.UnaryOperation;
+import org.apache.clerezza.sparql.query.impl.SimpleAlternativeGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleAskQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleConstructQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleDescribeQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleGraphGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleGroupGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleOrderCondition;
+import org.apache.clerezza.sparql.query.impl.SimpleQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleQueryWithSolutionModifier;
+import org.apache.clerezza.sparql.query.impl.SimpleSelectQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleTriplePattern;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.Set;
+
+/**
+ *
+ * Credits: Fedora Commons, Inc.
+ *            - for initial grammar of this file (available in mulgara project).
+ * Modified by: Hasan <ha...@trialox.org>
+ */
+class JavaCCGeneratedQueryParser {
+
+	private static final IRI RDF_TYPE =
+		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+	private static final IRI RDF_FIRST =
+		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+	private static final IRI RDF_REST =
+		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+	private static final IRI RDF_NIL =
+		new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+
+	/** A RegEx pattern for separating out a namespace from a prefixed name. */
+	private static final Pattern pfxNamePattern = Pattern.compile("([^:]*):(.*)");
+
+	private Query query;
+	private String base;
+	private Map<String, String> prefixes;
+	private Map<String, ResourceOrVariable> bNodes;
+	private int count;
+	private Map<String, Variable> vars;
+
+	void initialize() {
+		query = null;
+		base = null;
+		prefixes = new HashMap<String, String>();
+		bNodes = new HashMap<String, ResourceOrVariable>();
+		count = 0;
+		vars = new HashMap<String, Variable>();
+	}
+
+	Query parse() throws ParseException {
+		initialize();
+		this.Query();
+		return this.query;
+	}
+
+	private static String unquote(String s) {
+		return s.substring(1, s.length() - 1);
+	}
+
+	private static String unTripleQuote(String s) {
+		return s.substring(3, s.length() - 3);
+	}
+
+	private Variable getVariable(String name) {
+		name = name.substring(1);
+		Variable v = vars.get(name);
+		if (v == null) {
+			v = new Variable(name);
+			vars.put(name, v);
+			if (query instanceof SimpleSelectQuery) {
+				SimpleSelectQuery sq = (SimpleSelectQuery) query;
+				if (sq.isSelectAll()) {
+					sq.addSelection(v);
+				}
+			} else if (query instanceof SimpleDescribeQuery) {
+				SimpleDescribeQuery dq = (SimpleDescribeQuery) query;
+				if (dq.isDescribeAll()) {
+					dq.addResourceToDescribe(new ResourceOrVariable(v));
+				}
+			}
+		}
+		return v;
+	}
+
+	private void addTriplePatterns(Set<TriplePattern> triplePatterns,
+			ResourceOrVariable subject,
+			UriRefOrVariable predicate,
+			Set<ResourceOrVariable> objects) {
+
+		for (ResourceOrVariable object : objects) {
+			triplePatterns.add(
+				new SimpleTriplePattern(subject, predicate, object));
+		}
+	}
+
+	// nodes contain at least one element
+	private ResourceOrVariable addTriplePatterns(
+			Set<TriplePattern> triplePatterns,
+			List<ResourceOrVariable> nodes) {
+
+		ResourceOrVariable head = null;
+		UriRefOrVariable rdfFirst = new UriRefOrVariable(RDF_FIRST);
+		UriRefOrVariable rdfRest = new UriRefOrVariable(RDF_REST);
+		UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
+
+		ResourceOrVariable prevSubject = null;
+		for (ResourceOrVariable node : nodes) {
+			ResourceOrVariable currentSubject = getNewBNode();
+			if (prevSubject != null) {
+				triplePatterns.add(
+					new SimpleTriplePattern(prevSubject, rdfRest, currentSubject));
+			} else {
+				head = currentSubject;
+			}
+			triplePatterns.add(
+				new SimpleTriplePattern(currentSubject, rdfFirst, node));
+			prevSubject = currentSubject;
+		}
+		if (prevSubject != null) {
+			triplePatterns.add(
+				new SimpleTriplePattern(prevSubject, rdfRest, rdfNil));
+		}
+		return head;
+	}
+
+	private ResourceOrVariable getNewBNode() {
+		ResourceOrVariable bNode = new ResourceOrVariable(new BlankNode());
+		bNodes.put("*" + count++, bNode);
+		return bNode;
+	}
+
+	private ResourceOrVariable getBNode(String label) {
+		ResourceOrVariable bNode = bNodes.get(label);
+		if (bNode == null) {
+			bNode = new ResourceOrVariable(new BlankNode());
+			bNodes.put(label, bNode);
+		}
+		return bNode;
+	}
+
+	private IRI createUriRef(String r) throws ParseException {
+		// Create an IRI directly if the string does not start with a prefix
+		Matcher m = pfxNamePattern.matcher(r);
+		if (!m.matches()) {
+			// either a normal IRI, or one with a BASE
+			return isRelative(r) ? new IRI(base + r) : new IRI(r);
+		}
+		// extract the prefix, and attempt to convert to a URI before creating the reference
+		String ns = prefixes.get(m.group(1));
+		return ns == null ? new IRI(r) : new IRI(ns + m.group(2));
+	}
+
+	/**
+	 * Tests if the string for a URI is relative or absolute. The test is based on a scheme existing
+	 * in the string, which in turn expects a : character to follow it. If there is no colon, then
+	 * it is presumed to be relative. Otherwise, if there are special characters preceding the first
+	 * colon these are presumed to not be in a scheme.
+	 * @param u A string for a URI.
+	 * @return <code>true</code> if the URI appears to be relative, <code>false</code> otherwise.
+	 */
+	private static boolean isRelative(String u) {
+		int colon = u.indexOf(':');
+		if (colon < 0) {
+			return true;
+		}
+		for (int c = 0; c < colon; c++) {
+			// if there a non-alphanum characters then this is not a scheme, so the URI is relative
+			if (!Character.isLetterOrDigit(u.charAt(c))) {
+				return true;
+			}
+		}
+		// found a (probably) valid scheme, so the URI is absolute
+		return false;
+	}
+}
+PARSER_END(JavaCCGeneratedQueryParser)
+
+SKIP :
+{
+    "\t" | "\n" | "\r" | "\f" | " "
+}
+
+MORE :
+{
+    "#" : IN_COMMENT
+}
+
+<IN_COMMENT>
+SPECIAL_TOKEN :
+{
+  <COMMENT: ( ~[ "\r","\n" ] )* > : DEFAULT
+}
+
+TOKEN [IGNORE_CASE] :
+{
+    < SELECT : "SELECT" >
+|   < BASE : "BASE" >
+|   < ORDER : "ORDER" >
+|   < BY : "BY" >
+|   < FROM : "FROM" >
+|   < GRAPH : "GRAPH" >
+|   < STR : "STR" >
+|   < IS_URI : "isURI" >
+|   < PREFIX : "PREFIX" >
+|   < CONSTRUCT : "CONSTRUCT" >
+|   < LIMIT : "LIMIT" >
+|   < NAMED : "NAMED" >
+|   < OPTIONAL : "OPTIONAL" >
+|   < LANG : "lang" >
+|   < IS_IRI : "isIRI" >
+|   < DESCRIBE : "DESCRIBE" >
+|   < OFFSET : "OFFSET" >
+|   < WHERE : "WHERE" >
+|   < UNION : "UNION" >
+|   < LANGMATCHES : "langMatches" >
+|   < IS_BLANK : "isBlank" >
+|   < IS_LITERAL : "isLiteral" >
+|   < ASK : "ASK" >
+|   < DISTINCT : "DISTINCT" >
+|   < FILTER : "FILTER" >
+|   < DATATYPE : "datatype" >
+|   < REGEX : "regex" >
+|   < REDUCED : "REDUCED" >
+|   < BOUND : "bound" >
+|   < TRUE : "TRUE" >
+|   < SAME_TERM : "sameTerm" >
+|   < FALSE : "FALSE" >
+}
+
+
+/* [1]      Query      ::=      Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) */
+private void Query() : {} {
+	Prologue() ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() ) <EOF>
+}
+
+/* [2]      Prologue      ::=      BaseDecl? PrefixDecl* */
+private void Prologue() : {} {
+	( BaseDecl() )? ( PrefixDecl() )*
+}
+
+/* [3]      BaseDecl      ::=      'BASE' IRI_REF */
+private void BaseDecl() : {
+	Token iriRef; } {
+
+	<BASE> iriRef=<IRI_REF> { base = unquote(iriRef.image); }
+}
+
+/* [4]      PrefixDecl      ::=      'PREFIX' PNAME_NS IRI_REF */
+private void PrefixDecl() : {
+	Token ns, iriRef; } {
+
+	<PREFIX> ns=<PNAME_NS> iriRef=<IRI_REF> {
+	String pfx = ns.image;
+	prefixes.put(pfx.substring(0, pfx.length() - 1), unquote(iriRef.image)); }
+}
+
+/* [5]      SelectQuery   ::=   'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( Var+ | '*' ) DatasetClause* WhereClause SolutionModifier */
+private void SelectQuery() : {
+	Variable v; } {
+
+	<SELECT> {
+	query = new SimpleSelectQuery(); }
+	(
+		<DISTINCT> {
+		((SimpleSelectQuery) query).setDistinct(); }
+	|
+		<REDUCED> {
+		((SimpleSelectQuery) query).setReduced(); }
+	)?
+	(
+		( v=Var() {
+			((SimpleSelectQuery) query).addSelection(v); } )+
+		|
+		"*" {
+			((SimpleSelectQuery) query).setSelectAll(); }
+	)
+	( DatasetClause() )*
+	WhereClause()
+	SolutionModifier()
+}
+
+/* [6]      ConstructQuery    ::=   'CONSTRUCT' ConstructTemplate DatasetClause* WhereClause SolutionModifier */
+private void ConstructQuery() : {
+	Set<TriplePattern> triplePatterns = null; } {
+
+	<CONSTRUCT>
+	triplePatterns=ConstructTemplate() {
+	query = new SimpleConstructQuery(triplePatterns); }
+	( DatasetClause() )*
+	WhereClause()
+	SolutionModifier()
+}
+
+/* [7]      DescribeQuery      ::=      'DESCRIBE' ( VarOrIRIref+ | '*' ) DatasetClause* WhereClause? SolutionModifier */
+private void DescribeQuery() : {
+	UriRefOrVariable node; } {
+
+	<DESCRIBE> {
+	query = new SimpleDescribeQuery(); }
+	(
+		( node=VarOrIRIref() {
+			((SimpleDescribeQuery) query).addResourceToDescribe(node); } )+
+		|
+		"*" {
+			((SimpleDescribeQuery) query).setDescribeAll(); }
+	)
+	( DatasetClause() )*
+	( WhereClause() )?
+	SolutionModifier()
+}
+
+/* [8]      AskQuery      ::=   'ASK' DatasetClause* WhereClause */
+private void AskQuery() : {} {
+	<ASK> {
+	query = new SimpleAskQuery(); }
+	( DatasetClause() )*
+	WhereClause()
+}
+
+/* [9]   DatasetClause   ::=   'FROM' ( DefaultGraphClause | NamedGraphClause ) */
+private void DatasetClause() : {} {
+	<FROM> (DefaultGraphClause() | NamedGraphClause())
+}
+
+/* [10]    DefaultGraphClause    ::=    SourceSelector */
+private void DefaultGraphClause() : {
+	IRI defaultGraph; } {
+
+	defaultGraph=SourceSelector() {
+	((SimpleQuery) query).addDefaultGraph(defaultGraph); }
+}
+
+/* [11]    NamedGraphClause    ::=    'NAMED' SourceSelector */
+private void NamedGraphClause() : {
+	IRI namedGraph; } {
+
+	<NAMED> namedGraph=SourceSelector() {
+	((SimpleQuery) query).addNamedGraph(namedGraph); }
+}
+
+/* [12]    SourceSelector    ::=    IRIref */
+private IRI SourceSelector() : {
+	IRI graph; } {
+
+	graph=IRIref() {
+	return graph; }
+}
+
+/* [13]    WhereClause    ::=    'WHERE'? GroupGraphPattern */
+private void WhereClause() : {
+	GroupGraphPattern queryPattern; } {
+
+	(<WHERE>)? queryPattern=GroupGraphPattern() {
+	((SimpleQuery) query).setQueryPattern(queryPattern); }
+}
+
+/* [14]    SolutionModifier    ::=    OrderClause? LimitOffsetClauses? */
+private void SolutionModifier() : {} {
+	( OrderClause() )?
+	( LimitOffsetClauses() )?
+}
+
+/* [15]    LimitOffsetClauses    ::=    ( LimitClause OffsetClause? | OffsetClause LimitClause? ) */
+private void LimitOffsetClauses() : {} {
+	( LimitClause() (OffsetClause())? )
+	|
+	( OffsetClause() (LimitClause())? )
+}
+
+/* [16]    OrderClause    ::=    'ORDER' 'BY' OrderCondition+ */
+private void OrderClause() : {} {
+	<ORDER> <BY> ( OrderCondition() )+
+}
+
+/* [17]    OrderCondition    ::=     ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) */
+private void OrderCondition() : {
+	boolean asc = true;
+	Expression e; } {
+
+	(
+		( ( "ASC" | "DESC" { asc = false; } ) e=BrackettedExpression() )
+		|
+		( e=Constraint() | e=Var() )
+	) {
+	((SimpleQueryWithSolutionModifier) query).addOrderCondition(new SimpleOrderCondition(e, asc)); }
+}
+
+/* [18]    LimitClause    ::=    'LIMIT' INTEGER */
+private void LimitClause() : {
+	Token t; } {
+
+	<LIMIT> t=<INTEGER> {
+	((SimpleQueryWithSolutionModifier) query).setLimit(Integer.parseInt(t.image)); }
+}
+
+/* [19]    OffsetClause    ::=    'OFFSET' INTEGER */
+private void OffsetClause() : {
+	Token t; } {
+
+	<OFFSET> t=<INTEGER> {
+	((SimpleQueryWithSolutionModifier) query).setOffset(Integer.parseInt(t.image)); }
+}
+
+/* [20]    GroupGraphPattern    ::=    '{' TriplesBlock? ( ( GraphPatternNotTriples | Filter ) '.'? TriplesBlock? )* '}' */
+private GroupGraphPattern GroupGraphPattern() : {
+	GroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern();
+	Expression constraint; } {
+
+	"{"
+	( TriplesBlock(groupGraphPattern) )?
+	(
+		(
+		GraphPatternNotTriples(groupGraphPattern)
+		|
+		constraint=Filter() {
+		((SimpleGroupGraphPattern) groupGraphPattern).addConstraint(constraint); }
+		)
+
+		(".")?
+
+		(
+		TriplesBlock(groupGraphPattern)
+		)?
+	)*
+	"}" {
+	return groupGraphPattern; }
+}
+
+/* [21]    TriplesBlock    ::=    TriplesSameSubject ( '.' TriplesBlock? )? */
+private void TriplesBlock(GroupGraphPattern groupGraphPattern) : {
+	Set<TriplePattern> triplePatterns; } {
+
+	triplePatterns=TriplesSameSubject() {
+	((SimpleGroupGraphPattern) groupGraphPattern).addTriplePatterns(triplePatterns); }
+
+	( "." (TriplesBlock(groupGraphPattern) )?
+	)?
+}
+
+/* [22]    GraphPatternNotTriples    ::=    OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern */
+private void GraphPatternNotTriples(GroupGraphPattern groupGraphPattern) : {} {
+
+	(
+	OptionalGraphPattern(groupGraphPattern)
+	|
+	GroupOrUnionGraphPattern(groupGraphPattern)
+	|
+	GraphGraphPattern(groupGraphPattern)
+	)
+}
+
+/* [23]    OptionalGraphPattern    ::=    'OPTIONAL' GroupGraphPattern */
+private void OptionalGraphPattern(GroupGraphPattern groupGraphPattern) : {
+	GroupGraphPattern optional; } {
+
+	<OPTIONAL>
+	optional=GroupGraphPattern() {
+	((SimpleGroupGraphPattern) groupGraphPattern).addOptionalGraphPattern(optional); }
+}
+
+/* [24]    GraphGraphPattern    ::=    'GRAPH' VarOrIRIref GroupGraphPattern */
+private void GraphGraphPattern(GroupGraphPattern groupGraphPattern) : {
+	UriRefOrVariable graph;
+	GroupGraphPattern g; } {
+
+	<GRAPH>
+	graph=VarOrIRIref()
+	g=GroupGraphPattern() {
+	((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(
+		new SimpleGraphGraphPattern(graph, g)); }
+}
+
+/* [25]    GroupOrUnionGraphPattern    ::=    GroupGraphPattern ( 'UNION' GroupGraphPattern )* */
+private void GroupOrUnionGraphPattern(GroupGraphPattern groupGraphPattern) : {
+	GroupGraphPattern g;
+	AlternativeGraphPattern unionGraphPattern = null; } {
+
+	g=GroupGraphPattern()
+	(
+		<UNION> {
+		if (unionGraphPattern == null) {
+			unionGraphPattern = new SimpleAlternativeGraphPattern(g);
+		} }
+		g=GroupGraphPattern() {
+		((SimpleAlternativeGraphPattern) unionGraphPattern).addAlternativeGraphPattern(g); }
+	)* {
+	if (unionGraphPattern != null) {
+		((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(unionGraphPattern);
+	} else {
+		((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(g);
+	} }
+}
+
+/* [26]    Filter    ::=    'FILTER' Constraint */
+private Expression Filter() : {
+	Expression c; } {
+
+	<FILTER>
+	c=Constraint() {
+	return c; }
+}
+
+/* [27]    Constraint    ::=    BrackettedExpression | BuiltInCall | FunctionCall */
+private Expression Constraint() : {
+	Expression c; } {
+
+    ( c=BrackettedExpression() | c=BuiltInCall() | c=FunctionCall() ) {
+	return c; }
+}
+
+/* [28]    FunctionCall    ::=    IRIref ArgList */
+private FunctionCall FunctionCall() : {
+	IRI name;
+	List<Expression> arguments;} {
+
+	name=IRIref()
+	arguments=ArgList() {
+	return new FunctionCall(name, arguments); }
+}
+
+/* [29]    ArgList    ::=    ( NIL | '(' Expression ( ',' Expression )* ')' ) */
+private List<Expression> ArgList() : {
+	List<Expression> args = new ArrayList<Expression>();
+	Expression e; } {
+
+	(
+		<NIL>
+		|
+		(
+			"("
+			e=Expression() {
+			args.add(e); }
+				( ","
+				e=Expression() {
+				args.add(e); }
+				)*
+			")"
+		)
+	) {
+	return args; }
+}
+
+/* [30]    ConstructTemplate    ::=    '{' ConstructTriples? '}' */
+private Set<TriplePattern> ConstructTemplate() : {
+	Set<TriplePattern> triplePatterns = null; } {
+
+	"{" (
+	triplePatterns=ConstructTriples()
+	)? "}" {
+	return triplePatterns; }
+}
+
+/* [31]    ConstructTriples    ::=    TriplesSameSubject ( '.' ConstructTriples? )? */
+private Set<TriplePattern> ConstructTriples() : {
+	Set<TriplePattern> triplePatterns, t; } {
+
+	triplePatterns=TriplesSameSubject()
+	( "."
+		(
+		t=ConstructTriples() {
+		triplePatterns.addAll(t); }
+		)?
+	)? {
+	return triplePatterns; }
+}
+
+/* [32]    TriplesSameSubject    ::=    VarOrTerm PropertyListNotEmpty |  TriplesNode PropertyList */
+private Set<TriplePattern> TriplesSameSubject() : {
+	Set<TriplePattern> triplePatterns = new LinkedHashSet<TriplePattern>();
+	ResourceOrVariable subject; } {
+
+	( subject=VarOrTerm() PropertyListNotEmpty(subject, triplePatterns) {
+		return triplePatterns; }
+	)
+	|
+	( subject=TriplesNode(triplePatterns) PropertyList(subject, triplePatterns) {
+		return triplePatterns; }
+	)
+}
+
+/* [33]    PropertyListNotEmpty    ::=    Verb ObjectList ( ';' ( Verb ObjectList )? )* */
+private void PropertyListNotEmpty(ResourceOrVariable subject,
+		Set<TriplePattern> triplePatterns) : {
+	UriRefOrVariable predicate;
+	Set<ResourceOrVariable> objects; } {
+	predicate=Verb()
+	objects=ObjectList(triplePatterns) {
+	addTriplePatterns(triplePatterns, subject, predicate, objects); }
+
+	( ";"
+		( predicate=Verb() objects=ObjectList(triplePatterns) {
+			addTriplePatterns(triplePatterns, subject, predicate, objects); }
+		)?
+	)*
+}
+
+/* [34]    PropertyList    ::=    PropertyListNotEmpty? */
+private void PropertyList(ResourceOrVariable subject,
+		Set<TriplePattern> triplePatterns) : { } {
+	( PropertyListNotEmpty(subject, triplePatterns) )?
+}
+
+/* [35]    ObjectList    ::=    Object ( ',' Object )* */
+private Set<ResourceOrVariable> ObjectList(Set<TriplePattern> triplePatterns) : {
+	ResourceOrVariable object; } {
+
+	{
+	Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
+	}
+	object=Object(triplePatterns) {
+	objects.add(object); }
+
+	( ","
+		object=Object(triplePatterns) {
+			objects.add(object); }
+	)* {
+	return objects; }
+}
+
+/* [36]    Object    ::=    GraphNode */
+private ResourceOrVariable Object(Set<TriplePattern> triplePatterns) : {
+	ResourceOrVariable object; } {
+
+	object=GraphNode(triplePatterns) {
+	return object; }
+}
+
+/* [37]    Verb    ::=    VarOrIRIref | 'a' */
+private UriRefOrVariable Verb() : {
+	UriRefOrVariable predicate; } {
+
+	predicate=VarOrIRIref() {
+	return predicate; }
+	| "a" {
+	return new UriRefOrVariable(RDF_TYPE); }
+}
+
+// Fill in the specified set of TriplePattern and returns the subject node
+/* [38]    TriplesNode    ::=    Collection |  BlankNodePropertyList */
+private ResourceOrVariable TriplesNode(Set<TriplePattern> triplePatterns) : {
+	ResourceOrVariable subject; } {
+	(
+		subject=Collection(triplePatterns)
+	|
+		subject=BlankNodePropertyList(triplePatterns)
+	) {
+	return subject; }
+}
+
+/* [39]    BlankNodePropertyList    ::=    '[' PropertyListNotEmpty ']' */
+private ResourceOrVariable BlankNodePropertyList(Set<TriplePattern> triplePatterns) : { } {
+	{
+	ResourceOrVariable subject = getNewBNode();
+	}
+	"[" PropertyListNotEmpty(subject, triplePatterns) "]" {
+	return subject; }
+}
+
+/* [40]    Collection    ::=    '(' GraphNode+ ')' */
+private ResourceOrVariable Collection(Set<TriplePattern> triplePatterns) : {
+	ResourceOrVariable node;
+	List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
+
+	"("
+		(
+		node=GraphNode(triplePatterns) {
+		nodes.add(node); }
+		)+
+	")" {
+	return addTriplePatterns(triplePatterns, nodes); }
+}
+
+/* [41]    GraphNode    ::=    VarOrTerm |  TriplesNode */
+private ResourceOrVariable GraphNode(Set<TriplePattern> triplePatterns) : {
+	ResourceOrVariable node; } {
+
+	(
+	node=VarOrTerm()
+	|
+	node=TriplesNode(triplePatterns)
+	) {
+	return node; }
+}
+
+/* [42]    VarOrTerm    ::=    Var | GraphTerm */
+private ResourceOrVariable VarOrTerm() : {
+	ResourceOrVariable r;
+	Variable v; } {
+
+    (
+	v=Var() {
+	return new ResourceOrVariable(v); }
+	|
+	r=GraphTerm() {
+	return r; }
+	)
+}
+
+/* [43]    VarOrIRIref    ::=    Var | IRIref */
+private UriRefOrVariable VarOrIRIref() : {
+	Variable var;
+	IRI IRI; } {
+
+	(
+	var=Var() {
+	return new UriRefOrVariable(var); }
+	|
+	IRI=IRIref() {
+	return new UriRefOrVariable(IRI); }
+	)
+}
+
+/* [44]    Var    ::=    VAR1 | VAR2 */
+private Variable Var() : {
+	Token t;} {
+
+	(t=<VAR1> | t=<VAR2>) {
+	return getVariable(t.image); }
+}
+
+/* [45]    GraphTerm    ::=    IRIref |  RDFLiteral |  NumericLiteral |  BooleanLiteral |  BlankNode |  NIL */
+private ResourceOrVariable GraphTerm() : {
+	ResourceOrVariable bNode = null;
+	RDFTerm r = null; } {
+
+	(r=IRIref() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | bNode=BlankNode() | <NIL> {
+		r = RDF_NIL; }) {
+	if (bNode == null) {
+		return new ResourceOrVariable(r);
+	}
+	return bNode; }
+}
+
+/* [46]    Expression    ::=    ConditionalOrExpression */
+private Expression Expression() : {
+	Expression e; } {
+
+	e=ConditionalOrExpression() {
+	return e; }
+}
+
+/* [47]    ConditionalOrExpression    ::=    ConditionalAndExpression ( '||' ConditionalAndExpression )* */
+private Expression ConditionalOrExpression() : {
+	Expression e, ae; } {
+
+	e=ConditionalAndExpression()
+	( "||"
+		ae=ConditionalAndExpression() {
+		e = new BinaryOperation("||", e, ae); }
+	)* {
+	return e; }
+}
+
+/* [48]    ConditionalAndExpression    ::=    ValueLogical ( '&&' ValueLogical )* */
+private Expression ConditionalAndExpression() : {
+	Expression e, e2; } {
+
+	e=ValueLogical()
+	( "&&"
+		e2=ValueLogical() {
+		e = new BinaryOperation("&&", e, e2); }
+	)* {
+	return e; }
+}
+
+/* [49]    ValueLogical    ::=    RelationalExpression */
+private Expression ValueLogical() : {
+	Expression e; } {
+
+	e=RelationalExpression() {
+	return e; }
+}
+
+/* [50]    RelationalExpression    ::=    NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression )? */
+private Expression RelationalExpression() : {
+	Expression e, e2; } {
+
+	e=NumericExpression()
+	(
+		"=" e2=NumericExpression() {
+			e = new BinaryOperation("=", e, e2); }
+		| "!=" e2=NumericExpression() {
+			e = new BinaryOperation("!=", e, e2); }
+		| "<" e2=NumericExpression() {
+			e = new BinaryOperation("<", e, e2); }
+		| ">" e2=NumericExpression() {
+			e = new BinaryOperation(">", e, e2); }
+		| "<=" e2=NumericExpression() {
+			e = new BinaryOperation("<=", e, e2); }
+		| ">=" e2=NumericExpression() {
+			e = new BinaryOperation(">=", e, e2); }
+	)? {
+	return e; }
+}
+
+/* [51]    NumericExpression    ::=    AdditiveExpression */
+private Expression NumericExpression() : {
+	Expression e; } {
+
+	e=AdditiveExpression() {
+	return e; }
+}
+
+/* [52]    AdditiveExpression    ::=    MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | NumericLiteralPositive | NumericLiteralNegative )* */
+private Expression AdditiveExpression() : {
+	Expression e, e2;
+	Literal l; } {
+
+	e=MultiplicativeExpression()
+	(
+		"+" e2=MultiplicativeExpression() {
+			e = new BinaryOperation("+", e, e2); }
+		| "-" e2=MultiplicativeExpression() {
+			e = new BinaryOperation("-", e, e2); }
+		| l=NumericLiteralPositive() {
+			e = new BinaryOperation("+", e, new LiteralExpression(l)); }
+		| l=NumericLiteralNegative() {
+			e = new BinaryOperation("-", e, new LiteralExpression(l)); }
+	)* {
+	return e; }
+}
+
+/* [53]    MultiplicativeExpression    ::=    UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* */
+private Expression MultiplicativeExpression() : {
+	Expression e, e2; } {
+
+	e=UnaryExpression()
+	(
+		"*" e2=UnaryExpression() {
+			e = new BinaryOperation("*", e, e2); }
+		| "/" e2=UnaryExpression() {
+			e = new BinaryOperation("/", e, e2); }
+	)* {
+	return e; }
+}
+
+/* [54]    UnaryExpression    ::=      '!' PrimaryExpression  |  '+' PrimaryExpression  | '-' PrimaryExpression  | PrimaryExpression */
+private Expression UnaryExpression() : {
+	Expression e; } {
+
+	"!" e=PrimaryExpression() {
+		return new UnaryOperation("!", e); }
+    | "+" e=PrimaryExpression() {
+		return new UnaryOperation("+", e); }
+    | "-" e=PrimaryExpression() {
+		return new UnaryOperation("-", e); }
+    | e=PrimaryExpression() {
+		return e; }
+}
+
+/* [55]    PrimaryExpression    ::=    BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var */
+private Expression PrimaryExpression() : {
+	Expression e = null;
+	Literal l = null; } {
+
+	(
+	e=BrackettedExpression() | e=BuiltInCall() | e=IRIrefOrFunction() | l=RDFLiteral() | l=NumericLiteral() | l=BooleanLiteral() | e=Var()
+	) {
+	if (l != null) {
+		return new LiteralExpression(l);
+	}
+	return e; }
+}
+
+/* [56]    BrackettedExpression    ::=    '(' Expression ')' */
+private Expression BrackettedExpression() : {
+	Expression e; } {
+
+	"("
+	e=Expression()
+	")" {
+	return e; }
+}
+
+/* [57]    BuiltInCall    ::=      'STR' '(' Expression ')' */
+/* |  'LANG' '(' Expression ')' */
+/* |  'LANGMATCHES' '(' Expression ',' Expression ')' */
+/* |  'DATATYPE' '(' Expression ')' */
+/* |  'BOUND' '(' Var ')' */
+/* |  'sameTerm' '(' Expression ',' Expression ')' */
+/* |  'isIRI' '(' Expression ')' */
+/* |  'isURI' '(' Expression ')' */
+/* |  'isBLANK' '(' Expression ')' */
+/* |  'isLITERAL' '(' Expression ')' */
+/* |  RegexExpression */
+private BuiltInCall BuiltInCall() : {
+	List<Expression> args = new ArrayList<Expression>();
+	String name;
+	Expression e; } {
+	(
+	<STR> {
+		name = "STR"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <LANG> {
+		name = "LANG"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <LANGMATCHES> {
+		name = "LANGMATCHES"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		","
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <DATATYPE> {
+		name = "DATATYPE"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <BOUND> {
+		name = "BOUND"; }
+		"("
+		e=Var() {
+		args.add(e); }
+		")"
+	| <SAME_TERM> {
+		name = "sameTerm"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		","
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <IS_IRI> {
+		name = "isIRI"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <IS_URI> {
+		name = "isURI"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <IS_BLANK> {
+		name = "isBLANK"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| <IS_LITERAL> {
+		name = "isLITERAL"; }
+		"("
+		e=Expression() {
+		args.add(e); }
+		")"
+	| e=RegexExpression() {
+		return (BuiltInCall) e; }
+	) {
+		return new BuiltInCall(name, args);
+	}
+}
+
+/* [58]    RegexExpression    ::=    'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')' */
+private BuiltInCall RegexExpression() : {
+	List<Expression> args = new ArrayList<Expression>();
+	Expression e = null; } {
+
+	<REGEX>
+	"("
+	e=Expression() {
+	args.add(e); }
+	","
+	e=Expression() {
+	args.add(e); }
+	(
+		","
+		e=Expression() {
+		args.add(e); }
+	)?
+	")" {
+	return new BuiltInCall("REGEX", args); }
+}
+
+/* [59]    IRIrefOrFunction    ::=    IRIref ArgList? */
+private Expression IRIrefOrFunction() : {
+	IRI IRI;
+	List<Expression> args; } {
+
+	IRI=IRIref()
+	(
+		args=ArgList() {
+		return new FunctionCall(IRI, args); }
+	)? {
+	return new UriRefExpression(IRI); }
+}
+
+/* [60]    RDFLiteral    ::=    String ( LANGTAG | ( '^^' IRIref ) )? */
+private Literal RDFLiteral() : {
+	Token t;
+	String s;
+	IRI type; } {
+
+	s = String()
+	(
+		t=<LANGTAG> {
+		return new PlainLiteralImpl(s, new Language(t.image.substring(1))); }
+		|
+		( "^^"
+			type=IRIref() {
+			return new TypedLiteralImpl(s, type); }
+		)
+	)? {
+	return new PlainLiteralImpl(s); }
+}
+
+/* [61]    NumericLiteral    ::=    NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative */
+private Literal NumericLiteral() : {
+	Literal l; } {
+
+	( l=NumericLiteralUnsigned() | l=NumericLiteralPositive() | l=NumericLiteralNegative() ) {
+	return l; }
+}
+
+/* [62]    NumericLiteralUnsigned    ::=    INTEGER |  DECIMAL |  DOUBLE */
+private Literal NumericLiteralUnsigned() : {
+	Token t; } {
+
+	t=<INTEGER> {
+		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+	| t=<DECIMAL> {
+		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+	| t=<DOUBLE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [63]    NumericLiteralPositive    ::=    INTEGER_POSITIVE |  DECIMAL_POSITIVE |  DOUBLE_POSITIVE */
+private Literal NumericLiteralPositive() : {
+	Token t; } {
+
+	t=<INTEGER_POSITIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+	| t=<DECIMAL_POSITIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+	| t=<DOUBLE_POSITIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [64]    NumericLiteralNegative    ::=    INTEGER_NEGATIVE |  DECIMAL_NEGATIVE |  DOUBLE_NEGATIVE */
+private Literal NumericLiteralNegative() : {
+	Token t; } {
+
+	t=<INTEGER_NEGATIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+	| t=<DECIMAL_NEGATIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+	| t=<DOUBLE_NEGATIVE> {
+		return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [65]    BooleanLiteral    ::=    'true' |  'false' */
+private Literal BooleanLiteral() : {} {
+
+	<TRUE> {
+		return LiteralFactory.getInstance().createTypedLiteral(true); }
+	| <FALSE> {
+		return LiteralFactory.getInstance().createTypedLiteral(false); }
+}
+
+/* [66]    String    ::=    STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 */
+private String String() : {
+	Token t; } {
+	t=<STRING_LITERAL1> {
+		return unquote(t.image) ; }
+	| t=<STRING_LITERAL2> {
+		return unquote(t.image) ; }
+	| t=<STRING_LITERAL_LONG1> {
+		return unTripleQuote(t.image) ; }
+	| t=<STRING_LITERAL_LONG2> {
+		return unTripleQuote(t.image) ; }
+}
+
+/* [67]    IRIref    ::=    IRI_REF |  PrefixedName */
+private IRI IRIref() : {
+	IRI IRI;
+	Token t; } {
+
+	t=<IRI_REF> {
+	return createUriRef(unquote(t.image)); }
+	|
+	IRI=PrefixedName() {
+	return IRI; }
+}
+
+/* [68]    PrefixedName    ::=    PNAME_LN | PNAME_NS */
+private IRI PrefixedName() : {
+	Token t; } {
+
+	( t=<PNAME_LN> | t=<PNAME_NS> ) {
+	return createUriRef(t.image); }
+}
+
+/* [69]    BlankNode    ::=    BLANK_NODE_LABEL |  ANON */
+private ResourceOrVariable BlankNode() : {
+	Token t; } {
+
+	t=<BLANK_NODE_LABEL> {
+	return getBNode(t.image); }
+	| <ANON> {
+	return getNewBNode(); }
+}
+
+
+TOKEN : {
+  /* [70]    IRI_REF    ::=    '<' ([^<>"{}|^`\]-[#x00-#x20])* '>' */
+  < IRI_REF : "<" ( ~["<", ">", "\"", "{", "}", "|", "^", "`", "\\", "\u0000"-"\u0020"] )* ">" >
+  |
+  /* [71]    PNAME_NS    ::=    PN_PREFIX? ':' */
+  < PNAME_NS : (<PN_PREFIX>)? ":" >
+  |
+  /* [72]    PNAME_LN    ::=    PNAME_NS PN_LOCAL */
+  < PNAME_LN : <PNAME_NS> <PN_LOCAL> >
+  |
+  /* [73]    BLANK_NODE_LABEL    ::=    '_:' PN_LOCAL */
+  < BLANK_NODE_LABEL : "_:" <PN_LOCAL> >
+  |
+  /* [74]    VAR1    ::=    '?' VARNAME */
+  < VAR1 : "?" <VARNAME> >
+  |
+  /* [75]    VAR2    ::=    '$' VARNAME */
+  < VAR2 : "$" <VARNAME> >
+  |
+  /* [76]    LANGTAG    ::=    '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* */
+  < LANGTAG : "@" (["a"-"z", "A"-"Z"])+ ( "-" (["a"-"z", "A"-"Z", "0"-"9"])+ )* >
+}
+
+TOKEN : {
+  < #Z_9 : ["0"-"9"] >
+  |
+  < #Z_9r : (<Z_9>)+ >
+  |
+   < #Z_9o : (<Z_9>)* >
+  |
+  /* [77]    INTEGER    ::=    [0-9]+ */
+  < INTEGER : <Z_9r> >
+  |
+  /* [78]    DECIMAL    ::=    [0-9]+ '.' [0-9]* | '.' [0-9]+ */
+  < DECIMAL : ( <Z_9r> "." <Z_9o> ) | ( "." <Z_9r> ) >
+  |
+  /* [79]    DOUBLE    ::=    [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT */
+  < DOUBLE : ( <Z_9r> "." <Z_9o>  <EXPONENT> ) | ( "." <Z_9r> <EXPONENT> ) | ( <Z_9r> <EXPONENT> ) >
+  |
+  /* [80]    INTEGER_POSITIVE    ::=    '+' INTEGER */
+  < INTEGER_POSITIVE : "+" <INTEGER> >
+  |
+  /* [81]    DECIMAL_POSITIVE    ::=    '+' DECIMAL */
+  < DECIMAL_POSITIVE : "+" <DECIMAL> >
+  |
+  /* [82]    DOUBLE_POSITIVE    ::=    '+' DOUBLE */
+  < DOUBLE_POSITIVE : "+" <DOUBLE> >
+  |
+  /* [83]    INTEGER_NEGATIVE    ::=    '-' INTEGER */
+  < INTEGER_NEGATIVE : "-" <INTEGER> >
+  |
+  /* [84]    DECIMAL_NEGATIVE    ::=    '-' DECIMAL */
+  < DECIMAL_NEGATIVE : "-" <DECIMAL> >
+  |
+  /* [85]    DOUBLE_NEGATIVE    ::=    '-' DOUBLE */
+  < DOUBLE_NEGATIVE : "-" <DOUBLE> >
+  |
+  /* [86]    EXPONENT    ::=    [eE] [+-]? [0-9]+ */
+  < #EXPONENT : ["e","E"] (["+","-"])? <Z_9r> >
+}
+
+TOKEN : {
+  /* [87]    STRING_LITERAL1    ::=    "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'" */
+  < STRING_LITERAL1 : "'" ( ~["'", "\\", "\r", "\n"] | <ECHAR> )* "'" >
+  |
+  /* [88]    STRING_LITERAL2    ::=    '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"' */
+  < STRING_LITERAL2 : "\"" ( ~["\"", "\\", "\r", "\n"] | <ECHAR> )* "\"" >
+  |
+  /* [89]    STRING_LITERAL_LONG1    ::=    "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''" */
+  < STRING_LITERAL_LONG1 : "'''" ( ( "'" | "''" )? ( ~["'","\\"] | <ECHAR> ) )* "'''" >
+  |
+  /* [90]    STRING_LITERAL_LONG2    ::=    '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""' */
+  < STRING_LITERAL_LONG2 : "\"\"\"" ( ( "\"" | "\"\"" )? ( ~["\"","\\"] | <ECHAR> ) )* "\"\"\"" >
+  |
+  /* [91]    #ECHAR    ::=    '\' [tbnrf\"'] */
+  < #ECHAR : "\\" ["t","b","n","r","f","\\","\"","'"] >
+}
+
+TOKEN : {
+  /* [92]    NIL    ::=    '(' WS* ')' */
+  < NIL : "(" (<WS>)* ")" >
+  |
+  /* [93]    WS    ::=    #x20 | #x9 | #xD | #xA */
+  < #WS : " " | "\t" | "\n" | "\r" >
+  |
+  /* [94]   ANON    ::=    '[' WS* ']' */
+  < ANON : "[" (<WS>)* "]" >
+}
+
+TOKEN : {
+  /* [95]   #PN_CHARS_BASE ::=  [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] */
+  < #PN_CHARS_BASE : ["A"-"Z", "a"-"z", "\u00C0"-"\u00D6", "\u00D8"-"\u00F6", "\u00F8"-"\u02FF", "\u0370"-"\u037D", "\u037F"-"\u1FFF", "\u200C"-"\u200D", "\u2070"-"\u218F", "\u2C00"-"\u2FEF", "\u3001"-"\uD7FF", "\uF900"-"\uFDCF", "\uFDF0"-"\uFFFD"] >
+  |
+  /* [96]   #PN_CHARS_U    ::=  PN_CHARS_BASE | '_' */
+  < #PN_CHARS_U : <PN_CHARS_BASE> | "_" >
+  |
+  /* [97]   #VARNAME  ::=   ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* */
+  < #VARNAME : (<PN_CHARS_U> | <Z_9>) ( <PN_CHARS_U> | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] )* >
+  |
+  /* [98]   #PN_CHARS  ::=  PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] */
+  < #PN_CHARS : <PN_CHARS_U> | "-" | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] >
+  |
+  /* [99]   PN_PREFIX  ::=  PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? */
+  < PN_PREFIX : <PN_CHARS_BASE> (( <PN_CHARS> | "." )* <PN_CHARS>)? >
+  |
+  /* [100]  PN_LOCAL  ::=   ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?  */
+  /* Note that SPARQL local names allow leading digits while XML local names do not. */
+  < PN_LOCAL : ( <PN_CHARS_U> | <Z_9> ) (( <PN_CHARS> | "." )* <PN_CHARS>)? >
+}
diff --git a/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedSparqlPreParser.jj b/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedSparqlPreParser.jj
new file mode 100644
index 0000000..8c145ed
--- /dev/null
+++ b/sparql/src/main/javacc/org/apache/clerezza/sparql/JavaCCGeneratedSparqlPreParser.jj
@@ -0,0 +1,2557 @@
+/*
+ * 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.
+ */
+options
+{
+   STATIC=false;
+   UNICODE_INPUT=true;
+   IGNORE_CASE=false;
+   JAVA_UNICODE_ESCAPE=false;
+   DEBUG_PARSER=false;
+   JDK_VERSION="1.6";
+}
+
+PARSER_BEGIN(JavaCCGeneratedSparqlPreParser)
+
+package org.apache.clerezza.sparql;
+
+import org.apache.clerezza.api.BlankNode;
+import org.apache.clerezza.api.impl.literal.LiteralFactory;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.api.impl.literal.TypedLiteralImpl;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.Literal;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.sparql.query.AlternativeGraphPattern;
+import org.apache.clerezza.sparql.query.BinaryOperation;
+import org.apache.clerezza.sparql.query.BinaryPropertyPathOperation;
+import org.apache.clerezza.sparql.query.BuiltInCall;
+import org.apache.clerezza.sparql.query.Expression;
+import org.apache.clerezza.sparql.query.FunctionCall;
+import org.apache.clerezza.sparql.query.GroupGraphPattern;
+import org.apache.clerezza.sparql.query.InlineData;
+import org.apache.clerezza.sparql.query.LiteralExpression;
+import org.apache.clerezza.sparql.query.PatternExistenceCondition;
+import org.apache.clerezza.sparql.query.PredicatePath;
+import org.apache.clerezza.sparql.query.PropertyPathExpressionOrVariable;
+import org.apache.clerezza.sparql.query.PropertyPathExpression;
+import org.apache.clerezza.sparql.query.PropertyPathPattern;
+import org.apache.clerezza.sparql.query.PropertySet;
+import org.apache.clerezza.sparql.query.Query;
+import org.apache.clerezza.sparql.query.ResourceOrVariable;
+import org.apache.clerezza.sparql.query.RhsListBinaryOperation;
+import org.apache.clerezza.sparql.query.SelectQuery;
+import org.apache.clerezza.sparql.query.SparqlUnit;
+import org.apache.clerezza.sparql.query.TriplePattern;
+import org.apache.clerezza.sparql.query.UnaryOperation;
+import org.apache.clerezza.sparql.query.UnaryPropertyPathOperation;
+import org.apache.clerezza.sparql.query.UriRefExpression;
+import org.apache.clerezza.sparql.query.UriRefOrVariable;
+import org.apache.clerezza.sparql.query.Variable;
+import org.apache.clerezza.sparql.query.impl.SimpleAlternativeGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleAskQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleConstructQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleDataSet;
+import org.apache.clerezza.sparql.query.impl.SimpleDescribeQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleGraphGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleGroupGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleInlineData;
+import org.apache.clerezza.sparql.query.impl.SimpleOrderCondition;
+import org.apache.clerezza.sparql.query.impl.SimplePropertyPathPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleQueryWithSolutionModifier;
+import org.apache.clerezza.sparql.query.impl.SimpleSelectQuery;
+import org.apache.clerezza.sparql.query.impl.SimpleServiceGraphPattern;
+import org.apache.clerezza.sparql.query.impl.SimpleSparqlUnit;
+import org.apache.clerezza.sparql.query.impl.SimpleTriplePattern;
+import org.apache.clerezza.sparql.update.Update;
+import org.apache.clerezza.sparql.update.UpdateOperation;
+import org.apache.clerezza.sparql.update.UpdateOperation.GraphSpec;
+import org.apache.clerezza.sparql.update.impl.AddOperation;
+import org.apache.clerezza.sparql.update.impl.ClearOperation;
+import org.apache.clerezza.sparql.update.impl.ClearOrDropOperation;
+import org.apache.clerezza.sparql.update.impl.CopyOperation;
+import org.apache.clerezza.sparql.update.impl.CreateOperation;
+import org.apache.clerezza.sparql.update.impl.DeleteDataOperation;
+import org.apache.clerezza.sparql.update.impl.DeleteWhereOperation;
+import org.apache.clerezza.sparql.update.impl.DropOperation;
+import org.apache.clerezza.sparql.update.impl.InsertDataOperation;
+import org.apache.clerezza.sparql.update.impl.LoadOperation;
+import org.apache.clerezza.sparql.update.impl.ModifyOperation;
+import org.apache.clerezza.sparql.update.impl.MoveOperation;
+import org.apache.clerezza.sparql.update.impl.SimpleUpdate;
+import org.apache.clerezza.sparql.update.impl.SimpleUpdateOperation;
+import org.apache.clerezza.sparql.update.impl.UpdateOperationWithQuads;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.Set;
+
+/**
+ *
+ * Credits: Fedora Commons, Inc.
+ *            - for initial grammar of this file (available in mulgara project).
+ * Modified by: Hasan <ha...@trialox.org>
+ */
+class JavaCCGeneratedSparqlPreParser {
+
+    private static final IRI RDF_TYPE =
+        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+    private static final IRI RDF_FIRST =
+        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+    private static final IRI RDF_REST =
+        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+    private static final IRI RDF_NIL =
+        new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+
+    /** A RegEx pattern for separating out a namespace from a prefixed name. */
+    private static final Pattern pfxNamePattern = Pattern.compile("([^:]*):(.*)");
+
+    private String base;
+    private Map<String, String> prefixes;
+    private Map<String, ResourceOrVariable> bNodes;
+    private int count;
+
+    private class GraphRefAllSpec {
+        GraphSpec graphSpec;
+        IRI graph;
+        public void setGraphSpec(GraphSpec graphSpec) {
+            this.graphSpec = graphSpec;
+        }
+        public GraphSpec getGraphSpec() {
+            return this.graphSpec;
+        }
+        public void setGraph(IRI graph){
+            this.graph = graph;
+        }
+        public IRI getGraph() {
+            return this.graph;
+        }
+    }
+
+    void initialize() {
+        base = null;
+        prefixes = new HashMap<String, String>();
+        bNodes = new HashMap<String, ResourceOrVariable>();
+        count = 0;
+    }
+
+    SparqlUnit parse() throws ParseException {
+        SparqlUnit sparqlUnit;
+        initialize();
+        sparqlUnit = this.SparqlUnit();
+        return sparqlUnit;
+    }
+
+    Query parseQuery() throws ParseException {
+        Query query;
+        initialize();
+        query = this.QueryUnit();
+        return query;
+    }
+
+    Update parseUpdate() throws ParseException {
+        Update update;
+        initialize();
+        update = this.UpdateUnit();
+        return update;
+    }
+
+    private static String unquote(String s) {
+        return s.substring(1, s.length() - 1);
+    }
+
+    private static String unTripleQuote(String s) {
+        return s.substring(3, s.length() - 3);
+    }
+
+    private Variable createVariable(String name) {
+        name = name.substring(1);
+        Variable v = new Variable(name);
+        return v;
+    }
+
+    private void addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns,
+            ResourceOrVariable subject,
+            PropertyPathExpressionOrVariable propertyPathExpression,
+            Set<ResourceOrVariable> objects) {
+
+        for (ResourceOrVariable object : objects) {
+            propertyPathPatterns.add(
+                new SimplePropertyPathPattern(subject, propertyPathExpression, object));
+        }
+    }
+
+    // nodes contain at least one element
+    private ResourceOrVariable addPropertyPathPatterns(Set<PropertyPathPattern> propertyPathPatterns,
+            List<ResourceOrVariable> nodes) {
+
+        ResourceOrVariable head = null;
+        PropertyPathExpressionOrVariable rdfFirst = new PropertyPathExpressionOrVariable(new PredicatePath(RDF_FIRST));
+        PropertyPathExpressionOrVariable rdfRest = new PropertyPathExpressionOrVariable(new PredicatePath(RDF_REST));
+        UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
+
+        ResourceOrVariable prevSubject = null;
+        for (ResourceOrVariable node : nodes) {
+            ResourceOrVariable currentSubject = getNewBNode();
+            if (prevSubject != null) {
+                propertyPathPatterns.add(
+                    new SimplePropertyPathPattern(prevSubject, rdfRest, currentSubject));
+            } else {
+                head = currentSubject;
+            }
+            propertyPathPatterns.add(
+                new SimplePropertyPathPattern(currentSubject, rdfFirst, node));
+            prevSubject = currentSubject;
+        }
+        if (prevSubject != null) {
+            propertyPathPatterns.add(
+                new SimplePropertyPathPattern(prevSubject, rdfRest, rdfNil));
+        }
+        return head;
+    }
+
+    private void addTriplePatterns(Set<TriplePattern> triplePatterns,
+            ResourceOrVariable subject,
+            UriRefOrVariable predicate,
+            Set<ResourceOrVariable> objects) {
+
+        for (ResourceOrVariable object : objects) {
+            triplePatterns.add(
+                new SimpleTriplePattern(subject, predicate, object));
+        }
+    }
+
+    // nodes contain at least one element
+    private ResourceOrVariable addTriplePatterns(
+            Set<TriplePattern> triplePatterns,
+            List<ResourceOrVariable> nodes) {
+
+        ResourceOrVariable head = null;
+        UriRefOrVariable rdfFirst = new UriRefOrVariable(RDF_FIRST);
+        UriRefOrVariable rdfRest = new UriRefOrVariable(RDF_REST);
+        UriRefOrVariable rdfNil = new UriRefOrVariable(RDF_NIL);
+
+        ResourceOrVariable prevSubject = null;
+        for (ResourceOrVariable node : nodes) {
+            ResourceOrVariable currentSubject = getNewBNode();
+            if (prevSubject != null) {
+                triplePatterns.add(
+                    new SimpleTriplePattern(prevSubject, rdfRest, currentSubject));
+            } else {
+                head = currentSubject;
+            }
+            triplePatterns.add(
+                new SimpleTriplePattern(currentSubject, rdfFirst, node));
+            prevSubject = currentSubject;
+        }
+        if (prevSubject != null) {
+            triplePatterns.add(
+                new SimpleTriplePattern(prevSubject, rdfRest, rdfNil));
+        }
+        return head;
+    }
+
+    private ResourceOrVariable getNewBNode() {
+        ResourceOrVariable bNode = new ResourceOrVariable(new BlankNode());
+        bNodes.put("*" + count++, bNode);
+        return bNode;
+    }
+
+    private ResourceOrVariable getBNode(String label) {
+        ResourceOrVariable bNode = bNodes.get(label);
+        if (bNode == null) {
+            bNode = new ResourceOrVariable(new BlankNode());
+            bNodes.put(label, bNode);
+        }
+        return bNode;
+    }
+
+    private IRI createUriRef(String r) throws ParseException {
+        // Create an IRI directly if the string does not start with a prefix
+        Matcher m = pfxNamePattern.matcher(r);
+        if (!m.matches()) {
+            // either a normal IRI, or one with a BASE
+            return isRelative(r) ? new IRI(base + r) : new IRI(r);
+        }
+        // extract the prefix, and attempt to convert to a URI before creating the reference
+        String ns = prefixes.get(m.group(1));
+        return ns == null ? new IRI(r) : new IRI(ns + m.group(2));
+    }
+
+    /**
+     * Tests if the string for a URI is relative or absolute. The test is based on a scheme existing
+     * in the string, which in turn expects a : character to follow it. If there is no colon, then
+     * it is presumed to be relative. Otherwise, if there are special characters preceding the first
+     * colon these are presumed to not be in a scheme.
+     * @param u A string for a URI.
+     * @return <code>true</code> if the URI appears to be relative, <code>false</code> otherwise.
+     */
+    private static boolean isRelative(String u) {
+        int colon = u.indexOf(':');
+        if (colon < 0) {
+            return true;
+        }
+        for (int c = 0; c < colon; c++) {
+            // if there a non-alphanum characters then this is not a scheme, so the URI is relative
+            if (!Character.isLetterOrDigit(u.charAt(c))) {
+                return true;
+            }
+        }
+        // found a (probably) valid scheme, so the URI is absolute
+        return false;
+    }
+}
+PARSER_END(JavaCCGeneratedSparqlPreParser)
+
+SKIP :
+{
+    "\t" | "\n" | "\r" | "\f" | " "
+}
+
+MORE :
+{
+    "#" : IN_COMMENT
+}
+
+<IN_COMMENT>
+SPECIAL_TOKEN :
+{
+  <COMMENT: ( ~[ "\r","\n" ] )* > : DEFAULT
+}
+
+TOKEN [IGNORE_CASE] :
+{
+    < SELECT : "SELECT" >
+|   < BASE : "BASE" >
+|   < ORDER : "ORDER" >
+|   < BY : "BY" >
+|   < FROM : "FROM" >
+|   < GRAPH : "GRAPH" >
+|   < PREFIX : "PREFIX" >
+|   < CONSTRUCT : "CONSTRUCT" >
+|   < LIMIT : "LIMIT" >
+|   < NAMED : "NAMED" >
+|   < OPTIONAL : "OPTIONAL" >
+|   < DESCRIBE : "DESCRIBE" >
+|   < OFFSET : "OFFSET" >
+|   < WHERE : "WHERE" >
+|   < UNION : "UNION" >
+|   < ASK : "ASK" >
+|   < DISTINCT : "DISTINCT" >
+|   < FILTER : "FILTER" >
+|   < REDUCED : "REDUCED" >
+|   < GROUP_CONCAT : "GROUP_CONCAT" >
+|   < BOUND : "bound" >
+|   < TRUE : "TRUE" >
+|   < FALSE : "FALSE" >
+|   < VALUES : "VALUES" >
+|   < UNDEF : "UNDEF" >
+|   < AS : "AS" >
+|   < BIND : "BIND" >
+|   < MINUS : "MINUS" >
+|   < SERVICE : "SERVICE" >
+|   < GROUP : "GROUP" >
+|   < HAVING : "HAVING" >
+|   < LOAD : "LOAD" >
+|   < SILENT : "SILENT" >
+|   < INTO : "INTO" >
+|   < CLEAR : "CLEAR" >
+|   < DROP : "DROP" >
+|   < CREATE : "CREATE" >
+|   < ADD : "ADD" >
+|   < TO : "TO" >
+|   < MOVE : "MOVE" >
+|   < COPY : "COPY" >
+|   < INSERT : "INSERT" >
+|   < DELETE : "DELETE" >
+|   < DATA : "DATA" >
+|   < WITH : "WITH" >
+|   < USING : "USING" >
+|   < DEFAULT_T : "DEFAULT" >
+|   < ALL : "ALL" >
+|   < IN : "IN" >
+|   < NOT : "NOT" >
+|   < EXISTS : "EXISTS" >
+|   < BNODE : "BNODE" >
+|   < RAND : "RAND" >
+|   < CONCAT : "CONCAT" >
+|   < NOW : "NOW" >
+|   < UUID : "UUID" >
+|   < STRUUID : "STRUUID" >
+|   < COALESCE : "COALESCE" >
+|   < SEPARATOR : "SEPARATOR" >
+}
+
+/* SparqlUnit ::= Prologue ( Query | Update ) */
+private SparqlUnit SparqlUnit() : {
+    Query query;
+    Update update; } {
+
+    Prologue()
+    (
+        query=QueryUnit() {
+        return new SimpleSparqlUnit(query); }
+    |
+        update=UpdateUnit() {
+        return new SimpleSparqlUnit(update); }
+    )
+}
+
+/* [1]    QueryUnit ::= Query */
+private Query QueryUnit() : {
+    Query query; } {
+
+    query=Query() {
+    return query; }
+}
+
+/* [2]    Query ::= Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause */
+/* [2]    Query ::= ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause */
+private Query Query() : {
+    Query query; } {
+    (
+        query = SelectQuery()
+    |
+        query = ConstructQuery()
+    |
+        query = DescribeQuery()
+    |
+        query = AskQuery()
+    ) {
+    return query;
+    }
+}
+
+/* [3]    UpdateUnit ::= Update */
+private Update UpdateUnit() : {
+    Update update = new SimpleUpdate(); } {
+    Update(update) {
+    return update; }
+}
+
+/* [4]    Prologue ::= ( BaseDecl | PrefixDecl )* */
+private void Prologue() : {} {
+    ( BaseDecl() | PrefixDecl() )*
+}
+
+/* [5]    BaseDecl ::= 'BASE' IRIREF */
+private void BaseDecl() : {
+    Token iriRef; } {
+
+    <BASE> iriRef=<IRIREF> { base = unquote(iriRef.image); }
+}
+
+/* [6]    PrefixDecl ::= 'PREFIX' PNAME_NS IRIREF */
+private void PrefixDecl() : {
+    Token ns, iriRef; } {
+
+    <PREFIX> ns=<PNAME_NS> iriRef=<IRIREF> {
+    String pfx = ns.image;
+    prefixes.put(pfx.substring(0, pfx.length() - 1), unquote(iriRef.image)); }
+}
+
+/* [7]    SelectQuery ::= SelectClause DatasetClause* WhereClause SolutionModifier */
+private Query SelectQuery() : {
+    Query query; } {
+    query = SelectClause()
+    ( DatasetClause(query) )*
+    WhereClause(query)
+    SolutionModifier(query) {
+    return query; }
+}
+
+/* [8]    SubSelect ::= SelectClause WhereClause SolutionModifier ValuesClause */
+private Query SubSelect() : {
+    Query query; } {
+    query = SelectClause()
+    WhereClause(query)
+    SolutionModifier(query)
+    ValuesClause(query) {
+    return query; }
+}
+
+/* [9]    SelectClause ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' Expression 'AS' Var ')' ) )+ | '*' ) */
+private Query SelectClause() : {
+    Query query;
+    Variable v; 
+    Expression e; } {
+
+    <SELECT> {
+    query = new SimpleSelectQuery(); }
+    (
+        <DISTINCT> {
+        ((SimpleSelectQuery) query).setDistinct(); }
+    |
+        <REDUCED> {
+        ((SimpleSelectQuery) query).setReduced(); }
+    )?
+    (
+        (
+            v=Var() {
+            ((SimpleSelectQuery) query).addSelection(v); }
+        |
+            (
+                "("
+                e=Expression()
+                <AS>
+                v=Var() {
+                v.setBoundExpression(e); 
+                ((SimpleSelectQuery) query).addSelection(v); }
+                ")"
+            )
+        )+
+    |
+        "*" {
+        ((SimpleSelectQuery) query).setSelectAll(); }
+    ) {
+    return query; }
+}
+
+/* [10]    ConstructQuery ::= 'CONSTRUCT' ( ConstructTemplate DatasetClause* WhereClause SolutionModifier | DatasetClause* 'WHERE' '{' TriplesTemplate? '}' SolutionModifier ) */
+private Query ConstructQuery() : {
+    Query query;
+    Set<TriplePattern> triplePatterns = null;
+    GroupGraphPattern queryPattern; } {
+
+    <CONSTRUCT>
+    (
+        triplePatterns=ConstructTemplate() {
+        query = new SimpleConstructQuery(triplePatterns); }
+        ( DatasetClause(query) )*
+        WhereClause(query)
+    |
+        {
+        query = new SimpleConstructQuery(triplePatterns); }
+        ( DatasetClause(query) )*
+        <WHERE>
+        "{" {
+        queryPattern = new SimpleGroupGraphPattern(); }
+        (
+            triplePatterns=TriplesTemplate()
+        )? {
+        ((SimpleGroupGraphPattern) queryPattern).addTriplePatterns(triplePatterns); }
+        "}" {
+        ((SimpleQuery) query).setQueryPattern(queryPattern); }
+    )
+    SolutionModifier(query) {
+    return query; }
+}
+
+/* [11]    DescribeQuery ::= 'DESCRIBE' ( VarOrIRI+ | '*' ) DatasetClause* WhereClause? SolutionModifier */
+private Query DescribeQuery() : {
+    Query query;
+    UriRefOrVariable node; } {
+
+    <DESCRIBE> {
+    query = new SimpleDescribeQuery(); }
+    (
+        ( node=VarOrIRI() {
+            ((SimpleDescribeQuery) query).addResourceToDescribe(node); } )+
+        |
+        "*" {
+            ((SimpleDescribeQuery) query).setDescribeAll(); }
+    )
+    ( DatasetClause(query) )*
+    ( WhereClause(query) )?
+    SolutionModifier(query) {
+    return query; }
+}
+
+/* [12]    AskQuery ::= 'ASK' DatasetClause* WhereClause SolutionModifier */
+private Query AskQuery() : {
+    Query query; } {
+
+    <ASK> {
+    query = new SimpleAskQuery(); }
+    ( DatasetClause(query) )*
+    WhereClause(query)
+    SolutionModifier(query) {
+    return query; }
+}
+
+/* [13]    DatasetClause ::= 'FROM' ( DefaultGraphClause | NamedGraphClause ) */
+private void DatasetClause(Query query) : {} {
+    <FROM> (DefaultGraphClause(query) | NamedGraphClause(query))
+}
+
+/* [14]    DefaultGraphClause ::= SourceSelector */
+private void DefaultGraphClause(Query query) : {
+    IRI defaultGraph; } {
+
+    defaultGraph=SourceSelector() {
+    ((SimpleQuery) query).addDefaultGraph(defaultGraph); }
+}
+
+/* [15]    NamedGraphClause ::= 'NAMED' SourceSelector */
+private void NamedGraphClause(Query query) : {
+    IRI namedGraph; } {
+
+    <NAMED> namedGraph=SourceSelector() {
+    ((SimpleQuery) query).addNamedGraph(namedGraph); }
+}
+
+/* [16]    SourceSelector ::= iri */
+private IRI SourceSelector() : {
+    IRI graph; } {
+
+    graph=IRI() {
+    return graph; }
+}
+
+/* [17]    WhereClause ::= 'WHERE'? GroupGraphPattern */
+private void WhereClause(Query query) : {
+    GroupGraphPattern queryPattern; } {
+
+    (<WHERE>)?
+    queryPattern=GroupGraphPattern() {
+    ((SimpleQuery) query).setQueryPattern(queryPattern); }
+}
+
+/* [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses? */
+private void SolutionModifier(Query query) : {} {
+    ( GroupClause(query) )?
+    ( HavingClause(query) )?
+    ( OrderClause(query) )?
+    ( LimitOffsetClauses(query) )?
+}
+
+/* [19] GroupClause ::= 'GROUP' 'BY' GroupCondition+ */
+private void GroupClause(Query query) : {} {
+    <GROUP> <BY> ( GroupCondition(query) )+
+}
+
+/* [20] GroupCondition ::= BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var */
+private void GroupCondition(Query query) : {
+    Expression e;
+    Variable v; } {
+    (
+        e=BuiltInCall()
+    |
+        e=FunctionCall()
+    |
+        (
+            "("
+            e=Expression()
+            (
+                <AS>
+                v=Var() {
+                v.setBoundExpression(e);
+                e = v; }
+            )?
+            ")"
+        )
+    |
+        e=Var()
+    ) {
+    ((SimpleQueryWithSolutionModifier) query).addGroupCondition(e); }
+}
+
+/* [21] HavingClause ::= 'HAVING' HavingCondition+ */
+private void HavingClause(Query query) : {} {
+    <HAVING> ( HavingCondition(query) )+
+}
+
+/* [22] HavingCondition ::= Constraint */
+private void HavingCondition(Query query) : {
+    Expression c; } {
+
+    c=Constraint() {
+    ((SimpleQueryWithSolutionModifier) query).addHavingCondition(c); }
+}
+
+/* [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+ */
+private void OrderClause(Query query) : {} {
+    <ORDER> <BY> ( OrderCondition(query) )+
+}
+
+/* [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) */
+private void OrderCondition(Query query) : {
+    boolean asc = true;
+    Expression e; } {
+
+    (
+        ( ( "ASC" | "DESC" { asc = false; } ) e=BrackettedExpression() )
+    |
+        ( e=Constraint() | e=Var() )
+    ) {
+    ((SimpleQueryWithSolutionModifier) query).addOrderCondition(new SimpleOrderCondition(e, asc)); }
+}
+
+/* [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause? */
+private void LimitOffsetClauses(Query query) : {} {
+    ( LimitClause(query) (OffsetClause(query))? )
+    |
+    ( OffsetClause(query) (LimitClause(query))? )
+}
+
+/* [26] LimitClause ::= 'LIMIT' INTEGER */
+private void LimitClause(Query query) : {
+    Token t; } {
+
+    <LIMIT> t=<INTEGER> {
+    ((SimpleQueryWithSolutionModifier) query).setLimit(Integer.parseInt(t.image)); }
+}
+
+/* [27] OffsetClause ::= 'OFFSET' INTEGER */
+private void OffsetClause(Query query) : {
+    Token t; } {
+
+    <OFFSET> t=<INTEGER> {
+    ((SimpleQueryWithSolutionModifier) query).setOffset(Integer.parseInt(t.image)); }
+}
+
+/* [28] ValuesClause ::= ( 'VALUES' DataBlock )? */
+private void ValuesClause(Query query) : {
+    InlineData data; } {
+    (
+        <VALUES>
+        data=DataBlock() {
+        ((SimpleQuery) query).setInlineData(data); }
+    )?
+}
+
+/* [29]    Update ::= Prologue ( Update1 ( ';' Update )? )? */
+/* [29]    Update ::= ( Update1 ( ';' Prologue Update )? )? */
+private void Update(Update update) : {} {
+    (
+        Update1(update)
+        (
+            ";"
+            Prologue()
+            Update(update)
+        )?
+    )?
+}
+
+/* [30]    Update1 ::= Load | Clear | Drop | Add | Move | Copy | Create | InsertData | DeleteData | DeleteWhere | Modify */
+private void Update1(Update update) : {
+    UpdateOperation updateOperation = null; } {
+
+    (
+        updateOperation = Load()
+    |
+        updateOperation = Clear()
+    |
+        updateOperation = Drop()
+    |
+        updateOperation = Add()
+    |
+        updateOperation = Move()
+    |
+        updateOperation = Copy()
+    |
+        updateOperation = Create()
+    |
+        LOOKAHEAD(2)
+        updateOperation = InsertData()
+    |
+        LOOKAHEAD(2)
+        updateOperation = DeleteData()
+    |
+        LOOKAHEAD(2)
+        updateOperation = DeleteWhere()
+    |
+        updateOperation = Modify()
+    ) {
+    if (updateOperation != null) {
+        update.addOperation(updateOperation);
+    } }
+}
+
+/* [31]    Load ::= 'LOAD' 'SILENT'? iri ( 'INTO' GraphRef )? */
+private UpdateOperation Load() : {
+    IRI uriRef;
+    LoadOperation operation; } {
+    <LOAD> {
+    operation = new LoadOperation(); }
+    (
+        <SILENT> {
+        operation.setSilent(true); }
+    )?
+    uriRef = IRI() {
+    operation.setSource(uriRef); }
+    (
+        <INTO>
+        uriRef = GraphRef() {
+        operation.setDestinationGraph(uriRef); }
+    )? {
+    return operation; }
+}
+
+/* [32]    Clear ::= 'CLEAR' 'SILENT'? GraphRefAll */
+private UpdateOperation Clear() : {
+    ClearOperation operation; } {
+    <CLEAR> {
+    operation = new ClearOperation(); }
+    ProcessParametersOfClearOrDropOperation(operation) {
+    return operation; }
+}
+
+private void ProcessParametersOfClearOrDropOperation(ClearOrDropOperation operation) : {
+    GraphRefAllSpec graphRefAllSpec;
+    GraphSpec graphSpec; } {
+    (
+        <SILENT> {
+        operation.setSilent(true); }
+    )?
+    graphRefAllSpec = GraphRefAll() {
+    graphSpec = graphRefAllSpec.getGraphSpec();
+    operation.setDestinationGraphSpec(graphSpec);
+    if (graphSpec == GraphSpec.GRAPH) {
+        operation.setDestinationGraph(graphRefAllSpec.getGraph());
+    } }
+}
+
+/* [33]    Drop ::= 'DROP' 'SILENT'? GraphRefAll */
+private UpdateOperation Drop() : {
+    DropOperation operation; } {
+    <DROP> {
+    operation = new DropOperation(); }
+    ProcessParametersOfClearOrDropOperation(operation) {
+    return operation; }
+}
+
+/* [34]    Create ::= 'CREATE' 'SILENT'? GraphRef */
+private UpdateOperation Create() : {
+    IRI uriRef;
+    CreateOperation operation; } {
+    <CREATE> {
+    operation = new CreateOperation(); }
+    (
+        <SILENT> {
+        operation.setSilent(true); }
+    )?
+    uriRef = GraphRef() {
+    operation.setDestinationGraph(uriRef);
+    return operation; }
+}
+
+/* [35]    Add ::= 'ADD' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
+private UpdateOperation Add() : {
+    AddOperation operation; } {
+    <ADD> {
+    operation = new AddOperation(); }
+    ProcessParametersOfAddMoveOrCopyOperation(operation) {
+    return operation; }
+}
+
+private void ProcessParametersOfAddMoveOrCopyOperation(SimpleUpdateOperation operation) : {
+    GraphRefAllSpec graphRefAllSpec;
+    GraphSpec graphSpec; } {
+    (
+        <SILENT> {
+        operation.setSilent(true); }
+    )?
+    graphRefAllSpec = GraphOrDefault() {
+    graphSpec = graphRefAllSpec.getGraphSpec();
+    if (graphSpec == GraphSpec.GRAPH) {
+        operation.setInputGraph(graphRefAllSpec.getGraph());
+    } else {
+        operation.setInputGraphSpec(graphSpec);
+    } }
+    <TO>
+    graphRefAllSpec = GraphOrDefault() {
+    graphSpec = graphRefAllSpec.getGraphSpec();
+    if (graphSpec == GraphSpec.GRAPH) {
+        operation.setDestinationGraph(graphRefAllSpec.getGraph());
+    } else {
+        operation.setDestinationGraphSpec(graphSpec);
+    } }
+}
+
+/* [36]    Move ::= 'MOVE' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
+private UpdateOperation Move() : {
+    MoveOperation operation; } {
+    <MOVE> {
+    operation = new MoveOperation(); }
+    ProcessParametersOfAddMoveOrCopyOperation(operation) {
+    return operation; }
+}
+
+/* [37]    Copy ::= 'COPY' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault */
+private UpdateOperation Copy() : {
+    CopyOperation operation; } {
+    <COPY> {
+    operation = new CopyOperation(); }
+    ProcessParametersOfAddMoveOrCopyOperation(operation) {
+    return operation; }
+}
+
+/* [38]    InsertData ::= 'INSERT DATA' QuadData */
+private UpdateOperation InsertData() : {
+    InsertDataOperation operation; } {
+    <INSERT> <DATA> {
+    operation = new InsertDataOperation(); }
+    QuadData(operation) {
+    return operation; }
+}
+
+/* [39]    DeleteData ::= 'DELETE DATA' QuadData */
+private UpdateOperation DeleteData() : {
+    DeleteDataOperation operation; } {
+    <DELETE> <DATA> {
+    operation = new DeleteDataOperation(); }
+    QuadData(operation) {
+    return operation; }
+}
+
+/* [40]    DeleteWhere ::= 'DELETE WHERE' QuadPattern */
+private UpdateOperation DeleteWhere() : {
+    DeleteWhereOperation operation; } {
+    <DELETE> <WHERE> {
+    operation = new DeleteWhereOperation(); }
+    QuadPattern(operation) {
+    return operation; }
+}
+
+/* [41]    Modify ::= ( 'WITH' iri )? ( DeleteClause InsertClause? | InsertClause ) UsingClause* 'WHERE' GroupGraphPattern */
+private UpdateOperation Modify() : {
+    IRI fallbackGraph = null;
+    UpdateOperationWithQuads deleteOperation = null;
+    UpdateOperationWithQuads insertOperation = null;
+    SimpleDataSet dataSet = new SimpleDataSet();
+    GroupGraphPattern queryPattern;
+    ModifyOperation operation; } {
+    (
+        <WITH>
+        fallbackGraph = IRI()
+    )?
+    (
+        deleteOperation = DeleteClause()
+        (
+            insertOperation = InsertClause()
+        )?
+    |
+        insertOperation = InsertClause()
+    ) {
+    operation = new ModifyOperation();
+    if (fallbackGraph != null) {
+        operation.setFallbackGraph(fallbackGraph);
+    }
+    if (deleteOperation != null) {
+        operation.setDeleteOperation(deleteOperation);
+    }
+    if (insertOperation != null) {
+        operation.setInsertOperation(insertOperation);
+    } }
+    (
+        UsingClause(dataSet)
+    )* {
+    operation.setDataSet(dataSet); }
+
+    <WHERE>
+    queryPattern = GroupGraphPattern() {
+    operation.setQueryPattern(queryPattern);
+    return operation; }
+}
+
+/* [42]    DeleteClause ::= 'DELETE' QuadPattern */
+private UpdateOperationWithQuads DeleteClause() : {
+    UpdateOperationWithQuads operation; } {
+    <DELETE> {
+    operation = new UpdateOperationWithQuads(); }
+    QuadPattern(operation) {
+    return operation; }
+}
+
+/* [43]    InsertClause ::= 'INSERT' QuadPattern */
+private UpdateOperationWithQuads InsertClause() : {
+    UpdateOperationWithQuads operation; } {
+    <INSERT> {
+    operation = new UpdateOperationWithQuads(); }
+    QuadPattern(operation) {
+    return operation; }
+}
+
+/* [44]    UsingClause ::= 'USING' ( iri | 'NAMED' iri ) */
+private void UsingClause(SimpleDataSet dataSet) : {
+    IRI graph; } {
+    <USING>
+    (
+        graph = IRI() {
+        dataSet.addDefaultGraph(graph); }
+    |
+        <NAMED>
+        graph = IRI() {
+        dataSet.addNamedGraph(graph); }
+    )
+}
+
+/* [45]    GraphOrDefault ::= 'DEFAULT_T' | 'GRAPH'? iri */
+private GraphRefAllSpec GraphOrDefault() : {
+    IRI uriRef;
+    GraphRefAllSpec graphRefAllSpec = new GraphRefAllSpec(); } {
+    (
+        <DEFAULT_T> {
+        graphRefAllSpec.setGraphSpec(GraphSpec.DEFAULT); }
+    |
+        (
+            <GRAPH>
+        )?
+        uriRef = IRI() {
+        graphRefAllSpec.setGraph(uriRef);
+        graphRefAllSpec.setGraphSpec(GraphSpec.GRAPH); }
+    ) {
+    return graphRefAllSpec; }
+}
+
+/* [46]    GraphRef ::= 'GRAPH' iri */
+private IRI GraphRef() : {
+    IRI uriRef; } {
+    <GRAPH>
+    uriRef = IRI() {
+    return uriRef; }
+}
+
+/* [47]    GraphRefAll ::= GraphRef | 'DEFAULT_T' | 'NAMED' | 'ALL' */
+private GraphRefAllSpec GraphRefAll() : {
+    IRI uriRef;
+    GraphRefAllSpec graphRefAllSpec = new GraphRefAllSpec(); } {
+    (
+        uriRef = GraphRef() {
+        graphRefAllSpec.setGraph(uriRef);
+        graphRefAllSpec.setGraphSpec(GraphSpec.GRAPH); }
+    |
+        <DEFAULT_T> {
+        graphRefAllSpec.setGraphSpec(GraphSpec.DEFAULT); }
+    |
+        <NAMED> {
+        graphRefAllSpec.setGraphSpec(GraphSpec.NAMED); }
+    |
+        <ALL> {
+        graphRefAllSpec.setGraphSpec(GraphSpec.ALL); }
+    ) {
+    return graphRefAllSpec; }
+}
+
+/* [48]    QuadPattern ::= '{' Quads '}' */
+private void QuadPattern(UpdateOperationWithQuads operation) : {} {
+    "{"
+    Quads(operation)
+    "}"
+}
+
+/* [49]    QuadData ::= '{' Quads '}' */
+private void QuadData(UpdateOperationWithQuads operation) : {} {
+    "{"
+    Quads(operation)
+    "}"
+}
+
+/* [50]    Quads ::= TriplesTemplate? ( QuadsNotTriples '.'? TriplesTemplate? )* */
+private void Quads(UpdateOperationWithQuads operation) : {
+    Set<TriplePattern> triplePatterns; } {
+    (
+        triplePatterns=TriplesTemplate() {
+        operation.addQuad(triplePatterns); }
+    )?
+    (
+        QuadsNotTriples(operation)
+        ( "." )?
+        (
+            triplePatterns=TriplesTemplate() {
+            operation.addQuad(triplePatterns); }
+        )?
+    )*
+}
+
+/* [51]    QuadsNotTriples ::= 'GRAPH' VarOrIRI '{' TriplesTemplate? '}' */
+private void QuadsNotTriples(UpdateOperationWithQuads operation) : {
+    UriRefOrVariable graph;
+    Set<TriplePattern> triplePatterns = null; } {
+
+    <GRAPH>
+    graph=VarOrIRI()
+    "{"
+    (
+        triplePatterns=TriplesTemplate()
+    )?
+    "}" {
+    operation.addQuad(graph, triplePatterns); }
+}
+
+/* [52]    TriplesTemplate ::= TriplesSameSubject ( '.' TriplesTemplate? )? */
+private Set<TriplePattern> TriplesTemplate() : {
+    Set<TriplePattern> triplePatterns, t; } {
+
+    triplePatterns=TriplesSameSubject()
+    (
+        "."
+        (
+            t=TriplesTemplate() {
+            triplePatterns.addAll(t); }
+        )?
+    )? {
+    return triplePatterns; }
+}
+
+/* [53]    GroupGraphPattern ::= '{' ( SubSelect | GroupGraphPatternSub ) '}' */
+private GroupGraphPattern GroupGraphPattern() : {
+    Query query;
+    GroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern(); } {
+    "{"
+    (
+        query = SubSelect() {
+        ((SimpleGroupGraphPattern) groupGraphPattern).setSubSelect((SelectQuery) query); }
+    |
+        GroupGraphPatternSub(groupGraphPattern)
+    )
+    "}" {
+    return groupGraphPattern; }
+}
+
+/* [54]    GroupGraphPatternSub ::= TriplesBlock? ( GraphPatternNotTriples '.'? TriplesBlock? )* */
+private void GroupGraphPatternSub(GroupGraphPattern groupGraphPattern) : {} {
+    ( TriplesBlock(groupGraphPattern) )?
+    (
+        GraphPatternNotTriples(groupGraphPattern)
+        (".")?
+        ( TriplesBlock(groupGraphPattern) )?
+    )*
+}
+
+/* [55]    TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? */
+private void TriplesBlock(GroupGraphPattern groupGraphPattern) : {
+    Set<PropertyPathPattern> propertyPathPatterns; } {
+
+    propertyPathPatterns=TriplesSameSubjectPath() {
+    ((SimpleGroupGraphPattern) groupGraphPattern).addPropertyPathPatterns(propertyPathPatterns); }
+    (
+        "." ( TriplesBlock(groupGraphPattern) )?
+    )?
+}
+
+/* [56]    GraphPatternNotTriples ::= GroupOrUnionGraphPattern | OptionalGraphPattern | MinusGraphPattern | GraphGraphPattern | ServiceGraphPattern | Filter | Bind | InlineData */
+private void GraphPatternNotTriples(GroupGraphPattern groupGraphPattern) : {
+    Expression constraint;
+    Variable v; } {
+    (
+        GroupOrUnionGraphPattern(groupGraphPattern)
+    |
+        OptionalGraphPattern(groupGraphPattern)
+    |
+        MinusGraphPattern(groupGraphPattern)
+    |
+        GraphGraphPattern(groupGraphPattern)
+    |
+        ServiceGraphPattern(groupGraphPattern)
+    |
+        constraint=Filter() {
+        ((SimpleGroupGraphPattern) groupGraphPattern).addConstraint(constraint); }
+    |
+        v=Bind() {
+        // We should either store this binding in the respective variable in SelectQuery
+        // or we extend the BasicGraphPattern to store such binding.
+        // If we store the binding in the respective variable in SelectQuery, a serializer
+        // won't be able to determine whether a binding is defined by the BIND keyword or
+        // by an expression in the SELECT clause.
+        // The pre parser needs only to consume tokens, thus may ignore this binding.
+
+        // The use of BIND ends the preceding basic graph pattern, thus ...
+        ((SimpleGroupGraphPattern) groupGraphPattern).endLastBasicGraphPattern(); }
+    |
+        InlineData(groupGraphPattern)
+    )
+}
+
+/* [57]    OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern */
+private void OptionalGraphPattern(GroupGraphPattern groupGraphPattern) : {
+    GroupGraphPattern optional; } {
+
+    <OPTIONAL>
+    optional=GroupGraphPattern() {
+    ((SimpleGroupGraphPattern) groupGraphPattern).addOptionalGraphPattern(optional); }
+}
+
+/* [58]    GraphGraphPattern ::= 'GRAPH' VarOrIRI GroupGraphPattern */
+private void GraphGraphPattern(GroupGraphPattern groupGraphPattern) : {
+    UriRefOrVariable graph;
+    GroupGraphPattern g; } {
+
+    <GRAPH>
+    graph=VarOrIRI()
+    g=GroupGraphPattern() {
+    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(new SimpleGraphGraphPattern(graph, g)); }
+}
+
+/* [59]    ServiceGraphPattern ::= 'SERVICE' 'SILENT'? VarOrIRI GroupGraphPattern */
+private void ServiceGraphPattern(GroupGraphPattern groupGraphPattern) : {
+    UriRefOrVariable service;
+    GroupGraphPattern g;
+    boolean silent = false; } {
+
+    <SERVICE>
+    (
+        <SILENT> {
+        silent = true; }
+    )?
+    service=VarOrIRI()
+    g=GroupGraphPattern() {
+    SimpleServiceGraphPattern simpleServiceGraphPattern;
+    simpleServiceGraphPattern = new SimpleServiceGraphPattern(service, g);
+    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(simpleServiceGraphPattern);
+    if (silent) {
+        simpleServiceGraphPattern.setSilent(true);
+    } }
+}
+
+/* [60]    Bind ::= 'BIND' '(' Expression 'AS' Var ')' */
+private Variable Bind() : {
+    Variable v;
+    Expression e; } {
+
+    <BIND>
+    "("
+    e=Expression()
+    <AS>
+    v=Var() {
+    v.setBoundExpression(e); }
+    ")" {
+    return v; }
+}
+
+/* [61]    InlineData ::= 'VALUES' DataBlock */
+private void InlineData(GroupGraphPattern groupGraphPattern) : {
+    InlineData data; } {
+
+    <VALUES>
+    data=DataBlock() {
+    ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(data); }
+}
+
+/* [62]    DataBlock ::= InlineDataOneVar | InlineDataFull */
+private InlineData DataBlock() : {
+    InlineData inlineData = new SimpleInlineData(); } {
+
+    (
+        InlineDataOneVar(inlineData)
+    |
+        InlineDataFull(inlineData)
+    ) {
+    return inlineData; }
+}
+
+/* [63]    InlineDataOneVar ::= Var '{' DataBlockValue* '}' */
+private void InlineDataOneVar(InlineData inlineData) : {
+    Variable var;
+    RDFTerm val; } {
+
+    var=Var() {
+    ((SimpleInlineData) inlineData).addVariable(var); }
+    "{"
+    (
+        val=DataBlockValue() {
+        List<RDFTerm> values = new ArrayList<RDFTerm>();
+        values.add(val);
+        ((SimpleInlineData) inlineData).addValues(values); }
+    )*
+    "}"
+}
+
+/* [64]    InlineDataFull ::= ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}' */
+private void InlineDataFull(InlineData inlineData) : {
+    Variable var;
+    RDFTerm val; } {
+    (
+        <NIL>
+    |
+        "("
+        (
+            var=Var() {
+            ((SimpleInlineData) inlineData).addVariable(var); }
+        )*
+        
+        ")"
+    )
+    "{"
+    (
+        (
+            "(" {
+            List<RDFTerm> values = new ArrayList<RDFTerm>(); }
+            (
+                val=DataBlockValue() {
+                values.add(val); }
+            )*
+            ")" {
+            ((SimpleInlineData) inlineData).addValues(values); }
+        )
+    |
+        <NIL> {
+        ((SimpleInlineData) inlineData).addValues(new ArrayList<RDFTerm>()); }
+    )*
+    "}"
+}
+
+/* [65]    DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF' */
+private RDFTerm DataBlockValue() : {
+    RDFTerm r = null; } {
+    (r=IRI() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | <UNDEF> ) {
+    return r; }
+}
+
+/* [66]    MinusGraphPattern ::= 'MINUS' GroupGraphPattern */
+private void MinusGraphPattern(GroupGraphPattern groupGraphPattern) : {
+    GroupGraphPattern subtrahend; } {
+
+    <MINUS>
+    subtrahend=GroupGraphPattern() {
+    ((SimpleGroupGraphPattern) groupGraphPattern).addMinusGraphPattern(subtrahend); }
+}
+
+/* [67]    GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* */
+private void GroupOrUnionGraphPattern(GroupGraphPattern groupGraphPattern) : {
+    GroupGraphPattern g;
+    AlternativeGraphPattern unionGraphPattern = null; } {
+
+    g=GroupGraphPattern()
+    (
+        <UNION> {
+        if (unionGraphPattern == null) {
+            unionGraphPattern = new SimpleAlternativeGraphPattern(g);
+        } }
+        g=GroupGraphPattern() {
+        ((SimpleAlternativeGraphPattern) unionGraphPattern).addAlternativeGraphPattern(g); }
+    )* {
+    if (unionGraphPattern != null) {
+        ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(unionGraphPattern);
+    } else {
+        ((SimpleGroupGraphPattern) groupGraphPattern).addGraphPattern(g);
+    } }
+}
+
+/* [68]    Filter ::= 'FILTER' Constraint */
+private Expression Filter() : {
+    Expression c; } {
+
+    <FILTER>
+    c=Constraint() {
+    return c; }
+}
+
+/* [69]    Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall */
+private Expression Constraint() : {
+    Expression c; } {
+
+    ( c=BrackettedExpression() | c=BuiltInCall() | c=FunctionCall() ) {
+    return c; }
+}
+
+/* [70]    FunctionCall ::= iri ArgList */
+private FunctionCall FunctionCall() : {
+    IRI name;
+    List<Expression> arguments; } {
+
+    name=IRI()
+    arguments=ArgList() {
+    return new FunctionCall(name, arguments); }
+}
+
+/* [71]    ArgList ::= NIL | '(' 'DISTINCT'? Expression ( ',' Expression )* ')' */
+private List<Expression> ArgList() : {
+    List<Expression> args = new ArrayList<Expression>();
+    Expression e; } {
+
+    (
+        <NIL>
+    |
+        (
+            "("
+            (
+                <DISTINCT>
+            )?
+            e=Expression() {
+            args.add(e); }
+            (
+                ","
+                e=Expression() {
+                args.add(e); }
+            )*
+            ")"
+        )
+    ) {
+    return args; }
+}
+
+/* [72]    ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' */
+private List<Expression> ExpressionList() : {
+    List<Expression> args = new ArrayList<Expression>();
+    Expression e; } {
+
+    (
+        <NIL>
+    |
+        (
+            "("
+            e=Expression() {
+            args.add(e); }
+            (
+                ","
+                e=Expression() {
+                args.add(e); }
+            )*
+            ")"
+        )
+    ) {
+    return args; }
+}
+
+/* [73]    ConstructTemplate ::= '{' ConstructTriples? '}' */
+private Set<TriplePattern> ConstructTemplate() : {
+    Set<TriplePattern> triplePatterns = null; } {
+
+    "{"
+    (
+        triplePatterns=ConstructTriples()
+    )?
+    "}" {
+    return triplePatterns; }
+}
+
+/* [74]    ConstructTriples ::= TriplesSameSubject ( '.' ConstructTriples? )? */
+private Set<TriplePattern> ConstructTriples() : {
+    Set<TriplePattern> triplePatterns, t; } {
+
+    triplePatterns=TriplesSameSubject()
+    (
+        "."
+        (
+            t=ConstructTriples() {
+            triplePatterns.addAll(t); }
+        )?
+    )? {
+    return triplePatterns; }
+}
+
+/* [75]    TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty |  TriplesNode PropertyList */
+private Set<TriplePattern> TriplesSameSubject() : {
+    Set<TriplePattern> triplePatterns = new LinkedHashSet<TriplePattern>();
+    ResourceOrVariable subject; } {
+
+    ( subject=VarOrTerm() PropertyListNotEmpty(subject, triplePatterns) {
+        return triplePatterns; }
+    )
+    |
+    ( subject=TriplesNode(triplePatterns) PropertyList(subject, triplePatterns) {
+        return triplePatterns; }
+    )
+}
+
+/* [76]    PropertyList ::= PropertyListNotEmpty? */
+private void PropertyList(ResourceOrVariable subject, Set<TriplePattern> triplePatterns) : { } {
+    ( PropertyListNotEmpty(subject, triplePatterns) )?
+}
+
+/* [77]    PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* */
+private void PropertyListNotEmpty(ResourceOrVariable subject, Set<TriplePattern> triplePatterns) : {
+    UriRefOrVariable predicate;
+    Set<ResourceOrVariable> objects; } {
+    predicate=Verb()
+    objects=ObjectList(triplePatterns) {
+    addTriplePatterns(triplePatterns, subject, predicate, objects); }
+
+    ( ";"
+        ( predicate=Verb() objects=ObjectList(triplePatterns) {
+            addTriplePatterns(triplePatterns, subject, predicate, objects); }
+        )?
+    )*
+}
+
+/* [78]    Verb ::= VarOrIRI | 'a' */
+private UriRefOrVariable Verb() : {
+    UriRefOrVariable predicate; } {
+
+    predicate=VarOrIRI() {
+    return predicate; }
+    | "a" {
+    return new UriRefOrVariable(RDF_TYPE); }
+}
+
+/* [79]    ObjectList ::= Object ( ',' Object )* */
+private Set<ResourceOrVariable> ObjectList(Set<TriplePattern> triplePatterns) : {
+    ResourceOrVariable object; } {
+
+    {
+    Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
+    }
+    object=Object(triplePatterns) {
+    objects.add(object); }
+
+    ( ","
+        object=Object(triplePatterns) {
+            objects.add(object); }
+    )* {
+    return objects; }
+}
+
+/* [80]    Object ::= GraphNode */
+private ResourceOrVariable Object(Set<TriplePattern> triplePatterns) : {
+    ResourceOrVariable object; } {
+
+    object=GraphNode(triplePatterns) {
+    return object; }
+}
+
+/* [81]    TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath */
+private Set<PropertyPathPattern> TriplesSameSubjectPath() : {
+    Set<PropertyPathPattern> propertyPathPatterns = new LinkedHashSet<PropertyPathPattern>();
+    ResourceOrVariable subject; } {
+
+    (
+        subject=VarOrTerm()
+        PropertyListPathNotEmpty(subject, propertyPathPatterns) {
+        return propertyPathPatterns; }
+    )
+    |
+    (
+        subject=TriplesNodePath(propertyPathPatterns)
+        PropertyListPath(subject, propertyPathPatterns) {
+        return propertyPathPatterns; }
+    )
+}
+
+/* [82]    PropertyListPath ::= PropertyListPathNotEmpty? */
+private void PropertyListPath(ResourceOrVariable subject, Set<PropertyPathPattern> propertyPathPatterns) : { } {
+    (
+        PropertyListPathNotEmpty(subject, propertyPathPatterns)
+    )?
+}
+
+/* [83]    PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )* */
+private void PropertyListPathNotEmpty(ResourceOrVariable subject, Set<PropertyPathPattern> propertyPathPatterns) : {
+    PropertyPathExpressionOrVariable propertyPathExpressionOrVariable;
+    PropertyPathExpression propertyPathExpression;
+    Variable v;
+    Set<ResourceOrVariable> objects; } {
+    (
+        propertyPathExpression=VerbPath() {
+        propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(propertyPathExpression); }
+    |
+        v=VerbSimple() {
+        propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(v); }
+    )
+    objects=ObjectListPath(propertyPathPatterns) {
+    addPropertyPathPatterns(propertyPathPatterns, subject, propertyPathExpressionOrVariable, objects); }
+    (
+        ";"
+        (
+            (
+                propertyPathExpression=VerbPath() {
+                propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(propertyPathExpression); }
+
+            |
+                v=VerbSimple() {
+                propertyPathExpressionOrVariable = new PropertyPathExpressionOrVariable(v); }
+            )
+            objects=ObjectListPath(propertyPathPatterns) {
+            addPropertyPathPatterns(propertyPathPatterns, subject, propertyPathExpressionOrVariable, objects); }
+        )?
+    )*
+}
+
+/* [84]    VerbPath ::= Path */
+private PropertyPathExpression VerbPath() : {
+    PropertyPathExpression propertyPathExpression; } {
+    propertyPathExpression=Path() {
+    return propertyPathExpression; }
+}
+
+/* [85]    VerbSimple ::= Var */
+private Variable VerbSimple() : {
+    Variable v; } {
+    v=Var() {
+    return v; }
+}
+
+/* [86]    ObjectListPath ::= ObjectPath ( ',' ObjectPath )* */
+private Set<ResourceOrVariable> ObjectListPath(Set<PropertyPathPattern> propertyPathPatterns) : {
+    ResourceOrVariable object; } {
+    {
+    Set<ResourceOrVariable> objects = new LinkedHashSet<ResourceOrVariable>();
+    }
+    object=ObjectPath(propertyPathPatterns) {
+    objects.add(object); }
+
+    (
+        ","
+        object=ObjectPath(propertyPathPatterns) {
+        objects.add(object); }
+    )* {
+    return objects; }
+}
+
+/* [87]    ObjectPath ::= GraphNodePath */
+private ResourceOrVariable ObjectPath(Set<PropertyPathPattern> propertyPathPatterns) : {
+    ResourceOrVariable object; } {
+
+    object=GraphNodePath(propertyPathPatterns) {
+    return object; }
+}
+
+/* [88]    Path ::= PathAlternative */
+private PropertyPathExpression Path() : {
+    PropertyPathExpression propertyPathExpression; } {
+    propertyPathExpression=PathAlternative() {
+    return propertyPathExpression; }
+}
+
+/* [89]    PathAlternative ::= PathSequence ( '|' PathSequence )* */
+private PropertyPathExpression PathAlternative() : {
+    PropertyPathExpression ppe, pathSequence; } {
+
+    ppe=PathSequence()
+    (
+        "|"
+        pathSequence=PathSequence() {
+        ppe = new BinaryPropertyPathOperation("|", ppe, pathSequence); }
+    )* {
+    return ppe; }
+}
+
+/* [90]    PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* */
+private PropertyPathExpression PathSequence() : {
+    PropertyPathExpression ppe, pathEltOrInverse; } {
+
+    ppe=PathEltOrInverse()
+    (
+        "/"
+        pathEltOrInverse=PathEltOrInverse() {
+        ppe = new BinaryPropertyPathOperation("/", ppe, pathEltOrInverse); }
+    )* {
+    return ppe; }
+}
+
+/* [91]    PathElt ::= PathPrimary PathMod? */
+private PropertyPathExpression PathElt() : {
+    PropertyPathExpression ppe;
+    String pathMode; } {
+
+    ppe=PathPrimary()
+    (
+        pathMode=PathMod() {
+        ppe = new UnaryPropertyPathOperation(pathMode, ppe); }
+    )? {
+    return ppe; }
+}
+
+/* [92]    PathEltOrInverse ::= PathElt | '^' PathElt */
+private PropertyPathExpression PathEltOrInverse() : {
+    PropertyPathExpression ppe; } {
+
+    (
+        ppe=PathElt() {
+        return ppe; }
+    |
+        "^"
+        ppe=PathElt() {
+        return new UnaryPropertyPathOperation("^", ppe); }
+    )
+}
+
+/* [93]    PathMod ::= '?' | '*' | '+' */
+private String PathMod() : {} {
+    (
+        "?" {
+        return "?"; }
+    |
+        "*" {
+        return "*"; }
+    |
+        "+" {
+        return "+"; }
+    )
+}
+
+/* [94]    PathPrimary ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')' */
+private PropertyPathExpression PathPrimary() : {
+    PropertyPathExpression ppe;
+    IRI uriRef; } {
+
+    (
+        uriRef=IRI() {
+        return new PredicatePath(uriRef); }
+    |
+        "a" {
+        return new PredicatePath(RDF_TYPE); }
+    |
+        "!"
+        ppe=PathNegatedPropertySet() {
+        return new UnaryPropertyPathOperation("!", ppe); }
+    |
+        "("
+        ppe=Path() {
+        return ppe; }
+        ")"
+    )
+}
+
+/* [95]    PathNegatedPropertySet ::= PathOneInPropertySet | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')' */
+private PropertyPathExpression PathNegatedPropertySet() : {
+    PropertyPathExpression pathOneInPropertySet;
+    PropertySet propertySet = new PropertySet(); } {
+
+    (
+        pathOneInPropertySet=PathOneInPropertySet() {
+        return pathOneInPropertySet; }
+    |
+        "("
+        (
+            pathOneInPropertySet=PathOneInPropertySet() {
+            propertySet.addElement(pathOneInPropertySet); }
+            (
+                "|"
+                pathOneInPropertySet=PathOneInPropertySet() {
+                propertySet.addElement(pathOneInPropertySet); }
+            )*
+        )?
+        ")" {
+        return propertySet; }
+    )
+}
+
+/* [96]    PathOneInPropertySet ::= iri | 'a' | '^' ( iri | 'a' ) */
+private PropertyPathExpression PathOneInPropertySet() : {
+    IRI uriRef; } {
+
+    (
+        uriRef=IRI() {
+        return new PredicatePath(uriRef); }
+    |
+        "a" {
+        return new PredicatePath(RDF_TYPE); }
+    |
+        "^"
+        (
+            uriRef=IRI() {
+            return new UnaryPropertyPathOperation("^", new PredicatePath(uriRef)); }
+        |
+            "a" {
+            return new UnaryPropertyPathOperation("^", new PredicatePath(RDF_TYPE)); }
+        )
+    )
+}
+
+/* [97]    Integer ::= INTEGER */
+
+// Fill in the specified set of TriplePattern and returns the subject node
+/* [98]    TriplesNode ::= Collection |  BlankNodePropertyList */
+private ResourceOrVariable TriplesNode(Set<TriplePattern> triplePatterns) : {
+    ResourceOrVariable subject; } {
+    (
+        subject=Collection(triplePatterns)
+    |
+        subject=BlankNodePropertyList(triplePatterns)
+    ) {
+    return subject; }
+}
+
+/* [99]    BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' */
+private ResourceOrVariable BlankNodePropertyList(Set<TriplePattern> triplePatterns) : { } {
+    {
+    ResourceOrVariable subject = getNewBNode();
+    }
+    "["
+    PropertyListNotEmpty(subject, triplePatterns)
+    "]" {
+    return subject; }
+}
+
+/* [100] TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath */
+private ResourceOrVariable TriplesNodePath(Set<PropertyPathPattern> propertyPathPatterns) : {
+    ResourceOrVariable subject; } {
+    (
+        subject=CollectionPath(propertyPathPatterns)
+    |
+        subject=BlankNodePropertyListPath(propertyPathPatterns)
+    ) {
+    return subject; }
+}
+
+
+/* [101] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' */
+private ResourceOrVariable BlankNodePropertyListPath(Set<PropertyPathPattern> propertyPathPatterns) : {} {
+    {
+    ResourceOrVariable subject = getNewBNode();
+    }
+    "["
+    PropertyListPathNotEmpty(subject, propertyPathPatterns)
+    "]" {
+    return subject; }
+}
+
+/* [102]    Collection ::= '(' GraphNode+ ')' */
+private ResourceOrVariable Collection(Set<TriplePattern> triplePatterns) : {
+    ResourceOrVariable node;
+    List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
+
+    "("
+    (
+        node=GraphNode(triplePatterns) {
+        nodes.add(node); }
+    )+
+    ")" {
+    return addTriplePatterns(triplePatterns, nodes); }
+}
+
+/* [103]    CollectionPath ::= '(' GraphNodePath+ ')' */
+private ResourceOrVariable CollectionPath(Set<PropertyPathPattern> propertyPathPatterns) : {
+    ResourceOrVariable node;
+    List<ResourceOrVariable> nodes = new ArrayList<ResourceOrVariable>(); } {
+
+    "("
+    (
+        node=GraphNodePath(propertyPathPatterns) {
+        nodes.add(node); }
+    )+
+    ")" {
+    return addPropertyPathPatterns(propertyPathPatterns, nodes); }
+}
+
+/* [104]    GraphNode ::= VarOrTerm | TriplesNode */
+private ResourceOrVariable GraphNode(Set<TriplePattern> triplePatterns) : {
+    ResourceOrVariable node; } {
+    (
+        node=VarOrTerm()
+    |
+        node=TriplesNode(triplePatterns)
+    ) {
+    return node; }
+}
+
+/* [105]    GraphNodePath ::= VarOrTerm | TriplesNodePath */
+private ResourceOrVariable GraphNodePath(Set<PropertyPathPattern> propertyPathPatterns) : {
+    ResourceOrVariable node; } {
+    (
+        node=VarOrTerm()
+    |
+        node=TriplesNodePath(propertyPathPatterns)
+    ) {
+    return node; }
+}
+
+/* [106]    VarOrTerm ::= Var | GraphTerm */
+private ResourceOrVariable VarOrTerm() : {
+    ResourceOrVariable r;
+    Variable v; } {
+
+    (
+        v=Var() {
+        return new ResourceOrVariable(v); }
+    |
+        r=GraphTerm() {
+        return r; }
+    )
+}
+
+/* [107]    VarOrIRI ::= Var | iri */
+private UriRefOrVariable VarOrIRI() : {
+    Variable var;
+    IRI uriRef; } {
+
+    (
+    var=Var() {
+    return new UriRefOrVariable(var); }
+    |
+    uriRef=IRI() {
+    return new UriRefOrVariable(uriRef); }
+    )
+}
+
+/* [108]    Var ::= VAR1 | VAR2 */
+private Variable Var() : {
+    Token t;} {
+
+    (t=<VAR1> | t=<VAR2>) {
+    return createVariable(t.image); }
+}
+
+/* [109]    GraphTerm ::= IRI | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL */
+private ResourceOrVariable GraphTerm() : {
+    ResourceOrVariable bNode = null;
+    RDFTerm r = null; } {
+
+    (r=IRI() | r=RDFLiteral() | r=NumericLiteral() | r=BooleanLiteral() | bNode=BlankNode() | <NIL> {
+        r = RDF_NIL; }) {
+    if (bNode == null) {
+        return new ResourceOrVariable(r);
+    }
+    return bNode; }
+}
+
+/* [110]    Expression ::= ConditionalOrExpression */
+private Expression Expression() : {
+    Expression e; } {
+
+    e=ConditionalOrExpression() {
+    return e; }
+}
+
+/* [111]    ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* */
+private Expression ConditionalOrExpression() : {
+    Expression e, ae; } {
+
+    e=ConditionalAndExpression()
+    (
+        "||" ae=ConditionalAndExpression() {
+        e = new BinaryOperation("||", e, ae); }
+    )* {
+    return e; }
+}
+
+/* [112]    ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* */
+private Expression ConditionalAndExpression() : {
+    Expression e, e2; } {
+
+    e=ValueLogical()
+    (
+        "&&" e2=ValueLogical() {
+        e = new BinaryOperation("&&", e, e2); }
+    )* {
+    return e; }
+}
+
+/* [113]    ValueLogical ::= RelationalExpression */
+private Expression ValueLogical() : {
+    Expression e; } {
+
+    e=RelationalExpression() {
+    return e; }
+}
+
+/* [114]    RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? */
+private Expression RelationalExpression() : {
+    Expression e, e2; 
+    List<Expression> l; } {
+
+    e=NumericExpression()
+    (
+        "=" e2=NumericExpression() {
+        e = new BinaryOperation("=", e, e2); }
+    |
+        "!=" e2=NumericExpression() {
+        e = new BinaryOperation("!=", e, e2); }
+    |
+        "<" e2=NumericExpression() {
+        e = new BinaryOperation("<", e, e2); }
+    |
+        ">" e2=NumericExpression() {
+        e = new BinaryOperation(">", e, e2); }
+    |
+        "<=" e2=NumericExpression() {
+        e = new BinaryOperation("<=", e, e2); }
+    |
+        ">=" e2=NumericExpression() {
+        e = new BinaryOperation(">=", e, e2); }
+    |
+        <IN> l=ExpressionList() {
+        e = new RhsListBinaryOperation("IN", e, l); }
+    |
+        <NOT> <IN> l=ExpressionList() {
+        e = new RhsListBinaryOperation("NOT IN", e, l); }
+    )? {
+    return e; }
+}
+
+/* [115]    NumericExpression ::= AdditiveExpression */
+private Expression NumericExpression() : {
+    Expression e; } {
+
+    e=AdditiveExpression() {
+    return e; }
+}
+
+/* [116]    AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* */
+private Expression AdditiveExpression() : {
+    Expression e, e2, u;
+    Literal l; } {
+
+    e=MultiplicativeExpression()
+    (
+        "+" e2=MultiplicativeExpression() {
+        e = new BinaryOperation("+", e, e2); }
+    |
+        "-" e2=MultiplicativeExpression() {
+        e = new BinaryOperation("-", e, e2); }
+    |
+        (
+            (
+                l=NumericLiteralPositive()
+            |
+                l=NumericLiteralNegative()
+            ) {
+            e2 = new LiteralExpression(l); }
+            (
+                "*" u=UnaryExpression() {
+                e2 = new BinaryOperation("*", e2, u); }
+            |
+                "/" u=UnaryExpression() {
+                e2 = new BinaryOperation("/", e2, u); }
+            )*
+        ) {
+        e = new BinaryOperation("+", e, e2); }
+    )* {
+    return e; }
+}
+
+/* [117]    MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* */
+private Expression MultiplicativeExpression() : {
+    Expression e, e2; } {
+
+    e=UnaryExpression()
+    (
+        "*" e2=UnaryExpression() {
+        e = new BinaryOperation("*", e, e2); }
+    |
+        "/" e2=UnaryExpression() {
+        e = new BinaryOperation("/", e, e2); }
+    )* {
+    return e; }
+}
+
+/* [118]    UnaryExpression ::=   '!' PrimaryExpression  |  '+' PrimaryExpression  | '-' PrimaryExpression  | PrimaryExpression */
+private Expression UnaryExpression() : {
+    Expression e; } {
+
+        "!" e=PrimaryExpression() {
+        return new UnaryOperation("!", e); }
+    |
+        "+" e=PrimaryExpression() {
+        return new UnaryOperation("+", e); }
+    |
+        "-" e=PrimaryExpression() {
+        return new UnaryOperation("-", e); }
+    |
+        e=PrimaryExpression() {
+        return e; }
+}
+
+/* [119]    PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var */
+private Expression PrimaryExpression() : {
+    Expression e = null;
+    Literal l = null; } {
+
+    (
+        e=BrackettedExpression()
+/* There is a capture all names in BuiltInCall, so put it last
+    |
+        e=BuiltInCall()
+*/
+    |
+        e=IRIOrFunction()
+    |
+        l=RDFLiteral()
+    |
+        l=NumericLiteral()
+    |
+        l=BooleanLiteral()
+    |
+        e=Var()
+    |
+        e=BuiltInCall()
+    ) {
+    if (l != null) {
+        return new LiteralExpression(l);
+    }
+    return e; }
+}
+
+/* [120]    BrackettedExpression ::= '(' Expression ')' */
+private Expression BrackettedExpression() : {
+    Expression e; } {
+
+    "("
+    e=Expression()
+    ")" {
+    return e; }
+}
+
+/* [121]    BuiltInCall ::= Aggregate 
+|    'STR' '(' Expression ')' 
+|    'LANG' '(' Expression ')' 
+|    'LANGMATCHES' '(' Expression ',' Expression ')' 
+|    'DATATYPE' '(' Expression ')' 
+|    'BOUND' '(' Var ')' 
+|    'IRI' '(' Expression ')' 
+|    'URI' '(' Expression ')' 
+|    'BNODE' ( '(' Expression ')' | NIL ) 
+|    'RAND' NIL 
+|    'ABS' '(' Expression ')' 
+|    'CEIL' '(' Expression ')' 
+|    'FLOOR' '(' Expression ')' 
+|    'ROUND' '(' Expression ')' 
+|    'CONCAT' ExpressionList 
+|    SubstringExpression 
+|    'STRLEN' '(' Expression ')' 
+|    StrReplaceExpression 
+|    'UCASE' '(' Expression ')' 
+|    'LCASE' '(' Expression ')' 
+|    'ENCODE_FOR_URI' '(' Expression ')' 
+|    'CONTAINS' '(' Expression ',' Expression ')' 
+|    'STRSTARTS' '(' Expression ',' Expression ')' 
+|    'STRENDS' '(' Expression ',' Expression ')' 
+|    'STRBEFORE' '(' Expression ',' Expression ')' 
+|    'STRAFTER' '(' Expression ',' Expression ')' 
+|    'YEAR' '(' Expression ')' 
+|    'MONTH' '(' Expression ')' 
+|    'DAY' '(' Expression ')' 
+|    'HOURS' '(' Expression ')' 
+|    'MINUTES' '(' Expression ')' 
+|    'SECONDS' '(' Expression ')' 
+|    'TIMEZONE' '(' Expression ')' 
+|    'TZ' '(' Expression ')' 
+|    'NOW' NIL 
+|    'UUID' NIL 
+|    'STRUUID' NIL 
+|    'MD5' '(' Expression ')' 
+|    'SHA1' '(' Expression ')' 
+|    'SHA256' '(' Expression ')' 
+|    'SHA384' '(' Expression ')' 
+|    'SHA512' '(' Expression ')' 
+|    'COALESCE' ExpressionList 
+|    'IF' '(' Expression ',' Expression ',' Expression ')' 
+|    'STRLANG' '(' Expression ',' Expression ')' 
+|    'STRDT' '(' Expression ',' Expression ')' 
+|    'sameTerm' '(' Expression ',' Expression ')' 
+|    'isIRI' '(' Expression ')' 
+|    'isURI' '(' Expression ')' 
+|    'isBLANK' '(' Expression ')' 
+|    'isLITERAL' '(' Expression ')' 
+|    'isNUMERIC' '(' Expression ')' 
+|    RegexExpression 
+|    ExistsFunc 
+|    NotExistsFunc
+
+[122]    RegexExpression ::= 'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')'
+[123]    SubstringExpression ::= 'SUBSTR' '(' Expression ',' Expression ( ',' Expression )? ')'
+[124]    StrReplaceExpression ::= 'REPLACE' '(' Expression ',' Expression ',' Expression ( ',' Expression )? ')'
+
+[127]    Aggregate ::= 'COUNT' '(' 'DISTINCT'? ( '*' | Expression ) ')' 
+| 'SUM' '(' 'DISTINCT'? Expression ')' 
+| 'MIN' '(' 'DISTINCT'? Expression ')' 
+| 'MAX' '(' 'DISTINCT'? Expression ')' 
+| 'AVG' '(' 'DISTINCT'? Expression ')' 
+| 'SAMPLE' '(' 'DISTINCT'? Expression ')' 
+| 'GROUP_CONCAT' '(' 'DISTINCT'? Expression ( ';' 'SEPARATOR' '=' String )? ')'
+
+*/
+
+private BuiltInCall BuiltInCall() : {
+    List<Expression> args = new ArrayList<Expression>();
+    String name, s;
+    Expression e; } {
+    (
+        <GROUP_CONCAT> {
+        name = "GROUP_CONCAT"; }
+        "("
+        (
+            <DISTINCT>
+        )?
+        (
+            e=Expression() {
+            args.add(e); }
+            (
+                ";"
+                <SEPARATOR>
+                "="
+                s = String()
+            )?
+        )
+        ")"
+    |
+        <BOUND> {
+        name = "BOUND"; }
+        "("
+        e=Var() {
+        args.add(e); }
+        ")"
+    |
+        <BNODE> {
+        name = "BNODE"; }
+        (
+            (
+                "("
+                e=Expression() {
+                args.add(e); }
+                ")"
+            )
+        |
+            <NIL>
+        )
+    |
+        <RAND> {
+        name = "RAND"; }
+        <NIL>
+    |
+        <CONCAT> {
+        name = "CONCAT"; }
+        args=ExpressionList()
+    |
+        <NOW> {
+        name = "NOW"; }
+        <NIL>
+    |
+        <UUID> {
+        name = "UUID"; }
+        <NIL>
+    |
+        <STRUUID> {
+        name = "STRUUID"; }
+        <NIL>
+    |
+        <COALESCE> {
+        name = "COALESCE"; }
+        args=ExpressionList()
+    |
+        e=NotExistsFunc() {
+        return (BuiltInCall) e; }
+    |
+        e=ExistsFunc() {
+        return (BuiltInCall) e; }
+    |
+        name=BuiltInCallName()
+        "("
+        (
+            <DISTINCT>
+        )?
+        (
+            "*"
+        |
+            (
+                e=Expression() {
+                args.add(e); }
+                (
+                    ","
+                    e=Expression() {
+                    args.add(e); }
+                )*
+            )
+        )
+        ")"
+    ) {
+    return new BuiltInCall(name, args); }
+}
+
+private String BuiltInCallName() : {
+    Token t;} {
+
+    t=<BUILT_IN_CALL_NAME> {
+    return t.image; }
+}
+
+/* [125]    ExistsFunc ::= 'EXISTS' GroupGraphPattern */
+private Expression ExistsFunc() : {
+    GroupGraphPattern pattern; 
+    PatternExistenceCondition patternExistenceCondition; } {
+
+    <EXISTS>
+    pattern = GroupGraphPattern() {
+    patternExistenceCondition = new PatternExistenceCondition();
+    patternExistenceCondition.setPattern(pattern);
+    return patternExistenceCondition; }
+}
+
+/* [126]    NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern */
+private Expression NotExistsFunc() : {
+    GroupGraphPattern pattern; 
+    PatternExistenceCondition patternExistenceCondition; } {
+
+    <NOT> <EXISTS>
+    pattern = GroupGraphPattern() {
+    patternExistenceCondition = new PatternExistenceCondition();
+    patternExistenceCondition.setPattern(pattern);
+    patternExistenceCondition.setExistenceTest(false);
+    return patternExistenceCondition; }
+}
+
+/* [128]    IRIOrFunction ::= iri ArgList? */
+private Expression IRIOrFunction() : {
+    IRI uriRef;
+    List<Expression> args; } {
+
+    uriRef=IRI()
+    (
+        args=ArgList() {
+        return new FunctionCall(uriRef, args); }
+    )? {
+    return new UriRefExpression(uriRef); }
+}
+
+/* [129]    RDFLiteral ::= String ( LANGTAG | ( '^^' iri ) )? */
+private Literal RDFLiteral() : {
+    Token t;
+    String s;
+    IRI type; } {
+
+    s = String()
+    (
+        t=<LANGTAG> {
+        return new PlainLiteralImpl(s, new Language(t.image.substring(1))); }
+    |
+        (
+            "^^"
+            type=IRI() {
+            return new TypedLiteralImpl(s, type); }
+        )
+    )? {
+    return new PlainLiteralImpl(s); }
+}
+
+/* [130]    NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative */
+private Literal NumericLiteral() : {
+    Literal l; } {
+
+    (
+        l=NumericLiteralUnsigned()
+    |
+        l=NumericLiteralPositive()
+    |
+        l=NumericLiteralNegative()
+    ) {
+    return l; }
+}
+
+/* [131]    NumericLiteralUnsigned ::= INTEGER |  DECIMAL |  DOUBLE */
+private Literal NumericLiteralUnsigned() : {
+    Token t; } {
+
+        t=<INTEGER> {
+        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+    |
+        t=<DECIMAL> {
+        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+    |
+        t=<DOUBLE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [132]    NumericLiteralPositive ::= INTEGER_POSITIVE |  DECIMAL_POSITIVE |  DOUBLE_POSITIVE */
+private Literal NumericLiteralPositive() : {
+    Token t; } {
+
+        t=<INTEGER_POSITIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+    |
+        t=<DECIMAL_POSITIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+    |
+        t=<DOUBLE_POSITIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [133]    NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE */
+private Literal NumericLiteralNegative() : {
+    Token t; } {
+
+        t=<INTEGER_NEGATIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Long.valueOf(t.image)); }
+    |
+        t=<DECIMAL_NEGATIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Float.valueOf(t.image)); }
+    |
+        t=<DOUBLE_NEGATIVE> {
+        return LiteralFactory.getInstance().createTypedLiteral(Double.valueOf(t.image)); }
+}
+
+/* [134]    BooleanLiteral ::= 'true' | 'false' */
+private Literal BooleanLiteral() : {} {
+
+        <TRUE> {
+        return LiteralFactory.getInstance().createTypedLiteral(true); }
+    |
+        <FALSE> {
+        return LiteralFactory.getInstance().createTypedLiteral(false); }
+}
+
+/* [135]    String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 */
+private String String() : {
+    Token t; } {
+
+        t=<STRING_LITERAL1> {
+        return unquote(t.image) ; }
+    |
+        t=<STRING_LITERAL2> {
+        return unquote(t.image) ; }
+    |
+        t=<STRING_LITERAL_LONG1> {
+        return unTripleQuote(t.image) ; }
+    |
+        t=<STRING_LITERAL_LONG2> {
+        return unTripleQuote(t.image) ; }
+}
+
+/* [136]    iri ::= IRIREF |  PrefixedName */
+private IRI IRI() : {
+    IRI uriRef;
+    Token t; } {
+
+        t=<IRIREF> {
+        return createUriRef(unquote(t.image)); }
+    |
+        uriRef=PrefixedName() {
+        return uriRef; }
+}
+
+/* [137]    PrefixedName ::= PNAME_LN | PNAME_NS */
+private IRI PrefixedName() : {
+    Token t; } {
+
+    ( t=<PNAME_LN> | t=<PNAME_NS> ) {
+    return createUriRef(t.image); }
+}
+
+/* [138]    BlankNode ::= BLANK_NODE_LABEL | ANON */
+private ResourceOrVariable BlankNode() : {
+    Token t; } {
+
+        t=<BLANK_NODE_LABEL> {
+        return getBNode(t.image); }
+    |
+        <ANON> {
+        return getNewBNode(); }
+}
+
+
+TOKEN : {
+  /* [139]    IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* '>' */
+  < IRIREF : "<" ( ~["<", ">", "\"", "{", "}", "|", "^", "`", "\\", "\u0000"-"\u0020"] )* ">" >
+  |
+  /* [140]    PNAME_NS ::= PN_PREFIX? ':' */
+  < PNAME_NS : (<PN_PREFIX>)? ":" >
+  |
+  /* [141]    PNAME_LN ::= PNAME_NS PN_LOCAL */
+  < PNAME_LN : <PNAME_NS> <PN_LOCAL> >
+  |
+  /* [142]    BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? */
+  < BLANK_NODE_LABEL : "_:" ( <PN_CHARS_U> | ["0"-"9"] ) ( ( <PN_CHARS> | "." )* <PN_CHARS> )? >
+  |
+  /* [143]    VAR1 ::= '?' VARNAME */
+  < VAR1 : "?" <VARNAME> >
+  |
+  /* [144]    VAR2 ::= '$' VARNAME */
+  < VAR2 : "$" <VARNAME> >
+  |
+  /* [145]    LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* */
+  < LANGTAG : "@" (["a"-"z", "A"-"Z"])+ ( "-" (["a"-"z", "A"-"Z", "0"-"9"])+ )* >
+  |
+  < BUILT_IN_CALL_NAME : ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "0"-"9", "_"])* >
+}
+
+TOKEN : {
+  < #Z_9 : ["0"-"9"] >
+  |
+  < #Z_9r : (<Z_9>)+ >
+  |
+  < #Z_9o : (<Z_9>)* >
+  |
+  /* [146]    INTEGER ::= [0-9]+ */
+  < INTEGER : <Z_9r> >
+  |
+  /* [147]    DECIMAL ::= [0-9]* '.' [0-9]+ */
+  < DECIMAL : <Z_9o> "." <Z_9r> >
+  |
+  /* [148]    DOUBLE ::= [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT */
+  < DOUBLE : ( <Z_9r> "." <Z_9o>  <EXPONENT> ) | ( "." <Z_9r> <EXPONENT> ) | ( <Z_9r> <EXPONENT> ) >
+  |
+  /* [149]    INTEGER_POSITIVE ::= '+' INTEGER */
+  < INTEGER_POSITIVE : "+" <INTEGER> >
+  |
+  /* [150]    DECIMAL_POSITIVE ::= '+' DECIMAL */
+  < DECIMAL_POSITIVE : "+" <DECIMAL> >
+  |
+  /* [151]    DOUBLE_POSITIVE ::= '+' DOUBLE */
+  < DOUBLE_POSITIVE : "+" <DOUBLE> >
+  |
+  /* [152]    INTEGER_NEGATIVE ::= '-' INTEGER */
+  < INTEGER_NEGATIVE : "-" <INTEGER> >
+  |
+  /* [153]    DECIMAL_NEGATIVE ::= '-' DECIMAL */
+  < DECIMAL_NEGATIVE : "-" <DECIMAL> >
+  |
+  /* [154]    DOUBLE_NEGATIVE ::= '-' DOUBLE */
+  < DOUBLE_NEGATIVE : "-" <DOUBLE> >
+  |
+  /* [155]    EXPONENT ::= [eE] [+-]? [0-9]+ */
+  < #EXPONENT : ["e","E"] (["+","-"])? <Z_9r> >
+}
+
+TOKEN : {
+  /* [156]    STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'" */
+  < STRING_LITERAL1 : "'" ( ~["'", "\\", "\r", "\n"] | <ECHAR> )* "'" >
+  |
+  /* [157]    STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"' */
+  < STRING_LITERAL2 : "\"" ( ~["\"", "\\", "\r", "\n"] | <ECHAR> )* "\"" >
+  |
+  /* [158]    STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''" */
+  < STRING_LITERAL_LONG1 : "'''" ( ( "'" | "''" )? ( ~["'","\\"] | <ECHAR> ) )* "'''" >
+  |
+  /* [159]    STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""' */
+  < STRING_LITERAL_LONG2 : "\"\"\"" ( ( "\"" | "\"\"" )? ( ~["\"","\\"] | <ECHAR> ) )* "\"\"\"" >
+  |
+  /* [160]    #ECHAR ::= '\' [tbnrf\"'] */
+  < #ECHAR : "\\" ["t","b","n","r","f","\\","\"","'"] >
+}
+
+TOKEN : {
+  /* [161]    NIL ::= '(' WS* ')' */
+  < NIL : "(" (<WS>)* ")" >
+  |
+  /* [162]    WS ::= #x20 | #x9 | #xD | #xA */
+  < #WS : " " | "\t" | "\n" | "\r" >
+  |
+  /* [163]    ANON ::= '[' WS* ']' */
+  < ANON : "[" (<WS>)* "]" >
+}
+
+TOKEN : {
+  /* [164]    #PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] */
+  < #PN_CHARS_BASE : ["A"-"Z", "a"-"z", "\u00C0"-"\u00D6", "\u00D8"-"\u00F6", "\u00F8"-"\u02FF", "\u0370"-"\u037D", "\u037F"-"\u1FFF", "\u200C"-"\u200D", "\u2070"-"\u218F", "\u2C00"-"\u2FEF", "\u3001"-"\uD7FF", "\uF900"-"\uFDCF", "\uFDF0"-"\uFFFD"] >
+  |
+  /* [165]    #PN_CHARS_U ::= PN_CHARS_BASE | '_' */
+  < #PN_CHARS_U : <PN_CHARS_BASE> | "_" >
+  |
+  /* [166]    #VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* */
+  < #VARNAME : (<PN_CHARS_U> | <Z_9>) (<PN_CHARS_U> | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"])* >
+  |
+  /* [167]    #PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] */
+  < #PN_CHARS : <PN_CHARS_U> | "-" | <Z_9> | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"] >
+  |
+  /* [168]    PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? */
+  < PN_PREFIX : <PN_CHARS_BASE> ((<PN_CHARS> | "." )* <PN_CHARS>)? >
+  |
+  /* [169]    PN_LOCAL ::= ( PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? */
+  /* Note that SPARQL local names allow leading digits while XML local names do not. */
+  < PN_LOCAL : (<PN_CHARS_U> | ":" | <Z_9> | <PLX>) ((<PN_CHARS> | "." | ":" | <PLX>)* (<PN_CHARS> | ":" | <PLX>) )? >
+  |
+  /* [170]    PLX ::= PERCENT | PN_LOCAL_ESC */
+  < PLX : <PERCENT> | <PN_LOCAL_ESC> >
+  |
+  /* [171]    PERCENT ::= '%' HEX HEX */
+  < PERCENT : "%" <HEX> <HEX> >
+  |
+  /* [172]    HEX ::= [0-9] | [A-F] | [a-f] */
+  < #HEX : <Z_9> | ["A"-"F", "a"-"f"] >
+  |
+  /* [173]    PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) */
+  < PN_LOCAL_ESC : "\\" ( "_" | "~" | "." | "-" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%" ) >
+}
diff --git a/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserSerializerCombinationTest.java b/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserSerializerCombinationTest.java
new file mode 100644
index 0000000..b84c388
--- /dev/null
+++ b/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserSerializerCombinationTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.sparql.query.Query;
+import org.junit.*;
+
+/**
+ *
+ * @author hasan
+ */
+public class QueryParserSerializerCombinationTest {
+    
+    public QueryParserSerializerCombinationTest() {
+    }
+    
+    @BeforeClass
+    public static void setUpClass() {
+    }
+    
+    @AfterClass
+    public static void tearDownClass() {
+    }
+    
+    @Before
+    public void setUp() {
+    }
+    
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testPatternOrderPreservation() throws Exception {
+        String queryString =
+                "SELECT ?property ?range ?property_description ?subproperty ?subproperty_description \n"
+                + "WHERE\n"
+                + "{ ?property <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .\n"
+                + "{ { ?property <http://www.w3.org/2000/01/rdf-schema#domain> ?superclass .\n"
+                + "<http://example.org/ontologies/market_ontology.owl#Company> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superclass .\n"
+                + "}  UNION { ?property <http://www.w3.org/2000/01/rdf-schema#domain> ?dunion .\n"
+                + "?dunion <http://www.w3.org/2002/07/owl#unionOf> ?dlist .\n"
+                + "?dlist <http://jena.hpl.hp.com/ARQ/list#member> ?superclass .\n"
+                + "<http://example.org/ontologies/market_ontology.owl#Company> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superclass .\n"
+                + "} } { { ?property <http://www.w3.org/2000/01/rdf-schema#range> ?superrange .\n"
+                + "?range <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?superrange .\n"
+                + "FILTER (! (isBLANK(?range)))\n"
+                + "}  UNION { ?property <http://www.w3.org/2000/01/rdf-schema#range> ?range .\n"
+                + "FILTER (! (isBLANK(?range)))\n"
+                + "} }  OPTIONAL { ?somesub <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?range .\n"
+                + "FILTER (((?somesub) != (<http://www.w3.org/2002/07/owl#Nothing>)) && ((?somesub) != (?range)))\n"
+                + "}  OPTIONAL { ?subproperty <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> ?property .\n"
+                 + " OPTIONAL { ?subproperty <http://purl.org/dc/elements/1.1/description> ?subproperty_description .\n"
+                + "} FILTER (((?subproperty) != (<http://www.w3.org/2002/07/owl#bottomObjectProperty>)) && ((?subproperty) != (?property)))\n"
+                + "}  OPTIONAL { ?property <http://purl.org/dc/elements/1.1/description> ?property_description .\n"
+                + "} FILTER ((?property) != (<http://www.w3.org/2002/07/owl#bottomObjectProperty>))\n"
+                + "FILTER ((?range) != (<http://www.w3.org/2002/07/owl#Nothing>))\n"
+                + "FILTER (! (BOUND(?somesub)))\n"
+                + "} \n";
+
+        Query query = QueryParser.getInstance().parse(queryString);
+        Assert.assertEquals(queryString.replaceAll("\\s", "").trim(), query.toString().replaceAll("\\s", "").trim());
+    }
+
+    @Test
+    public void testParsingAndSerializationStability() throws Exception {
+        String queryString =
+                "PREFIX mo: <http://example.org/ontologies/market_ontology.owl#>\n"
+                + "PREFIX list: <http://jena.hpl.hp.com/ARQ/list#>\n"
+                + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
+                + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+                + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
+                + "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n"
+                + "SELECT ?property ?range ?property_description ?subproperty ?subproperty_description\n"
+                + "WHERE {\n"
+                + "    ?property a owl:ObjectProperty .\n"
+                + "    FILTER (?property != owl:bottomObjectProperty) .\n"
+                + "    {\n"
+                + "        {\n"
+                + "            ?property rdfs:domain ?superclass .\n"
+                + "            mo:Company rdfs:subClassOf ?superclass .\n"
+                + "        }\n"
+                + "        UNION\n"
+                + "        {\n"
+                + "            ?property rdfs:domain ?dunion .\n"
+                + "            ?dunion owl:unionOf ?dlist .\n"
+                + "            ?dlist list:member ?superclass .\n"
+                + "            mo:Company rdfs:subClassOf ?superclass .\n"
+                + "        }\n"
+                + "    }\n"
+                + "    {\n"
+                + "        {\n"
+                + "            ?property rdfs:range ?superrange .\n"
+                + "            ?range rdfs:subClassOf ?superrange .\n"
+                + "            FILTER (!isBlank(?range)) .\n"
+                + "        }\n"
+                + "        UNION\n"
+                + "        {\n"
+                + "            ?property rdfs:range ?range .\n"
+                + "            FILTER (!isBlank(?range)) .\n"
+                + "        }\n"
+                + "    } .\n"
+                + "    FILTER (?range != owl:Nothing) .\n"
+                + "    OPTIONAL { ?somesub rdfs:subClassOf ?range . FILTER(?somesub != owl:Nothing && ?somesub != ?range)}\n"
+                + "    FILTER (!bound(?somesub)) .\n"
+                + "    OPTIONAL {\n"
+                + "        ?subproperty rdfs:subPropertyOf ?property .\n"
+                + "        FILTER(?subproperty != owl:bottomObjectProperty && ?subproperty != ?property)\n"
+                + "        OPTIONAL { ?subproperty dc:description ?subproperty_description . }\n"
+                + "    }\n"
+                + "    OPTIONAL { ?property dc:description ?property_description . }\n"
+                + "} ";
+
+        Query query1 = QueryParser.getInstance().parse(queryString);
+        Thread.sleep(5000l);
+        Query query2 = QueryParser.getInstance().parse(queryString);
+        Assert.assertEquals(query1.toString(), query2.toString());
+    }
+}
diff --git a/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserTest.java b/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserTest.java
new file mode 100644
index 0000000..fe1ce88
--- /dev/null
+++ b/sparql/src/test/java/org/apache/clerezza/sparql/QueryParserTest.java
@@ -0,0 +1,367 @@
+/*
+ * 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.sparql;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.Language;
+import org.apache.clerezza.api.impl.literal.PlainLiteralImpl;
+import org.apache.clerezza.sparql.query.*;
+import org.apache.clerezza.sparql.query.impl.SimpleTriplePattern;
+import org.junit.Assert;
+import org.junit.Test;
+
... 1165 lines suppressed ...


[clerezza] 44/45: CLEREZZA-1040: Update versions

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 6d149e91f8174b37c28666243d7334b97f858b90
Author: Hasan <ha...@apache.org>
AuthorDate: Sat May 11 20:45:29 2019 +0200

    CLEREZZA-1040: Update versions
---
 api.impl/pom.xml            | 43 +++++++++++-----------------
 api.utils/pom.xml           | 20 ++++++-------
 api/pom.xml                 | 21 ++++----------
 dataset/pom.xml             | 24 ++++++++--------
 jaxrs.rdf.providers/pom.xml | 18 ++++++------
 ontologies/pom.xml          | 12 ++++----
 parent/pom.xml              | 69 ++++++++++++++++++++++-----------------------
 pom.xml                     | 55 ++++++++++++++++++++----------------
 representation/pom.xml      | 18 ++++++------
 sparql/pom.xml              | 47 +++++++++++++++---------------
 test.utils/pom.xml          | 19 ++++++-------
 11 files changed, 164 insertions(+), 182 deletions(-)

diff --git a/api.impl/pom.xml b/api.impl/pom.xml
index 326b7e4..9034432 100644
--- a/api.impl/pom.xml
+++ b/api.impl/pom.xml
@@ -19,32 +19,34 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>api.impl</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
     <name>Clerezza - API Implementation</name>
     <description>
         This module implements Apache Clerezza API
     </description>
 
-    <issueManagement>
-        <system>jira</system>
-        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
-    </issueManagement>
-
-    <scm>
-        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
-        <tag>HEAD</tag>
-    </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
     <build>
         <plugins>
@@ -60,17 +62,4 @@
             </plugin>
         </plugins>
     </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
 </project>
diff --git a/api.utils/pom.xml b/api.utils/pom.xml
index 1b31090..5cc4235 100644
--- a/api.utils/pom.xml
+++ b/api.utils/pom.xml
@@ -19,17 +19,17 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>api.utils</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - API Utilities</name>
     <description>Utility classes to work with Clerezza API</description>
 
@@ -42,32 +42,32 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>representation</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>dataset</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>ontologies</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>test.utils</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/api/pom.xml b/api/pom.xml
index 8fbc4ac..95d1f40 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -19,15 +19,16 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>api</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
     <name>Clerezza - API</name>
     <description>
@@ -35,18 +36,6 @@
         http://www.w3.org/TR/rdf11-concepts/
     </description>
 
-    <issueManagement>
-        <system>jira</system>
-        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
-    </issueManagement>
-
-    <scm>
-        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
-        <tag>HEAD</tag>
-    </scm>
-
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -63,7 +52,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.api.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/dataset/pom.xml b/dataset/pom.xml
index 2042366..b3492d9 100644
--- a/dataset/pom.xml
+++ b/dataset/pom.xml
@@ -16,21 +16,20 @@
   either  express  or implied.  See  the License  for  the  specific
   language governing permissions and limitations under  the License.
 -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>8-SNAPSHOT</version>
-        <relativePath/>
+        <version>8</version>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
     <artifactId>dataset</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - DataSet</name>
     <description>Interfaces and utilities to access RDF Graphs</description>
 
@@ -38,22 +37,22 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>sparql</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>test.utils</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -84,6 +83,7 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
     <build>
         <plugins>
             <plugin>
@@ -92,7 +92,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.dataset.*, org.apache.clerezza.simple.storage.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*, org.apache.clerezza.simple.storage.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/jaxrs.rdf.providers/pom.xml b/jaxrs.rdf.providers/pom.xml
index 4156840..f0916e7 100644
--- a/jaxrs.rdf.providers/pom.xml
+++ b/jaxrs.rdf.providers/pom.xml
@@ -19,39 +19,39 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>jaxrs.rdf.providers</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - JAX-RS MessageBodyProviders for RDF</name>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>representation</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.utils</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>com.googlecode.json-simple</groupId>
@@ -76,4 +76,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/ontologies/pom.xml b/ontologies/pom.xml
index a936230..2d60b9e 100644
--- a/ontologies/pom.xml
+++ b/ontologies/pom.xml
@@ -19,17 +19,17 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>ontologies</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - Ontologies</name>
     <description>Ontology classes</description>
 
@@ -37,7 +37,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
     </dependencies>
 
@@ -49,7 +49,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.ontologies.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/parent/pom.xml b/parent/pom.xml
index 2607b41..12bb040 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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
 
- 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
 
-   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.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache</groupId>
         <artifactId>apache</artifactId>
         <version>17</version>
-        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>clerezza</artifactId>
     <packaging>pom</packaging>
-    <name>Clerezza - Parent for all</name>
-    <url>http://clerezza.apache.org/mvn-site/</url>
-    <version>8-SNAPSHOT</version>
-    <description>The direct or indirect parent of all Clerezza Artifacts</description>
+    <name>Clerezza - Parent</name>
+    <url>https://mvnrepository.com/artifact/org.apache.clerezza</url>
+    <version>8</version>
+    <description>The direct or indirect parent of all Clerezza artifacts</description>
     <properties>
         <sourceReleaseAssemblyDescriptor>multimodule-source-release</sourceReleaseAssemblyDescriptor>
         <stanbol.version>0.12.0</stanbol.version>
@@ -560,39 +560,38 @@
     <distributionManagement>
         <!-- where to deploy the web site -->
         <!-- <site>
-            <id>people.apache.org</id>
-            <url>scp://people.apache.org/www/incubator.apache.org/content/clerezza/mvn-site/</url>
+            <id></id>
+            <url></url>
         </site> -->
 
         <!-- where to deploy the artifacts -->
         <repository>
             <id>apache.releases.https</id>
             <name>Apache Release Distribution Repository</name>
-            <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+            <url>https://repository.apache.org/content/repositories/releases/</url>
         </repository>
         <snapshotRepository>
             <id>apache.snapshots.https</id>
             <name>Apache Development Snapshot Repository</name>
-            <url>https://repository.apache.org/content/repositories/snapshots</url>
+            <url>https://repository.apache.org/content/repositories/snapshots/</url>
         </snapshotRepository>
     </distributionManagement>
 
-    <!-- jira -->
     <issueManagement>
         <system>Jira</system>
-        <url>https://issues.apache.org/jira/browse/CLEREZZA</url>
+        <url>https://issues.apache.org/jira/projects/CLEREZZA</url>
     </issueManagement>
+
     <ciManagement>
         <system>Jenkins</system>
-        <url>https://builds.apache.org/job/clerezza-trunk-1.6/</url>
+        <url>https://builds.apache.org/job/clerezza/</url>
     </ciManagement>
 
-
     <scm>
-        <url>http://git.apache.org/clerezza.git/</url>
-        <connection>scm:git:git://git.apache.org/clerezza.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-        <tag>reactor-0.3</tag>
+        <url>https://github.com/apache/clerezza</url>
+        <connection>scm:git:https://gitbox.apache.org/repos/asf/clerezza.git</connection>
+        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/clerezza.git</developerConnection>
+        <tag>HEAD</tag>
     </scm>
 
     <!-- lets generate reports -->
diff --git a/pom.xml b/pom.xml
index febb632..4ba15b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,44 +1,52 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          !!!!!!                               !!!!!!
-         !!!!!!   This pom is only provided   !!!!!!
+         !!!!!!   This pom is provided only   !!!!!!
          !!!!!!   for build convenience and   !!!!!!
          !!!!!!   should not be released      !!!!!!
          !!!!!!                               !!!!!!
-         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+-->
     <modelVersion>4.0.0</modelVersion>
-    
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>8-SNAPSHOT</version>
-        <relativePath />
+        <version>8</version>
+        <relativePath>parent/pom.xml</relativePath>
      </parent>
 
     <artifactId>clerezza-reactor</artifactId>
+    <version>2.0.0</version>
     <packaging>pom</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - Reactor</name>
     <description>
         Apache Clerezza provides an API modelling RDF data as defined by 
         http://www.w3.org/TR/rdf11-concepts/
     </description>
-    
+
     <url>http://clerezza.apache.org/</url>
-    
-    <issueManagement>
-        <system>jira</system>
-        <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
-    </issueManagement>
-    
     <inceptionYear>2015</inceptionYear>
-    <scm>
-        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</connection>
-        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza.git</developerConnection>
-        <url>https://git-wip-us.apache.org/repos/asf/clerezza.git</url>
-      <tag>HEAD</tag>
-  </scm>
 
     <modules>
         <module>parent</module>
@@ -52,6 +60,7 @@
         <module>api.utils</module>
         <module>jaxrs.rdf.providers</module>
     </modules>
+
     <profiles>
         <profile>
             <id>rat</id>
@@ -109,7 +118,5 @@
                 </plugins>
             </build>
         </profile>
-        
     </profiles>
-    
 </project>
diff --git a/representation/pom.xml b/representation/pom.xml
index 342cde5..e5e80c3 100644
--- a/representation/pom.xml
+++ b/representation/pom.xml
@@ -16,21 +16,20 @@
   either  express  or implied.  See  the License  for  the  specific
   language governing permissions and limitations under  the License.
 -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>8-SNAPSHOT</version>
+        <artifactId>clerezza</artifactId>
+        <version>8</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>representation</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - Representation</name>
     <description>This bundle provides for functionality to parse and serialize RDF Graphs</description>
 
@@ -38,12 +37,12 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -72,6 +71,7 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
     <build>
         <plugins>
             <plugin>
@@ -80,7 +80,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.representation.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
@@ -98,4 +98,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/sparql/pom.xml b/sparql/pom.xml
index 4b93faa..100b82d 100644
--- a/sparql/pom.xml
+++ b/sparql/pom.xml
@@ -1,37 +1,35 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!--
+  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
 
-   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.
+    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.
 -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>8-SNAPSHOT</version>
-        <relativePath/>
+        <version>8</version>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
     <artifactId>sparql</artifactId>
+    <version>2.0.0</version>
     <packaging>bundle</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - SPARQL</name>
     <description>Model SPARQL query and update</description>
 
@@ -39,12 +37,12 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -73,6 +71,7 @@
             <version>1.2.8</version>
         </dependency>
     </dependencies>
+
     <build>
         <plugins>
             <plugin>
@@ -112,7 +111,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.clerezza.sparql.*</Export-Package>
+                        <Export-Package>${project.groupId}.${project.artifactId}.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/test.utils/pom.xml b/test.utils/pom.xml
index f7c4bc5..900cc08 100644
--- a/test.utils/pom.xml
+++ b/test.utils/pom.xml
@@ -16,21 +16,20 @@
   either  express  or implied.  See  the License  for  the  specific
   language governing permissions and limitations under  the License.
 -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>8-SNAPSHOT</version>
-        <relativePath/>
+        <version>8</version>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
     <artifactId>test.utils</artifactId>
+    <version>2.0.0</version>
     <packaging>jar</packaging>
-    <version>8-SNAPSHOT</version>
     <name>Clerezza - API Test Utilities</name>
     <description>Utilities to test Clerezza API implementations</description>
 
@@ -42,16 +41,16 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>api.impl</artifactId>
-            <version>8-SNAPSHOT</version>
+            <version>2.0.0</version>
         </dependency>
         <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>


[clerezza] 25/45: CLEREZZA-1025: Use api and api.impl module in representation module

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 447fd0081511df2b2d41808bae95f5bfb97f4146
Author: Hasan <ha...@apache.org>
AuthorDate: Tue Feb 12 01:01:08 2019 +0100

    CLEREZZA-1025: Use api and api.impl module in representation module
---
 representation/pom.xml                             | 54 +++++++++++-----------
 .../org/apache/clerezza/representation/Parser.java | 34 +++++++-------
 .../clerezza/representation/ParsingProvider.java   | 30 ++++++------
 .../apache/clerezza/representation/Serializer.java | 28 +++++------
 .../representation/SerializingProvider.java        | 29 ++++++------
 .../clerezza/representation/SupportedFormat.java   | 26 +++++------
 .../representation/UnsupportedFormatException.java | 26 +++++------
 .../UnsupportedParsingFormatException.java         | 26 +++++------
 .../UnsupportedSerializationFormatException.java   | 26 +++++------
 .../apache/clerezza/representation/ParserTest.java | 30 ++++++------
 .../clerezza/representation/SerializerTest.java    | 28 +++++------
 .../representation/TestServiceManagedProvider.java | 30 ++++++------
 ....apache.clerezza.representation.ParsingProvider | 17 -------
 13 files changed, 182 insertions(+), 202 deletions(-)

diff --git a/representation/pom.xml b/representation/pom.xml
index 7101b66..342cde5 100644
--- a/representation/pom.xml
+++ b/representation/pom.xml
@@ -1,33 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
+  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
 
-   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.
+    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.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
     <parent>
-        <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
         <version>8-SNAPSHOT</version>
-        <relativePath/>
+        <relativePath>../parent/pom.xml</relativePath>
     </parent>
+    <modelVersion>4.0.0</modelVersion>
 
     <artifactId>representation</artifactId>
     <packaging>bundle</packaging>
@@ -37,14 +36,14 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.clerezza.commons-rdf</groupId>
-            <artifactId>commons-rdf-api</artifactId>
-            <version>0.2</version>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api</artifactId>
+            <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.clerezza.commons-rdf</groupId>
-            <artifactId>commons-rdf-impl-utils</artifactId>
-            <version>0.2</version>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>api.impl</artifactId>
+            <version>8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -64,9 +63,8 @@
             <version>1.2.8</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>utils</artifactId>
-            <version>0.2</version>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
diff --git a/representation/src/main/java/org/apache/clerezza/representation/Parser.java b/representation/src/main/java/org/apache/clerezza/representation/Parser.java
index 4202ad6..7612478 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/Parser.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/Parser.java
@@ -1,27 +1,27 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleMGraph;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.ImmutableGraph;
+import org.apache.clerezza.api.impl.graph.SimpleMGraph;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.*;
diff --git a/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java b/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java
index fbdf721..f315edc 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/ParsingProvider.java
@@ -1,25 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
 
 import java.io.InputStream;
 
diff --git a/representation/src/main/java/org/apache/clerezza/representation/Serializer.java b/representation/src/main/java/org/apache/clerezza/representation/Serializer.java
index e36b9c7..0eafb08 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/Serializer.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/Serializer.java
@@ -1,24 +1,24 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.*;
diff --git a/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java b/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java
index 3053e45..45ed62c 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/SerializingProvider.java
@@ -1,28 +1,27 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
 
 import java.io.OutputStream;
 
-
 /**
  * An instance of this class serializes <code>Graph</code>s to a
  * specified serialization format. The supported formats are indicated using the
diff --git a/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java b/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java
index d246a39..ec13ebc 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/SupportedFormat.java
@@ -1,21 +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
+ * 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.
+ * 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.representation;
 
 import java.lang.annotation.ElementType;
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java
index d914a3d..9bda2f7 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedFormatException.java
@@ -1,21 +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
+ * 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.
+ * 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.representation;
 
 /**
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java
index 51fafc9..2f20a06 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedParsingFormatException.java
@@ -1,21 +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
+ * 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.
+ * 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.representation;
 
 /**
diff --git a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java
index b2bf5cc..d47806d 100644
--- a/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java
+++ b/representation/src/main/java/org/apache/clerezza/representation/UnsupportedSerializationFormatException.java
@@ -1,21 +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
+ * 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.
+ * 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.representation;
 
 /**
diff --git a/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
index 97f6e69..12f1768 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
@@ -1,26 +1,26 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
 import junit.framework.Assert;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
 import org.junit.Test;
 
 import java.io.InputStream;
diff --git a/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
index feae79a..d908556 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
@@ -1,25 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
 import junit.framework.Assert;
-import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.api.Graph;
 import org.junit.Test;
 
 import java.io.OutputStream;
diff --git a/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
index ec6fe9c..e9b8dbc 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
@@ -1,25 +1,25 @@
 /*
- * 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
+ * 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.
+ * 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.representation;
 
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.IRI;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider b/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider
index 16e04f4..1752e40 100644
--- a/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider
+++ b/representation/src/test/resources/META-INF/services/org.apache.clerezza.representation.ParsingProvider
@@ -1,18 +1 @@
-# 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.
-
 org.apache.clerezza.representation.TestServiceManagedProvider
\ No newline at end of file


[clerezza] 39/45: CLEREZZA-1039: Reformat site.xml

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hasan pushed a commit to branch reunited
in repository https://gitbox.apache.org/repos/asf/clerezza.git

commit 471770a27a805cd94875e752ee9990e5e3fa46c1
Author: Hasan <ha...@apache.org>
AuthorDate: Fri Feb 15 21:09:08 2019 +0100

    CLEREZZA-1039: Reformat site.xml
---
 src/site/site.xml | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/site/site.xml b/src/site/site.xml
index a6596b2..98ed9df 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -1,22 +1,19 @@
 <!--
+  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
 
- 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.
+    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.
 -->
 <project>
     <publishDate position="navigation-bottom" format="yyyy-MM-dd"/>