clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [14/14] clerezza git commit: CLEREZZA-976: ported TDB storage provider and some related fixes, some tests still failing.
Date Sun, 22 Mar 2015 22:04:57 GMT
CLEREZZA-976: ported TDB storage provider and some related fixes, some tests still failing.

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

Branch: refs/heads/rdf-commons
Commit: 8a337849cfa59c30b740954b93eaa7cec8464167
Parents: be0f378
Author: Reto Gmuer <reto@apache.org>
Authored: Sun Mar 22 22:04:32 2015 +0000
Committer: Reto Gmuer <reto@apache.org>
Committed: Sun Mar 22 22:04:32 2015 +0000

----------------------------------------------------------------------
 rdf/core.test/pom.xml                           |   4 +-
 rdf/jena/commons/pom.xml                        |  12 +-
 .../rdf/jena/commons/Jena2TriaUtil.java         |  22 +--
 rdf/jena/dependencymanagement/pom.xml           |  57 +++++++
 rdf/jena/facade/pom.xml                         |  21 ++-
 .../clerezza/rdf/jena/facade/JenaGraph.java     |   2 +-
 rdf/jena/parser/pom.xml                         |  12 +-
 rdf/jena/pom.xml                                |   1 +
 rdf/jena/serializer/pom.xml                     |  11 ++
 rdf/jena/sparql/pom.xml                         |  12 +-
 rdf/jena/storage/pom.xml                        |  11 ++
 .../rdf/jena/storage/JenaGraphAdaptor.java      |   6 +
 rdf/jena/tdb.storage/pom.xml                    |  27 +++-
 .../jena/tdb/internals/DatasetLockedMGraph.java |  46 ------
 .../clerezza/rdf/jena/tdb/internals/IriSet.java |  62 ++++++++
 .../rdf/jena/tdb/internals/ModelGraph.java      |  67 ++++----
 .../rdf/jena/tdb/internals/Symbols.java         |  10 +-
 .../rdf/jena/tdb/internals/UriRefSet.java       |  62 --------
 .../rdf/jena/tdb/storage/BaseTdbTcProvider.java |  10 +-
 .../tdb/storage/SingleTdbDatasetTcProvider.java | 154 +++++++++----------
 .../rdf/jena/tdb/storage/TdbTcProvider.java     |  97 ++++++------
 .../MultiThreadedSingleTdbDatasetTest.java      |  35 ++---
 .../rdf/jena/tdb/storage/MultiThreadedTest.java |  24 +--
 .../tdb/storage/MultiThreadedTestSingleTdb.java |  24 +--
 .../tdb/storage/SingleTdbDatasetGraphTest.java  |  56 +++++++
 .../tdb/storage/SingleTdbDatasetMGraphTest.java |  56 -------
 .../storage/SingleTdbDatasetTcProviderTest.java |  70 ++++-----
 .../rdf/jena/tdb/storage/TdbGraphTest.java      | 107 +++++++++++++
 .../rdf/jena/tdb/storage/TdbMGraphTest.java     | 107 -------------
 29 files changed, 638 insertions(+), 547 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/core.test/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/core.test/pom.xml b/rdf/core.test/pom.xml
index 5cd0e48..41e53d0 100644
--- a/rdf/core.test/pom.xml
+++ b/rdf/core.test/pom.xml
@@ -24,8 +24,8 @@
     <parent>
         <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>1.0.0-SNAPSHOT</version>
-        <relativePath>../parent</relativePath>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.core.test</artifactId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/commons/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/commons/pom.xml b/rdf/jena/commons/pom.xml
index 61b0c99..8cb7a84 100644
--- a/rdf/jena/commons/pom.xml
+++ b/rdf/jena/commons/pom.xml
@@ -33,6 +33,17 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Commons</name>
     <description>Common classes needed by Jena adaptors</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza.commons-rdf</groupId>
@@ -47,7 +58,6 @@
         <dependency>
             <groupId>org.apache.jena</groupId>
             <artifactId>jena-core</artifactId>
-            <version>2.13.0</version>
             <exclusions>
                 <exclusion>
                     <artifactId>slf4j-log4j12</artifactId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
----------------------------------------------------------------------
diff --git a/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java b/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
index 32919a4..842c118 100644
--- a/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
+++ b/rdf/jena/commons/src/main/java/org/apache/clerezza/rdf/jena/commons/Jena2TriaUtil.java
@@ -27,9 +27,8 @@ import org.apache.commons.rdf.Language;
 import org.apache.commons.rdf.Literal;
 import org.apache.commons.rdf.RdfTerm;
 import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.commons.rdf.impl.utils.LiteralImpl;
 import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.commons.rdf.impl.utils.TypedLiteralImpl;
 
 /**
  *
@@ -59,18 +58,19 @@ public class Jena2TriaUtil {
      */
     private Literal convertJenaLiteral2Literal(Node node) {
         final String lexicalForm = node.getLiteralLexicalForm();
-        String datatypeString = node.getLiteralDatatypeURI();
+        final String datatypeString = node.getLiteralDatatypeURI();
+        final String languageTag = node.getLiteralLanguage();
+        Language language = null;
+        if ((languageTag != null) && !languageTag.equals("")) {
+             language = new Language(languageTag);
+        }
+        Iri dataType = null;
         if (datatypeString != null) {
-            Iri dtUriRef = new Iri(datatypeString);
-            return new TypedLiteralImpl(lexicalForm, dtUriRef);
+            dataType = new Iri(datatypeString);
         } else {
-            String language = node.getLiteralLanguage();
-            if ((language != null) && !language.equals("")) {
-                return new PlainLiteralImpl(lexicalForm, new Language(language));
-            } else {
-                return new PlainLiteralImpl(lexicalForm);
-            }
+            dataType = new Iri("http://www.w3.org/2001/XMLSchema#string");
         }
+        return new LiteralImpl(lexicalForm, dataType, language);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/dependencymanagement/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/dependencymanagement/pom.xml b/rdf/jena/dependencymanagement/pom.xml
new file mode 100644
index 0000000..78b9771
--- /dev/null
+++ b/rdf/jena/dependencymanagement/pom.xml
@@ -0,0 +1,57 @@
+<?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>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>rdf.jena.dependencymanagement</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - RDF - Jena - Dependency Management</name>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.jena</groupId>
+                <artifactId>jena-tdb</artifactId>
+                <version>1.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.jena</groupId>
+                <artifactId>jena-iri</artifactId>
+                <version>1.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.jena</groupId>
+                <artifactId>jena-arq</artifactId>
+                <version>2.11.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.jena</groupId>
+                <artifactId>jena-core</artifactId>
+                <version>2.11.1</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/facade/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/facade/pom.xml b/rdf/jena/facade/pom.xml
index d9db3ca..4c138b9 100644
--- a/rdf/jena/facade/pom.xml
+++ b/rdf/jena/facade/pom.xml
@@ -18,7 +18,7 @@
  specific language governing permissions and limitations
  under the License.
 
--->
+    -->
 
     <modelVersion>4.0.0</modelVersion>
     <parent>
@@ -33,7 +33,18 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Facade: Jena API on SCB</name>
     <description>An implementation of the Jena API on top of Clerezza RDF Commons, allows to
-    run code written against the Jena API on a source exposing the Clerezza Commons API .</description>
+        run code written against the Jena API on a source exposing the Clerezza Commons API .</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza.commons-rdf</groupId>
@@ -53,7 +64,11 @@
         <dependency>
             <groupId>org.wymiwyg</groupId>
             <artifactId>wymiwyg-commons-core</artifactId>
-        </dependency>        
+        </dependency>   
+        <dependency>
+            <groupId>org.apache.jena</groupId>
+            <artifactId>jena-core</artifactId>
+        </dependency>     
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/facade/src/main/java/org/apache/clerezza/rdf/jena/facade/JenaGraph.java
----------------------------------------------------------------------
diff --git a/rdf/jena/facade/src/main/java/org/apache/clerezza/rdf/jena/facade/JenaGraph.java b/rdf/jena/facade/src/main/java/org/apache/clerezza/rdf/jena/facade/JenaGraph.java
index 420d6e3..2a7c8a6 100644
--- a/rdf/jena/facade/src/main/java/org/apache/clerezza/rdf/jena/facade/JenaGraph.java
+++ b/rdf/jena/facade/src/main/java/org/apache/clerezza/rdf/jena/facade/JenaGraph.java
@@ -154,7 +154,7 @@ public class JenaGraph extends GraphBase implements com.hp.hpl.jena.graph.Graph
         return new TrackingTripleIterator(convert(filter(m)));
     }
 
