clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [4/4] clerezza git commit: using rdf.commons draft in core
Date Thu, 18 Dec 2014 20:23:02 GMT
using rdf.commons draft in core


Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/29f822c7
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/29f822c7
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/29f822c7

Branch: refs/heads/rdf-commons
Commit: 29f822c7e1c0794f8e4b1d1442ce0b178642c18d
Parents: 68d7f66
Author: Reto Gm?r <reto@apache.org>
Authored: Thu Dec 18 15:13:37 2014 +0000
Committer: Reto Gm?r <reto@apache.org>
Committed: Thu Dec 18 15:13:37 2014 +0000

----------------------------------------------------------------------
 rdf.core/pom.xml                                |   5 +
 .../org/apache/clerezza/rdf/core/BNode.java     |  30 ---
 .../org/apache/clerezza/rdf/core/Graph.java     |  55 ----
 .../rdf/core/InvalidLiteralTypeException.java   |   4 +-
 .../org/apache/clerezza/rdf/core/Language.java  |  63 -----
 .../org/apache/clerezza/rdf/core/Literal.java   |  37 ---
 .../clerezza/rdf/core/LiteralFactory.java       |   5 +-
 .../org/apache/clerezza/rdf/core/MGraph.java    |  47 ----
 .../apache/clerezza/rdf/core/NonLiteral.java    |  30 ---
 .../apache/clerezza/rdf/core/PlainLiteral.java  |  47 ----
 .../org/apache/clerezza/rdf/core/Resource.java  |  30 ---
 .../org/apache/clerezza/rdf/core/Triple.java    |  57 ----
 .../clerezza/rdf/core/TripleCollection.java     | 105 --------
 .../apache/clerezza/rdf/core/TypedLiteral.java  |  57 ----
 .../org/apache/clerezza/rdf/core/UriRef.java    |  83 ------
 .../access/EntityAlreadyExistsException.java    |   8 +-
 .../core/access/EntityUndeletableException.java |   8 +-
 .../rdf/core/access/GraphServiceFactory.java    |   8 +-
 .../rdf/core/access/LockableMGraph.java         |   2 +-
 .../rdf/core/access/LockableMGraphWrapper.java  |  18 +-
 .../rdf/core/access/LockingIterator.java        |   2 +-
 .../rdf/core/access/MGraphServiceFactory.java   |   6 +-
 .../rdf/core/access/NoSuchEntityException.java  |   8 +-
 .../rdf/core/access/QueryableTcProvider.java    |   6 +-
 .../clerezza/rdf/core/access/SecuredMGraph.java |   6 +-
 .../core/access/SecuredTripleCollection.java    |  20 +-
 .../clerezza/rdf/core/access/TcManager.java     |  72 ++---
 .../clerezza/rdf/core/access/TcProvider.java    | 268 +++++++++----------
 .../rdf/core/access/TcProviderMultiplexer.java  |  58 ++--
 .../access/security/TcAccessController.java     |  82 +++---
 .../clerezza/rdf/core/event/AddEvent.java       |  37 ---
 .../clerezza/rdf/core/event/FilterTriple.java   |  86 ------
 .../clerezza/rdf/core/event/GraphEvent.java     |  59 ----
 .../clerezza/rdf/core/event/GraphListener.java  |  43 ---
 .../clerezza/rdf/core/event/RemoveEvent.java    |  37 ---
 .../clerezza/rdf/core/impl/AbstractGraph.java   |  16 +-
 .../clerezza/rdf/core/impl/AbstractMGraph.java  |   4 +-
 .../rdf/core/impl/AbstractTripleCollection.java |  28 +-
 .../rdf/core/impl/DelayedNotificator.java       |   4 +-
 .../rdf/core/impl/PlainLiteralImpl.java         |  17 +-
 .../clerezza/rdf/core/impl/SimpleGraph.java     |  12 +-
 .../rdf/core/impl/SimpleLiteralFactory.java     |  92 +++----
 .../clerezza/rdf/core/impl/SimpleMGraph.java    |   6 +-
 .../rdf/core/impl/SimpleTripleCollection.java   |  10 +-
 .../clerezza/rdf/core/impl/TripleImpl.java      |  22 +-
 .../rdf/core/impl/TypedLiteralImpl.java         |  25 +-
 .../rdf/core/impl/WriteBlockedMGraph.java       |   2 +-
 .../core/impl/WriteBlockedTripleCollection.java |  16 +-
 .../core/impl/graphmatching/GraphMatcher.java   |  44 +--
 .../core/impl/graphmatching/HashMatching.java   | 114 ++++----
 .../rdf/core/impl/graphmatching/Utils.java      |  20 +-
 .../core/impl/util/PrivilegedGraphWrapper.java  |   2 +-
 .../core/impl/util/PrivilegedMGraphWrapper.java |   4 +-
 .../util/PrivilegedTripleCollectionWrapper.java |  18 +-
 .../rdf/core/serializedform/Parser.java         |  10 +-
 .../core/serializedform/ParsingProvider.java    |   6 +-
 .../rdf/core/serializedform/Serializer.java     |   2 +-
 .../serializedform/SerializingProvider.java     |   2 +-
 .../clerezza/rdf/core/sparql/QueryEngine.java   |   2 +-
 .../rdf/core/sparql/SolutionMapping.java        |   6 +-
 .../rdf/core/sparql/SparqlPreParser.java        |   8 +-
 .../clerezza/rdf/core/sparql/query/DataSet.java |   6 +-
 .../rdf/core/sparql/query/FunctionCall.java     |  10 +-
 .../core/sparql/query/GroupGraphPattern.java    |   4 +-
 .../rdf/core/sparql/query/InlineData.java       |   4 +-
 .../core/sparql/query/LiteralExpression.java    |   2 +-
 .../rdf/core/sparql/query/PredicatePath.java    |   8 +-
 .../core/sparql/query/ResourceOrVariable.java   |  12 +-
 .../rdf/core/sparql/query/UriRefExpression.java |  10 +-
 .../rdf/core/sparql/query/UriRefOrVariable.java |  10 +-
 .../core/sparql/query/impl/SimpleDataSet.java   |  14 +-
 .../query/impl/SimpleGroupGraphPattern.java     |  10 +-
 .../sparql/query/impl/SimpleInlineData.java     |   8 +-
 .../query/impl/SimplePropertyPathPattern.java   |  16 +-
 .../rdf/core/sparql/query/impl/SimpleQuery.java |   6 +-
 .../query/impl/SimpleStringQuerySerializer.java |  14 +-
 .../sparql/query/impl/SimpleTriplePattern.java  |  20 +-
 .../clerezza/rdf/core/sparql/update/Update.java |   4 +-
 .../rdf/core/sparql/update/UpdateOperation.java |   6 +-
 .../sparql/update/impl/BaseUpdateOperation.java |  18 +-
 .../update/impl/ClearOrDropOperation.java       |   8 +-
 .../sparql/update/impl/CreateOperation.java     |   6 +-
 .../core/sparql/update/impl/LoadOperation.java  |   6 +-
 .../sparql/update/impl/ModifyOperation.java     |  20 +-
 .../core/sparql/update/impl/SimpleUpdate.java   |   6 +-
 .../update/impl/SimpleUpdateOperation.java      |  14 +-
 .../update/impl/UpdateOperationWithQuads.java   |  10 +-
 .../core/sparql/JavaCCGeneratedQueryParser.jj   |  89 +++---
 .../sparql/JavaCCGeneratedSparqlPreParser.jj    | 115 ++++----
 .../apache/clerezza/rdf/core/LanguageTest.java  |   1 +
 .../clerezza/rdf/core/LiteralFactoryTest.java   |  22 +-
 .../apache/clerezza/rdf/core/UriRefTest.java    |  11 +-
 .../clerezza/rdf/core/access/SecurityTest.java  |  40 +--
 .../clerezza/rdf/core/access/TcManagerTest.java |  16 +-
 .../rdf/core/access/providers/WeightedA.java    | 172 ++++++------
 .../rdf/core/access/providers/WeightedA1.java   |  30 +--
 .../core/access/providers/WeightedAHeavy.java   |  30 +--
 .../core/access/providers/WeightedBlight.java   |  30 +--
 .../core/access/providers/WeightedDummy.java    |  32 +--
 .../rdf/core/events/NotificationTest.java       |  16 +-
 .../rdf/core/impl/PlainLiteralImplTest.java     |  20 +-
 .../rdf/core/impl/SimpleLiteralFactoryTest.java |  20 +-
 .../core/impl/SimpleTripleCollectionTest.java   |  10 +-
 .../clerezza/rdf/core/impl/TripleImplTest.java  |  14 +-
 .../rdf/core/impl/TypedLiteralImplTest.java     |  26 +-
 .../impl/graphmatching/GraphMatcherTest.java    |  84 +++---
 .../impl/graphmatching/HashMatchingTest.java    |  12 +-
 .../core/impl/graphmatching/Utils4Testing.java  |  16 +-
 .../rdf/core/serializedform/ParserTest.java     |   6 +-
 .../rdf/core/serializedform/SerializerTest.java |   1 +
 .../TestServiceManagedProvider.java             |   6 +-
 .../rdf/core/sparql/QueryParserTest.java        |  33 ++-
 .../rdf/core/sparql/QuerySerializerTest.java    |  32 +--
 .../rdf/core/sparql/SparqlPreParserTest.java    | 108 ++++----
 114 files changed, 1177 insertions(+), 2048 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.core/pom.xml b/rdf.core/pom.xml
