clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [3/4] clerezza git commit: using rdf.commons draft in core
Date Thu, 18 Dec 2014 20:23:01 GMT
http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
index 74a88b2..3e046a0 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/security/TcAccessController.java
@@ -31,18 +31,18 @@ import java.util.LinkedList;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.rdf.core.BNode;
+import org.apache.commons.rdf.BlankNode;
 import org.apache.clerezza.rdf.core.LiteralFactory;
-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.TypedLiteral;
-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.Iri;
 import org.apache.clerezza.rdf.core.access.LockableMGraph;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.utils.security.PermissionParser;
+import org.apache.commons.rdf.Literal;
 
 /**
  * Controls the permissions needed to access a triple collection provided by
@@ -59,24 +59,24 @@ import org.apache.clerezza.utils.security.PermissionParser;
 public abstract class TcAccessController {
 
     private final TcManager tcManager;
-    private final UriRef permissionGraphName = new UriRef("urn:x-localinstance:/graph-access.graph");
+    private final Iri permissionGraphName = new Iri("urn:x-localinstance:/graph-access.graph");
     //we can't rely on ontology plugin in rdf core
     private String ontologyNamespace = "http://clerezza.apache.org/2010/07/10/graphpermssions#";
-    private final UriRef readPermissionListProperty = new UriRef(ontologyNamespace + "readPermissionList");
-    private final UriRef readWritePermissionListProperty = new UriRef(ontologyNamespace + "readWritePermissionList");
+    private final Iri readPermissionListProperty = new Iri(ontologyNamespace + "readPermissionList");
+    private final Iri readWritePermissionListProperty = new Iri(ontologyNamespace + "readWritePermissionList");
     /**
      * The first item in the subject RDF list.
      */
-    public static final UriRef first = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+    public static final Iri first = new Iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
     /**
      * The rest of the subject RDF list after the first item.
      */
-    public static final UriRef rest = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
-    public static final UriRef rdfNil = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
-    private final Map<UriRef, Collection<Permission>> readPermissionCache =
-            Collections.synchronizedMap(new HashMap<UriRef, Collection<Permission>>());
-    private final Map<UriRef, Collection<Permission>> readWritePermissionCache =
-            Collections.synchronizedMap(new HashMap<UriRef, Collection<Permission>>());
+    public static final Iri rest = new Iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+    public static final Iri rdfNil = new Iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+    private final Map<Iri, Collection<Permission>> readPermissionCache =
+            Collections.synchronizedMap(new HashMap<Iri, Collection<Permission>>());
+    private final Map<Iri, Collection<Permission>> readWritePermissionCache =
+            Collections.synchronizedMap(new HashMap<Iri, Collection<Permission>>());
 
     /**
      *
@@ -86,7 +86,7 @@ public abstract class TcAccessController {
         this.tcManager = getTcManager();
     }
 
-    public void checkReadPermission(UriRef tripleCollectionUri) {
+    public void checkReadPermission(Iri tripleCollectionUri) {
         if (tripleCollectionUri.equals(permissionGraphName)) {
             //This is world readable, as this prevents as from doingf things as
             //priviledged during verfification
@@ -111,7 +111,7 @@ public abstract class TcAccessController {
         }
     }
 
-    public void checkReadWritePermission(UriRef tripleCollectionUri) {
+    public void checkReadWritePermission(Iri tripleCollectionUri) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             //will AllPermissions the rest is obsolete
@@ -143,7 +143,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @param permissionDescriptions
      */