-    @Override
+    //not yet @Override
     protected ExtendedIterator<com.hp.hpl.jena.graph.Triple> graphBaseFind(com.hp.hpl.jena.graph.Triple triple) {
         return new TrackingTripleIterator(convert(filter(triple)));
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/parser/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/parser/pom.xml b/rdf/jena/parser/pom.xml
index 19fd86c..90572ad 100644
--- a/rdf/jena/parser/pom.xml
+++ b/rdf/jena/parser/pom.xml
@@ -33,6 +33,17 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Parser</name>
     <description>A ParserProvider based on jena</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -51,7 +62,6 @@
         <dependency>
             <groupId>org.apache.jena</groupId>
             <artifactId>jena-core</artifactId>
-            <version>2.13.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/pom.xml b/rdf/jena/pom.xml
index 54b054b..b41ad1e 100644
--- a/rdf/jena/pom.xml
+++ b/rdf/jena/pom.xml
@@ -43,6 +43,7 @@
     <name>Clerezza - RDF - Jena</name>
     <description>The clerezza RDF Implementation using Jena</description>
     <modules>
+        <module>dependencymanagement</module>
         <module>commons</module>
         <module>facade</module>
         <module>parser</module>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/serializer/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/serializer/pom.xml b/rdf/jena/serializer/pom.xml
index c9cca45..9555624 100644
--- a/rdf/jena/serializer/pom.xml
+++ b/rdf/jena/serializer/pom.xml
@@ -33,6 +33,17 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Serializer</name>
     <description>A SerializingProvider based on jena</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/sparql/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/sparql/pom.xml b/rdf/jena/sparql/pom.xml
index 7af8e15..2e8dfb0 100644
--- a/rdf/jena/sparql/pom.xml
+++ b/rdf/jena/sparql/pom.xml
@@ -33,6 +33,17 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - SPARQL</name>
     <description>Allows executing SPARQL queries on SCB using the jena sparql engine.</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -52,7 +63,6 @@
         <dependency>
             <groupId>org.apache.jena</groupId>
             <artifactId>jena-arq</artifactId>
-            <version>2.11.1</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/storage/pom.xml b/rdf/jena/storage/pom.xml
index c352ee5..654d13c 100644
--- a/rdf/jena/storage/pom.xml
+++ b/rdf/jena/storage/pom.xml
@@ -33,6 +33,17 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Storage</name>
     <description>Allows converting Jena graphs to SCB graphs. (Currently no TcProvider comprised)</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
----------------------------------------------------------------------
diff --git a/rdf/jena/storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java b/rdf/jena/storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
index 0fb594e..87df8b1 100644
--- a/rdf/jena/storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
+++ b/rdf/jena/storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
@@ -24,6 +24,7 @@ import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.concurrent.locks.ReadWriteLock;
 import org.apache.commons.rdf.BlankNode;
 import org.apache.commons.rdf.BlankNodeOrIri;
 import org.apache.commons.rdf.RdfTerm;
@@ -56,6 +57,11 @@ public class JenaGraphAdaptor extends AbstractGraph {
     public JenaGraphAdaptor(com.hp.hpl.jena.graph.Graph jenaGraph) {
         this.jenaGraph = jenaGraph;
     }
+    
+    public JenaGraphAdaptor(com.hp.hpl.jena.graph.Graph jenaGraph, ReadWriteLock lock) {
+        super(lock);
+        this.jenaGraph = jenaGraph;
+    }
 
     @Override
     public void clear() {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/pom.xml b/rdf/jena/tdb.storage/pom.xml
index 9306ee3..11d054d 100644
--- a/rdf/jena/tdb.storage/pom.xml
+++ b/rdf/jena/tdb.storage/pom.xml
@@ -22,20 +22,31 @@
     <parent>
         <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>0.5</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.jena.tdb.storage</artifactId>
     <packaging>bundle</packaging>
     <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - SCB Jena TDB Storage Provider</name>
+    <name>Clerezza - RDF - Jena - TDB Storage Provider</name>
     <description>A Jena TDB based storage provider</description>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>rdf.jena.dependencymanagement</artifactId>
+                <type>pom</type>
+                <version>1.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -45,22 +56,22 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.ontologies</artifactId>
-            <version>0.12</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.commons</artifactId>
-            <version>0.7</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.storage</artifactId>
-            <version>0.7</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.sparql</artifactId>
-            <version>0.7</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -101,7 +112,7 @@
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core.test</artifactId>
             <scope>test</scope>
-            <version>0.15</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/DatasetLockedMGraph.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/DatasetLockedMGraph.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/DatasetLockedMGraph.java
deleted file mode 100644
index a3cdd19..0000000
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/DatasetLockedMGraph.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.clerezza.rdf.jena.tdb.internals;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-
-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.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.core.access.LockableMGraphWrapper;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
-import org.apache.clerezza.rdf.jena.tdb.storage.SingleTdbDatasetTcProvider;
-
-/**
- * {@link LockableMGraph} wrapper that uses a single {@link ReadWriteLock} for
- * the Jena TDB {@link SingleTdbDatasetTcProvider#dataset}
- * @author Rupert Westenthaler
- *
- */
-public class DatasetLockedMGraph extends LockableMGraphWrapper {
-
-
-    /**
-     * Constructs a LocalbleMGraph for an MGraph.
-     *
-     * @param providedMGraph a non-lockable mgraph
-     */
-    public DatasetLockedMGraph(final ReadWriteLock lock, final MGraph providedMGraph) {
-        super(providedMGraph, lock);
-    }
-
-    //Maybe overwriting this prevents unnecessary locking
-    /*
-    @Override
-    public Iterator<Triple> filter(NonLiteral subject, UriRef predicate, Resource object) {
-        //users will need to aquire a readlock while iterating
-        return wrapped.filter(subject, predicate, object);
-    }
-    */
-        
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/IriSet.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/IriSet.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/IriSet.java
new file mode 100644
index 0000000..1eb5d55
--- /dev/null
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/IriSet.java
@@ -0,0 +1,62 @@
+package org.apache.clerezza.rdf.jena.tdb.internals;
+
+import java.util.AbstractSet;
+import java.util.Iterator;
+
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.ontologies.RDF;
+
+/**
+ * Represents a set of uri ref Set<Iri>
+ * @author Minto van der Sluis
+ */
+public class IriSet extends AbstractSet<Iri> {
+    private ModelGraph graphNameIndex;
+    private Iri graphType;
+
+    public IriSet(ModelGraph index, Iri object) {
+        graphNameIndex = index;
+        graphType = object;
+    }
+  
+    @Override
+    public int size() {
+        // TODO: How to get the proper size based on graphType
+        return graphNameIndex.getGraph().size();
+    }
+  
+    @Override
+    public Iterator<Iri> iterator() {
+        final Iterator<Triple> indexIter = graphNameIndex.getGraph().filter( null, RDF.type, graphType );
+        return new Iterator<Iri>() {
+            @Override
+            public boolean hasNext() {
+                return indexIter.hasNext();
+            }
+  
+            @Override
+            public Iri next() {
+                return Iri.class.cast(indexIter.next().getSubject());
+            }
+  
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        };
+    }
+    
+    @Override
+    public boolean add(Iri o) {
+        throw new UnsupportedOperationException();
+    }
+  
+    @Override
+    public boolean contains(Object o) {
+        if (o instanceof Iri) {
+            return graphNameIndex.getGraph().filter(Iri.class.cast(o), RDF.type, graphType).hasNext();
+        }
+        return false;
+    }
+};    

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/ModelGraph.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/ModelGraph.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/ModelGraph.java
index 7b6421f..6465d86 100644
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/ModelGraph.java
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/ModelGraph.java
@@ -2,14 +2,13 @@ package org.apache.clerezza.rdf.jena.tdb.internals;
 
 import java.util.concurrent.locks.ReadWriteLock;
 
-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.clerezza.rdf.core.access.LockableMGraphWrapper;
-import org.apache.clerezza.rdf.core.impl.SimpleGraph;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper;
 import org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper;
-import org.apache.clerezza.rdf.core.impl.util.PrivilegedMGraphWrapper;
 import org.apache.clerezza.rdf.jena.storage.JenaGraphAdaptor;
 import org.apache.clerezza.rdf.jena.tdb.storage.SingleTdbDatasetTcProvider;
 
@@ -17,12 +16,13 @@ import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.sparql.core.DatasetGraph;
 import com.hp.hpl.jena.sparql.core.Quad;
 import com.hp.hpl.jena.tdb.TDB;
+import org.apache.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
 
 /**
- * Represents the Jena {@link Model} and the Clerezza {@link Graph} or
- * {@link MGraph}. It also provide access to the {@link JenaGraphAdaptor}
- * so that this component can add parsed data to {@link Graph}s created
- * by calls to {@link SingleTdbDatasetTcProvider#createGraph(UriRef, TripleCollection)}.
+ * Represents the Jena {@link Model} and the Clerezza {@link ImmutableGraph} or
+ * {@link Graph}. It also provide access to the {@link JenaGraphAdaptor}
+ * so that this component can add parsed data to {@link ImmutableGraph}s created
+ * by calls to {@link SingleTdbDatasetTcProvider#createGraph(Iri, TripleCollection)}.
  * @author Rupert Westenthaler
  *
  */
@@ -38,16 +38,16 @@ public class ModelGraph {
      */
     private JenaGraphAdaptor jenaAdapter;
     /**
-     * The {@link Graph}(in case of read-only) or {@link MGraph} (if read/write)
+     * The {@link ImmutableGraph}(in case of read-only) or {@link Graph} (if read/write)
      * that can be shared with other components. The instance stored by this
      * variable will use all the required Wrappers such as such as 
-     * {@link LockableMGraphWrapper lockable} and {@link PrivilegedMGraphWrapper
+     * {@link LockableGraphWrapper lockable} and {@link PrivilegedGraphWrapper
      * privileged}.
      */
-    private TripleCollection graph;
+    private Graph graph;
     /**
-     * keeps the state if this represents an {@link Graph} (read-only) or
-     * {@link MGraph}(read/write) ModelGraph.
+     * keeps the state if this represents an {@link ImmutableGraph} (read-only) or
+     * {@link Graph}(read/write) ModelGraph.
      */
     private final boolean readWrite;
     
@@ -71,21 +71,20 @@ public class ModelGraph {
                  * @return
                  */
                 @Override
-                public Graph getGraph() {
-                    return new SimpleGraph(this,true);
+                public ImmutableGraph getImmutableGraph() {
+                    return new SimpleImmutableGraph(this,true);
                 }
             };
-            graph = new PrivilegedGraphWrapper(jenaAdapter.getGraph());
-        } else { //construct an MGraph
-            jenaAdapter = new JenaGraphAdaptor(model.getGraph());
-            this.graph =  new DatasetLockedMGraph(lock,
-                new PrivilegedMGraphWrapper(jenaAdapter));
+            graph = new PrivilegedGraphWrapper(jenaAdapter).getImmutableGraph();
+        } else { //construct an Graph
+            jenaAdapter = new JenaGraphAdaptor(model.getGraph(), lock);
+            this.graph =  new PrivilegedGraphWrapper(jenaAdapter);
         }
     }
     /**
      * The {@link JenaGraphAdaptor}. For internal use only! Do not pass
      * this instance to other components. Use {@link #getGraph()} and
-     * {@link #getMGraph()} instead!
+     * {@link #getGraph()} instead!
      * @return the plain {@link JenaGraphAdaptor}
      */
     public JenaGraphAdaptor getJenaAdapter(){
@@ -96,28 +95,28 @@ public class ModelGraph {
         return readWrite;
     }
     /**
-     * Getter for the {@link MGraph}
-     * @return the {@link MGraph}
+     * Getter for the {@link Graph}
+     * @return the {@link Graph}
      * @throws IllegalStateException if this {@link ModelGraph} is NOT
      * {@link #readWrite}
      */
-    public MGraph getMGraph(){
+    public Graph getGraph(){
         if(!readWrite){
-            throw new IllegalStateException("Unable to return MGraph for read-only models");
+            throw new IllegalStateException("Unable to return Graph for read-only models");
         }
-        return (MGraph)graph;
+        return (Graph)graph;
     }
     /**
-     * Getter for the {@link Graph}
-     * @return the {@link Graph}
+     * Getter for the {@link ImmutableGraph}
+     * @return the {@link ImmutableGraph}
      * @throws IllegalStateException if this {@link ModelGraph} is 
      * {@link #readWrite}
      */
-    public Graph getGraph() {
+    public ImmutableGraph getImmutableGraph() {
         if(readWrite){
-            throw new IllegalStateException("Unable to return Graph for read/write models.");
+            throw new IllegalStateException("Unable to return ImmutableGraph for read/write models.");
         }
-        return (Graph)graph;
+        return (ImmutableGraph)graph;
     }
     /**
      * closes this ModelGraph and frees up all Jena TDB related resources.

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/Symbols.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/Symbols.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/Symbols.java
index ccf3003..39ec2fd 100644
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/Symbols.java
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/Symbols.java
@@ -1,6 +1,6 @@
 package org.apache.clerezza.rdf.jena.tdb.internals;
 
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 /**
  * Provides static methods in order to represent classes used to
@@ -11,12 +11,12 @@ import org.apache.clerezza.rdf.core.UriRef;
  */
 public class Symbols {
 
-    public static UriRef Index = new UriRef("http://clerezza.apache.org/storage/Index");
+    public static Iri Index = new Iri("http://clerezza.apache.org/storage/Index");
 
-    public static UriRef Default = new UriRef("http://clerezza.apache.org/storage/Default");
+    public static Iri Default = new Iri("http://clerezza.apache.org/storage/Default");
     
-    public static UriRef Graph = new UriRef("http://clerezza.apache.org/storage/Graph");
+    public static Iri ImmutableGraph = new Iri("http://clerezza.apache.org/storage/ImmutableGraph");
 
-    public static UriRef MGraph = new UriRef("http://clerezza.apache.org/storage/MGraph");
+    public static Iri Graph = new Iri("http://clerezza.apache.org/storage/Graph");
 
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/UriRefSet.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/UriRefSet.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/UriRefSet.java
deleted file mode 100644
index fb165d0..0000000
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/internals/UriRefSet.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.clerezza.rdf.jena.tdb.internals;
-
-import java.util.AbstractSet;
-import java.util.Iterator;
-
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.ontologies.RDF;
-
-/**
- * Represents a set of uri ref Set<UriRef>
- * @author Minto van der Sluis
- */
-public class UriRefSet extends AbstractSet<UriRef> {
-    private ModelGraph graphNameIndex;
-    private UriRef graphType;
-
-    public UriRefSet(ModelGraph index, UriRef object) {
-        graphNameIndex = index;
-        graphType = object;
-    }
-  
-    @Override
-    public int size() {
-        // TODO: How to get the proper size based on graphType
-        return graphNameIndex.getMGraph().size();
-    }
-  
-    @Override
-    public Iterator<UriRef> iterator() {
-        final Iterator<Triple> indexIter = graphNameIndex.getMGraph().filter( null, RDF.type, graphType );
-        return new Iterator<UriRef>() {
-            @Override
-            public boolean hasNext() {
-                return indexIter.hasNext();
-            }
-  
-            @Override
-            public UriRef next() {
-                return UriRef.class.cast(indexIter.next().getSubject());
-            }
-  
-            @Override
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
-    }
-    
-    @Override
-    public boolean add(UriRef o) {
-        throw new UnsupportedOperationException();
-    }
-  
-    @Override
-    public boolean contains(Object o) {
-        if (o instanceof UriRef) {
-            return graphNameIndex.getMGraph().filter(UriRef.class.cast(o), RDF.type, graphType).hasNext();
-        }
-        return false;
-    }
-};    

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
index c8a7a5f..feb5dcc 100644
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
@@ -3,7 +3,7 @@ package org.apache.clerezza.rdf.jena.tdb.storage;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
 import org.apache.clerezza.rdf.core.access.QueryableTcProvider;
 import org.apache.clerezza.rdf.core.sparql.query.Query;
 import org.apache.clerezza.rdf.jena.sparql.ResultSetWrapper;
@@ -18,7 +18,7 @@ import com.hp.hpl.jena.query.QueryFactory;
 import com.hp.hpl.jena.update.GraphStore;
 import com.hp.hpl.jena.update.GraphStoreFactory;
 import com.hp.hpl.jena.update.UpdateAction;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 abstract class BaseTdbTcProvider implements QueryableTcProvider{
 
@@ -33,7 +33,7 @@ abstract class BaseTdbTcProvider implements QueryableTcProvider{
 	// ------------------------------------------------------------------------
 
     @Override
-    public Object executeSparqlQuery(final String query, UriRef defaultGraph) {
+    public Object executeSparqlQuery(final String query, Iri defaultGraph) {
 		// Missing permission (java.lang.RuntimePermission getClassLoader)
 		// when calling QueryFactory.create causes ExceptionInInitializerError
 		// to be thrown.
@@ -71,10 +71,10 @@ abstract class BaseTdbTcProvider implements QueryableTcProvider{
 				} catch (QueryExecException e2) {
 					try {
 						return new JenaGraphAdaptor(qexec.execDescribe()
-								.getGraph()).getGraph();
+								.getGraph()).getImmutableGraph();
 					} catch (QueryExecException e3) {
 						return new JenaGraphAdaptor(qexec.execConstruct()
-								.getGraph()).getGraph();
+								.getGraph()).getImmutableGraph();
 					}
 				}
 			}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetTcProvider.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetTcProvider.java
index b8df417..8a9d1aa 100644
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetTcProvider.java
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetTcProvider.java
@@ -13,21 +13,21 @@ import java.util.concurrent.ConcurrentMap;
 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.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
 import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.QueryableTcProvider;
 import org.apache.clerezza.rdf.core.access.TcProvider;
 import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.jena.tdb.internals.ModelGraph;
 import org.apache.clerezza.rdf.jena.tdb.internals.Symbols;
-import org.apache.clerezza.rdf.jena.tdb.internals.UriRefSet;
+import org.apache.clerezza.rdf.jena.tdb.internals.IriSet;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -54,15 +54,15 @@ import org.apache.clerezza.rdf.core.access.TcManager;
 /**
  * {@link WeightedTcProvider} implementation for Jena TDB that uses a single
  * {@link TDBFactory#createDataset(String) Dataset} to store all created
- * {@link Graph} and {@link MGraph} instances.<p>
+ * {@link ImmutableGraph} and {@link Graph} instances.<p>
  * The {@link #TDB_DIR} is uses to configure the directory on the disc. It
  * supports property substitution <code>'${property}'</code> based on properties defined
  * in the {@link BundleContext#getProperty(String)} and 
  * {@link System#getProperty(String)}. This is to easily allow configurations
  * such as <code>"${myHome}/myRdfStore"</code><p>
  * The {@link #DEFAULT_GRAPH_NAME} property can be used to define the
- * name of the Graph that exposes the {@link Dataset#getDefaultModel()} as
- * both {@link TcProvider#getGraph(UriRef)} and {@link TcProvider#getMGraph(UriRef)}.
+ * name of the ImmutableGraph that exposes the {@link Dataset#getDefaultModel()} as
+ * both {@link TcProvider#getGraph(Iri)} and {@link TcProvider#getGraph(Iri)}.
  * This easily allows to access the union graph of the Jena TDB dataset.<p>
  * This {@link TcProvider} {@link ConfigurationPolicy#REQUIRE requires} an
  * configuration and uses the {@link Component#configurationFactory() 
@@ -109,10 +109,10 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     private SyncThread syncThread;
 
     private final ReadWriteLock datasetLock = new ReentrantReadWriteLock();;
-    private UriRef defaultGraphName;
+    private Iri defaultGraphName;
 
     // Ensure that models not yet garbage collected get properly synced.
-    private final ConcurrentMap<UriRef, ModelGraph> syncModels = new MapMaker().weakValues().makeMap();
+    private final ConcurrentMap<Iri, ModelGraph> syncModels = new MapMaker().weakValues().makeMap();
     
     /**
      * This background thread ensures that changes to {@link Model}s are
@@ -167,8 +167,8 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * <li> {@link #TDB_DIR} (required): The directory used by Jena TDB. Property
      * substitution "${property-name}" with {@link System#getProperties()} is
      * supported.
-     * <li> {@link #DEFAULT_GRAPH_NAME}: The name ({@link UriRef}) of the
-     * {@link Graph} that exports the union graph. This graph allows to query
+     * <li> {@link #DEFAULT_GRAPH_NAME}: The name ({@link Iri}) of the
+     * {@link ImmutableGraph} that exports the union graph. This graph allows to query
      * triples in any named model managed by this {@link TcProvider}.
      * <li> {@link #SYNC_INTERVAL}: The sync interval that
      * is used to write changes in the graph to the file system. If missing
@@ -257,7 +257,7 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
         if(value != null && !value.toString().isEmpty()){
             try {
                 new URI(value.toString());
-                defaultGraphName = new UriRef(value.toString());
+                defaultGraphName = new Iri(value.toString());
             } catch (URISyntaxException e) {
                 throw new ConfigurationException(DEFAULT_GRAPH_NAME, "The parsed name '"
                         + value + "'for the default graph (union over all "
@@ -291,10 +291,10 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
         if (defaultGraphName != null) {
           if (isExistingGraphName(defaultGraphName)) {
             throw new ConfigurationException(DEFAULT_GRAPH_NAME, "The configured default graph name '"
-                +defaultGraphName+"' is already used as a Graph or MGraph name!");
+                +defaultGraphName+"' is already used as a ImmutableGraph or Graph name!");
           } else {
             addToIndex( defaultGraphName, Symbols.Default );
-            addToIndex( defaultGraphName, Symbols.Graph );
+            addToIndex( defaultGraphName, Symbols.ImmutableGraph );
           }
         }
 
@@ -357,18 +357,18 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     /**
      * Internal method used to retrieve an existing Jena {@link ModelGraph} 
      * instance from {@link #syncModels} or initializes a new Jena TDB {@link Model}
-     * and Clerezza {@link Graph}s/{@link MGraph}s.
-     * @param name the name of the Graph to initialize/create
-     * @param readWrite if <code>true</code> a {@link MGraph} is initialized.
-     * Otherwise a {@link Graph} is created.
+     * and Clerezza {@link ImmutableGraph}s/{@link Graph}s.
+     * @param name the name of the ImmutableGraph to initialize/create
+     * @param readWrite if <code>true</code> a {@link Graph} is initialized.
+     * Otherwise a {@link ImmutableGraph} is created.
      * @param create if this method is allowed to create an new {@link Model} or
      * if an already existing model is initialized.
-     * @return the initialized {@link Model} and @link Graph} or {@link MGraph}.
+     * @return the initialized {@link Model} and @link ImmutableGraph} or {@link Graph}.
      * The returned instance will be also cached in {@link #syncModels}. 
      * @throws NoSuchEntityException If <code>create == false</code> and no
      * {@link Model} for the parsed <code>name</code> exists.
      */
-    private ModelGraph getModelGraph(UriRef name, boolean readWrite,boolean create) throws NoSuchEntityException {
+    private ModelGraph getModelGraph(Iri name, boolean readWrite,boolean create) throws NoSuchEntityException {
         ModelGraph modelGraph = null;
         datasetLock.readLock().lock();
         try {
@@ -396,17 +396,17 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#getGraph(org.apache.clerezza.rdf.core.UriRef)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#getGraph(org.apache.commons.rdf.Iri)
      */
     @Override
-    public Graph getGraph(UriRef name) throws NoSuchEntityException {
+    public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
         if(name == null){
-            throw new IllegalArgumentException("The parsed Graph UriRef MUST NOT be NULL!");
+            throw new IllegalArgumentException("The parsed ImmutableGraph Iri MUST NOT be NULL!");
         }
         datasetLock.readLock().lock();
         try {
-            if (isExistingGraphName(name, Symbols.Graph) || name.equals(defaultGraphName)){
-                return getModelGraph(name,false,false).getGraph();
+            if (isExistingGraphName(name, Symbols.ImmutableGraph) || name.equals(defaultGraphName)){
+                return getModelGraph(name,false,false).getImmutableGraph();
             } else {
                 throw new NoSuchEntityException(name);
             }
@@ -417,17 +417,17 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#getMGraph(org.apache.clerezza.rdf.core.UriRef)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#getGraph(org.apache.commons.rdf.Iri)
      */
     @Override
-    public MGraph getMGraph(UriRef name) throws NoSuchEntityException {
+    public Graph getMGraph(Iri name) throws NoSuchEntityException {
         if(name == null){
-            throw new IllegalArgumentException("The parsed Graph UriRef MUST NOT be NULL!");
+            throw new IllegalArgumentException("The parsed ImmutableGraph Iri MUST NOT be NULL!");
         }
         datasetLock.readLock().lock();
         try {
-            if(isExistingGraphName(name, Symbols.MGraph)){
-                return getModelGraph(name,true,false).getMGraph();
+            if(isExistingGraphName(name, Symbols.Graph)){
+                return getModelGraph(name,true,false).getGraph();
             } else {
                 throw new NoSuchEntityException(name);
             }
@@ -438,19 +438,19 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#getTriples(org.apache.clerezza.rdf.core.UriRef)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#getTriples(org.apache.commons.rdf.Iri)
      */
     @Override
-    public TripleCollection getTriples(UriRef name) throws NoSuchEntityException {
+    public Graph getGraph(Iri name) throws NoSuchEntityException {
         if(name == null){
-            throw new IllegalArgumentException("The parsed Graph UriRef MUST NOT be NULL!");
+            throw new IllegalArgumentException("The parsed ImmutableGraph Iri MUST NOT be NULL!");
         }
         datasetLock.readLock().lock();
         try {
-            if(isExistingGraphName(name, Symbols.Graph) || name.equals(defaultGraphName)){
-                return getGraph(name);
-            } else if(isExistingGraphName(name, Symbols.MGraph)){
+            if(isExistingGraphName(name, Symbols.ImmutableGraph) || name.equals(defaultGraphName)){
                 return getMGraph(name);
+            } else if(isExistingGraphName(name, Symbols.Graph)){
+                return getImmutableGraph(name);
             } else {
                 throw new NoSuchEntityException(name);
             }
@@ -464,10 +464,10 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * @see org.apache.clerezza.rdf.core.access.TcProvider#listGraphs()
      */
     @Override
-    public Set<UriRef> listGraphs() {
+    public Set<Iri> listImmutableGraphs() {
         datasetLock.readLock().lock();
         try {
-            return new HashSet(new UriRefSet( graphNameIndex, Symbols.Graph ));
+            return new HashSet(new IriSet( graphNameIndex, Symbols.ImmutableGraph ));
         } finally {
             datasetLock.readLock().unlock();
         }
@@ -475,13 +475,13 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
 
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#listMGraphs()
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#listGraphs()
      */
     @Override
-    public Set<UriRef> listMGraphs() {
+    public Set<Iri> listMGraphs() {
         datasetLock.readLock().lock();
         try {
-            return  new HashSet(new UriRefSet( graphNameIndex, Symbols.MGraph ));
+            return  new HashSet(new IriSet( graphNameIndex, Symbols.Graph ));
         } finally {
             datasetLock.readLock().unlock();
         }
@@ -489,13 +489,13 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
 
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#listTripleCollections()
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#listGraphs()
      */
     @Override
-    public Set<UriRef> listTripleCollections() {
+    public Set<Iri> listGraphs() {
         datasetLock.readLock().lock();
         try {
-            return  new HashSet(new UriRefSet( graphNameIndex, null ));
+            return  new HashSet(new IriSet( graphNameIndex, null ));
         } finally {
             datasetLock.readLock().unlock();
         }
@@ -503,10 +503,10 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
 
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#createMGraph(org.apache.clerezza.rdf.core.UriRef)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#createGraph(org.apache.commons.rdf.Iri)
      */
     @Override
-    public MGraph createMGraph(UriRef name) throws UnsupportedOperationException,
+    public Graph createGraph(Iri name) throws UnsupportedOperationException,
                                            EntityAlreadyExistsException {
         if(name == null){
             throw new IllegalArgumentException("The parsed MGrpah name MUST NOT be NULL!");
@@ -516,8 +516,8 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
             if(isExistingGraphName(name)){
                 throw new EntityAlreadyExistsException(name);
             }
-            MGraph graph = getModelGraph(name,true,true).getMGraph();
-            addToIndex( name, Symbols.MGraph);
+            Graph graph = getModelGraph(name,true,true).getGraph();
+            addToIndex( name, Symbols.Graph);
             return graph;
         } finally {
             datasetLock.writeLock().unlock();
@@ -526,10 +526,10 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#createGraph(org.apache.clerezza.rdf.core.UriRef, org.apache.clerezza.rdf.core.TripleCollection)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#createGraph(org.apache.commons.rdf.Iri, org.apache.commons.rdf.Graph)
      */
     @Override
-    public Graph createGraph(UriRef name, TripleCollection triples) throws UnsupportedOperationException,
+    public ImmutableGraph createImmutableGraph(Iri name, Graph triples) throws UnsupportedOperationException,
                                                                    EntityAlreadyExistsException {
         if(name == null){
             throw new IllegalArgumentException("The parsed Grpah name MUST NOT be NULL!");
@@ -541,7 +541,7 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
                 throw new EntityAlreadyExistsException(name);
             }
             mg = getModelGraph(name,false,true);
-            addToIndex( name, Symbols.Graph);
+            addToIndex( name, Symbols.ImmutableGraph);
             
             //add the parsed data!
             if(triples != null) { //load the initial and final set of triples
@@ -551,15 +551,15 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
         } finally {
             datasetLock.writeLock().unlock();
         }
-        return mg.getGraph();
+        return mg.getImmutableGraph();
     }
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#deleteTripleCollection(org.apache.clerezza.rdf.core.UriRef)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#deleteGraph(org.apache.commons.rdf.Iri)
      */
     @Override
-    public void deleteTripleCollection(UriRef name) throws UnsupportedOperationException,
+    public void deleteGraph(Iri name) throws UnsupportedOperationException,
                                                    NoSuchEntityException,
                                                    EntityUndeletableException {
         if(name == null){
@@ -567,14 +567,14 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
         }
         datasetLock.writeLock().lock();
         try {
-            if(isExistingGraphName(name,Symbols.MGraph)){
+            if(isExistingGraphName(name,Symbols.Graph)){
                 ModelGraph mg = getModelGraph(name, true, false);
                 mg.delete();
-                removeFromIndex( name, Symbols.MGraph );
-            } else if(isExistingGraphName(name,Symbols.Graph)){
+                removeFromIndex( name, Symbols.Graph );
+            } else if(isExistingGraphName(name,Symbols.ImmutableGraph)){
                 ModelGraph mg = getModelGraph(name, false, false);
                 mg.delete();
-                removeFromIndex( name, Symbols.Graph );
+                removeFromIndex( name, Symbols.ImmutableGraph );
             } else if (name.equals(defaultGraphName)){
                 throw new EntityUndeletableException(defaultGraphName);
             }
@@ -587,17 +587,17 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     
     /*
      * (non-Javadoc)
-     * @see org.apache.clerezza.rdf.core.access.TcProvider#getNames(org.apache.clerezza.rdf.core.Graph)
+     * @see org.apache.clerezza.rdf.core.access.TcProvider#getNames(org.apache.commons.rdf.ImmutableGraph)
      */
     @Override
-    public Set<UriRef> getNames(Graph graph) {
+    public Set<Iri> getNames(ImmutableGraph graph) {
         //TODO: this method would require to compare the triples within the graph
-        //      because an equals check will not work with BNodes. 
-        Set<UriRef> graphNames = new HashSet<UriRef>();
-        for( Iterator<Triple> iterator = graphNameIndex.getMGraph().iterator(); iterator.hasNext(); ) {
+        //      because an equals check will not work with BlankNodes. 
+        Set<Iri> graphNames = new HashSet<Iri>();
+        for( Iterator<Triple> iterator = graphNameIndex.getGraph().iterator(); iterator.hasNext(); ) {
             Triple triple = iterator.next();
-            UriRef graphName = new UriRef(triple.getSubject().toString());
-            Graph currentGraph = getModelGraph(graphName, false, false).getGraph();
+            Iri graphName = new Iri(triple.getSubject().toString());
+            ImmutableGraph currentGraph = getModelGraph(graphName, false, false).getImmutableGraph();
             if(graph.equals(currentGraph)){
                 graphNames.add(graphName);
             }
@@ -666,8 +666,8 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * @param graphType the resource type
      * @return true if a resource with the given name and type already exists, false otherwise.
      */
-    private boolean isExistingGraphName(UriRef graphName, UriRef graphType) {
-        return graphNameIndex.getMGraph().filter(graphName, RDF.type, graphType).hasNext();
+    private boolean isExistingGraphName(Iri graphName, Iri graphType) {
+        return graphNameIndex.getGraph().filter(graphName, RDF.type, graphType).hasNext();
     }
 
     /**
@@ -675,7 +675,7 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * @param graphName the graph name
      * @return true if a graph or mgraph with the given name already exists, false otherwise.
      */
-    private boolean isExistingGraphName(UriRef graphName) {
+    private boolean isExistingGraphName(Iri graphName) {
         return isExistingGraphName(graphName, null);
     }
     
@@ -684,8 +684,8 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * @param graphName name of the graph
      * @param graphType resourcetype for the graph to add.
      */
-    private void addToIndex(UriRef graphName, UriRef graphType) {
-        graphNameIndex.getMGraph().add(new TripleImpl(graphName, RDF.type, graphType));
+    private void addToIndex(Iri graphName, Iri graphType) {
+        graphNameIndex.getGraph().add(new TripleImpl(graphName, RDF.type, graphType));
         graphNameIndex.sync();
     }
     
@@ -694,8 +694,8 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
      * @param graphName name of the graph to remove
      * @param graphType resource type of the graph to remove.
      */
-    private void removeFromIndex(UriRef graphName, UriRef graphType) {
-        MGraph index = graphNameIndex.getMGraph();
+    private void removeFromIndex(Iri graphName, Iri graphType) {
+        Graph index = graphNameIndex.getGraph();
         Iterator<Triple> triplesToRemove = index.filter(graphName, RDF.type, graphType);
         for( ; triplesToRemove.hasNext(); ) {
             triplesToRemove.next();
@@ -705,12 +705,12 @@ public class SingleTdbDatasetTcProvider extends BaseTdbTcProvider implements Wei
     }
     
     private void removeDefaultGraphFromIndex() {
-      MGraph index = graphNameIndex.getMGraph();
+      Graph index = graphNameIndex.getGraph();
       Iterator<Triple> triplesToRemove = index.filter(null, RDF.type, Symbols.Default);
       for( ; triplesToRemove.hasNext(); ) {
           Triple triple = triplesToRemove.next();
           triplesToRemove.remove();
-          removeFromIndex( UriRef.class.cast(triple.getSubject()), Symbols.Graph );
+          removeFromIndex( Iri.class.cast(triple.getSubject()), Symbols.ImmutableGraph );
       }
       graphNameIndex.sync();
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
index f8924fc..d50ef64 100644
--- a/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
+++ b/rdf/jena/tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
@@ -38,19 +38,16 @@ import java.util.logging.Level;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-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.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
 import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.core.access.LockableMGraphWrapper;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.util.PrivilegedMGraphWrapper;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper;
 import org.apache.clerezza.rdf.jena.storage.JenaGraphAdaptor;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Properties;
@@ -89,8 +86,8 @@ public class TdbTcProvider implements WeightedTcProvider {
      */
     private static final String DATA_PATH_NAME = "tdb-data/";
     private String dataPathString = DATA_PATH_NAME;
-    private Map<UriRef, LockableMGraph> mGraphMap = new HashMap<UriRef, LockableMGraph>();
-    private Map<UriRef, Graph> graphMap = new HashMap<UriRef, Graph>();
+    private Map<Iri, Graph> mGraphMap = new HashMap<Iri, Graph>();
+    private Map<Iri, ImmutableGraph> graphMap = new HashMap<Iri, ImmutableGraph>();
     private Map<File, com.hp.hpl.jena.graph.Graph> dir2JenaGraphMap = new HashMap<File, com.hp.hpl.jena.graph.Graph>();
     private Map<File, Lock> dir2Lock = new HashMap<File, Lock>();
     private final Map<File, Dataset> dir2Dataset = new HashMap<File, Dataset>();
@@ -126,8 +123,8 @@ public class TdbTcProvider implements WeightedTcProvider {
 
     TdbTcProvider(File directory) {
         dataPathString = directory.getAbsolutePath();
-        loadMGraphs();
         loadGraphs();
+        loadImmutableGraphs();
     }
 
     public void activate(ComponentContext cCtx) {
@@ -138,8 +135,8 @@ public class TdbTcProvider implements WeightedTcProvider {
                     getDataFile(DATA_PATH_NAME).getAbsolutePath();
             syncInterval = Integer.parseInt(cCtx.getProperties().get(SYNC_INTERVAL).toString());
         }
-        loadMGraphs();
         loadGraphs();
+        loadImmutableGraphs();
         syncThread = new SyncThread();
         syncThread.start();
     }
@@ -163,7 +160,7 @@ public class TdbTcProvider implements WeightedTcProvider {
     }
 
     @Override
-    public Graph getGraph(UriRef name) throws NoSuchEntityException {
+    public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
         if (!graphMap.containsKey(name)) {
             throw new NoSuchEntityException(name);
         }
@@ -171,7 +168,7 @@ public class TdbTcProvider implements WeightedTcProvider {
     }
 
     @Override
-    public synchronized MGraph getMGraph(UriRef name) throws NoSuchEntityException {
+    public synchronized Graph getMGraph(Iri name) throws NoSuchEntityException {
         if (!mGraphMap.containsKey(name)) {
             throw new NoSuchEntityException(name);
         }
@@ -179,18 +176,18 @@ public class TdbTcProvider implements WeightedTcProvider {
     }
 
     @Override
-    public TripleCollection getTriples(UriRef name) throws NoSuchEntityException {
+    public Graph getGraph(Iri name) throws NoSuchEntityException {
         try {
             return getMGraph(name);
         } catch (NoSuchEntityException e) {
-            return getGraph(name);
+            return getImmutableGraph(name);
         }
     }
 
     @Override
-    public synchronized MGraph createMGraph(UriRef name)
+    public synchronized Graph createGraph(Iri name)
             throws UnsupportedOperationException, EntityAlreadyExistsException {
-        File tcDir = getMGraphDir(name);
+        File tcDir = getGraphDir(name);
         if (tcDir.exists()) {
             throw new EntityAlreadyExistsException(name);
         }
@@ -201,22 +198,22 @@ public class TdbTcProvider implements WeightedTcProvider {
         } catch (IOException ex) {
             throw new RuntimeException(ex);
         }
-        LockableMGraph result = new LockableMGraphWrapper(getMGraph(tcDir));
+        Graph result = getGraph(tcDir);
         dir2Lock.put(tcDir, result.getLock().writeLock());
         mGraphMap.put(name, result);
         return result;
     }
 
     @Override
-    public Graph createGraph(UriRef name, TripleCollection triples)
+    public ImmutableGraph createImmutableGraph(Iri name, Graph triples)
             throws UnsupportedOperationException, EntityAlreadyExistsException {
-        File tcDir = getGraphDir(name);
+        File tcDir = getImmutableGraphDir(name);
         if (tcDir.exists()) {
             throw new EntityAlreadyExistsException(name);
         }
 
         if (triples == null) {
-            triples = new SimpleMGraph();
+            triples = new SimpleGraph();
         }
         tcDir.mkdirs();
         File otimizationIndicator = new File(tcDir, "fixed.opt");
@@ -225,24 +222,24 @@ public class TdbTcProvider implements WeightedTcProvider {
         } catch (IOException ex) {
             throw new RuntimeException(ex);
         }
-        MGraph mGraph = getMGraph(tcDir);
+        Graph mGraph = getGraph(tcDir);
         mGraph.addAll(triples);
-        Graph result = mGraph.getGraph();
+        ImmutableGraph result = mGraph.getImmutableGraph();
         TDB.sync(dir2Dataset.get(tcDir));
         graphMap.put(name, result);
         return result;
     }
 
     @Override
-    public void deleteTripleCollection(UriRef name)
+    public void deleteGraph(Iri name)
             throws UnsupportedOperationException, NoSuchEntityException,
             EntityUndeletableException {
         syncWithFileSystem();
-        if (deleteTcDir(getGraphDir(name))) {
+        if (deleteTcDir(getImmutableGraphDir(name))) {
             graphMap.remove(name);
             return;
         }
-        if (deleteTcDir(getMGraphDir(name))) {
+        if (deleteTcDir(getGraphDir(name))) {
             mGraphMap.remove(name);
             return;
         }
@@ -312,11 +309,11 @@ public class TdbTcProvider implements WeightedTcProvider {
     }
 
     @Override
-    public Set<UriRef> getNames(Graph graph) {
+    public Set<Iri> getNames(ImmutableGraph graph) {
         //this could be done more efficiently with an index, could be done with
         //a MultiBidiMap (BidiMap allowing multiple keys for the same value)
-        Set<UriRef> result = new HashSet<UriRef>();
-        for (UriRef name : listGraphs()) {
+        Set<Iri> result = new HashSet<Iri>();
+        for (Iri name : listGraphs()) {
             if (getGraph(name).equals(graph)) {
                 result.add(name);
             }
@@ -325,33 +322,33 @@ public class TdbTcProvider implements WeightedTcProvider {
     }
 
     @Override
-    public Set<UriRef> listTripleCollections() {
-        Set<UriRef> result = new HashSet<UriRef>();
+    public Set<Iri> listGraphs() {
+        Set<Iri> result = new HashSet<Iri>();
+        result.addAll(listGraphs());
         result.addAll(listGraphs());
-        result.addAll(listMGraphs());
         return result;
     }
 
     @Override
-    public Set<UriRef> listGraphs() {
+    public Set<Iri> listMGraphs() {
         return graphMap.keySet();
     }
 
     @Override
-    public Set<UriRef> listMGraphs() {
+    public Set<Iri> listImmutableGraphs() {
         return mGraphMap.keySet();
     }
 
-    private Graph getGraph(File tcDir) {
-        return getMGraph(tcDir).getGraph();
+    private ImmutableGraph getImmutableGraph(File tcDir) {
+        return getGraph(tcDir).getImmutableGraph();
     }
 
-    private File getGraphDir(UriRef name) {
+    private File getImmutableGraphDir(Iri name) {
         File base = new File(dataPathString);
         return getTcDir(new File(base, "graph"), name);
     }
 
-    private MGraph getMGraph(File tcDir) {
+    private Graph getGraph(File tcDir) {
         Dataset dataset = TDBFactory.createDataset(tcDir.getAbsolutePath());
         Model model = dataset.getDefaultModel();
         //Model model = TDBFactory.createModel(tcDir.getAbsolutePath());
@@ -361,15 +358,15 @@ public class TdbTcProvider implements WeightedTcProvider {
         synchronized (dir2Dataset) {
             dir2Dataset.put(tcDir, dataset);
         }
-        return new PrivilegedMGraphWrapper(new JenaGraphAdaptor(jenaGraph));
+        return new PrivilegedGraphWrapper(new JenaGraphAdaptor(jenaGraph));
     }
 
-    private File getMGraphDir(UriRef name) {
+    private File getGraphDir(Iri name) {
         File base = new File(dataPathString);
         return getTcDir(new File(base, "mgraph"), name);
     }
 
-    private File getTcDir(File directory, UriRef name) {
+    private File getTcDir(File directory, Iri name) {
         try {
             String subDirName = URLEncoder.encode(name.getUnicodeString(), "utf-8");
             return new File(directory, subDirName);
@@ -378,14 +375,14 @@ public class TdbTcProvider implements WeightedTcProvider {
         }
     }
 
-    private void loadGraphs() {
+    private void loadImmutableGraphs() {
         File graphsDir = new File(new File(dataPathString), "graph");
         if (graphsDir.exists()) {
             for (String graphDirName : graphsDir.list()) {
                 try {
-                    UriRef uri = new UriRef(URLDecoder.decode(graphDirName, "utf-8"));
+                    Iri uri = new Iri(URLDecoder.decode(graphDirName, "utf-8"));
                     log.info("loading: " + graphDirName);
-                    graphMap.put(uri, getGraph(new File(graphsDir, graphDirName)));
+                    graphMap.put(uri, getImmutableGraph(new File(graphsDir, graphDirName)));
                 } catch (UnsupportedEncodingException ex) {
                     throw new RuntimeException("utf-8 not supported", ex);
                 } catch (Exception e) {
@@ -395,17 +392,17 @@ public class TdbTcProvider implements WeightedTcProvider {
         }
     }
 
-    private void loadMGraphs() {
+    private void loadGraphs() {
         File mGraphsDir = new File(new File(dataPathString), "mgraph");
         if (mGraphsDir.exists()) {
             for (String mGraphDirName : mGraphsDir.list()) {
                 try {
-                    UriRef uri = new UriRef(URLDecoder.decode(mGraphDirName, "utf-8"));
+                    Iri uri = new Iri(URLDecoder.decode(mGraphDirName, "utf-8"));
                     log.info("loading: " + mGraphDirName);
                     final File tcDir = new File(mGraphsDir, mGraphDirName);
-                    final LockableMGraphWrapper lockableMGraph = new LockableMGraphWrapper(getMGraph(tcDir));
-                    mGraphMap.put(uri, lockableMGraph);
-                    dir2Lock.put(tcDir, lockableMGraph.getLock().writeLock());
+                    final Graph lockableGraph = getGraph(tcDir);
+                    mGraphMap.put(uri, lockableGraph);
+                    dir2Lock.put(tcDir, lockableGraph.getLock().writeLock());
                 } catch (UnsupportedEncodingException ex) {
                     throw new RuntimeException("utf-8 not supported", ex);
                 } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedSingleTdbDatasetTest.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedSingleTdbDatasetTest.java b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedSingleTdbDatasetTest.java
index ac0dc89..d08ce42 100644
--- a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedSingleTdbDatasetTest.java
+++ b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedSingleTdbDatasetTest.java
@@ -33,14 +33,13 @@ import java.util.Random;
 import java.util.Set;
 
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Literal;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
@@ -69,7 +68,7 @@ public class MultiThreadedSingleTdbDatasetTest {
     private static final int DELAY = 15;
     
     
-    protected final List<MGraph> mGraphs = new ArrayList<MGraph>();
+    protected final List<Graph> mGraphs = new ArrayList<Graph>();
     protected final List<Set<Triple>> testTriplesList = new ArrayList<Set<Triple>>();
     private Random random = new Random();
 
@@ -94,7 +93,7 @@ public class MultiThreadedSingleTdbDatasetTest {
                 synchronized (random) {
                     r = random.nextFloat();
                 }
-                MGraph graph;
+                Graph graph;
                 Set<Triple> testTriples;
                 if(r > 0.995){
                     int num;
@@ -102,7 +101,7 @@ public class MultiThreadedSingleTdbDatasetTest {
                         num = graphNum[0];
                         graphNum[0]++;
                     }
-                    graph = provider.createMGraph(new UriRef(TEST_GRAPH_URI_PREFIX+num));
+                    graph = provider.createGraph(new Iri(TEST_GRAPH_URI_PREFIX+num));
                     log.info(" ... creating the {}. Grpah", num+1);
                     testTriples = new HashSet<Triple>();
                     synchronized (mGraphs) {
@@ -117,7 +116,7 @@ public class MultiThreadedSingleTdbDatasetTest {
                     }
                 }
                 Literal randomLiteral = new PlainLiteralImpl(Util.createRandomString(22));
-                Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), randomLiteral);
+                Triple triple = new TripleImpl(new BlankNode(), new Iri("http://example.com/property"), randomLiteral);
                 graph.add(triple);
                 addedTripleCount++;
                 if ((addedTripleCount % 100) == 0) {
@@ -132,7 +131,7 @@ public class MultiThreadedSingleTdbDatasetTest {
 
     }
     /**
-     * Iterates over max. the first 10 triples of a Graph
+     * Iterates over max. the first 10 triples of a ImmutableGraph
      * while acquiring a read lock on the graph.
      * @author westei
      *
@@ -158,9 +157,9 @@ public class MultiThreadedSingleTdbDatasetTest {
                     r = random.nextFloat();
                 }
                 int num = Math.round(r*(float)(mGraphs.size()-1));
-                LockableMGraph graph;
+                Graph graph;
                 synchronized (mGraphs) {
-                    graph = (LockableMGraph)mGraphs.get(num);
+                    graph = mGraphs.get(num);
                 }
                 int elem = 0;
                 graph.getLock().readLock().lock();
@@ -202,10 +201,10 @@ public class MultiThreadedSingleTdbDatasetTest {
     }
     @Before
     public void createGraphs(){
-        mGraphs.add(provider.createMGraph(new UriRef(TEST_GRAPH_URI_PREFIX+graphNum[0])));
+        mGraphs.add(provider.createGraph(new Iri(TEST_GRAPH_URI_PREFIX+graphNum[0])));
         testTriplesList.add(new HashSet<Triple>());
         graphNum[0]++;
-        mGraphs.add(provider.createMGraph(new UriRef(TEST_GRAPH_URI_PREFIX+graphNum[0])));
+        mGraphs.add(provider.createGraph(new Iri(TEST_GRAPH_URI_PREFIX+graphNum[0])));
         testTriplesList.add(new HashSet<Triple>());
         graphNum[0]++;
     }
@@ -239,7 +238,7 @@ public class MultiThreadedSingleTdbDatasetTest {
         int graphTriples = 0;
         log.info("Test created {} graphs with {} triples", mGraphs.size(), addedTriples);
         for(int i = 0;i < mGraphs.size(); i++){
-            MGraph graph = mGraphs.get(i);
+            Graph graph = mGraphs.get(i);
             graphTriples += graph.size();
             log.info("  > Grpah {}: {} triples",i,graph.size());
             for (Triple testTriple : testTriplesList.get(i)) {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTest.java b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTest.java
index 91791c3..88a6cec 100644
--- a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTest.java
+++ b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTest.java
@@ -28,14 +28,14 @@ import java.util.HashSet;
 import java.util.Set;
 
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Literal;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.felix.scr.annotations.Activate;
 import org.junit.Assert;
 import org.junit.Before;
@@ -57,7 +57,7 @@ public class MultiThreadedTest {
     private static final int DELAY = 15;
     
     
-    private MGraph mGraph;
+    private Graph mGraph;
     private Set<Triple> testTriples = Collections.synchronizedSet(new HashSet<Triple>()); 
 
     class TestThread extends Thread {
@@ -81,7 +81,7 @@ public class MultiThreadedTest {
             while (!stopRequested) {
                 try {
                     Literal randomLiteral = new PlainLiteralImpl(Util.createRandomString(22));
-                    Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), randomLiteral);
+                    Triple triple = new TripleImpl(new BlankNode(), new Iri("http://example.com/property"), randomLiteral);
                     mGraph.add(triple);
                     addedTripleCount++;
                     if ((addedTripleCount % 100) == 0) {
@@ -104,14 +104,14 @@ public class MultiThreadedTest {
     @Before
     public void setUp() throws IOException {
         File tempFile;
-        UriRef MGRAPHNAME = new UriRef("http://text.example.org/");
+        Iri MGRAPHNAME = new Iri("http://text.example.org/");
         TdbTcProvider tdbTcProvider;
         tempFile = File.createTempFile("tdbtest", null);
         tempFile.delete();
         tempFile.mkdirs();
         tdbTcProvider = new TdbTcProvider(tempFile);
         tdbTcProvider.activate(null);
-        mGraph = tdbTcProvider.createMGraph(MGRAPHNAME);
+        mGraph = tdbTcProvider.createGraph(MGRAPHNAME);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTestSingleTdb.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTestSingleTdb.java b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTestSingleTdb.java
index 76505b3..2554225 100644
--- a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTestSingleTdb.java
+++ b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/MultiThreadedTestSingleTdb.java
@@ -31,15 +31,15 @@ import java.util.Hashtable;
 import java.util.Set;
 
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.MGraph;
-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.BlankNode;
+import org.apache.commons.rdf.Literal;
+import org.apache.commons.rdf.Graph;
+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.TcProvider;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.felix.scr.annotations.Activate;
 import org.junit.Assert;
 import org.junit.Before;
@@ -62,7 +62,7 @@ public class MultiThreadedTestSingleTdb {
     private static final int DELAY = 15;
     
     
-    private MGraph mGraph;
+    private Graph mGraph;
     private Set<Triple> testTriples = Collections.synchronizedSet(new HashSet<Triple>()); 
 
     class TestThread extends Thread {
@@ -86,7 +86,7 @@ public class MultiThreadedTestSingleTdb {
             while (!stopRequested) {
                 try {
                     Literal randomLiteral = new PlainLiteralImpl(Util.createRandomString(22));
-                    Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), randomLiteral);
+                    Triple triple = new TripleImpl(new BlankNode(), new Iri("http://example.com/property"), randomLiteral);
                     mGraph.add(triple);
                     addedTripleCount++;
                     if ((addedTripleCount % 100) == 0) {
@@ -109,7 +109,7 @@ public class MultiThreadedTestSingleTdb {
     @Before
     public void setUp() throws IOException, ConfigurationException {
         File tempFile;
-        UriRef MGRAPHNAME = new UriRef("http://text.example.org/");
+        Iri MGRAPHNAME = new Iri("http://text.example.org/");
         TcProvider tdbTcProvider;
         tempFile = File.createTempFile("tdbtest", null);
         tempFile.delete();
@@ -118,7 +118,7 @@ public class MultiThreadedTestSingleTdb {
         dict.put(SingleTdbDatasetTcProvider.TDB_DIR, tempFile.getAbsolutePath());
         tdbTcProvider = new SingleTdbDatasetTcProvider(dict);
         //tdbTcProvider.activate(null);
-        mGraph = tdbTcProvider.createMGraph(MGRAPHNAME);
+        mGraph = tdbTcProvider.createGraph(MGRAPHNAME);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/clerezza/blob/8a337849/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetGraphTest.java b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetGraphTest.java
new file mode 100644
index 0000000..30451f3
--- /dev/null
+++ b/rdf/jena/tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/SingleTdbDatasetGraphTest.java
@@ -0,0 +1,56 @@
+package org.apache.clerezza.rdf.jena.tdb.storage;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.test.GraphTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.osgi.service.cm.ConfigurationException;
+
+public class SingleTdbDatasetGraphTest extends GraphTest {
+
+    private static final String MGRAPHNAME_PREFIX = "http://text.example.org/testGraph";
+    private static Iri UNION_GRAPH_NAME = new Iri("http://www.example.org/unionGraph");
+    private static int testGraphCounter = 0;
+
+    private static File tempFile;
+    private static Dictionary<String,Object> config;
+    private static SingleTdbDatasetTcProvider provider;
+
+    @BeforeClass
+    public static void setup() throws IOException, ConfigurationException {
+        tempFile = File.createTempFile("tdbdatasettest", null);
+        tempFile.delete();
+        tempFile.mkdirs();
+        config = new Hashtable<String,Object>();
+        config.put(SingleTdbDatasetTcProvider.TDB_DIR, tempFile.getAbsolutePath());
+        config.put(SingleTdbDatasetTcProvider.DEFAULT_GRAPH_NAME, UNION_GRAPH_NAME.getUnicodeString());
+        provider = new SingleTdbDatasetTcProvider(config);
+    }
+    
+    @AfterClass
+    public static void cleanUpDirectory() throws IOException {
+        for(int i = 0; i < testGraphCounter;i++){
+            provider.deleteGraph(new Iri(MGRAPHNAME_PREFIX+i));
+        }
+        provider.deactivate(null);
+        try {
+            TdbTcProvider.delete(tempFile);
+        } catch (IOException e) {
+            System.err.println("Couldn't remove "+tempFile);
+        }
+    }
+
+    @Override
+    protected Graph getEmptyGraph() {
+        Graph graph = provider.createGraph(new Iri(MGRAPHNAME_PREFIX+testGraphCounter));
+        testGraphCounter++;
+        return graph;
+    }
+
+}


Mime
View raw message