index 6c43334..f150df9 100644
--- a/rdf.core/pom.xml
+++ b/rdf.core/pom.xml
@@ -33,6 +33,11 @@
     <description>Interfaces and utilities to access RDF Graphs</description>
     <dependencies>
         <dependency>
+            <groupId>commons-rdf</groupId>
+            <artifactId>commons-rdf</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/BNode.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/BNode.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/BNode.java
deleted file mode 100644
index 236b404..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/BNode.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;
-
-/**
- * A Blank Node, extends a NonLiteral. represents a resource, 
- * but does not indicate a URI for the resource. Blank nodes act like 
- * existentially qualified variables in first order logic. 
- *
- * @author reto
- */
-public class BNode implements NonLiteral {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Graph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Graph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Graph.java
deleted file mode 100644
index 43e565e..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Graph.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;
-
-/**
- * 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 Graph extends TripleCollection {
-
-    /** 
-     * Returns true if two graphs are isomorphic
-     * 
-     * @return true if two graphs are isomorphic
-     */
-    @Override
-    public boolean equals(Object obj);
-
-    /** 
-     * Return the sum of the blank-nodes independent hashes of the triples. 
-     * More precisely the hash of the triple is calculated as follows:
-     * (hash(subject) >> 1) ^  hash(hashCode) ^ (hash(hashCode) << 1)
-     * Where the hash-fucntion return the hashCode of the argument 
-     * for grounded arguments and 0 otherwise. 
-     * 
-     * @return hash code
-     */
-    @Override
-    public int hashCode();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/InvalidLiteralTypeException.java
----------------------------------------------------------------------
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
index b3f9759..9a214a2 100644
--- 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
@@ -18,6 +18,8 @@
  */
 package org.apache.clerezza.rdf.core;
 
+import org.apache.commons.rdf.Iri;
+
 /**
  * Thrown when a literal is of the wrong type for conversion to a java-type
  *
@@ -32,7 +34,7 @@ public class InvalidLiteralTypeException extends RuntimeException {
      * @param javaType the <code>Class</code> to convert to
      * @param literalType the literalType which can't be converted
      */
-    public InvalidLiteralTypeException(Class<?> javaType, UriRef literalType) {
+    public InvalidLiteralTypeException(Class<?> javaType, Iri literalType) {
         super("Cannot create a "+javaType+" from a literal of type "+literalType);
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Language.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Language.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Language.java
deleted file mode 100644
index b04e24c..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Language.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-/**
- * 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;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (other == null) {
-            return false;
-        }
-        if (other instanceof Language) {
-            return id.equals(((Language) other).id);
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        return id.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Literal.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Literal.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Literal.java
deleted file mode 100644
index 2089f70..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Literal.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;
-
-/**
- * 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 Resource {
-    
-    /**
-     * 
-     * @return the text of this literal
-     */
-    public String getLexicalForm();
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/LiteralFactory.java
----------------------------------------------------------------------
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
index 350af81..a7c6104 100644
--- 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
@@ -19,6 +19,7 @@
 package org.apache.clerezza.rdf.core;
 
 import org.apache.clerezza.rdf.core.impl.SimpleLiteralFactory;
+import org.apache.commons.rdf.Literal;
 
 /**
  * This class provides methods to convert java objects to typed literals and
@@ -65,7 +66,7 @@ public abstract class LiteralFactory {
      * @return a TypedLiteral representing the value
      * @throws NoConvertorException thrown if <code>value</code> is of an invalid type
      */
-    public abstract TypedLiteral createTypedLiteral(Object value)
+    public abstract Literal createTypedLiteral(Object value)
             throws NoConvertorException;
 
     /**
@@ -78,6 +79,6 @@ public abstract class LiteralFactory {
      * @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, TypedLiteral literal)
+    public abstract <T> T createObject(Class<T> type, Literal literal)
             throws NoConvertorException, InvalidLiteralTypeException;
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/MGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/MGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/MGraph.java
deleted file mode 100644
index 1706cfb..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/MGraph.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;
-
-/** 
- * A mutable graph 
- *
- * @author reto
- *
- */
-public interface MGraph extends TripleCollection {
-
-    /**
-     * Returns true if <code>other</code> represents the same mutable 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.
-     *
-     * @param other
-     * @return true if other == this
-     */
-    @Override
-    public boolean equals(Object other);
-
-    /**
-     * Returns the graph
-     *
-     * @return graph
-     */
-    public Graph getGraph();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/NonLiteral.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/NonLiteral.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/NonLiteral.java
deleted file mode 100644
index 580e32f..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/NonLiteral.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;
-
-/**
- * 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 NonLiteral extends Resource {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/PlainLiteral.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/PlainLiteral.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/PlainLiteral.java
deleted file mode 100644
index f7e0828..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/PlainLiteral.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;
-
-/**
- * A string combined with an optional language tag
- * The lexical form is the string represented by the Literal 
- * without including the language tag
- * 
- * @author reto
- *
- */
-public interface PlainLiteral extends Literal {
-    public Language getLanguage();
-    
-    /** 
-     * Returns true if <code>obj</code> is an instance of 
-     * <code>PlainLiteral</code> for which the lexical form and the language 
-     * are equals to the ones of this instance, false otherwise
-     * 
-     * @return true if obj == this
-     */
-    public boolean equals(Object obj);
-    
-    /**
-     * Returns the hash code of the lexical form plus the hash code of the language
-     * 
-     * @return hash code
-     */
-    public int hashCode();
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Resource.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Resource.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Resource.java
deleted file mode 100644
index f9006fe..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Resource.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;
-
-/**
- * Some entity. It could be a web resource such as a web page, or it could 
- * be a concrete physical thing such as a tree or a car. It could be an 
- * abstract idea such as a football game. 
- *
- * @author reto
- */
-public interface Resource {
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Triple.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Triple.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Triple.java
deleted file mode 100644
index 56decc2..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/Triple.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-/**
- * A structure containing a subject, a predicate, and an object. 
- * Also known as a statement.
- *
- * @author reto
- */
-public interface Triple {
-
-    NonLiteral getSubject();
-
-    UriRef getPredicate();
-
-    Resource getObject();
-
-    /**
-     * 
-     * @param obj
-     * @return true iff subject, predicate, and object of both triples are equal
-     */
-    @Override
-    boolean equals(Object obj);
-
-    /**
-     * The hash code is computed as follow
-     * (subject.hashCode() >> 1) ^  predicate.hashCode() ^ object.hashCode() << 1)
-     * 
-     * Note that the hash returned is computed including the hash of BNodes, so 
-     * it is not blank-node blind as in Graph.
-     * 
-     * This would have to change if triple should extend Graph
-     * 
-     * @return hash code
-     */
-    @Override
-    int hashCode();
-
-}

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/TypedLiteral.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/TypedLiteral.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/TypedLiteral.java
deleted file mode 100644
index b4f506e..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/TypedLiteral.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-/**
- * Typed literals have a lexical form and a data type URI being an RDF URI reference.
- * 
- * To convert java objects to typed literals use {@link LiteralFactory}
- * 
- * @author reto
- *
- */
-public interface TypedLiteral extends Literal {
-
-    /** 
-     * Returns the data type which is a UriRef.
-     * Note that the return value is not a node in the graph
-     * 
-     * @return UriRef
-     */
-    public UriRef getDataType();
-    
-    /** 
-     * Two TypedLiteral nodes are equal iff they have the same lexical form and
-     * the same data type
-     *
-     * @param obj
-     * @return true if <code>obj</code> is an instance of <code>TypedLiteral</code> 
-     * for which the lexical form and the data type URI are equal to the ones 
-     * of this instance, false otherwise
-     */
-    public boolean equals(Object obj);
-
-    /** 
-     * The hash code is equal to the hash code of the lexical form 
-     * plus the hash code of the dataType
-     * 
-     * @return hash code
-     */
-    public int hashCode();
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/UriRef.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/UriRef.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/UriRef.java
deleted file mode 100644
index e856115..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/UriRef.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core;
-
-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 UriRef implements NonLiteral, Serializable {
-
-    private String unicodeString;
-
-    public UriRef(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 UriRef)) {
-            return false;
-        }
-
-        return unicodeString.equals(((UriRef) obj).getUnicodeString());
-    }
-
-    /**
-     * @return 5 + the hashcode of the string
-     */
-    @Override
-    public int hashCode() {
-        int hash = 5 + unicodeString.hashCode();
-        return hash;
-    }
-
-    @Override
-    public String toString() {
-        StringBuffer buffer = new StringBuffer();
-        buffer.append('<');
-        buffer.append(unicodeString);
-        buffer.append('>');
-        return buffer.toString();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/EntityAlreadyExistsException.java
----------------------------------------------------------------------
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
index a95cd57..9b9961b 100644
--- 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
@@ -18,7 +18,7 @@
  */
 package org.apache.clerezza.rdf.core.access;
 
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 /**
  * is thrown on an attempt to create an entity with a name which already exists
@@ -27,7 +27,7 @@ import org.apache.clerezza.rdf.core.UriRef;
  */
 public class EntityAlreadyExistsException extends RuntimeException {
 
-    private UriRef entityName;
+    private Iri entityName;
 
     /**
      * creates an exception indicating that an entity with the specified name
@@ -35,7 +35,7 @@ public class EntityAlreadyExistsException extends RuntimeException {
      * 
      * @param entityName the name of the entity which already exists
      */
-    public EntityAlreadyExistsException(UriRef entityName) {
+    public EntityAlreadyExistsException(Iri entityName) {
         super("An entity with this name already exists: "+entityName);
         this.entityName = entityName;
     }
@@ -44,7 +44,7 @@ public class EntityAlreadyExistsException extends RuntimeException {
      * 
      * @return the name of the entity which already exists
      */
-    public UriRef getEntityName() {
+    public Iri getEntityName() {
         return entityName;
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/EntityUndeletableException.java
----------------------------------------------------------------------
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
index ed47585..a6cf537 100644
--- 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
@@ -18,7 +18,7 @@
  */
 package org.apache.clerezza.rdf.core.access;
 
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 /**
  * is thrown on an attempt to delete an entity with a provider that
@@ -27,7 +27,7 @@ import org.apache.clerezza.rdf.core.UriRef;
  * @author reto
  */
 public class EntityUndeletableException extends RuntimeException {
-    private UriRef entityName;
+    private Iri entityName;
 
     /**
      * creates an exception indicating that the entity with the specified name
@@ -35,7 +35,7 @@ public class EntityUndeletableException extends RuntimeException {
      * 
      * @param entityName the name of the entity which is undeletable
      */
-    public EntityUndeletableException(UriRef entityName) {
+    public EntityUndeletableException(Iri entityName) {
         super("This entity is undeletable: "+entityName);
         this.entityName = entityName;
     }
@@ -44,7 +44,7 @@ public class EntityUndeletableException extends RuntimeException {
      * 
      * @return the name of the entity which is undeletable
      */
-    public UriRef getEntityName() {
+    public Iri getEntityName() {
         return entityName;
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/GraphServiceFactory.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/GraphServiceFactory.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/GraphServiceFactory.java
index e8341a1..af8a6e0 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/GraphServiceFactory.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/GraphServiceFactory.java
@@ -21,8 +21,8 @@ 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.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.security.TcAccessController;
 import org.apache.clerezza.rdf.core.impl.SimpleGraph;
 
@@ -35,10 +35,10 @@ import org.apache.clerezza.rdf.core.impl.SimpleGraph;
 public class GraphServiceFactory implements ServiceFactory {
     
     private final TcManager tcManager;
-    private final UriRef name;
+    private final Iri name;
     private final TcAccessController tcAccessController;
 
-    GraphServiceFactory(TcManager tcManager, UriRef name,
+    GraphServiceFactory(TcManager tcManager, Iri name,
             TcAccessController tcAccessController) {
         this.tcManager = tcManager;
         this.name = name;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraph.java
index 7e3dc66..ab837a2 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraph.java
@@ -19,7 +19,7 @@
 package org.apache.clerezza.rdf.core.access;
 
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.MGraph;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraphWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraphWrapper.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraphWrapper.java
index 6b5a8eb..c796a48 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraphWrapper.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockableMGraphWrapper.java
@@ -23,15 +23,15 @@ 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.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.debug.ReentrantReadWriteLockTracker;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
+import org.apache.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphListener;
 
 /**
  * Wrappes an MGraph as a LockableMGraph, this class is used by TcManager to
@@ -90,7 +90,7 @@ public class LockableMGraphWrapper implements LockableMGraph {
     }
 
     @Override
-    public Iterator<Triple> filter(NonLiteral subject, UriRef predicate, Resource object) {
+    public Iterator<Triple> filter(BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
         readLock.lock();
         try {
             return new LockingIterator(wrapped.filter(subject, predicate, object), lock);

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockingIterator.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockingIterator.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockingIterator.java
index dd333f7..defb966 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockingIterator.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/LockingIterator.java
@@ -21,7 +21,7 @@ package org.apache.clerezza.rdf.core.access;
 import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.rdf.core.Triple;
+import org.apache.commons.rdf.Triple;
 
 /**
  * Wrapps an iterator<Triple> reading entering a read-lock on every invocation

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/MGraphServiceFactory.java
----------------------------------------------------------------------
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
index 77520b2..7774177 100644
--- 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
@@ -21,7 +21,7 @@ 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.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.security.TcAccessController;
 
 /**
@@ -33,10 +33,10 @@ import org.apache.clerezza.rdf.core.access.security.TcAccessController;
 public class MGraphServiceFactory implements ServiceFactory {
     
     private TcManager tcManager;
-    private UriRef name;
+    private Iri name;
     private final TcAccessController tcAccessController;
 
-    MGraphServiceFactory(TcManager tcManager, UriRef name,
+    MGraphServiceFactory(TcManager tcManager, Iri name,
             TcAccessController tcAccessController) {
         this.tcManager = tcManager;
         this.name = name;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/NoSuchEntityException.java
----------------------------------------------------------------------
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
index 05a295b..1fce6c5 100644
--- 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
@@ -18,7 +18,7 @@
  */
 package org.apache.clerezza.rdf.core.access;
 
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 /**
  * is thrown on an attempt to perform an operation on an entity (i.e. a
@@ -27,7 +27,7 @@ import org.apache.clerezza.rdf.core.UriRef;
  * @author reto
  */
 public class NoSuchEntityException extends RuntimeException {
-    private UriRef entityName;
+    private Iri entityName;
 
     /**
      * creates an exception indicating that the entity with the specified name
@@ -35,7 +35,7 @@ public class NoSuchEntityException extends RuntimeException {
      * 
      * @param entityName the name for which no entity exists
      */
-    public NoSuchEntityException(UriRef entityName) {
+    public NoSuchEntityException(Iri entityName) {
         super("No such entity: "+entityName);
         this.entityName = entityName;
     }
@@ -45,7 +45,7 @@ public class NoSuchEntityException extends RuntimeException {
      * 
      * @return the name of the entity that doesn't exist
      */
-    public UriRef getEntityName() {
+    public Iri getEntityName() {
         return entityName;
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/QueryableTcProvider.java
----------------------------------------------------------------------
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
index f68a08d..d0c8bac 100644
--- 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
@@ -18,8 +18,8 @@
  */
 package org.apache.clerezza.rdf.core.access;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.query.Query;
 
 /**
@@ -38,6 +38,6 @@ public interface QueryableTcProvider extends TcProvider {
      *            FROM clause is present
      * @return the resulting ResultSet, Graph or Boolean value
      */
-    public Object executeSparqlQuery(String query, UriRef defaultGraphUri);
+    public Object executeSparqlQuery(String query, Iri defaultGraphUri);
 
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredMGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredMGraph.java
index d627254..6e68eda 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredMGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredMGraph.java
@@ -20,8 +20,8 @@ package org.apache.clerezza.rdf.core.access;
 
 import java.security.AccessControlException;
 import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.security.TcAccessController;
 import org.apache.clerezza.rdf.core.impl.SimpleGraph;
 import org.apache.clerezza.rdf.core.impl.WriteBlockedMGraph;
@@ -37,7 +37,7 @@ public class SecuredMGraph extends SecuredTripleCollection implements LockableMG
 
     private LockableMGraph wrapped;
 
-    public SecuredMGraph(LockableMGraph wrapped, UriRef name,
+    public SecuredMGraph(LockableMGraph wrapped, Iri name,
             TcAccessController tcAccessController) {
         super(wrapped, name,  tcAccessController);
         this.wrapped = wrapped;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredTripleCollection.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredTripleCollection.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredTripleCollection.java
index 761db14..affd22d 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredTripleCollection.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/SecuredTripleCollection.java
@@ -20,14 +20,14 @@ package org.apache.clerezza.rdf.core.access;
 
 import java.util.Collection;
 import java.util.Iterator;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.security.TcAccessController;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
+import org.apache.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphListener;
 
 /**
  * A Secured triple collection wraps a triple collection checking each access
@@ -39,10 +39,10 @@ import org.apache.clerezza.rdf.core.event.GraphListener;
 public class SecuredTripleCollection implements TripleCollection {
 
     private final TripleCollection wrapped;
-    private final UriRef name;
+    private final Iri name;
     private final TcAccessController tcAccessController;
 
-    public SecuredTripleCollection(TripleCollection wrapped, UriRef name,
+    public SecuredTripleCollection(TripleCollection wrapped, Iri name,
             TcAccessController tcAccessController) {
         this.wrapped = wrapped;
         this.name = name;
@@ -50,7 +50,7 @@ public class SecuredTripleCollection implements TripleCollection {
     }
 
     @Override
-    public Iterator<Triple> filter(final NonLiteral subject, final UriRef predicate, final Resource object) {
+    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>() {
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
----------------------------------------------------------------------
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
index 48a5c9a..048c5a4 100644
--- 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
@@ -32,10 +32,10 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.security.TcAccessController;
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.impl.WriteBlockedMGraph;
@@ -123,8 +123,8 @@ public class TcManager extends TcProviderMultiplexer {
         }
             
     };
-    private Map<UriRef, ServiceRegistration> serviceRegistrations = Collections
-            .synchronizedMap(new HashMap<UriRef, ServiceRegistration>());
+    private Map<Iri, ServiceRegistration> serviceRegistrations = Collections
+            .synchronizedMap(new HashMap<Iri, ServiceRegistration>());
     
     protected QueryEngine queryEngine;
     private boolean isActivated = false;
@@ -211,13 +211,13 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    public Graph getGraph(UriRef name) throws NoSuchEntityException {
+    public Graph getGraph(Iri name) throws NoSuchEntityException {
         tcAccessController.checkReadPermission(name);
         return super.getGraph(name);
     }
 
     @Override
-    public LockableMGraph getMGraph(UriRef name) {
+    public LockableMGraph getMGraph(Iri name) {
         try {
             tcAccessController.checkReadWritePermission(name);
         } catch (AccessControlException e) {
@@ -228,7 +228,7 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    public TripleCollection getTriples(UriRef name) {
+    public TripleCollection getTriples(Iri name) {
         try {
             tcAccessController.checkReadWritePermission(name);
         } catch (AccessControlException e) {
@@ -240,54 +240,54 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    public LockableMGraph createMGraph(UriRef name)
+    public LockableMGraph createMGraph(Iri name)
             throws UnsupportedOperationException {
         tcAccessController.checkReadWritePermission(name);
         return super.createMGraph(name);
     }
 
     @Override
-    public Graph createGraph(UriRef name, TripleCollection triples) {
+    public Graph createGraph(Iri name, TripleCollection triples) {
         tcAccessController.checkReadWritePermission(name);
         return super.createGraph(name, triples);
     }
 
     @Override
-    public void deleteTripleCollection(UriRef name) {
+    public void deleteTripleCollection(Iri name) {
         tcAccessController.checkReadWritePermission(name);
         super.deleteTripleCollection(name);
     }
 
     @Override
-    public Set<UriRef> getNames(Graph graph) {
+    public Set<Iri> getNames(Graph graph) {
         return super.getNames(graph);
     }
 
     @Override
-    public Set<UriRef> listGraphs() {
-        Set<UriRef> result = super.listGraphs();
+    public Set<Iri> listGraphs() {
+        Set<Iri> result = super.listGraphs();
         return excludeNonReadable(result);
     }
 
     @Override
-    public Set<UriRef> listMGraphs() {
-        Set<UriRef> result = super.listMGraphs();
+    public Set<Iri> listMGraphs() {
+        Set<Iri> result = super.listMGraphs();
         return excludeNonReadable(result);
     }
 
     @Override
-    public Set<UriRef> listTripleCollections() {
-        Set<UriRef> result = super.listTripleCollections();
+    public Set<Iri> listTripleCollections() {
+        Set<Iri> result = super.listTripleCollections();
         return excludeNonReadable(result);
     }
 
-    private Set<UriRef> excludeNonReadable(Set<UriRef> tcNames) {
+    private Set<Iri> excludeNonReadable(Set<Iri> tcNames) {
         SecurityManager security = System.getSecurityManager();
         if (security == null) {
             return tcNames;
         }
-        Set<UriRef> result = new HashSet<UriRef>();
-        for (UriRef name : tcNames) {
+        Set<Iri> result = new HashSet<Iri>();
+        for (Iri name : tcNames) {
             try {
                 tcAccessController.checkReadPermission(name);
             } catch (AccessControlException e) {
@@ -311,9 +311,9 @@ public class TcManager extends TcProviderMultiplexer {
     public Object executeSparqlQuery(String query, TripleCollection defaultGraph) throws ParseException {
         TcProvider singleTargetTcProvider = null;
 
-        final UriRef defaultGraphName = new UriRef("urn:x-temp:/kjsfadfhfasdffds");
+        final Iri defaultGraphName = new Iri("urn:x-temp:/kjsfadfhfasdffds");
         final SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+        final Set<Iri> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
         if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
             singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
         }
@@ -342,9 +342,9 @@ public class TcManager extends TcProviderMultiplexer {
     	if (forceFastlane) {
             singleTargetTcProvider = getSingleTargetTcProvider(Collections.EMPTY_SET);
     	} else {    	
-	        final UriRef defaultGraphName = new UriRef("urn:x-temp:/kjsfadfhfasdffds");
+	        final Iri defaultGraphName = new Iri("urn:x-temp:/kjsfadfhfasdffds");
 	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-	        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+	        final Set<Iri> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
 	        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
 	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
 	        }
@@ -370,7 +370,7 @@ public class TcManager extends TcProviderMultiplexer {
      * @param defaultGraphName the graph to be used as default graph in the Sparql Graph Store
      * @return the resulting ResultSet, Graph or Boolean value
      */
-    public Object executeSparqlQuery(String query, UriRef defaultGraphName) throws ParseException {
+    public Object executeSparqlQuery(String query, Iri defaultGraphName) throws ParseException {
       return executeSparqlQuery(query, defaultGraphName, false);
     }
 
@@ -384,13 +384,13 @@ public class TcManager extends TcProviderMultiplexer {
      * @param forceFastlane indicate whether to force fastlane usage.
      * @return the resulting ResultSet, Graph or Boolean value
      */
-    public Object executeSparqlQuery(String query, UriRef defaultGraphName, boolean forceFastlane) throws ParseException {
+    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<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
+	        final Set<Iri> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
 	        if ((referencedGraphs != null)) {
 	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
 	        }
@@ -557,7 +557,7 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    protected void mGraphAppears(UriRef name) {
+    protected void mGraphAppears(Iri name) {
     	if (isTcServicesEnabled()) {
     		// Only create the service when activated. When not activated
     		// creating will be delayed till after activation.
@@ -568,7 +568,7 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    protected void graphAppears(UriRef name) {
+    protected void graphAppears(Iri name) {
     	if (isTcServicesEnabled()) {
     		// Only create the service when activated. When not activated
     		// creating will be delayed till after activation.
@@ -578,7 +578,7 @@ public class TcManager extends TcProviderMultiplexer {
     	}
     }
 
-    private void registerTripleCollectionAsService(UriRef name, boolean isMGraph) {
+    private void registerTripleCollectionAsService(Iri name, boolean isMGraph) {
         Dictionary<String,Object> props = new Hashtable<String, Object>();
         props.put("name", name.getUnicodeString());
         String[] interfaceNames;
@@ -602,7 +602,7 @@ public class TcManager extends TcProviderMultiplexer {
     }
 
     @Override
-    protected void tcDisappears(UriRef name) {
+    protected void tcDisappears(Iri name) {
         ServiceRegistration reg = serviceRegistrations.get(name);
         if (reg != null) {
             reg.unregister();
@@ -610,15 +610,15 @@ public class TcManager extends TcProviderMultiplexer {
         }
     }
 
-    private TcProvider getSingleTargetTcProvider(final Set<UriRef> referencedGraphs) {
+    private TcProvider getSingleTargetTcProvider(final Set<Iri> referencedGraphs) {
         TcProvider singleTargetTcProvider = null;
         for (WeightedTcProvider provider : providerList) {
-            final Set<UriRef> providerTripleCollections = provider.listTripleCollections();
+            final Set<Iri> providerTripleCollections = provider.listTripleCollections();
             if (providerTripleCollections.containsAll(referencedGraphs)) {
                singleTargetTcProvider = provider;
                break; //success
             }
-            for (UriRef graphName : referencedGraphs) {
+            for (Iri graphName : referencedGraphs) {
                 if (providerTripleCollections.contains(graphName)) {
                     break; //failure
                 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcProvider.java
----------------------------------------------------------------------
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
index 5850196..003d2fa 100644
--- 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
@@ -16,137 +16,137 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.core.access;
-
-import java.util.Set;
-
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-
-/**
- * A TC (TripleCollection) Provider allows access to and optionally 
- * creation of named {@link Graph}s and {@link MGraph}s (mutable graphs)
- *
- * @author reto
- */
-public interface TcProvider {
-
-    /**
-     * Get a <code>Graph</code> by its name
-     *
-     * @param name the name of the Graph
-     * @return the <code>Graph</code> with the specified name
-     * @throws NoSuchEntityException if there is no <code>Graph</code>
-     *         with the specified name
-     */
-    Graph getGraph(UriRef name) throws NoSuchEntityException;
-
-    /**
-     * Get an <code>MGraph</code> by its name. The instances
-     * returned in different invocations are <code>equals</code>.
-     *
-     * @param the name of the <code>MGraph</code>
-     * @return name the <code>MGraph</code> with the specified name
-     * @throws NoSuchEntityException if there is no <code>MGraph</code>
-     *         with the specified name
-     */
-    MGraph getMGraph(UriRef name) throws NoSuchEntityException;
-    
-    /**
-     * This method is used to get a <code>TripleCollection</code> indifferently
-     * whether it's a Graph or an MGraph. If the <code>name</code> names an 
-     * <code>MGraph</code> the result is the same as when invoking 
-     * <code>getMGraph</code> with that argument, analogously for 
-     * <code>Graph</code>S the method returns an instance equals to what 
-     * <code>getGraph</code> would return. 
-     * 
-     * @param name the name of the <Code>Graph</code> or <code>MGraph</code>
-     * @return the <Code>Graph</code> or <code>MGraph</code>
-     * @throws NoSuchEntityException if there is no <code>Graph</code>
-     *         or <code>MGraph</code> with the specified name
-     */
-    TripleCollection getTriples(UriRef name) throws NoSuchEntityException;
-
-    /**
-     * Lists the name of the <Code>Graph</code>s available through this
-     * <code>TcProvider</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<UriRef> listGraphs();
-
-    /**
-     * Lists the name of the <Code>MGraph</code>s available through this
-     * <code>TcProvider</code>, implementations may take into account the
-     * security context and omit <Code>MGraph</code>s for which access is not
-     * allowed.
-     *
-     * @return the list of <Code>MGraph</code>s
-     */
-    Set<UriRef> listMGraphs();
-
-    /**
-     * Lists the name of the <Code>TripleCollection</code>s available through this
-     * <code>TcProvider</code> indifferently whether they are Graphs or an
-     * MGraphs, implementations may take into account the security context and
-     * omit <Code>TripleCollection</code>s for which access is not allowed.
-     *
-     * @return the list of <Code>TripleCollection</code>s
-     */
-    Set<UriRef> listTripleCollections();
-
-    /**
-     * Creates an initially empty <code>MGraph</code> with a specified name
-     *
-     * @param name names the new <code>MGraph</code>
-     * @return the newly created <code>MGraph</code>
-     * @throws UnsupportedOperationException if this provider doesn't support
-     *         creating <code>MGraph</code>S
-     * @throws EntityAlreadyExistsException if an MGraph with the specified name
-     *         already exists
-     */
-    MGraph createMGraph(UriRef name) throws UnsupportedOperationException, 
-            EntityAlreadyExistsException;
-
-    /**
-     * Creates a <code>Graph</code> with a specified name
-     *
-     * @param name the name of the <code>Graph</code> to be created
-     * @param triples the triples of 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 a Graph with the specified name
-     *         already exists
-     */
-    Graph createGraph(UriRef name, TripleCollection triples) 
-            throws UnsupportedOperationException, EntityAlreadyExistsException;
-    
-    /**
-     * Deletes the <code>Graph</code> or <code>MGraph</code> of a specified name.
-     * If <code>name</code> references a Graph and the graph 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>Graph</code> or an <code>MGraph</code>.
-     * @throws EntityUndeletableException if the specified Graph is undeletable
-     */
-    void deleteTripleCollection(UriRef name) throws UnsupportedOperationException,
-            NoSuchEntityException, EntityUndeletableException;
-
-    /**
-     * get a set of the names of a <code>Graph</code>
-     *
-     * @param graph
-     * @return the set names of <code>Graph</code>, the set is empty if
-     *         <code>Graph</code> is unknown
-     */
-    Set<UriRef> getNames(Graph graph);
-}
+package org.apache.clerezza.rdf.core.access;
+
+import java.util.Set;
+
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
+
+/**
+ * A TC (TripleCollection) Provider allows access to and optionally 
+ * creation of named {@link Graph}s and {@link MGraph}s (mutable graphs)
+ *
+ * @author reto
+ */
+public interface TcProvider {
+
+    /**
+     * Get a <code>Graph</code> by its name
+     *
+     * @param name the name of the Graph
+     * @return the <code>Graph</code> with the specified name
+     * @throws NoSuchEntityException if there is no <code>Graph</code>
+     *         with the specified name
+     */
+    Graph getGraph(Iri name) throws NoSuchEntityException;
+
+    /**
+     * Get an <code>MGraph</code> by its name. The instances
+     * returned in different invocations are <code>equals</code>.
+     *
+     * @param the name of the <code>MGraph</code>
+     * @return name the <code>MGraph</code> with the specified name
+     * @throws NoSuchEntityException if there is no <code>MGraph</code>
+     *         with the specified name
+     */
+    MGraph getMGraph(Iri name) throws NoSuchEntityException;
+    
+    /**
+     * This method is used to get a <code>TripleCollection</code> indifferently
+     * whether it's a Graph or an MGraph. If the <code>name</code> names an 
+     * <code>MGraph</code> the result is the same as when invoking 
+     * <code>getMGraph</code> with that argument, analogously for 
+     * <code>Graph</code>S the method returns an instance equals to what 
+     * <code>getGraph</code> would return. 
+     * 
+     * @param name the name of the <Code>Graph</code> or <code>MGraph</code>
+     * @return the <Code>Graph</code> or <code>MGraph</code>
+     * @throws NoSuchEntityException if there is no <code>Graph</code>
+     *         or <code>MGraph</code> with the specified name
+     */
+    TripleCollection getTriples(Iri name) throws NoSuchEntityException;
+
+    /**
+     * Lists the name of the <Code>Graph</code>s available through this
+     * <code>TcProvider</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> listGraphs();
+
+    /**
+     * Lists the name of the <Code>MGraph</code>s available through this
+     * <code>TcProvider</code>, implementations may take into account the
+     * security context and omit <Code>MGraph</code>s for which access is not
+     * allowed.
+     *
+     * @return the list of <Code>MGraph</code>s
+     */
+    Set<Iri> listMGraphs();
+
+    /**
+     * Lists the name of the <Code>TripleCollection</code>s available through this
+     * <code>TcProvider</code> indifferently whether they are Graphs or an
+     * MGraphs, implementations may take into account the security context and
+     * omit <Code>TripleCollection</code>s for which access is not allowed.
+     *
+     * @return the list of <Code>TripleCollection</code>s
+     */
+    Set<Iri> listTripleCollections();
+
+    /**
+     * Creates an initially empty <code>MGraph</code> with a specified name
+     *
+     * @param name names the new <code>MGraph</code>
+     * @return the newly created <code>MGraph</code>
+     * @throws UnsupportedOperationException if this provider doesn't support
+     *         creating <code>MGraph</code>S
+     * @throws EntityAlreadyExistsException if an MGraph with the specified name
+     *         already exists
+     */
+    MGraph createMGraph(Iri name) throws UnsupportedOperationException, 
+            EntityAlreadyExistsException;
+
+    /**
+     * Creates a <code>Graph</code> with a specified name
+     *
+     * @param name the name of the <code>Graph</code> to be created
+     * @param triples the triples of 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 a Graph with the specified name
+     *         already exists
+     */
+    Graph createGraph(Iri name, TripleCollection triples) 
+            throws UnsupportedOperationException, EntityAlreadyExistsException;
+    
+    /**
+     * Deletes the <code>Graph</code> or <code>MGraph</code> of a specified name.
+     * If <code>name</code> references a Graph and the graph 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>Graph</code> or an <code>MGraph</code>.
+     * @throws EntityUndeletableException if the specified Graph is undeletable
+     */
+    void deleteTripleCollection(Iri name) throws UnsupportedOperationException,
+            NoSuchEntityException, EntityUndeletableException;
+
+    /**
+     * get a set of the names of a <code>Graph</code>
+     *
+     * @param graph
+     * @return the set names of <code>Graph</code>, the set is empty if
+     *         <code>Graph</code> is unknown
+     */
+    Set<Iri> getNames(Graph graph);
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcProviderMultiplexer.java
----------------------------------------------------------------------
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
index 65f663e..de15f2b 100644
--- 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
@@ -30,10 +30,10 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.QueryEngine;
 
 /**
@@ -52,7 +52,7 @@ public class TcProviderMultiplexer implements TcProvider {
      * otherwise the locks in the <code>LockableMGraph</code>s would have no effect
      * between different instances and concurrency issues could occur.
      */
-    private Map<UriRef, MGraphHolder> mGraphCache = Collections.synchronizedMap(new HashMap<UriRef, MGraphHolder>());
+    private Map<Iri, MGraphHolder> mGraphCache = Collections.synchronizedMap(new HashMap<Iri, MGraphHolder>());
 
 	/**
 	 * Flag to indicate whether mgraphs should be cached for faster access. By
@@ -91,7 +91,7 @@ public class TcProviderMultiplexer implements TcProvider {
      *
      * @param name
      */
-    protected void graphAppears(UriRef name) {
+    protected void graphAppears(Iri name) {
     }
 
     /**
@@ -102,7 +102,7 @@ public class TcProviderMultiplexer implements TcProvider {
      *
      * @param name
      */
-    protected void mGraphAppears(UriRef name) {
+    protected void mGraphAppears(Iri name) {
     }
 
     /**
@@ -115,7 +115,7 @@ public class TcProviderMultiplexer implements TcProvider {
      *
      * @param name
      */
-    protected void tcDisappears(UriRef name) {
+    protected void tcDisappears(Iri name) {
     }
 
     /**
@@ -135,7 +135,7 @@ public class TcProviderMultiplexer implements TcProvider {
      */
     private void updateLockableMGraphCache(WeightedTcProvider provider,
             boolean providerAdded) {
-        Set<UriRef> uriSet = provider.listTripleCollections();
+        Set<Iri> uriSet = provider.listTripleCollections();
         if (!(uriSet == null || uriSet.isEmpty())) {
             if (providerAdded) {
                 weightedProviderAdded(provider, uriSet);
@@ -146,10 +146,10 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     private void weightedProviderAdded(WeightedTcProvider newProvider,
-            Set<UriRef> newProvidedUris) {
+            Set<Iri> newProvidedUris) {
         Set<WeightedTcProvider> lowerWeightedProviderList = getLowerWeightedProvider(newProvider);
     	if (isCachingEnabled()) {
-	        for (UriRef name : newProvidedUris) {
+	        for (Iri name : newProvidedUris) {
 	            final MGraphHolder holder = mGraphCache.get(name);
 	            if ((holder != null) && (holder.getWeightedTcProvider() != null)) {
 	                if (lowerWeightedProviderList.contains(holder.getWeightedTcProvider())) {
@@ -187,8 +187,8 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     private void weightedProviderRemoved(WeightedTcProvider oldProvider,
-            Set<UriRef> oldProvidedUris) {
-        for (UriRef name : oldProvidedUris) {
+            Set<Iri> oldProvidedUris) {
+        for (Iri name : oldProvidedUris) {
             final MGraphHolder holder = mGraphCache.get(name);
             if ((holder != null) && (holder.getWeightedTcProvider() != null)
                     && holder.getWeightedTcProvider().equals(oldProvider)) {
@@ -218,7 +218,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Graph getGraph(UriRef name) throws NoSuchEntityException {
+    public Graph getGraph(Iri name) throws NoSuchEntityException {
         for (TcProvider provider : providerList) {
             try {
                 return provider.getGraph(name);
@@ -232,7 +232,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public LockableMGraph getMGraph(UriRef name)
+    public LockableMGraph getMGraph(Iri name)
             throws NoSuchEntityException {
         LockableMGraph result = getMGraphFromCache(name);
         if (result == null) {
@@ -246,7 +246,7 @@ public class TcProviderMultiplexer implements TcProvider {
         return result;
     }
 
-    private LockableMGraph getMGraphFromCache(UriRef name) {
+    private LockableMGraph getMGraphFromCache(Iri name) {
         MGraphHolder holder = mGraphCache.get(name);
         if (holder == null) {
             return null;
@@ -254,7 +254,7 @@ public class TcProviderMultiplexer implements TcProvider {
         return holder.getMGraph();
     }
 
-    private LockableMGraph getUnsecuredMGraphAndAddToCache(UriRef name)
+    private LockableMGraph getUnsecuredMGraphAndAddToCache(Iri name)
             throws NoSuchEntityException {
         for (WeightedTcProvider provider : providerList) {
             try {
@@ -276,7 +276,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public TripleCollection getTriples(UriRef name)
+    public TripleCollection getTriples(Iri name)
             throws NoSuchEntityException {
         TripleCollection result;
         for (WeightedTcProvider provider : providerList) {
@@ -298,7 +298,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public LockableMGraph createMGraph(UriRef name)
+    public LockableMGraph createMGraph(Iri name)
             throws UnsupportedOperationException {
 
         for (WeightedTcProvider provider : providerList) {
@@ -330,7 +330,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Graph createGraph(UriRef name, TripleCollection triples) {
+    public Graph createGraph(Iri name, TripleCollection triples) {
         for (WeightedTcProvider provider : providerList) {
             try {
                 Graph result = provider.createGraph(name, triples);
@@ -354,7 +354,7 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public void deleteTripleCollection(UriRef name) {
+    public void deleteTripleCollection(Iri name) {
         for (TcProvider provider : providerList) {
             try {
                 provider.deleteTripleCollection(name);
@@ -382,8 +382,8 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Set<UriRef> getNames(Graph graph) {
-        Set<UriRef> result = new HashSet<UriRef>();
+    public Set<Iri> getNames(Graph graph) {
+        Set<Iri> result = new HashSet<Iri>();
         for (TcProvider provider : providerList) {
             result.addAll(provider.getNames(graph));
         }
@@ -391,8 +391,8 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Set<UriRef> listGraphs() {
-        Set<UriRef> result = new HashSet<UriRef>();
+    public Set<Iri> listGraphs() {
+        Set<Iri> result = new HashSet<Iri>();
         for (TcProvider provider : providerList) {
             result.addAll(provider.listGraphs());
         }
@@ -400,8 +400,8 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Set<UriRef> listMGraphs() {
-        Set<UriRef> result = new HashSet<UriRef>();
+    public Set<Iri> listMGraphs() {
+        Set<Iri> result = new HashSet<Iri>();
         for (TcProvider provider : providerList) {
             result.addAll(provider.listMGraphs());
         }
@@ -409,8 +409,8 @@ public class TcProviderMultiplexer implements TcProvider {
     }
 
     @Override
-    public Set<UriRef> listTripleCollections() {
-        Set<UriRef> result = new HashSet<UriRef>();
+    public Set<Iri> listTripleCollections() {
+        Set<Iri> result = new HashSet<Iri>();
         for (TcProvider provider : providerList) {
             result.addAll(provider.listTripleCollections());
         }


Mime
View raw message