-    public void setRequiredReadPermissionStrings(UriRef tripleCollectionUri,
+    public void setRequiredReadPermissionStrings(Iri tripleCollectionUri,
             Collection<String> permissionDescriptions) {
         readPermissionCache.remove(tripleCollectionUri);
         final LockableMGraph permissionMGraph = getOrCreatePermisionGraph();
@@ -151,7 +151,7 @@ public abstract class TcAccessController {
         l.lock();
         try {
             removeExistingRequiredReadPermissions(tripleCollectionUri, permissionMGraph);
-            final NonLiteral permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
+            final BlankNodeOrIri permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
             permissionMGraph.add(new TripleImpl(tripleCollectionUri,
                     readPermissionListProperty, permissionList));
         } finally {
@@ -166,7 +166,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @param permissionDescriptions
      */
-    public void setRequiredReadPermissions(UriRef tripleCollectionUri,
+    public void setRequiredReadPermissions(Iri tripleCollectionUri,
             Collection<Permission> permissions) {
         Collection<String> permissionStrings = new ArrayList<String>();
         for (Permission permission : permissions) {
@@ -183,7 +183,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @param permissionDescriptions
      */
-    public void setRequiredReadWritePermissionStrings(UriRef tripleCollectionUri,
+    public void setRequiredReadWritePermissionStrings(Iri tripleCollectionUri,
             Collection<String> permissionDescriptions) {
         readWritePermissionCache.remove(tripleCollectionUri);
         final LockableMGraph permissionMGraph = getOrCreatePermisionGraph();
@@ -191,7 +191,7 @@ public abstract class TcAccessController {
         l.lock();
         try {
             removeExistingRequiredReadPermissions(tripleCollectionUri, permissionMGraph);
-            final NonLiteral permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
+            final BlankNodeOrIri permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
             permissionMGraph.add(new TripleImpl(tripleCollectionUri,
                     readWritePermissionListProperty, permissionList));
         } finally {
@@ -207,7 +207,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @param permissionDescriptions
      */
-    public void setRequiredReadWritePermissions(UriRef tripleCollectionUri,
+    public void setRequiredReadWritePermissions(Iri tripleCollectionUri,
             Collection<Permission> permissions) {
         Collection<String> permissionStrings = new ArrayList<String>();
         for (Permission permission : permissions) {
@@ -224,7 +224,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @return the collection of permissions
      */
-    public Collection<Permission> getRequiredReadPermissions(UriRef tripleCollectionUri) {
+    public Collection<Permission> getRequiredReadPermissions(Iri tripleCollectionUri) {
         Collection<Permission> result = readPermissionCache.get(tripleCollectionUri);
         if (result == null) {
             result = new ArrayList<Permission>();
@@ -245,7 +245,7 @@ public abstract class TcAccessController {
      * @param tripleCollectionUri
      * @return the collection of permissions
      */
-    public Collection<Permission> getRequiredReadWritePermissions(UriRef tripleCollectionUri) {
+    public Collection<Permission> getRequiredReadWritePermissions(Iri tripleCollectionUri) {
         Collection<Permission> result = readWritePermissionCache.get(tripleCollectionUri);
         if (result == null) {
             result = new ArrayList<Permission>();
@@ -258,11 +258,11 @@ public abstract class TcAccessController {
         return result;
     }
 
-    private NonLiteral createList(Iterator<String> iterator, LockableMGraph permissionMGraph) {
+    private BlankNodeOrIri createList(Iterator<String> iterator, LockableMGraph permissionMGraph) {
         if (!iterator.hasNext()) {
             return rdfNil;
         }
-        final BNode result = new BNode();
+        final BlankNode result = new BlankNode();
         permissionMGraph.add(new TripleImpl(result, first,
                 LiteralFactory.getInstance().createTypedLiteral(iterator.next())));
         permissionMGraph.add(new TripleImpl(result, rest,
@@ -272,23 +272,23 @@ public abstract class TcAccessController {
     }
 
     //called withiong write-lock
-    private void removeExistingRequiredReadPermissions(UriRef tripleCollectionUri,
+    private void removeExistingRequiredReadPermissions(Iri tripleCollectionUri,
             LockableMGraph permissionMGraph) {
         try {
             Triple t = permissionMGraph.filter(tripleCollectionUri, readPermissionListProperty, null).next();
-            Resource list = t.getObject();
-            removeList((NonLiteral) list, permissionMGraph);
+            RdfTerm list = t.getObject();
+            removeList((BlankNodeOrIri) list, permissionMGraph);
             permissionMGraph.remove(t);
         } catch (NoSuchElementException e) {
             //There was no existing to remove
         }
     }
 
-    private void removeList(NonLiteral list, LockableMGraph permissionMGraph) {
+    private void removeList(BlankNodeOrIri list, LockableMGraph permissionMGraph) {
         try {
             Triple t = permissionMGraph.filter(list, rest, null).next();
-            Resource restList = t.getObject();
-            removeList((NonLiteral) restList, permissionMGraph);
+            RdfTerm restList = t.getObject();
+            removeList((BlankNodeOrIri) restList, permissionMGraph);
             permissionMGraph.remove(t);
             Iterator<Triple> iter = permissionMGraph.filter(list, first, null);
             iter.next();
@@ -298,20 +298,20 @@ public abstract class TcAccessController {
         }
     }
 
-    private Collection<String> getRequiredReadWritePermissionStrings(final UriRef tripleCollectionUri) {
+    private Collection<String> getRequiredReadWritePermissionStrings(final Iri tripleCollectionUri) {
         return getRequiredPermissionStrings(tripleCollectionUri, readWritePermissionListProperty);
     }
-    private Collection<String> getRequiredReadPermissionStrings(final UriRef tripleCollectionUri) {
+    private Collection<String> getRequiredReadPermissionStrings(final Iri tripleCollectionUri) {
         return getRequiredPermissionStrings(tripleCollectionUri, readPermissionListProperty);
     }
-    private Collection<String> getRequiredPermissionStrings(final UriRef tripleCollectionUri, UriRef property) {
+    private Collection<String> getRequiredPermissionStrings(final Iri tripleCollectionUri, Iri property) {
         try {
             final LockableMGraph permissionMGraph = tcManager.getMGraph(permissionGraphName);
             Lock l = permissionMGraph.getLock().readLock();
             l.lock();
             try {
                 Triple t = permissionMGraph.filter(tripleCollectionUri, property, null).next();
-                NonLiteral list = (NonLiteral) t.getObject();
+                BlankNodeOrIri list = (BlankNodeOrIri) t.getObject();
                 LinkedList<String> result = new LinkedList<String>();
                 readList(list, permissionMGraph, result);
                 return result;
@@ -325,15 +325,15 @@ public abstract class TcAccessController {
         }
     }
 
-    private void readList(NonLiteral list, LockableMGraph permissionMGraph, LinkedList<String> target) {
+    private void readList(BlankNodeOrIri list, LockableMGraph permissionMGraph, LinkedList<String> target) {
         if (list.equals(rdfNil)) {
             return;
         }
         Triple restTriple = permissionMGraph.filter(list, rest, null).next();
-        NonLiteral restList = (NonLiteral) restTriple.getObject();
+        BlankNodeOrIri restList = (BlankNodeOrIri) restTriple.getObject();
         readList(restList, permissionMGraph, target);
         Triple firstTriple = permissionMGraph.filter(list, first, null).next();
-        TypedLiteral firstValue = (TypedLiteral) firstTriple.getObject();
+        Literal firstValue = (Literal) firstTriple.getObject();
         String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
         target.addFirst(value);
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/AddEvent.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/AddEvent.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/AddEvent.java
deleted file mode 100644
index fcdebef..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/AddEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.event;
-
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-
-/**
- * This class represent a addition event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class AddEvent extends GraphEvent {
-
-
-    public AddEvent(TripleCollection graph,  Triple triple) {
-        super(graph, triple);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/FilterTriple.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/FilterTriple.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/FilterTriple.java
deleted file mode 100644
index 4df2135..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/FilterTriple.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.event;
-
-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;
-
-/**
- * The <code>FilterTriple</code> class provides a match()-method that tests
- * if a <code>Triple</code> match a certain triple pattern.
- *
- * @author mir
- */
-public class FilterTriple {
-
-    private NonLiteral subject;
-    private UriRef predicate;
-    private Resource object;
-    
-    /**
-     * Creates a new <code>FilterTriple</code>. The specified subject,
-     * predicate and object are used to test a given <code>Triple</code>. Any
-     * of these values can be null, which acts as wildcard in the test.
-     *
-     * @param subject  the subject.
-     * @param predicate  the predicate.
-     * @param object  the object.
-     */
-    public FilterTriple (NonLiteral subject, UriRef predicate, Resource object) {
-        this.subject = subject;
-        this.predicate = predicate;
-        this.object = object;
-    }
-
-    /**
-     * Returns true if the subject, predicate and object of the specified
-     * <code>Triple</code> match the subject, predicate and object of this
-     * <code>FilterTriple</code>. Null values in the <code>FilterTriple</code>
-     * act as wildcards.
-     * @param triple
-     * @return
-     */
-    public boolean match(Triple triple) {
-        boolean subjectMatch, predicateMatch, objectMatch;
-        if (this.subject == null) {
-            subjectMatch = true;            
-        } else {
-            subjectMatch = this.subject.equals(triple.getSubject());
-        }
-        if (this.predicate == null) {
-            predicateMatch = true;
-        } else {
-            predicateMatch = this.predicate.equals(triple.getPredicate());
-        }
-        if (this.object == null) {
-            objectMatch = true;
-        } else {
-            objectMatch = this.object.equals(triple.getObject());
-        }
-        return subjectMatch && predicateMatch && objectMatch;
-    }
-
-    @Override
-    public String toString() {
-        return "FilterTriples: "+subject+" "+predicate+" "+object;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphEvent.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphEvent.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphEvent.java
deleted file mode 100644
index 089a6c5..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphEvent.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.event;
-
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-
-/**
- * This class represent a modification event that occured on a
- * <code>TripleCollection</code>. A <code>GraphEvent</code> object keeps
- * information about this event. These information are: The <code>Triple</code>
- * that was part of the modification, the type of modification (addition or
- * removal) and the <code>TripleCollection</code> that was modified.
- *
- * @author mir
- */
-public class GraphEvent {
-
-    private TripleCollection graph;
-    private Triple triple;
-
-    protected GraphEvent(TripleCollection graph, Triple triple) {
-        this.graph = graph;
-        this.triple = triple;
-    }
-
-    /**
-     * Returns the <code>TripleCollection</code> that was modified in the event.
-     * @return the graph
-     */
-    public TripleCollection getGraph() {
-        return graph;
-    }
-
-
-    /**
-     * Return the <code>Triple</code> that was part of the modification.
-     * @return the triple
-     */
-    public Triple getTriple() {
-        return triple;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphListener.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphListener.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphListener.java
deleted file mode 100644
index 37cbcae..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/GraphListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.event;
-
-import java.util.List;
-
-/**
- * A class that is interested in graph events implements this interface and
- * is then added as listener to a <code>ListenableTripleCollection</code> or
- * one of its subclasses. When the <code>ListenableTripleCollection</code> is
- * modified, then the <code>GraphListener</code> is notified.
- *
- * @author mir
- */
-public interface GraphListener {
-
-    /**
-     * This method is called when a <code>ListenableTripleCollection</code> was
-     * modified, to which this <code>GraphListener</code> was added. A
-     * <code>List</code> containing <code>GraphEvent</code>s are passed as
-     * argument. The list contains all events in which a triple was part of
-     * the modification that matched the <code>FilterTriple</code> which was passed
-     * as argument when the listener was added.
-     * @param events
-     */
-    public void graphChanged(List<GraphEvent> events);
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/RemoveEvent.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/RemoveEvent.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/RemoveEvent.java
deleted file mode 100644
index 1a3503b..0000000
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/event/RemoveEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.core.event;
-
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-
-/**
- * This class represent a removal event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class RemoveEvent extends GraphEvent {
-
-
-    public RemoveEvent(TripleCollection graph,  Triple triple) {
-        super(graph, triple);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractGraph.java
index fdbaacd..7827d61 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractGraph.java
@@ -21,10 +21,10 @@ package org.apache.clerezza.rdf.core.impl;
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
 import org.apache.clerezza.rdf.core.impl.graphmatching.GraphMatcher;
 
 /**
@@ -51,13 +51,13 @@ public abstract class AbstractGraph extends AbstractTripleCollection
      */
     private int getBlankNodeBlindHash(Triple triple) {
         int hash = triple.getPredicate().hashCode();
-        Resource subject = triple.getSubject();
+        RdfTerm subject = triple.getSubject();
 
-        if (!(subject instanceof BNode)) {
+        if (!(subject instanceof BlankNode)) {
             hash ^= subject.hashCode() >> 1;
         }
-        Resource object = triple.getObject();
-        if (!(object instanceof BNode)) {
+        RdfTerm object = triple.getObject();
+        if (!(object instanceof BlankNode)) {
             hash ^= object.hashCode() << 1;
         }
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractMGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractMGraph.java
index c54b592..6f993f2 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractMGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractMGraph.java
@@ -18,8 +18,8 @@
  */
 package org.apache.clerezza.rdf.core.impl;
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
 
 /**
  * <code>AbstractMGraph</code> is an abstract implementation of <code>MGraph</code> 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractTripleCollection.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractTripleCollection.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractTripleCollection.java
index 9a19d37..c3528da 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractTripleCollection.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/AbstractTripleCollection.java
@@ -26,16 +26,16 @@ import java.util.HashSet;
 import java.util.Iterator;
 
 import java.util.Set;
-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.clerezza.rdf.core.event.AddEvent;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphEvent;
-import org.apache.clerezza.rdf.core.event.GraphListener;
-import org.apache.clerezza.rdf.core.event.RemoveEvent;
+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.commons.rdf.event.AddEvent;
+import org.apache.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphEvent;
+import org.apache.commons.rdf.event.GraphListener;
+import org.apache.commons.rdf.event.RemoveEvent;
 
 /**
  * An abstract implementation of <code>TripleCollection</code> implementing
@@ -66,8 +66,8 @@ public abstract class AbstractTripleCollection extends AbstractCollection<Triple
     }
 
     @Override
-    public Iterator<Triple> filter(NonLiteral subject, UriRef predicate,
-            Resource object) {
+    public Iterator<Triple> filter(BlankNodeOrIri subject, Iri predicate,
+            RdfTerm object) {
         final Iterator<Triple> baseIter = performFilter(subject, predicate, object);
         return new Iterator<Triple>() {
 
@@ -104,8 +104,8 @@ public abstract class AbstractTripleCollection extends AbstractCollection<Triple
      * @param object
      * @return
      */
-    protected abstract Iterator<Triple> performFilter(NonLiteral subject, UriRef predicate,
-            Resource object);
+    protected abstract Iterator<Triple> performFilter(BlankNodeOrIri subject, Iri predicate,
+            RdfTerm object);
 
     @Override
     public boolean add(Triple triple) {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/DelayedNotificator.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/DelayedNotificator.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/DelayedNotificator.java
index b976081..78446b2 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/DelayedNotificator.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/DelayedNotificator.java
@@ -21,8 +21,8 @@ package org.apache.clerezza.rdf.core.impl;
 import java.lang.ref.WeakReference;
 import java.util.*;
 
-import org.apache.clerezza.rdf.core.event.GraphEvent;
-import org.apache.clerezza.rdf.core.event.GraphListener;
+import org.apache.commons.rdf.event.GraphEvent;
+import org.apache.commons.rdf.event.GraphListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/PlainLiteralImpl.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/PlainLiteralImpl.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/PlainLiteralImpl.java
index ad76770..9ba5495 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/PlainLiteralImpl.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/PlainLiteralImpl.java
@@ -19,15 +19,16 @@
 package org.apache.clerezza.rdf.core.impl;
 
 import java.io.Serializable;
+import org.apache.commons.rdf.Iri;
 
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.PlainLiteral;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.Literal;
 
 /**
  *
  * @author reto
  */
-public class PlainLiteralImpl implements PlainLiteral, Serializable {
+public class PlainLiteralImpl implements Literal, Serializable {
 
     private String lexicalForm;
     private Language language = null;
@@ -54,10 +55,10 @@ public class PlainLiteralImpl implements PlainLiteral, Serializable {
 
     @Override
     public boolean equals(Object otherObj) {
-        if (!(otherObj instanceof PlainLiteral)) {
+        if (!(otherObj instanceof Literal)) {
             return false;
         }
-        PlainLiteral other = (PlainLiteral) otherObj;
+        Literal other = (Literal) otherObj;
         if (!lexicalForm.equals(other.getLexicalForm())) {
             return false;
         }
@@ -93,4 +94,10 @@ public class PlainLiteralImpl implements PlainLiteral, Serializable {
         }
         return result.toString();
     }
+
+    @Override
+    public Iri getDataType() {
+        return XSD_STRING;
+    }
+    private static final Iri XSD_STRING = new Iri("http://www.w3.org/2001/XMLSchema#string");
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleGraph.java
index 39acd1b..707f95a 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleGraph.java
@@ -20,11 +20,11 @@ package org.apache.clerezza.rdf.core.impl;
 
 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;
 
 /**
  *
@@ -72,7 +72,7 @@ public class SimpleGraph extends AbstractGraph {
     }
 
     @Override
-    public Iterator<Triple> performFilter(NonLiteral subject, UriRef predicate, Resource object) {
+    public Iterator<Triple> performFilter(BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
         return tripleCollection.filter(subject, predicate, object);
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleLiteralFactory.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleLiteralFactory.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleLiteralFactory.java
index 8d652f7..4a19132 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleLiteralFactory.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleLiteralFactory.java
@@ -30,10 +30,10 @@ import java.util.Set;
 import org.apache.clerezza.rdf.core.InvalidLiteralTypeException;
 import org.apache.clerezza.rdf.core.LiteralFactory;
 import org.apache.clerezza.rdf.core.NoConvertorException;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.impl.util.Base64;
 import org.apache.clerezza.rdf.core.impl.util.W3CDateFormat;
+import org.apache.commons.rdf.Literal;
 
 /**
  * An implementation of literal factory currently supporting only
@@ -45,14 +45,14 @@ import org.apache.clerezza.rdf.core.impl.util.W3CDateFormat;
 public class SimpleLiteralFactory extends LiteralFactory {
 
     private static final String XSD = "http://www.w3.org/2001/XMLSchema#";
-    final private static UriRef xsdInteger = xsd("integer");
-    final private static UriRef xsdInt = xsd("int");
-    final private static UriRef xsdShort = xsd("short");
-    final private static UriRef xsdByte = xsd("byte");
-    final private static UriRef xsdLong = xsd("long");
+    final private static Iri xsdInteger = xsd("integer");
+    final private static Iri xsdInt = xsd("int");
+    final private static Iri xsdShort = xsd("short");
+    final private static Iri xsdByte = xsd("byte");
+    final private static Iri xsdLong = xsd("long");
     
 
-    final private static Set<UriRef> decimalTypes = new HashSet<UriRef>();
+    final private static Set<Iri> decimalTypes = new HashSet<Iri>();
 
     final private static Map<Class<?>, TypeConverter<?>> typeConverterMap = new HashMap<Class<?>, TypeConverter<?>>();
     final static Class<? extends byte[]> byteArrayType;
@@ -71,33 +71,33 @@ public class SimpleLiteralFactory extends LiteralFactory {
         typeConverterMap.put(Long.class, new LongConverter());
         typeConverterMap.put(Double.class, new DoubleConverter());
         typeConverterMap.put(Float.class, new FloatConverter());
-        typeConverterMap.put(UriRef.class, new UriRefConverter());
+        typeConverterMap.put(Iri.class, new UriRefConverter());
     }
 
-    final private static UriRef xsdDouble =xsd("double");
-    final private static UriRef xsdFloat =xsd("float");
-    final private static UriRef xsdAnyURI =xsd("anyURI");
+    final private static Iri xsdDouble =xsd("double");
+    final private static Iri xsdFloat =xsd("float");
+    final private static Iri xsdAnyURI =xsd("anyURI");
 
-    final private static UriRef xsd(String name) {
-       return new UriRef(XSD+name);
+    final private static Iri xsd(String name) {
+       return new Iri(XSD+name);
     }
 
     private static interface TypeConverter<T> {
-        TypedLiteral createTypedLiteral(T value);
-        T createObject(TypedLiteral literal);        
+        Literal createLiteral(T value);
+        T createObject(Literal literal);        
     }
 
     private static class  ByteArrayConverter implements TypeConverter<byte[]> {
 
-        private static final UriRef base64Uri =xsd("base64Binary");
+        private static final Iri base64Uri =xsd("base64Binary");
 
         @Override
-        public TypedLiteral createTypedLiteral(byte[] value) {
+        public Literal createLiteral(byte[] value) {
             return new TypedLiteralImpl(Base64.encode((byte[]) value), base64Uri);
         }
 
         @Override
-        public byte[] createObject(TypedLiteral literal) {
+        public byte[] createObject(Literal literal) {
             if (!literal.getDataType().equals(base64Uri)) {
                 throw new InvalidLiteralTypeException(byteArrayType, literal.getDataType());
             }
@@ -108,16 +108,16 @@ public class SimpleLiteralFactory extends LiteralFactory {
     }
     private static class  DateConverter implements TypeConverter<Date> {
 
-        private static final UriRef dateTimeUri =xsd("dateTime");
+        private static final Iri dateTimeUri =xsd("dateTime");
         private static final DateFormat DATE_FORMAT = new W3CDateFormat();
 
         @Override
-        public TypedLiteral createTypedLiteral(Date value) {
+        public Literal createLiteral(Date value) {
             return new TypedLiteralImpl(DATE_FORMAT.format(value), dateTimeUri);
         }
 
         @Override
-        public Date createObject(TypedLiteral literal) {
+        public Date createObject(Literal literal) {
             if (!literal.getDataType().equals(dateTimeUri)) {
                 throw new InvalidLiteralTypeException(Date.class, literal.getDataType());
             }
@@ -133,18 +133,18 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
     private static class BooleanConverter implements TypeConverter<Boolean> {
 
-        private static final UriRef booleanUri =xsd("boolean");
+        private static final Iri booleanUri =xsd("boolean");
         public static final TypedLiteralImpl TRUE = new TypedLiteralImpl("true", booleanUri);
         public static final TypedLiteralImpl FALSE = new TypedLiteralImpl("false", booleanUri);
 
         @Override
-        public TypedLiteral createTypedLiteral(Boolean value) {
+        public Literal createLiteral(Boolean value) {
             if (value) return TRUE;
             else return FALSE;
         }
 
         @Override
-        public Boolean createObject(TypedLiteral literal) {
+        public Boolean createObject(Literal literal) {
             if (literal == TRUE) return true;
             else if (literal == FALSE) return false;
             else if (!literal.getDataType().equals(booleanUri)) {
@@ -156,15 +156,15 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
     private static class StringConverter implements TypeConverter<String> {
 
-        private static final UriRef stringUri =xsd("string");
+        private static final Iri stringUri =xsd("string");
 
         @Override
-        public TypedLiteral createTypedLiteral(String value) {
+        public Literal createLiteral(String value) {
             return new TypedLiteralImpl(value, stringUri);
         }
 
         @Override
-        public String createObject(TypedLiteral literal) {
+        public String createObject(Literal literal) {
             if (!literal.getDataType().equals(stringUri)) {
                 throw new InvalidLiteralTypeException(String.class, literal.getDataType());
             }
@@ -176,12 +176,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
 
         @Override
-        public TypedLiteral createTypedLiteral(Integer value) {
+        public Literal createLiteral(Integer value) {
             return new TypedLiteralImpl(value.toString(), xsdInt);
         }
 
         @Override
-        public Integer createObject(TypedLiteral literal) {
+        public Integer createObject(Literal literal) {
             if (!decimalTypes.contains(literal.getDataType())) {
                 throw new InvalidLiteralTypeException(Integer.class, literal.getDataType());
             }
@@ -194,12 +194,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
         
 
         @Override
-        public TypedLiteral createTypedLiteral(Long value) {
+        public Literal createLiteral(Long value) {
             return new TypedLiteralImpl(value.toString(), xsdLong);
         }
 
         @Override
-        public Long createObject(TypedLiteral literal) {
+        public Long createObject(Literal literal) {
             if (!decimalTypes.contains(literal.getDataType())) {
                 throw new InvalidLiteralTypeException(Long.class, literal.getDataType());
             }
@@ -211,12 +211,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
     private static class FloatConverter implements TypeConverter<Float> {
 
         @Override
-        public TypedLiteral createTypedLiteral(Float value) {
+        public Literal createLiteral(Float value) {
             return new TypedLiteralImpl(value.toString(), xsdFloat);
         }
 
         @Override
-        public Float createObject(TypedLiteral literal) {
+        public Float createObject(Literal literal) {
             if (!literal.getDataType().equals(xsdFloat)) {
                 throw new InvalidLiteralTypeException(Float.class, literal.getDataType());
             }
@@ -229,12 +229,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
 
         @Override
-        public TypedLiteral createTypedLiteral(Double value) {
+        public Literal createLiteral(Double value) {
             return new TypedLiteralImpl(value.toString(), xsdDouble);
         }
 
         @Override
-        public Double createObject(TypedLiteral literal) {
+        public Double createObject(Literal literal) {
             if (!literal.getDataType().equals(xsdDouble)) {
                 throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
             }
@@ -247,12 +247,12 @@ public class SimpleLiteralFactory extends LiteralFactory {
 
 
         @Override
-        public TypedLiteral createTypedLiteral(BigInteger value) {
+        public Literal createLiteral(BigInteger value) {
             return new TypedLiteralImpl(value.toString(), xsdInteger);
         }
 
         @Override
-        public BigInteger createObject(TypedLiteral literal) {
+        public BigInteger createObject(Literal literal) {
             if (!literal.getDataType().equals(xsdInteger)) {
                 throw new InvalidLiteralTypeException(Double.class, literal.getDataType());
             }
@@ -260,36 +260,36 @@ public class SimpleLiteralFactory extends LiteralFactory {
         }
     }
     
-    private static class UriRefConverter implements TypeConverter<UriRef> {
+    private static class UriRefConverter implements TypeConverter<Iri> {
 
 
 
         @Override
-        public TypedLiteral createTypedLiteral(UriRef value) {
+        public Literal createLiteral(Iri value) {
             return new TypedLiteralImpl(value.getUnicodeString(), xsdAnyURI);
         }
 
         @Override
-        public UriRef createObject(TypedLiteral literal) {
+        public Iri createObject(Literal literal) {
             if (!literal.getDataType().equals(xsdAnyURI)) {
-                throw new InvalidLiteralTypeException(UriRef.class, literal.getDataType());
+                throw new InvalidLiteralTypeException(Iri.class, literal.getDataType());
             }
-            return new UriRef(literal.getLexicalForm());
+            return new Iri(literal.getLexicalForm());
         }
     }
 
 
     @SuppressWarnings("unchecked")
     @Override
-    public TypedLiteral createTypedLiteral(Object value) throws NoConvertorException {
+    public Literal createTypedLiteral(Object value) throws NoConvertorException {
         TypeConverter converter = getConverterFor(value.getClass());
-        return converter.createTypedLiteral(value);
+        return converter.createLiteral(value);
     }
 
     
     
     @Override
-    public <T> T createObject(Class<T> type, TypedLiteral literal)
+    public <T> T createObject(Class<T> type, Literal literal)
             throws NoConvertorException, InvalidLiteralTypeException {
         final TypeConverter<T> converter = getConverterFor(type);
         return converter.createObject(literal);

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleMGraph.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleMGraph.java
index 63efd42..a27f395 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleMGraph.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleMGraph.java
@@ -22,9 +22,9 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Triple;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.Triple;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleTripleCollection.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleTripleCollection.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleTripleCollection.java
index c5939f2..124f0ff 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleTripleCollection.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/SimpleTripleCollection.java
@@ -28,10 +28,10 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-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.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
 
 /**
  * For now this is a minimalistic implementation, without any indexes or other
@@ -140,7 +140,7 @@ class SimpleTripleCollection extends AbstractTripleCollection {
     }
 
     @Override
-    public Iterator<Triple> performFilter(final NonLiteral subject, final UriRef predicate, final Resource object) {
+    public Iterator<Triple> performFilter(final BlankNodeOrIri subject, final Iri predicate, final RdfTerm object) {
         final List<Triple> tripleList = new ArrayList<Triple>();
         synchronized (triples) {
             Iterator<Triple> baseIter = triples.iterator();

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TripleImpl.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TripleImpl.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TripleImpl.java
index 1239c17..e41bbd0 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TripleImpl.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TripleImpl.java
@@ -18,10 +18,10 @@
  */
 package org.apache.clerezza.rdf.core.impl;
 
-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.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
 
 /**
  *
@@ -29,9 +29,9 @@ import org.apache.clerezza.rdf.core.UriRef;
  */
 public class TripleImpl implements Triple {
 
-    private final NonLiteral subject;
-    private final UriRef predicate;
-    private final Resource object;
+    private final BlankNodeOrIri subject;
+    private final Iri predicate;
+    private final RdfTerm object;
 
     /**
      * Creates a new <code>TripleImpl</code>.
@@ -41,7 +41,7 @@ public class TripleImpl implements Triple {
      * @param object  the object.
      * @throws IllegalArgumentException  if an attribute is <code>null</code>.
      */
-    public TripleImpl(NonLiteral subject, UriRef predicate, Resource object) {
+    public TripleImpl(BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
         if (subject == null) {
             throw new IllegalArgumentException("Invalid subject: null");
         } else if (predicate == null) {
@@ -81,15 +81,15 @@ public class TripleImpl implements Triple {
     }
 
     @Override
-    public NonLiteral getSubject() {
+    public BlankNodeOrIri getSubject() {
         return subject;
     }
 
-    public UriRef getPredicate() {
+    public Iri getPredicate() {
         return predicate;
     }
 
-    public Resource getObject() {
+    public RdfTerm getObject() {
         return object;
     }
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TypedLiteralImpl.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TypedLiteralImpl.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TypedLiteralImpl.java
index 0fb511f..ded5097 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TypedLiteralImpl.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/TypedLiteralImpl.java
@@ -20,29 +20,30 @@ package org.apache.clerezza.rdf.core.impl;
 
 import java.io.Serializable;
 
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.Literal;
 
 /**
  *
  * @author reto
  */
-public class TypedLiteralImpl implements TypedLiteral, Serializable {
+public class TypedLiteralImpl implements Literal, Serializable {
     private String lexicalForm;
-    private UriRef dataType;
+    private Iri dataType;
     private int hashCode;
 
     /**
      * @param lexicalForm 
      * @param dataType 
      */
-    public TypedLiteralImpl(String lexicalForm, UriRef dataType) {
+    public TypedLiteralImpl(String lexicalForm, Iri dataType) {
         this.lexicalForm = lexicalForm;
         this.dataType = dataType;
         this.hashCode = lexicalForm.hashCode()+dataType.hashCode();
     }
     
-    public UriRef getDataType() {
+    public Iri getDataType() {
         return dataType;
     }
 
@@ -64,8 +65,11 @@ public class TypedLiteralImpl implements TypedLiteral, Serializable {
         if (this == obj) {
             return true;
         }
-        if (obj instanceof TypedLiteral) {
-            TypedLiteral other = (TypedLiteral) obj;
+        if (obj instanceof Literal) {
+            Literal other = (Literal) obj;
+            if (other.getLanguage() != null) {
+                return false;
+            }
             boolean res = getDataType().equals(other.getDataType())
                     && getLexicalForm().equals(other.getLexicalForm());
             return res;
@@ -85,4 +89,9 @@ public class TypedLiteralImpl implements TypedLiteral, Serializable {
         return result.toString();
     }
 
+    @Override
+    public Language getLanguage() {
+        return null;
+    }
+
 }

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedTripleCollection.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedTripleCollection.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedTripleCollection.java
index 4d14e5b..19a7271 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedTripleCollection.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/WriteBlockedTripleCollection.java
@@ -22,14 +22,14 @@ import java.util.AbstractCollection;
 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.ReadOnlyException;
-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;
 
 /**
  *
@@ -55,7 +55,7 @@ public class WriteBlockedTripleCollection extends AbstractCollection<Triple>
     }
 
     @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 = triples.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/impl/graphmatching/GraphMatcher.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/GraphMatcher.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/GraphMatcher.java
index dd602e5..eced71e 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/GraphMatcher.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/GraphMatcher.java
@@ -25,12 +25,12 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.TripleCollection;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.slf4j.Logger;
@@ -72,7 +72,7 @@ public class GraphMatcher {
      * @param g2
      * @return a Set of NodePairs
      */
-    public static Map<BNode, BNode> getValidMapping(TripleCollection og1, TripleCollection og2) {
+    public static Map<BlankNode, BlankNode> getValidMapping(TripleCollection og1, TripleCollection og2) {
         MGraph g1 = new SimpleMGraph(og1);
         MGraph g2 = new SimpleMGraph(og2);
         if (!Utils.removeGrounded(g1,g2)) {
@@ -84,13 +84,13 @@ public class GraphMatcher {
         } catch (GraphNotIsomorphicException ex) {
             return null;
         }
-        Map<BNode, BNode> matchings = hashMatching.getMatchings();
+        Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings();
         if (g1.size() > 0) {
             //start trial an error matching
             //TODO (CLEREZZA-81) at least in the situation where one matching
             //group is big (approx > 5) we should switch back to hash-based matching
             //after a first guessed matching, rather than try all permutations
-            Map<BNode, BNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups());
+            Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups());
             if (remainingMappings == null) {
                 return null;
             } else {
@@ -100,17 +100,17 @@ public class GraphMatcher {
         return matchings;
     }
 
-    private static Map<BNode, BNode> trialAndErrorMatching(MGraph g1, MGraph g2,
-            Map<Set<BNode>, Set<BNode>> matchingGroups) {
+    private static Map<BlankNode, BlankNode> trialAndErrorMatching(MGraph g1, MGraph g2,
+            Map<Set<BlankNode>, Set<BlankNode>> matchingGroups) {
         if (log.isDebugEnabled()) {
-            Set<BNode> bn1  = Utils.getBNodes(g1);
+            Set<BlankNode> bn1  = Utils.getBNodes(g1);
             log.debug("doing trial and error matching for {} bnodes, " +
                     "in graphs of size: {}.", bn1.size(), g1.size());
         }
-        Iterator<Map<BNode, BNode>> mappingIter
+        Iterator<Map<BlankNode, BlankNode>> mappingIter
                 = GroupMappingIterator.create(matchingGroups);
         while (mappingIter.hasNext()) {
-            Map<BNode, BNode> map = mappingIter.next();
+            Map<BlankNode, BlankNode> map = mappingIter.next();
             if (checkMapping(g1, g2, map)) {
                 return map;
             }
@@ -118,7 +118,7 @@ public class GraphMatcher {
         return null;
     }
 
-    private static boolean checkMapping(MGraph g1, MGraph g2, Map<BNode, BNode> map) {
+    private static boolean checkMapping(MGraph g1, MGraph g2, Map<BlankNode, BlankNode> map) {
         for (Triple triple : g1) {
             if (!g2.contains(map(triple, map))) {
                 return false;
@@ -127,15 +127,15 @@ public class GraphMatcher {
         return true;
     }
 
-    private static Triple map(Triple triple, Map<BNode, BNode> map) {
-        final NonLiteral oSubject = triple.getSubject();
+    private static Triple map(Triple triple, Map<BlankNode, BlankNode> map) {
+        final BlankNodeOrIri oSubject = triple.getSubject();
 
-        NonLiteral subject = oSubject instanceof BNode ?
-            map.get((BNode)oSubject) : oSubject;
+        BlankNodeOrIri subject = oSubject instanceof BlankNode ?
+            map.get((BlankNode)oSubject) : oSubject;
 
-        Resource oObject = triple.getObject();
-        Resource object = oObject instanceof BNode ?
-            map.get((BNode)oObject) : oObject;
+        RdfTerm oObject = triple.getObject();
+        RdfTerm object = oObject instanceof BlankNode ?
+            map.get((BlankNode)oObject) : oObject;
         return new TripleImpl(subject, triple.getPredicate(), object);
     }
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/HashMatching.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/HashMatching.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/HashMatching.java
index 8ca0e79..b5289e6 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/HashMatching.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/HashMatching.java
@@ -26,13 +26,13 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import org.apache.clerezza.rdf.core.BNode;
-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.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+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.TripleCollection;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.impl.graphmatching.collections.IntIterator;
 
@@ -42,8 +42,8 @@ import org.apache.clerezza.rdf.core.impl.graphmatching.collections.IntIterator;
  */
 public class HashMatching {
 
-    private Map<BNode, BNode> matchings = new HashMap<BNode, BNode>();
-    private Map<Set<BNode>, Set<BNode>> matchingGroups;
+    private Map<BlankNode, BlankNode> matchings = new HashMap<BlankNode, BlankNode>();
+    private Map<Set<BlankNode>, Set<BlankNode>> matchingGroups;
 
     /**
      * tc1 and tc2 will be modified: the triples containing no unmatched bnode
@@ -56,7 +56,7 @@ public class HashMatching {
     HashMatching(MGraph tc1, MGraph tc2) throws GraphNotIsomorphicException {
         int foundMatchings = 0;
         int foundMatchingGroups = 0;
-        Map<BNode, Integer> bNodeHashMap = new HashMap<BNode, Integer>();
+        Map<BlankNode, Integer> bNodeHashMap = new HashMap<BlankNode, Integer>();
         while (true) {
             bNodeHashMap = matchByHashes(tc1, tc2, bNodeHashMap);
             if (bNodeHashMap == null) {
@@ -76,23 +76,23 @@ public class HashMatching {
      *
      * @return a map containing set of which each bnodes mappes one of the other set
      */
-    public Map<Set<BNode>, Set<BNode>> getMatchingGroups() {
+    public Map<Set<BlankNode>, Set<BlankNode>> getMatchingGroups() {
         return matchingGroups;
     }
 
-    public Map<BNode, BNode> getMatchings() {
+    public Map<BlankNode, BlankNode> getMatchings() {
         return matchings;
     }
 
     
-    private static IntHashMap<Set<BNode>> getHashNodes(Map<BNode,
-            Set<Property>> bNodePropMap, Map<BNode, Integer> bNodeHashMap) {
-        IntHashMap<Set<BNode>> result = new IntHashMap<Set<BNode>>();
-        for (Map.Entry<BNode, Set<Property>> entry : bNodePropMap.entrySet()) {
+    private static IntHashMap<Set<BlankNode>> getHashNodes(Map<BlankNode,
+            Set<Property>> bNodePropMap, Map<BlankNode, Integer> bNodeHashMap) {
+        IntHashMap<Set<BlankNode>> result = new IntHashMap<Set<BlankNode>>();
+        for (Map.Entry<BlankNode, Set<Property>> entry : bNodePropMap.entrySet()) {
             int hash = computeHash(entry.getValue(), bNodeHashMap);
-            Set<BNode> bNodeSet = result.get(hash);
+            Set<BlankNode> bNodeSet = result.get(hash);
             if (bNodeSet == null) {
-                bNodeSet = new HashSet<BNode>();
+                bNodeSet = new HashSet<BlankNode>();
                 result.put(hash,bNodeSet);
             }
             bNodeSet.add(entry.getKey());
@@ -108,22 +108,22 @@ public class HashMatching {
      * Note that the matched node are not guaranteed to be equals, but only to
      * be the correct if the graphs are isomorphic.
      */
-    private Map<BNode, Integer> matchByHashes(MGraph g1, MGraph g2,
-            Map<BNode, Integer> bNodeHashMap) {
-        Map<BNode, Set<Property>> bNodePropMap1  = getBNodePropMap(g1);
-        Map<BNode, Set<Property>> bNodePropMap2  = getBNodePropMap(g2);
-        IntHashMap<Set<BNode>> hashNodeMap1 = getHashNodes(bNodePropMap1, bNodeHashMap);
-        IntHashMap<Set<BNode>> hashNodeMap2 = getHashNodes(bNodePropMap2, bNodeHashMap);
+    private Map<BlankNode, Integer> matchByHashes(MGraph g1, MGraph g2,
+            Map<BlankNode, Integer> bNodeHashMap) {
+        Map<BlankNode, Set<Property>> bNodePropMap1  = getBNodePropMap(g1);
+        Map<BlankNode, Set<Property>> bNodePropMap2  = getBNodePropMap(g2);
+        IntHashMap<Set<BlankNode>> hashNodeMap1 = getHashNodes(bNodePropMap1, bNodeHashMap);
+        IntHashMap<Set<BlankNode>> hashNodeMap2 = getHashNodes(bNodePropMap2, bNodeHashMap);
         if (!hashNodeMap1.keySet().equals(hashNodeMap2.keySet())) {
             return null;
         }
 
-        matchingGroups = new HashMap<Set<BNode>, Set<BNode>>();
+        matchingGroups = new HashMap<Set<BlankNode>, Set<BlankNode>>();
         IntIterator hashIter = hashNodeMap1.keySet().intIterator();
         while (hashIter.hasNext()) {
             int hash = hashIter.next();
-            Set<BNode> nodes1 = hashNodeMap1.get(hash);
-            Set<BNode> nodes2 = hashNodeMap2.get(hash);
+            Set<BlankNode> nodes1 = hashNodeMap1.get(hash);
+            Set<BlankNode> nodes2 = hashNodeMap2.get(hash);
             if (nodes1.size() != nodes2.size()) {
                 return null;
             }
@@ -131,11 +131,11 @@ public class HashMatching {
                 matchingGroups.put(nodes1, nodes2);
                 continue;
             }
-            final BNode bNode1 = nodes1.iterator().next();
-            final BNode bNode2 = nodes2.iterator().next();
+            final BlankNode bNode1 = nodes1.iterator().next();
+            final BlankNode bNode2 = nodes2.iterator().next();
             matchings.put(bNode1,bNode2);
             //in the graphs replace node occurences with grounded node,
-            NonLiteral mappedNode = new MappedNode(bNode1, bNode2);
+            BlankNodeOrIri mappedNode = new MappedNode(bNode1, bNode2);
             replaceNode(g1,bNode1, mappedNode);
             replaceNode(g2, bNode2, mappedNode);
             //remove grounded triples
@@ -143,27 +143,27 @@ public class HashMatching {
                 return null;
             }
         }
-        Map<BNode, Integer> result = new HashMap<BNode, Integer>();
+        Map<BlankNode, Integer> result = new HashMap<BlankNode, Integer>();
         addInverted(result, hashNodeMap1);
         addInverted(result, hashNodeMap2);
         return result;
     }
-    private static int computeHash(Set<Property> propertySet, Map<BNode, Integer> bNodeHashMap) {
+    private static int computeHash(Set<Property> propertySet, Map<BlankNode, Integer> bNodeHashMap) {
         int result = 0;
         for (Property property : propertySet) {
             result += property.hashCode(bNodeHashMap);
         }
         return result;
     }
-    private static Map<BNode, Set<Property>> getBNodePropMap(MGraph g) {
-        Set<BNode> bNodes = Utils.getBNodes(g);
-        Map<BNode, Set<Property>> result = new HashMap<BNode, Set<Property>>();
-        for (BNode bNode : bNodes) {
+    private static Map<BlankNode, Set<Property>> getBNodePropMap(MGraph g) {
+        Set<BlankNode> bNodes = Utils.getBNodes(g);
+        Map<BlankNode, Set<Property>> result = new HashMap<BlankNode, Set<Property>>();
+        for (BlankNode bNode : bNodes) {
             result.put(bNode, getProperties(bNode, g));
         }
         return result;
     }
-    private static Set<Property> getProperties(BNode bNode, MGraph g) {
+    private static Set<Property> getProperties(BlankNode bNode, MGraph g) {
         Set<Property> result = new HashSet<Property>();
         Iterator<Triple> ti = g.filter(bNode, null, null);
         while (ti.hasNext()) {
@@ -177,9 +177,9 @@ public class HashMatching {
         }
         return result;
     }
-    private static int nodeHash(Resource resource, Map<BNode, Integer> bNodeHashMap) {
-        if (resource instanceof BNode) {
-            Integer mapValue = bNodeHashMap.get((BNode)resource);
+    private static int nodeHash(RdfTerm resource, Map<BlankNode, Integer> bNodeHashMap) {
+        if (resource instanceof BlankNode) {
+            Integer mapValue = bNodeHashMap.get((BlankNode)resource);
             if (mapValue == null) {
                 return 0;
             } else {
@@ -189,7 +189,7 @@ public class HashMatching {
             return resource.hashCode();
         }
     }
-    private static void replaceNode(MGraph mGraph, BNode bNode, NonLiteral replacementNode) {
+    private static void replaceNode(MGraph mGraph, BlankNode bNode, BlankNodeOrIri replacementNode) {
         Set<Triple> triplesToRemove = new HashSet<Triple>();
         for (Triple triple : mGraph) {
             Triple replacementTriple = getReplacement(triple, bNode, replacementNode);
@@ -200,7 +200,7 @@ public class HashMatching {
         }
         mGraph.removeAll(triplesToRemove);
     }
-    private static Triple getReplacement(Triple triple, BNode bNode, NonLiteral replacementNode) {
+    private static Triple getReplacement(Triple triple, BlankNode bNode, BlankNodeOrIri replacementNode) {
         if (triple.getSubject().equals(bNode)) {
             if (triple.getObject().equals(bNode)) {
                 return new TripleImpl(replacementNode, triple.getPredicate(), replacementNode);
@@ -215,54 +215,54 @@ public class HashMatching {
             }
         }
     }
-    private static void addInverted(Map<BNode, Integer> result, IntHashMap<Set<BNode>> hashNodeMap) {
+    private static void addInverted(Map<BlankNode, Integer> result, IntHashMap<Set<BlankNode>> hashNodeMap) {
         for (int hash : hashNodeMap.keySet()) {
-            Set<BNode> bNodes = hashNodeMap.get(hash);
-            for (BNode bNode : bNodes) {
+            Set<BlankNode> bNodes = hashNodeMap.get(hash);
+            for (BlankNode bNode : bNodes) {
                 result.put(bNode, hash);
             }
         }
     }
     
     private static class BackwardProperty implements Property {
-        private NonLiteral subject;
-        private UriRef predicate;
+        private BlankNodeOrIri subject;
+        private Iri predicate;
     
-        public BackwardProperty(NonLiteral subject, UriRef predicate) {
+        public BackwardProperty(BlankNodeOrIri subject, Iri predicate) {
             this.subject = subject;
             this.predicate = predicate;
         }
     
         @Override
-        public int hashCode(Map<BNode, Integer> bNodeHashMap) {
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
             return  0xFF ^ predicate.hashCode() ^ nodeHash(subject, bNodeHashMap);
         }
     
     }
     private static class ForwardProperty implements Property {
-        private UriRef predicate;
-        private Resource object;
+        private Iri predicate;
+        private RdfTerm object;
     
-        public ForwardProperty(UriRef predicate, Resource object) {
+        public ForwardProperty(Iri predicate, RdfTerm object) {
             this.predicate = predicate;
             this.object = object;
         }
     
         @Override
-        public int hashCode(Map<BNode, Integer> bNodeHashMap) {
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap) {
             return predicate.hashCode() ^ nodeHash(object, bNodeHashMap);
         }
     }
-    private static class MappedNode implements NonLiteral {
-        private BNode bNode1, bNode2;
+    private static class MappedNode implements BlankNodeOrIri {
+        private BlankNode bNode1, bNode2;
     
-        public MappedNode(BNode bNode1, BNode bNode2) {
+        public MappedNode(BlankNode bNode1, BlankNode bNode2) {
             this.bNode1 = bNode1;
             this.bNode2 = bNode2;
         }
         
     }
     private static interface Property {
-        public int hashCode(Map<BNode, Integer> bNodeHashMap);
+        public int hashCode(Map<BlankNode, Integer> bNodeHashMap);
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/Utils.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/Utils.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/Utils.java
index 739b6a4..f8400fd 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/Utils.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/graphmatching/Utils.java
@@ -26,19 +26,19 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Triple;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Triple;
 
 public class Utils {
 
-    static Set<BNode> getBNodes(Collection<Triple> s) {
-        Set<BNode> result = new HashSet<BNode>();
+    static Set<BlankNode> getBNodes(Collection<Triple> s) {
+        Set<BlankNode> result = new HashSet<BlankNode>();
         for (Triple triple : s) {
-            if (triple.getSubject() instanceof BNode) {
-                result.add((BNode) triple.getSubject());
+            if (triple.getSubject() instanceof BlankNode) {
+                result.add((BlankNode) triple.getSubject());
             }
-            if (triple.getObject() instanceof BNode) {
-                result.add((BNode) triple.getObject());
+            if (triple.getObject() instanceof BlankNode) {
+                result.add((BlankNode) triple.getObject());
             }
         }
         return result;
@@ -70,10 +70,10 @@ public class Utils {
     }
 
     private static boolean isGrounded(Triple triple) {
-        if (triple.getSubject() instanceof BNode) {
+        if (triple.getSubject() instanceof BlankNode) {
             return false;
         }
-        if (triple.getObject() instanceof BNode) {
+        if (triple.getObject() instanceof BlankNode) {
             return false;
         }
         return true;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
index 83ad4ec..8236e75 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedGraphWrapper.java
@@ -18,7 +18,7 @@
  */
 package org.apache.clerezza.rdf.core.impl.util;
 
-import org.apache.clerezza.rdf.core.Graph;
+import org.apache.commons.rdf.Graph;
 
 /**
  * Calls the methods of the wrapped <code>Graph</code> as privileged

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedMGraphWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedMGraphWrapper.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedMGraphWrapper.java
index c75bd92..4575bea 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedMGraphWrapper.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedMGraphWrapper.java
@@ -18,8 +18,8 @@
  */
 package org.apache.clerezza.rdf.core.impl.util;
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
 import org.apache.clerezza.rdf.core.impl.SimpleGraph;
 
 /**

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedTripleCollectionWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedTripleCollectionWrapper.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedTripleCollectionWrapper.java
index ed28183..85a9dbd 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedTripleCollectionWrapper.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/impl/util/PrivilegedTripleCollectionWrapper.java
@@ -22,13 +22,13 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 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.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
+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.commons.rdf.event.FilterTriple;
+import org.apache.commons.rdf.event.GraphListener;
 
 /**
  * Calls the methods of the wrapped <code>TripleCollection</code> as privileged
@@ -46,8 +46,8 @@ public class PrivilegedTripleCollectionWrapper 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) {
         return AccessController.doPrivileged(new PrivilegedAction<Iterator<Triple>>() {
 
             @Override

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
index 4852d24..9466af6 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
@@ -32,9 +32,9 @@ import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.logging.Level;
 
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentContext;
@@ -206,7 +206,7 @@ public class Parser {
      * @throws UnsupportedFormatException
      */
     public Graph parse(InputStream serializedGraph,
-            String formatIdentifier, UriRef baseUri) throws UnsupportedFormatException {
+            String formatIdentifier, Iri baseUri) throws UnsupportedFormatException {
         MGraph mGraph = new SimpleMGraph();
         parse(mGraph, serializedGraph, formatIdentifier, baseUri);
         return mGraph.getGraph();
@@ -225,7 +225,7 @@ public class Parser {
      * @throws UnsupportedFormatException
      */
     public void parse(MGraph target, InputStream serializedGraph,
-            String formatIdentifier, UriRef baseUri) throws UnsupportedFormatException {
+            String formatIdentifier, Iri baseUri) throws UnsupportedFormatException {
         String deParameterizedIdentifier;
         int semicolonPos = formatIdentifier.indexOf(';');
         if (semicolonPos > -1) {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
index 9349c20..d2e1ee6 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
@@ -20,8 +20,8 @@ package org.apache.clerezza.rdf.core.serializedform;
 
 import java.io.InputStream;
 
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.MGraph;
+import org.apache.commons.rdf.Iri;
 
 /**
  * An instance of this class parses RDF-Graph from one or more serialization
@@ -44,6 +44,6 @@ public interface ParsingProvider {
      * @param baseUri the baseUri for interpreting relative uris, may be null
      */
     void parse(MGraph target, InputStream serializedGraph,
-            String formatIdentifier, UriRef baseUri);
+            String formatIdentifier, Iri baseUri);
 
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
index c65c19e..7fece9b 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
@@ -32,7 +32,7 @@ import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.Set;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.TripleCollection;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.Activate;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
index f58614f..da65d56 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/SerializingProvider.java
@@ -20,7 +20,7 @@ package org.apache.clerezza.rdf.core.serializedform;
 
 import java.io.OutputStream;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.TripleCollection;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
index 84ffb23..d861067 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/QueryEngine.java
@@ -18,7 +18,7 @@
  */
 package org.apache.clerezza.rdf.core.sparql;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.TripleCollection;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.sparql.query.Query;
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/29f822c7/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
index 0835597..f1561c2 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SolutionMapping.java
@@ -20,7 +20,7 @@ package org.apache.clerezza.rdf.core.sparql;
 
 import org.apache.clerezza.rdf.core.sparql.query.Variable;
 import java.util.Map;
-import org.apache.clerezza.rdf.core.Resource;
+import org.apache.commons.rdf.RdfTerm;
 
 /**
  * A set of mapping from variable names to solutions.
@@ -35,7 +35,7 @@ import org.apache.clerezza.rdf.core.Resource;
  *
  * @author rbn
  */
-public interface SolutionMapping extends Map<Variable, Resource> {
+public interface SolutionMapping extends Map<Variable, RdfTerm> {
 
     /**
      * Should be the equivalent to this:
@@ -46,5 +46,5 @@ public interface SolutionMapping extends Map<Variable, Resource> {
      * @param name
      * @return
      */
-    public Resource get(String name);
+    public RdfTerm get(String name);
 }


Mime
View raw message