You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/24 11:51:37 UTC

[1/9] clerezza git commit: CLEREZZA-989: All bundle and components in linked data launchers satisfied, some runtime problems

Repository: clerezza
Updated Branches:
  refs/heads/rdf-commons 9677f50eb -> d0f43e94e


http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
index 3477bd2..5029eea 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
@@ -38,20 +38,19 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
+import org.apache.clerezza.rdf.core.LiteralFactory;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.Graph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
@@ -88,12 +87,12 @@ public class BackupMessageBodyWriter implements MessageBodyWriter<Backup> {
     }
 
     private void archive(ZipOutputStream compressedTcs, 
-            TripleCollection tripleCollection,
+            Graph tripleCollection,
             String fileName) throws IOException, UnsupportedFormatException {
         Lock readLock = null;
         compressedTcs.putNextEntry(new ZipEntry(fileName));
-        if (tripleCollection instanceof LockableMGraph) {
-            readLock = ((LockableMGraph) tripleCollection).getLock().readLock();
+        if (tripleCollection instanceof Graph) {
+            readLock = ((Graph) tripleCollection).getLock().readLock();
             readLock.lock();
         }
         try {
@@ -106,7 +105,7 @@ public class BackupMessageBodyWriter implements MessageBodyWriter<Backup> {
         }
     }
 
-    private String getTcFileName(UriRef tcUri, String extension,
+    private String getTcFileName(Iri tcUri, String extension,
             Map<String, Integer> fileNameCount) {
         String fileName = tcUri.getUnicodeString();
         fileName = fileName.substring(fileName.lastIndexOf("/")+1);
@@ -123,23 +122,23 @@ public class BackupMessageBodyWriter implements MessageBodyWriter<Backup> {
 
     private void writeBackup(OutputStream result) {
         Map<String, Integer> fileNameCount = new HashMap<String, Integer>();
-        MGraph backupContents = new SimpleMGraph();
+        Graph backupContents = new SimpleGraph();
         try {
             ZipOutputStream compressedTcs = new ZipOutputStream(result);
 
             compressedTcs.putNextEntry(new ZipEntry(folder));
 
-            Set<UriRef> tripleCollections = tcManager.listTripleCollections();
-            Iterator<UriRef> tcUriRefs = tripleCollections.iterator();
-            while (tcUriRefs.hasNext()) {
-                UriRef tcUri = tcUriRefs.next();
+            Set<Iri> tripleCollections = tcManager.listGraphs();
+            Iterator<Iri> tcIris = tripleCollections.iterator();
+            while (tcIris.hasNext()) {
+                Iri tcUri = tcIris.next();
                 String fileName = folder + getTcFileName(tcUri, ".nt",
                         fileNameCount);
-                TripleCollection tripleCollection = tcManager.getTriples(tcUri);
+                Graph tripleCollection = tcManager.getGraph(tcUri);
                 archive(compressedTcs, tripleCollection, fileName);
-                if (tripleCollection instanceof MGraph) {
+                if (tripleCollection instanceof Graph) {
                     backupContents.add(new TripleImpl(tcUri, RDF.type,
-                            BACKUP.MGraph));
+                            BACKUP.Graph));
                 } else {
                     backupContents.add(new TripleImpl(tcUri, RDF.type,
                             BACKUP.Graph));

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
index 1cd7491..caf5d18 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
@@ -33,7 +33,7 @@ public class BackupPermission extends Permission {
 
 
     public BackupPermission() {
-        super("Graph Management permission");
+        super("ImmutableGraph Management permission");
     }
     /**
      *
@@ -41,7 +41,7 @@ public class BackupPermission extends Permission {
      * @param action ignored
      */
     public BackupPermission(String target, String actions) {
-        super("Graph Management permission");
+        super("ImmutableGraph Management permission");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
index f08e5ce..c00bf1b 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
@@ -26,17 +26,17 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import org.apache.clerezza.jaxrs.utils.RedirectUtil;
 import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Graph;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.ontologies.FOAF;
 import org.apache.clerezza.rdf.ontologies.OWL;
 import org.apache.clerezza.rdf.ontologies.PLATFORM;
@@ -45,7 +45,7 @@ import org.apache.clerezza.rdf.utils.Smusher;
 import org.osgi.service.component.ComponentContext;
 
 /**
- * Provides a method to remove duplicate noded from (aka smush) a Graph
+ * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
  * 
  * @author reto
  */
@@ -60,8 +60,8 @@ public class Delete {
 
     
     @POST
-    public Response delete(@Context UriInfo uriInfo, @FormParam("graphName") UriRef graphName) {
-        tcManager.deleteTripleCollection(graphName);
+    public Response delete(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
+        tcManager.deleteGraph(graphName);
         return RedirectUtil.createSeeOtherResponse("./", uriInfo);
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
index 118c6f1..886d1e7 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
@@ -33,18 +33,18 @@ import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
 import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
 import org.apache.clerezza.platform.typerendering.RenderletManager;
 import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
 import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.ontologies.PLATFORM;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.ontologies.TCPROVIDER;
@@ -74,7 +74,7 @@ public class GraphManagement implements GlobalMenuItemsProvider {
     protected void activate(ComponentContext componentContext) {
         URL templateURL = getClass().getResource("graph-management.ssp");
         renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
-                new UriRef(templateURL.toString()), GRAPHMANAGEMENT.GraphManagementPage,
+                new Iri(templateURL.toString()), GRAPHMANAGEMENT.GraphManagementPage,
                 "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
     }
 
@@ -82,19 +82,19 @@ public class GraphManagement implements GlobalMenuItemsProvider {
     public GraphNode mainPage(@Context UriInfo uriInfo) {
         AccessController.checkPermission(new GraphManagementAppPermission());
         TrailingSlash.enforcePresent(uriInfo);
-        final SimpleMGraph resultGraph = new SimpleMGraph();
-        GraphNode graphNode = new GraphNode(new BNode(), resultGraph);
-        Set<UriRef> tripleCollections = tcManager.listTripleCollections();
-        for (UriRef uriRef : tripleCollections) {
+        final SimpleGraph resultGraph = new SimpleGraph();
+        GraphNode graphNode = new GraphNode(new BlankNode(), resultGraph);
+        Set<Iri> tripleCollections = tcManager.listGraphs();
+        for (Iri uriRef : tripleCollections) {
             graphNode.addProperty(GRAPHMANAGEMENT.tripleCollection, uriRef);
-            final TripleCollection tripleCollection = tcManager.getTriples(uriRef);
+            final Graph tripleCollection = tcManager.getGraph(uriRef);
             resultGraph.add(new TripleImpl(uriRef,GRAPHMANAGEMENT.size,
                     LiteralFactory.getInstance().createTypedLiteral(
                     tripleCollection.size())));
-            if (tripleCollection instanceof Graph) {
+            if (tripleCollection instanceof ImmutableGraph) {
                 resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
             } else {
-                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.MGraph));
+                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
             }
         }
         graphNode.addProperty(RDF.type, GRAPHMANAGEMENT.GraphManagementPage);

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
index 838879e..09ec04d 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
@@ -22,18 +22,18 @@ import java.security.Permission;
 import org.apache.clerezza.permissiondescriptions.PermissionInfo;
 
 /**
- * Permission to use the Graph-Management page. Nothe that the user
- * additioonally needs permssion on the TripleCollections they manipulate.
+ * Permission to use the ImmutableGraph-Management page. Nothe that the user
+ * additioonally needs permssion on the Graphs they manipulate.
  *
  * @author reto
  */
-@PermissionInfo(value="Graph Management Access Permission", description="Grants access " +
-    "to the Graph Management page")
+@PermissionInfo(value="ImmutableGraph Management Access Permission", description="Grants access " +
+    "to the ImmutableGraph Management page")
 public class GraphManagementAppPermission extends Permission {
 
 
     public GraphManagementAppPermission() {
-        super("Graph Management permission");
+        super("ImmutableGraph Management permission");
     }
     /**
      * 
@@ -41,7 +41,7 @@ public class GraphManagementAppPermission extends Permission {
      * @param action ignored
      */
     public GraphManagementAppPermission(String target, String actions) {
-        super("Graph Management permission");
+        super("ImmutableGraph Management permission");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
index 1096524..d0ceed7 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
@@ -32,13 +32,13 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Literal;
 import org.apache.clerezza.rdf.core.LiteralFactory;
-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.Literal;
+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.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcProvider;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
@@ -75,10 +75,10 @@ public class Restorer {
     public void restore(InputStream backupData, TcProvider target) throws IOException {
         ZipInputStream compressedTcs = new ZipInputStream(backupData);
 
-        Map<String, TripleCollection> extractedTc = new HashMap<String, TripleCollection>();
+        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
         String folder = "";
         ZipEntry entry;
-        Graph metaGraph = null;
+        ImmutableGraph metaGraph = null;
         while ((entry = compressedTcs.getNextEntry()) != null) {
             String entryName = entry.getName();
             if (entry.isDirectory()) {
@@ -109,7 +109,7 @@ public class Restorer {
                     metaGraph = parser.parse(serializedGraph,
                             SupportedFormat.N_TRIPLE, null);
                 } else {
-                    Graph deserializedGraph = parser.parse(serializedGraph,
+                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
                             SupportedFormat.N_TRIPLE, null);
                     extractedTc.put(entryName, deserializedGraph);
                 }
@@ -121,16 +121,16 @@ public class Restorer {
         }
         compressedTcs.close();
         {
-            final Iterator<Triple> mGraphIterator = metaGraph.filter(null, RDF.type, BACKUP.MGraph);
+            final Iterator<Triple> mGraphIterator = metaGraph.filter(null, RDF.type, BACKUP.Graph);
             while (mGraphIterator.hasNext()) {
                 GraphNode graphGN = new GraphNode(mGraphIterator.next().getSubject(), metaGraph);
                 String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
-                TripleCollection extracted = extractedTc.get(fileName);
+                Graph extracted = extractedTc.get(fileName);
                 
-                MGraph mGraph;
+                Graph mGraph;
                 boolean created = false;
                 try {
-                    mGraph = target.getMGraph((UriRef)graphGN.getNode());
+                    mGraph = target.getGraph((Iri)graphGN.getNode());
                     try {
                         mGraph.clear();
                     } catch (UnsupportedOperationException ex) {
@@ -139,7 +139,7 @@ public class Restorer {
                         continue;
                     }
                 } catch (NoSuchEntityException ex) {
-                    mGraph = target.createMGraph((UriRef)graphGN.getNode());
+                    mGraph = target.createGraph((Iri)graphGN.getNode());
                     created = true;
                 }
                 try {
@@ -156,9 +156,9 @@ public class Restorer {
             while (graphIterator.hasNext()) {
                 GraphNode graphGN = new GraphNode(graphIterator.next().getSubject(), metaGraph);
                 String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
-                TripleCollection extracted = extractedTc.get(fileName);
+                Graph extracted = extractedTc.get(fileName);
                 try {
-                    target.deleteTripleCollection((UriRef)graphGN.getNode());
+                    target.deleteGraph((Iri)graphGN.getNode());
                 } catch (UnsupportedOperationException ex) {
                     log.warn("could not restore "+graphGN.getNode()+" as the exsting triple "
                             + "collection could not be deleted");
@@ -166,10 +166,10 @@ public class Restorer {
                 } catch (NoSuchEntityException ex) {
                     log.debug("could not remove "+graphGN.getNode()+", no such entity");
                 }
-                target.createGraph((UriRef)graphGN.getNode(), extracted);
+                target.createImmutableGraph((Iri)graphGN.getNode(), extracted);
             }
         }
-        for (Map.Entry<String, TripleCollection> pathTcPair : extractedTc.entrySet()) {
+        for (Map.Entry<String, Graph> pathTcPair : extractedTc.entrySet()) {
             Literal fileNameLit = LiteralFactory.getInstance().createTypedLiteral(
                         pathTcPair.getKey());
             Iterator<Triple> graphResIterator = metaGraph.filter(null, BACKUP.file, fileNameLit);

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
index 9db6c04..f3678a7 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
@@ -45,16 +45,15 @@ import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
 import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
 import org.apache.clerezza.rdf.core.sparql.query.Variable;
+import org.apache.commons.rdf.Literal;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -154,33 +153,29 @@ public class ResultSetMessageBodyWriter implements MessageBodyWriter<ResultSet>
 
 
     /**
-     * Helper: creates value element from {@link Resource} depending on its
+     * Helper: creates value element from {@link RdfTerm} depending on its
      * class
      *
      */
-    private Element createValueElement(Resource resource, Document doc) {
+    private Element createValueElement(RdfTerm resource, Document doc) {
         Element value = null;
-        if (resource instanceof UriRef) {
+        if (resource instanceof Iri) {
             value = doc.createElement("uri");
-            value.appendChild(doc.createTextNode(((UriRef) resource)
+            value.appendChild(doc.createTextNode(((Iri) resource)
                     .getUnicodeString()));
-        } else if (resource instanceof TypedLiteral) {
+        } else if (resource instanceof Literal) {
             value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((TypedLiteral) resource)
+            value.appendChild(doc.createTextNode(((Literal) resource)
                     .getLexicalForm()));
-            value.setAttribute("datatype", (((TypedLiteral) resource)
+            value.setAttribute("datatype", (((Literal) resource)
                     .getDataType().getUnicodeString()));
-        } else if (resource instanceof PlainLiteral) {
-            value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((PlainLiteral) resource)
-                    .getLexicalForm()));
-            Language lang = ((PlainLiteral) resource).getLanguage();
+            Language lang = ((Literal) resource).getLanguage();
             if (lang != null) {
                 value.setAttribute("xml:lang", (lang.toString()));
             }
         } else {
             value = doc.createElement("bnode");
-            value.appendChild(doc.createTextNode(((BNode) resource).toString()));
+            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
         }
         return value;
     }
@@ -197,7 +192,7 @@ public class ResultSetMessageBodyWriter implements MessageBodyWriter<ResultSet>
             Element bindingElement = doc.createElement("binding");
             bindingElement.setAttribute("name", key.getName());
             bindingElement.appendChild(createValueElement(
-                    (Resource) solutionMap.get(key), doc));
+                    (RdfTerm) solutionMap.get(key), doc));
             result.appendChild(bindingElement);
         }
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
index 98e125a..fa29fde 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
@@ -26,17 +26,16 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import org.apache.clerezza.jaxrs.utils.RedirectUtil;
 import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.ontologies.FOAF;
 import org.apache.clerezza.rdf.ontologies.OWL;
 import org.apache.clerezza.rdf.ontologies.PLATFORM;
@@ -45,7 +44,7 @@ import org.apache.clerezza.rdf.utils.Smusher;
 import org.osgi.service.component.ComponentContext;
 
 /**
- * Provides a method to remove duplicate noded from (aka smush) a Graph
+ * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
  * 
  * @author reto
  */
@@ -54,7 +53,7 @@ import org.osgi.service.component.ComponentContext;
 @Property(name="javax.ws.rs", boolValue=true)
 @Path("/admin/graphs/smush")
 public class Smush {
-    private final UriRef tBoxName = new UriRef("urn:x-localinstance:/tbox.graph");
+    private final Iri tBoxName = new Iri("urn:x-localinstance:/tbox.graph");
 
     @Reference
     private TcManager tcManager;
@@ -62,27 +61,27 @@ public class Smush {
     @Reference
     private RenderletManager renderletManager;
 
-    private TripleCollection tBox;
+    private Graph tBox;
 
     protected void activate(ComponentContext componentContext) {
         try {
             //getting the tBox here means no read right on Tbox is necessary
             //when smushing
-            tBox = tcManager.getTriples(tBoxName);
+            tBox = tcManager.getGraph(tBoxName);
         } catch (NoSuchEntityException e) {
-            tBox = new SimpleMGraph();
+            tBox = new SimpleGraph();
             tBox.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
             tBox.add(new TripleImpl(FOAF.mbox_sha1sum, RDF.type, OWL.InverseFunctionalProperty));
             tBox.add(new TripleImpl(PLATFORM.userName, RDF.type, OWL.InverseFunctionalProperty));
-            tBox = tcManager.createGraph(tBoxName, tBox);
+            tBox = tcManager.createImmutableGraph(tBoxName, tBox);
         }
     }
 
 
     
     @POST
-    public Response smush(@Context UriInfo uriInfo, @FormParam("graphName") UriRef graphName) {
-        MGraph mGraph = tcManager.getMGraph(graphName);
+    public Response smush(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
+        Graph mGraph = tcManager.getGraph(graphName);
         Smusher.smush(mGraph, tBox);
         return RedirectUtil.createSeeOtherResponse("./", uriInfo);
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
index 59f6e46..69f318f 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
@@ -61,18 +61,16 @@ import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPa
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
 import org.apache.clerezza.rdf.core.sparql.ParseException;
 import org.apache.clerezza.rdf.core.sparql.QueryParser;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
@@ -83,6 +81,7 @@ import org.apache.clerezza.rdf.core.sparql.query.Variable;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.clerezza.rdf.web.ontologies.SPARQLENDPOINT;
+import org.apache.commons.rdf.Literal;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.ProcessingInstruction;
@@ -115,18 +114,18 @@ public class SparqlEndpoint {
     protected void activate(ComponentContext componentContext) {
         URL templateURL = getClass().getResource("sparql-endpoint.ssp");
         renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
-                new UriRef(templateURL.toString()), SPARQLENDPOINT.SparqlEndpoint,
+                new Iri(templateURL.toString()), SPARQLENDPOINT.SparqlEndpoint,
                 null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
     }
 
     @GET
     @Path("form")
-    public GraphNode getAvailableTripleCollectionUris(@Context UriInfo uriInfo) {
+    public GraphNode getAvailableGraphUris(@Context UriInfo uriInfo) {
         AccessController.checkPermission(new SparqlEndpointAccessPermission());
         TrailingSlash.enforceNotPresent(uriInfo);
-        GraphNode graphNode = new GraphNode(new BNode(), new SimpleMGraph());
-        Set<UriRef> tripleCollections = tcManager.listTripleCollections();
-        for (UriRef uriRef : tripleCollections) {
+        GraphNode graphNode = new GraphNode(new BlankNode(), new SimpleGraph());
+        Set<Iri> tripleCollections = tcManager.listGraphs();
+        for (Iri uriRef : tripleCollections) {
             graphNode.addProperty(SPARQLENDPOINT.tripleCollection, uriRef);
         }
         graphNode.addProperty(RDF.type, SPARQLENDPOINT.SparqlEndpoint);
@@ -134,7 +133,7 @@ public class SparqlEndpoint {
     }
 
     /**
-     * Returns either a {@link Graph} or a {@link DOMSource}. A {@link Graph} is
+     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
      * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
      * successfully carried out. A {@link DOMSource} is returned if an ASK or a
      * SELECT sparql query was submitted and successfully carried out. The query
@@ -144,15 +143,15 @@ public class SparqlEndpoint {
      * @param queryString
      *            URL encoded sparql query
      * @param defaultGraphUri
-     *            URI of the default graph, an {@link UriRef} is expected
+     *            URI of the default graph, an {@link Iri} is expected
      * @param applyStyleSheet
      * @param serverSide
      * @param styleSheetUri 
-     * @return either a {@link Graph} or a {@link DOMSource}
+     * @return either a {@link ImmutableGraph} or a {@link DOMSource}
      */
     @POST
     public Object runFormQuery(@FormParam("query") String queryString,
-            @FormParam("default-graph-uri") UriRef defaultGraphUri,
+            @FormParam("default-graph-uri") Iri defaultGraphUri,
             @FormParam("apply-style-sheet") String applyStyleSheet,
             @FormParam("server-side") String serverSide,
             @FormParam("style-sheet-uri") String styleSheetUri) {
@@ -170,12 +169,12 @@ public class SparqlEndpoint {
         } else {
             applyServerSide = false;
         }
-        //TripleCollection defaultGraph = null;
+        //Graph defaultGraph = null;
         Object result = null;
         try {
             if (defaultGraphUri == null
                     || defaultGraphUri.getUnicodeString().equals("")) {
-                defaultGraphUri = new UriRef(Constants.CONTENT_GRAPH_URI_STRING);
+                defaultGraphUri = new Iri(Constants.CONTENT_GRAPH_URI_STRING);
                 //defaultGraph = contentGraph;
             } else {
                 //defaultGraph = tcManager.getTriples(defaultGraphUri);
@@ -184,8 +183,8 @@ public class SparqlEndpoint {
             //TODO use ResultSet.getResultVars instead
             Query query = QueryParser.getInstance().parse(queryString);
             result = tcManager.executeSparqlQuery(queryString, defaultGraphUri);
-            if (result instanceof Graph) {
-                return (Graph) result;
+            if (result instanceof ImmutableGraph) {
+                return (ImmutableGraph) result;
             } else if ((result instanceof ResultSet)
                     || (result instanceof Boolean)) {
                 Source source = toXmlSource(result, query, applyStyle,
@@ -199,7 +198,7 @@ public class SparqlEndpoint {
             } else {
                 throw new WebApplicationException(
                         Response.status(Status.BAD_REQUEST).entity("Only " +
-                        "queries yielding to a Graph, a ResultSet or " +
+                        "queries yielding to a ImmutableGraph, a ResultSet or " +
                         "Boolean are supported").build());
             }
         } catch (ParseException e) {
@@ -210,7 +209,7 @@ public class SparqlEndpoint {
     }
 
     /**
-     * Returns either a {@link Graph} or a {@link DOMSource}. A {@link Graph} is
+     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
      * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
      * successfully carried out. A {@link DOMSource} is returned if an ASK or a
      * SELECT sparql query was submitted and successfully carried out. The query
@@ -225,7 +224,7 @@ public class SparqlEndpoint {
      */
     @GET
     public Object runGetQuery(@QueryParam("query") String queryString,
-            @QueryParam("default-graph-uri") UriRef defaultGraphUri,
+            @QueryParam("default-graph-uri") Iri defaultGraphUri,
             @QueryParam("style-sheet-uri") String styleSheetUri,
             @QueryParam("server-side") String serverSide) {
         AccessController.checkPermission(new SparqlEndpointAccessPermission());
@@ -375,7 +374,7 @@ public class SparqlEndpoint {
                 Element bindingElement = doc.createElement("binding");
                 bindingElement.setAttribute("name", key.getName());
                 bindingElement.appendChild(createValueElement(
-                        (Resource) solutionMap.get(key), doc));
+                        (RdfTerm) solutionMap.get(key), doc));
                 result.appendChild(bindingElement);
             }
         }
@@ -383,33 +382,29 @@ public class SparqlEndpoint {
     }
 
     /**
-     * Helper: creates value element from {@link Resource} depending on its
+     * Helper: creates value element from {@link RdfTerm} depending on its
      * class
      * 
      */
-    private Element createValueElement(Resource resource, Document doc) {
+    private Element createValueElement(RdfTerm resource, Document doc) {
         Element value = null;
-        if (resource instanceof UriRef) {
+        if (resource instanceof Iri) {
             value = doc.createElement("uri");
-            value.appendChild(doc.createTextNode(((UriRef) resource)
+            value.appendChild(doc.createTextNode(((Iri) resource)
                     .getUnicodeString()));
-        } else if (resource instanceof TypedLiteral) {
+        } else if (resource instanceof Literal) {
             value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((TypedLiteral) resource)
+            value.appendChild(doc.createTextNode(((Literal) resource)
                     .getLexicalForm()));
-            value.setAttribute("datatype", (((TypedLiteral) resource)
+            value.setAttribute("datatype", (((Literal) resource)
                     .getDataType().getUnicodeString()));
-        } else if (resource instanceof PlainLiteral) {
-            value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((PlainLiteral) resource)
-                    .getLexicalForm()));
-            Language lang = ((PlainLiteral) resource).getLanguage();
+            Language lang = ((Literal) resource).getLanguage();
             if (lang != null) {
                 value.setAttribute("xml:lang", (lang.toString()));
             }
         } else {
             value = doc.createElement("bnode");
-            value.appendChild(doc.createTextNode(((BNode) resource).toString()));
+            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
         }
         return value;
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
index 8a95484..6a71c01 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
@@ -43,14 +43,13 @@ import org.apache.felix.scr.annotations.Service;
 import org.apache.clerezza.jaxrs.utils.RedirectUtil;
 import org.apache.clerezza.jaxrs.utils.form.FormFile;
 import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-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.access.LockableMGraph;
+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.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
@@ -77,13 +76,13 @@ public class WebAccess {
     final Logger logger = LoggerFactory.getLogger(WebAccess.class);
 
     /**
-     * Gets the TripleCollection with specified name
+     * Gets the Graph with specified name
      *
      * @param name
      * @return
      */
     @GET
-    public TripleCollection getTriples(@QueryParam("name") UriRef name) {
+    public Graph getTriples(@QueryParam("name") Iri name) {
         AccessController.checkPermission(new WebAccessPermission());
         if (name == null) {
             Response r = Response.status(Response.Status.BAD_REQUEST)
@@ -91,7 +90,7 @@ public class WebAccess {
                     .type(MediaType.TEXT_PLAIN_TYPE).build();
             throw new WebApplicationException(r);
         }
-        TripleCollection result = tcManager.getTriples(name);
+        Graph result = tcManager.getGraph(name);
         logger.debug("Got graph of size {} ", result.size());
         int i = 1;
         if (logger.isDebugEnabled()) {
@@ -104,8 +103,8 @@ public class WebAccess {
     }
 
     /**
-     * Puts the triples replacing the triples of the existing MGraph with the
-     * specified name. If the graph doesn't exist creates a new <code>MGraph</code> 
+     * Puts the triples replacing the triples of the existing Graph with the
+     * specified name. If the graph doesn't exist creates a new <code>Graph</code> 
      * with the specified name and puts the triples
      * 
      *
@@ -113,13 +112,13 @@ public class WebAccess {
      * @param triples
      */
     @PUT
-    public void putTriples(@QueryParam("name") UriRef name, TripleCollection triples) {
+    public void putTriples(@QueryParam("name") Iri name, Graph triples) {
         AccessController.checkPermission(new WebAccessPermission());
-        LockableMGraph mGraph;
+        Graph mGraph;
         try {
-            mGraph = tcManager.getMGraph(name);
+            mGraph = tcManager.getGraph(name);
         } catch (NoSuchEntityException e) {
-            mGraph = tcManager.createMGraph(name);
+            mGraph = tcManager.createGraph(name);
         }
         Lock writeLock = mGraph.getLock().writeLock();
         writeLock.lock();
@@ -132,18 +131,18 @@ public class WebAccess {
     }
 
     /**
-     * Posts triples to be placed into an {@link MGraph} of the specified name.
-     * If an {@link MGraph} with this name doesn't already exist, a new one
+     * Posts triples to be placed into an {@link Graph} of the specified name.
+     * If an {@link Graph} with this name doesn't already exist, a new one
      * is created and filled with the triples posted.
      * @param form
      *        a multipart/form-data consisting of:
      *        - a {@link FormFile} labeled "graph" containing the triples and
      *            the mime-type.
-     *        - a text field labeled "name" specifying the name of the MGraph.
+     *        - a text field labeled "name" specifying the name of the Graph.
      *        - an optional text field labeled "mode" specifying the mode.
-     *            If the mode is "replace", existing triples of the MGraph will be
+     *            If the mode is "replace", existing triples of the Graph will be
      *            deleted before new triples are added. If the mode is not
-     *            specified or is "append", posted triples are added to the MGraph.
+     *            specified or is "append", posted triples are added to the Graph.
      *        - an optional text field labeled "redirection" specifying an URI
      *            which the client should be redirected to in case of success.
      * @return
@@ -152,9 +151,9 @@ public class WebAccess {
      *        satisfied, one of the following responses is returned:
      *        - SEE OTHER (303), if redirection is specified.
      *        - CREATED (201), if redirection is not specified and a new
-     *            {@link MGraph} is created.
+     *            {@link Graph} is created.
      *        - NO CONTENT (204), if redirection is not specified and no new
-     *            {@link MGraph} is created.
+     *            {@link Graph} is created.
      */
     @POST
     @Consumes("multipart/form-data")
@@ -193,14 +192,14 @@ public class WebAccess {
             mode = "append";
         }
         InputStream is = new ByteArrayInputStream(graph);
-        Graph parsedGraph = parser.parse(is, mediaType.toString());
-        UriRef graphUri = new UriRef(graphName);
-        LockableMGraph mGraph;
+        ImmutableGraph parsedGraph = parser.parse(is, mediaType.toString());
+        Iri graphUri = new Iri(graphName);
+        Graph mGraph;
         boolean newGraph = false;
         try {
-            mGraph = tcManager.getMGraph(graphUri);
+            mGraph = tcManager.getGraph(graphUri);
         } catch (NoSuchEntityException e) {
-            mGraph = tcManager.createMGraph(graphUri);
+            mGraph = tcManager.createGraph(graphUri);
             newGraph = true;
         }
         Lock writeLock = mGraph.getLock().writeLock();

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
index d922d78..8964eda 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
@@ -23,17 +23,17 @@ import java.security.Permission;
 import org.apache.clerezza.permissiondescriptions.PermissionInfo;
 
 /**
- * Permission to use the Graph via Web. Note that the user
+ * Permission to use the ImmutableGraph via Web. Note that the user
  * additionally needs permission to read a graph.
  *
  * @author mir
  */
-@PermissionInfo(value="Graph via Web Access Permission", description="Grants access " +
-    "to the Graph via Web")
+@PermissionInfo(value="ImmutableGraph via Web Access Permission", description="Grants access " +
+    "to the ImmutableGraph via Web")
 public class WebAccessPermission extends Permission{
 
     public WebAccessPermission() {
-        super("Graph via Web access permission");
+        super("ImmutableGraph via Web access permission");
     }
     /**
      *
@@ -41,7 +41,7 @@ public class WebAccessPermission extends Permission{
      * @param action ignored
      */
     public WebAccessPermission(String target, String actions) {
-        super("Graph via Web access permission");
+        super("ImmutableGraph via Web access permission");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java b/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
index 6419460..a43a6a2 100644
--- a/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
+++ b/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
@@ -29,17 +29,16 @@ import java.util.Map;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
-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.TypedLiteral;
-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.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
@@ -48,6 +47,7 @@ import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
 import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.web.ontologies.BACKUP;
+import org.apache.commons.rdf.Literal;
 import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
@@ -62,25 +62,25 @@ public class BackupAndRestoreTest {
 
     private static String testGraphFileName = "test.graph";
 
-    private static MGraph testMGraph0 = new SimpleMGraph();
-    private static UriRef testMGraphUri0 = // the URI of testMGraph0
-            new UriRef("http://localhost/test0/"+testGraphFileName);
-    // a resource in testMGraph0
-    private    static UriRef uri0 = new UriRef("http://localhost/test0/testuri");
+    private static Graph testGraph0 = new SimpleGraph();
+    private static Iri testGraphUri0 = // the URI of testGraph0
+            new Iri("http://localhost/test0/"+testGraphFileName);
+    // a resource in testGraph0
+    private    static Iri uri0 = new Iri("http://localhost/test0/testuri");
 
-    private static MGraph testMGraph1 = new SimpleMGraph();
-    private static UriRef testMGraphUri1 = // the URI of testMGraph1
-            new UriRef("http://localhost/test1/"+testGraphFileName);
+    private static Graph testGraph1 = new SimpleGraph();
+    private static Iri testGraphUri1 = // the URI of testGraph1
+            new Iri("http://localhost/test1/"+testGraphFileName);
 
-    // a resource in testMGraph1
-    private    static UriRef uri1 = new UriRef("http://localhost/test1/testuri");
+    // a resource in testGraph1
+    private    static Iri uri1 = new Iri("http://localhost/test1/testuri");
 
-    private static Graph testGraphA;
-    private static UriRef testGraphUriA = // the URI of testGraphA
-            new UriRef("http://localhost/testA/"+testGraphFileName);
+    private static ImmutableGraph testGraphA;
+    private static Iri testGraphUriA = // the URI of testGraphA
+            new Iri("http://localhost/testA/"+testGraphFileName);
 
     // a resource in testGraphA
-    private    static UriRef uriA = new UriRef("http://localhost/testA/testuri");
+    private    static Iri uriA = new Iri("http://localhost/testA/testuri");
     
 
     private static String backupContentFileName = "triplecollections.nt";
@@ -94,24 +94,24 @@ public class BackupAndRestoreTest {
         backup.serializer = Serializer.getInstance();
         backup.serializer.bindSerializingProvider(
                 new JenaSerializerProvider());
-        testMGraph0.add(new TripleImpl(uri0, uri0, uri0));
-        testMGraph1.add(new TripleImpl(uri1, uri1, uri1));
-        MGraph graphBuilder = new SimpleMGraph();
+        testGraph0.add(new TripleImpl(uri0, uri0, uri0));
+        testGraph1.add(new TripleImpl(uri1, uri1, uri1));
+        Graph graphBuilder = new SimpleGraph();
         graphBuilder.add(new TripleImpl(uriA, uriA, uriA));
-        testGraphA = graphBuilder.getGraph();
+        testGraphA = graphBuilder.getImmutableGraph();
     }
 
     @Test
     public void testBackup() throws IOException {
-        //Graph downloadedTestGraphX = null;
-        //Graph downloadedTestGraphY = null;
-        Graph downloadedBackupContentsGraph = null;
+        //ImmutableGraph downloadedTestGraphX = null;
+        //ImmutableGraph downloadedTestGraphY = null;
+        ImmutableGraph downloadedBackupContentsGraph = null;
 
         byte[] download = backup.createBackup();
         ByteArrayInputStream bais = new ByteArrayInputStream(download);
         ZipInputStream compressedTcs = new ZipInputStream(bais);
 
-        Map<String, TripleCollection> extractedTc = new HashMap<String, TripleCollection>();
+        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
         String folder = "";
         ZipEntry entry;
         while ((entry = compressedTcs.getNextEntry()) != null) {
@@ -140,7 +140,7 @@ public class BackupAndRestoreTest {
                     downloadedBackupContentsGraph = parser.parse(serializedGraph,
                             SupportedFormat.N_TRIPLE, null);
                 } else {
-                    Graph deserializedGraph = parser.parse(serializedGraph,
+                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
                             SupportedFormat.N_TRIPLE, null);
                     extractedTc.put(entryName, deserializedGraph);
                 }
@@ -157,13 +157,13 @@ public class BackupAndRestoreTest {
     public void restoreFromBackup() throws IOException {
         byte[] backupData = backup.createBackup();
         TcProvider tcProvider = EasyMock.createMock(TcProvider.class);
-        EasyMock.expect(tcProvider.getMGraph(testMGraphUri0)).andReturn(
-                EasyMock.createNiceMock(MGraph.class));
-        EasyMock.expect(tcProvider.getMGraph(testMGraphUri1)).andReturn(
-                EasyMock.createNiceMock(MGraph.class));
-        tcProvider.deleteTripleCollection(testGraphUriA);
-        EasyMock.expect(tcProvider.createGraph(EasyMock.eq(testGraphUriA),
-                EasyMock.notNull(TripleCollection.class))).andReturn(new SimpleMGraph().getGraph());
+        EasyMock.expect(tcProvider.getGraph(testGraphUri0)).andReturn(
+                EasyMock.createNiceMock(Graph.class));
+        EasyMock.expect(tcProvider.getGraph(testGraphUri1)).andReturn(
+                EasyMock.createNiceMock(Graph.class));
+        tcProvider.deleteGraph(testGraphUriA);
+        EasyMock.expect(tcProvider.createImmutableGraph(EasyMock.eq(testGraphUriA),
+                EasyMock.notNull(Graph.class))).andReturn(new SimpleGraph().getImmutableGraph());
         EasyMock.replay(tcProvider);
         Restorer restore = new Restorer();
         restore.parser = Parser.getInstance();
@@ -171,36 +171,36 @@ public class BackupAndRestoreTest {
         EasyMock.verify(tcProvider);
     }
 
-    private void checkDownloadedGraphs(Map<String, TripleCollection> extractedTc,
-            Graph downloadedBackupContentsGraph, String folder) {
+    private void checkDownloadedGraphs(Map<String, Graph> extractedTc,
+            ImmutableGraph downloadedBackupContentsGraph, String folder) {
         Assert.assertFalse(extractedTc.isEmpty());
         Assert.assertNotNull(downloadedBackupContentsGraph);
 
         Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
-                testMGraphUri0, RDF.type, BACKUP.MGraph)));
+                testGraphUri0, RDF.type, BACKUP.Graph)));
 
         Iterator<Triple> triples = downloadedBackupContentsGraph.filter(
-                testMGraphUri0, BACKUP.file, null);
+                testGraphUri0, BACKUP.file, null);
         Assert.assertTrue(triples.hasNext());
 
-        String fileName0 = ((TypedLiteral) triples.next().getObject()).getLexicalForm();
+        String fileName0 = ((Literal) triples.next().getObject()).getLexicalForm();
         Assert.assertTrue(fileName0.startsWith(folder+testGraphFileName));
 
-        TripleCollection extracted0 = extractedTc.get(fileName0);
+        Graph extracted0 = extractedTc.get(fileName0);
         Assert.assertNotNull(extracted0);
         Assert.assertTrue(extracted0.filter(uri0, uri0, uri0).hasNext());
 
         Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
-                testMGraphUri1, RDF.type, BACKUP.MGraph)));
+                testGraphUri1, RDF.type, BACKUP.Graph)));
 
         triples = downloadedBackupContentsGraph.filter(
-                testMGraphUri1, BACKUP.file, null);
+                testGraphUri1, BACKUP.file, null);
         Assert.assertTrue(triples.hasNext());
 
-        String fileName1 = ((TypedLiteral) triples.next().getObject()).getLexicalForm();
+        String fileName1 = ((Literal) triples.next().getObject()).getLexicalForm();
         Assert.assertTrue(fileName1.startsWith(folder+testGraphFileName));
 
-        TripleCollection extracted1 = extractedTc.get(fileName1);
+        Graph extracted1 = extractedTc.get(fileName1);
         Assert.assertNotNull(extracted1);
 
         Assert.assertTrue(extracted1.filter(uri1, uri1, uri1).hasNext());
@@ -214,9 +214,9 @@ public class BackupAndRestoreTest {
                 testGraphUriA, BACKUP.file, null);
         Assert.assertTrue(triples.hasNext());
 
-        String fileNameA = ((TypedLiteral) triples.next().getObject()).getLexicalForm();
+        String fileNameA = ((Literal) triples.next().getObject()).getLexicalForm();
         Assert.assertTrue(fileNameA.startsWith(folder+testGraphFileName));
-        TripleCollection extractedA = extractedTc.get(fileNameA);
+        Graph extractedA = extractedTc.get(fileNameA);
         Assert.assertNotNull(extractedA);
 
         Assert.assertTrue(extractedA.filter(uriA, uriA, uriA).hasNext());
@@ -225,13 +225,13 @@ public class BackupAndRestoreTest {
 
     private class TestTcManager extends TcManager {
 
-        // Associates testGraphUri0 with testMGraph0 and testGraphUri1 with testGraph1
+        // Associates testGraphUri0 with testGraph0 and testGraphUri1 with testGraph1
         @Override
-        public TripleCollection getTriples(UriRef name) throws NoSuchEntityException {
-            if (name.equals(testMGraphUri0)) {
-                return testMGraph0;
-            } else if (name.equals(testMGraphUri1)) {
-                return testMGraph1;
+        public Graph getGraph(Iri name) throws NoSuchEntityException {
+            if (name.equals(testGraphUri0)) {
+                return testGraph0;
+            } else if (name.equals(testGraphUri1)) {
+                return testGraph1;
             } else if (name.equals(testGraphUriA)) {
                 return testGraphA;
             }
@@ -239,10 +239,10 @@ public class BackupAndRestoreTest {
         }
 
         @Override
-        public Set<UriRef> listTripleCollections() {
-            Set<UriRef> result = new HashSet<UriRef>();
-            result.add(testMGraphUri0);
-            result.add(testMGraphUri1);
+        public Set<Iri> listGraphs() {
+            Set<Iri> result = new HashSet<Iri>();
+            result.add(testGraphUri0);
+            result.add(testGraphUri1);
             result.add(testGraphUriA);
             return result;
         }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.ontologies/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/pom.xml b/rdf.web/rdf.web.ontologies/pom.xml
index 4585475..1713a43 100644
--- a/rdf.web/rdf.web.ontologies/pom.xml
+++ b/rdf.web/rdf.web.ontologies/pom.xml
@@ -23,8 +23,9 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.clerezza</groupId>
-        <artifactId>rdf.web</artifactId>
-        <version>0.10</version>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.web.ontologies</artifactId>
@@ -36,7 +37,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <build>
@@ -58,7 +59,7 @@
                         </goals>
                     </execution>
                 </executions>
-                <version>0.3-incubating</version>
+                <version>1.0.0-SNAPSHOT</version>
         </plugin>
         </plugins>
     </build>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf/jena/parser/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/parser/pom.xml b/rdf/jena/parser/pom.xml
index 90572ad..d682f94 100644
--- a/rdf/jena/parser/pom.xml
+++ b/rdf/jena/parser/pom.xml
@@ -70,7 +70,11 @@
         </dependency>
     </dependencies>
     <build>
-        <plugins>    
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>  
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf/jena/serializer/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/serializer/pom.xml b/rdf/jena/serializer/pom.xml
index 9555624..1de87ce 100644
--- a/rdf/jena/serializer/pom.xml
+++ b/rdf/jena/serializer/pom.xml
@@ -33,6 +33,14 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - Serializer</name>
     <description>A SerializingProvider based on jena</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencyManagement>
         <dependencies>
             <dependency>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf/jena/tdb.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/jena/tdb.storage/pom.xml b/rdf/jena/tdb.storage/pom.xml
index 11d054d..5fc86ef 100644
--- a/rdf/jena/tdb.storage/pom.xml
+++ b/rdf/jena/tdb.storage/pom.xml
@@ -31,6 +31,14 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - RDF - Jena - TDB Storage Provider</name>
     <description>A Jena TDB based storage provider</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencyManagement>
         <dependencies>
             <dependency>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/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 d50ef64..c9733ff 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
@@ -324,8 +324,8 @@ public class TdbTcProvider implements WeightedTcProvider {
     @Override
     public Set<Iri> listGraphs() {
         Set<Iri> result = new HashSet<Iri>();
-        result.addAll(listGraphs());
-        result.addAll(listGraphs());
+        result.addAll(listMGraphs());
+        result.addAll(listImmutableGraphs());
         return result;
     }
 


[3/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.ontologies/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.ontologies/pom.xml b/rdf/web/rdf.web.ontologies/pom.xml
new file mode 100644
index 0000000..1713a43
--- /dev/null
+++ b/rdf/web/rdf.web.ontologies/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>rdf.web.ontologies</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - SCB Web Access Ontologies</name>
+    <description>Ontologies defined for local use in SCB Web Access</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>maven-ontologies-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <resourcePath>${basedir}/src/main/resources</resourcePath>
+                            <sources>
+                                <source>${basedir}/target/generated-sources/main/java</source>
+                            </sources>
+                        </configuration>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <version>1.0.0-SNAPSHOT</version>
+        </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
new file mode 100644
index 0000000..17d70ee
--- /dev/null
+++ b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF xmlns="http://clerezza.org/2009/11/backup#"
+	xml:base="http://clerezza.org/2009/11/backup"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:skos="http://www.w3.org/2008/05/skos#"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+>
+
+<!-- Ontology -->
+
+<owl:Ontology rdf:about="http://clerezza.org/2009/11/backup#">
+	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
+	<dc:title xml:lang="en">
+		Clerezza Backup
+	</dc:title>
+</owl:Ontology>
+
+<!-- Classes -->
+<rdfs:Class rdf:about="#Graph">
+	<rdf:type rdf:resource="owl:Class"/>
+	<rdfs:label xml:lang="en">Graph</rdfs:label>
+	<skos:definition xml:lang="en">An RDF graph.</skos:definition>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="#MGraph">
+	<rdf:type rdf:resource="owl:Class"/>
+	<rdfs:label xml:lang="en">MGraph</rdfs:label>
+	<skos:definition xml:lang="en">A mutable RDF graph.</skos:definition>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="#BackupAdminPage">
+	<rdf:type rdf:resource="owl:Class"/>
+	<rdfs:label xml:lang="en">BackupAdminPage</rdfs:label>
+	<skos:definition xml:lang="en">The administrative page to get backups and restore from backups.</skos:definition>
+</rdfs:Class>
+
+
+<!-- Properties -->
+
+<rdf:Property rdf:about="#file">
+	<rdf:type rdf:resource="owl:DatatypeProperty" />
+	<rdfs:label xml:lang="en">file</rdfs:label>
+	<skos:definition xml:lang="en">Points to the backup filename of the subject.
+	</skos:definition>
+	<rdfs:domain rdf:resource="#Graph"/>
+	<rdfs:range rdf:resource="xsd:string"/>
+</rdf:Property>
+
+</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
new file mode 100644
index 0000000..3368915
--- /dev/null
+++ b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF xmlns="http://clerezza.org/2010/03/graph-management#"
+	xml:base="http://clerezza.org/2010/03/graph-management"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:skos="http://www.w3.org/2008/05/skos#"
+	xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
+>
+
+<!-- Ontology -->
+
+<owl:Ontology rdf:about="http://clerezza.org/2010/03/graph-management#">
+	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
+	<dc:title xml:lang="en">
+		Ontology for Graph Management Page related concepts
+	</dc:title>
+</owl:Ontology>
+
+<!-- Classes -->
+<rdfs:Class rdf:about="#GraphManagementPage">
+	<rdf:type rdf:resource="owl:Class"/>
+	<rdfs:label xml:lang="en">GraphManagementPage</rdfs:label>
+	<skos:definition xml:lang="en">
+		A web page fro managing triple collections
+	</skos:definition>
+</rdfs:Class>
+
+<!-- Properties -->
+
+<rdf:Property rdf:about="#tripleCollection">
+	<rdf:type rdf:resource="owl:ObjectProperty" />
+	<rdfs:label xml:lang="en">tripleCollection</rdfs:label>
+	<skos:definition xml:lang="en">Points to a Triple Collection.
+	</skos:definition>
+	<rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
+</rdf:Property>
+
+<rdf:Property rdf:about="#size">
+	<rdf:type rdf:resource="owl:DatatypeProperty" />
+	<rdfs:label xml:lang="en">size</rdfs:label>
+	<skos:definition xml:lang="en">The size (in triples) of a Triple Collection
+	</skos:definition>
+	<rdfs:domain rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
+</rdf:Property>
+
+</rdf:RDF>
+

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
new file mode 100644
index 0000000..60dc58d
--- /dev/null
+++ b/rdf/web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF xmlns="http://clerezza.org/2009/11/sparql-endpoint#"
+	xml:base="http://clerezza.org/2009/11/sparql-endpoint"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:skos="http://www.w3.org/2008/05/skos#"
+	xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
+>
+
+<!-- Ontology -->
+
+<owl:Ontology rdf:about="http://clerezza.org/2009/11/sparql-endpoint#">
+	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
+	<dc:title xml:lang="en">
+		Clerezza Sparql-Endpoint
+	</dc:title>
+</owl:Ontology>
+
+<!-- Classes -->
+<rdfs:Class rdf:about="#SparqlEndpoint">
+	<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
+	<rdfs:label xml:lang="en">SparqlEndpoint</rdfs:label>
+	<skos:definition xml:lang="en">
+		A web page containing a form for entering a SPARQL query.
+	</skos:definition>
+</rdfs:Class>
+
+<!-- Properties -->
+
+<rdf:Property rdf:about="#tripleCollection">
+	<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty" />
+	<rdfs:label xml:lang="en">tripleCollection</rdfs:label>
+	<skos:definition xml:lang="en">Points to a Triple Collection.
+	</skos:definition>
+	<rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
+</rdf:Property>
+
+</rdf:RDF>
+


[8/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
----------------------------------------------------------------------
diff --git a/rdf.storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml b/rdf.storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
deleted file mode 100644
index e1bd1fb..0000000
--- a/rdf.storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="OSGI-INF/metatype/metatype">
-    <OCD id="org.apache.clerezza.rdf.storage.web.WebProxy"
-         name="Clerezza SCB Web Storage Provider"
-         description="%org.apache.clerezza.rdf.storage.web.WebProxy.description">
-        <AD id="network-timeout" type="int" default="false" name="Network Timeout" description="Specifies the network timeout in ms."/>
-    </OCD>
-    <Designate pid="org.apache.clerezza.rdf.storage.web.WebProxy">
-        <Object ocdref="org.apache.clerezza.rdf.storage.web.WebProxy"/>
-    </Designate>
-</metatype:MetaData>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
----------------------------------------------------------------------
diff --git a/rdf.storage.web/src/main/resources/OSGI-INF/serviceComponents.xml b/rdf.storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
deleted file mode 100644
index ff9b296..0000000
--- a/rdf.storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
-
-    <scr:component enabled="true" name="org.apache.clerezza.rdf.storage.web.WebProxy">
-        <implementation class="org.apache.clerezza.rdf.storage.web.WebProxy"/>
-        <service servicefactory="false">
-            <provide interface="org.apache.clerezza.rdf.storage.web.WebProxy"/>
-            <provide interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"/>
-        </service>
-        <!-- hard coded <property name="weight" type="Integer" value="0"/> -->
-        <reference name="weightedTcProvider" interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"
-                   cardinality="1..n" policy="dynamic" bind="bindWeightedTcProvider" unbind="unbindWeightedTcProvider"/>
-        <reference name="parser" interface="org.apache.clerezza.rdf.core.serializedform.Parser"
-        cardinality="1..1" policy="static" bind="bindParser" unbind="unbindParser"/>
-        <property name="network-timeout" value="3000" type="Integer"/>
-    </scr:component>
-
-</components>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.storage.web/src/main/scala/WebProxy.scala
----------------------------------------------------------------------
diff --git a/rdf.storage.web/src/main/scala/WebProxy.scala b/rdf.storage.web/src/main/scala/WebProxy.scala
deleted file mode 100644
index 3a03e3b..0000000
--- a/rdf.storage.web/src/main/scala/WebProxy.scala
+++ /dev/null
@@ -1,271 +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.storage.web
-
-
-import org.apache.commons.rdf.ImmutableGraph
-import org.apache.commons.rdf.Iri
-import org.apache.commons.rdf._
-import org.apache.commons.rdf.impl.utils.AbstractGraph
-import org.osgi.service.component.ComponentContext
-import java.io.IOException
-import java.net.{HttpURLConnection, URL}
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat
-import org.apache.clerezza.rdf.core.serializedform.Parser
-import java.security.{PrivilegedExceptionAction, PrivilegedActionException, AccessController}
-
-import org.slf4j.scala._
-import org.apache.clerezza.rdf.core.access._
-import org.apache.clerezza.rdf.core._
-import java.sql.Time
-
-/**
- * The Web Proxy Service enables applications to request remote (and local) graphs.
- * It keeps cached version of the remote graphs in store for faster delivery.
- *
- */
-class WebProxy extends WeightedTcProvider with Logging {
-
-  val networkTimeoutKey = "network-timeout"
-
-  private var networkTimeout: Int = _
-
-  private var tcProvider: TcProviderMultiplexer = new TcProviderMultiplexer
-
-  /**
-   * Register a provider
-   *
-   * @param provider
-   *            the provider to be registered
-   */
-  protected def bindWeightedTcProvider(provider: WeightedTcProvider): Unit = {
-    tcProvider.addWeightedTcProvider(provider)
-  }
-
-  /**
-   * Deregister a provider
-   *
-   * @param provider
-   *            the provider to be deregistered
-   */
-  protected def unbindWeightedTcProvider(provider: WeightedTcProvider): Unit = {
-    tcProvider.removeWeightedTcProvider(provider)
-  }
-
-  /**OSGI method, called on activation */
-  protected def activate(context: ComponentContext) = {
-    networkTimeout = Integer.parseInt(context.getProperties.get(networkTimeoutKey).toString)
-  }
-
-
-  private var parser: Parser = null
-
-  protected def bindParser(p: Parser) = {
-    parser = p
-  }
-
-  protected def unbindParser(p: Parser) = {
-    parser = null
-  }
-
-  def getWeight: Int = {
-    return 0
-  }
-
-  /**
-   * Any Graph is available as ImmutableGraph as well as immutable Graph
-   *
-   * @param name
-   * @return
-   * @throws NoSuchEntityException
-   */
-  def getMGraph(name: Iri): Graph = {
-    val graph = getImmutableGraph(name)
-    return new AbstractGraph() {
-      protected def performFilter(subject: BlankNodeOrIri, predicate: Iri, `object` : RdfTerm): java.util.Iterator[Triple] = {
-        graph.filter(subject, predicate, `object`)
-      }
-
-      def performSize = graph.size
-    }
-  }
-
-  def getImmutableGraph(name: Iri): ImmutableGraph = {
-    try {
-      getGraph(name, Cache.Fetch)
-    } catch {
-      case e: IOException => {
-          logger.debug("could not get graph by dereferencing uri", e)
-          throw new NoSuchEntityException(name)
-      }
-
-    }
-  }
-
-  def getGraph(name: Iri): Graph = {
-    return getMGraph(name)
-  }
-
-  def createGraph(name: Iri): Graph = {
-    throw new UnsupportedOperationException
-  }
-
-  def createImmutableGraph(name: Iri, triples: Graph): ImmutableGraph = {
-    throw new UnsupportedOperationException
-  }
-
-  def deleteGraph(name: Iri): Unit = {
-    throw new UnsupportedOperationException
-  }
-
-  def getNames(graph: ImmutableGraph): java.util.Set[Iri] = {
-    var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
-    import collection.JavaConversions._
-    for (name <- listGraphs) {
-      if (getImmutableGraph(name).equals(graph)) {
-        result.add(name)
-      }
-    }
-    return result
-  }
-
-  def listGraphs: java.util.Set[Iri] = {
-    var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
-    result.addAll(listMGraphs)
-    result.addAll(listImmutableGraphs)
-    return result
-  }
-
-  def listMGraphs: java.util.Set[Iri] = {
-    //or should we list graphs for which we have a cached version?
-    return java.util.Collections.emptySet[Iri]
-  }
-
-  def listImmutableGraphs: java.util.Set[Iri] = {
-    return java.util.Collections.emptySet[Iri]
-  }
-
-  /**
-   * The semantics of this resource
-   * @param update if a remote URI, update information on the resource first
-   */
-  def getGraph(name: Iri, updatePolicy: Cache.Value): ImmutableGraph = {
-    logger.debug("getting graph " + name)
-    if (name.getUnicodeString.indexOf('#') != -1) {
-      logger.debug("not dereferencing URI with hash sign. Please see CLEREZZA-533 for debate.")
-      throw new NoSuchEntityException(name)
-    }
-    if (name.getUnicodeString.startsWith("urn")) {
-      //these are not dereferenceable
-      throw new NoSuchEntityException(name)
-    }
-    val cacheGraphName = new Iri("urn:x-localinstance:/cache/" + name.getUnicodeString)
-    //todo: follow redirects and keep track of them
-    //todo: keep track of headers especially date and etag. test for etag similarity
-    //todo: for https connection allow user to specify his webid and send his key: ie allow web server to be an agent
-    //todo: add GRDDL functionality, so that other return types can be processed too
-    //todo: enable ftp and other formats (though content negotiation won't work there)
-    def updateGraph() {
-      val url = new URL(name.getUnicodeString)
-      val connection = url.openConnection()
-      connection match {
-        case hc: HttpURLConnection => {
-          hc.addRequestProperty("Accept", acceptHeader)
-          hc.setReadTimeout(networkTimeout)
-          hc.setConnectTimeout(networkTimeout)
-        };
-      }
-      connection.connect()
-      val in = connection.getInputStream()
-      val mediaType = connection.getContentType()
-      val remoteTriples = parser.parse(in, mediaType, name)
-      tcProvider.synchronized {
-        try {
-          tcProvider.deleteGraph(cacheGraphName)
-        } catch {
-          case e: NoSuchEntityException =>;
-        }
-        tcProvider.createImmutableGraph(cacheGraphName, remoteTriples)
-      }
-    }
-    try {
-      //the logic here is not quite right, as we don't look at time of previous fetch.
-      updatePolicy match {
-        case Cache.Fetch => try {
-          tcProvider.getImmutableGraph(cacheGraphName)
-        } catch {
-          case e: NoSuchEntityException => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
-        }
-        case Cache.ForceUpdate => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
-        case Cache.CacheOnly => tcProvider.getImmutableGraph(cacheGraphName)
-      }
-    } catch {
-      case ex: PrivilegedActionException => {
-        var cause: Throwable = ex.getCause
-        if (cause.isInstanceOf[UnsupportedOperationException]) {
-          throw cause.asInstanceOf[UnsupportedOperationException]
-        }
-        if (cause.isInstanceOf[EntityAlreadyExistsException]) {
-          throw cause.asInstanceOf[EntityAlreadyExistsException]
-        }
-        if (cause.isInstanceOf[RuntimeException]) {
-          throw cause.asInstanceOf[RuntimeException]
-        }
-        throw new RuntimeException(cause)
-      }
-    }
-  }
-
-
-  private lazy val acceptHeader = {
-
-    import scala.collection.JavaConversions._
-
-    (for (f <- parser.getSupportedFormats) yield {
-      val qualityOfFormat = {
-        f match {
-          //the default, well established format
-          case SupportedFormat.RDF_XML => "1.0";
-          //n3 is a bit less well defined and/or many parsers supports only subsets
-          case SupportedFormat.N3 => "0.6";
-          //we prefer most dedicated formats to (X)HTML, not because those are "better",
-          //but just because it is quite likely that the pure RDF format will be
-          //lighter (contain less presentation markup), and it is also possible that HTML does not
-          //contain any RDFa, but just points to another format.
-          case SupportedFormat.XHTML => "0.5";
-          //we prefer XHTML over html, because parsing (should) be easier
-          case SupportedFormat.HTML => "0.4";
-          //all other formats known currently are structured formats
-          case _ => "0.8"
-        }
-      }
-      f + "; q=" + qualityOfFormat + ","
-    }).mkString + " *; q=.1" //is that for GRDDL?
-  }
-}
-
-object Cache extends Enumeration {
-  /**fetch if not in cache, if version in cache is out of date, or return cache */
-  val Fetch = Value
-  /**fetch from source whatever is in cache */
-  val ForceUpdate = Value
-  /**only get cached version. If none exists return empty graph */
-  val CacheOnly = Value
-}

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/pom.xml b/rdf.web/pom.xml
deleted file mode 100644
index 7dc74da..0000000
--- a/rdf.web/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.clerezza</groupId>
-        <artifactId>clerezza</artifactId>
-        <version>7-SNAPSHOT</version>
-        <relativePath />
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.web</artifactId>
-    <packaging>pom</packaging>
-    <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - RDF Web Access</name>
-    <description>Allows access to Clerezza graphs over HTTP with JAX-RS</description>
-    <modules>
-        <module>rdf.web.core</module>
-        <module>rdf.web.ontologies</module>
-    </modules>
-</project>
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/nbactions.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/nbactions.xml b/rdf.web/rdf.web.core/nbactions.xml
deleted file mode 100644
index 49e8307..0000000
--- a/rdf.web/rdf.web.core/nbactions.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
-    <action>
-        <actionName>CUSTOM-deploy to localhost:8080</actionName>
-        <displayName>deploy to localhost:8080</displayName>
-        <goals>
-            <goal>install</goal>
-            <goal>org.apache.sling:maven-sling-plugin:install</goal>
-        </goals>
-    </action>
-</actions>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/pom.xml b/rdf.web/rdf.web.core/pom.xml
deleted file mode 100644
index 2cad597..0000000
--- a/rdf.web/rdf.web.core/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
-    -->
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.clerezza</groupId>
-        <artifactId>clerezza</artifactId>
-        <version>7-SNAPSHOT</version>
-        <relativePath />
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.web.core</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - RDF Web Access Core</name>
-    <description>The core part of Clerezza RDF  Web Access</description>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.typerendering.core</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.typerendering.scalaserverpages</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.serializer</artifactId>
-            <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.parser</artifactId>
-            <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>jsr311-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>jaxrs.utils</artifactId>
-            <version>0.9</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.ontologies</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.web.ontologies</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>platform.globalmenu.api</artifactId>
-            <version>0.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>permissiondescriptions</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>web.fileserver</artifactId>
-            <version>0.10</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
deleted file mode 100644
index 440e877..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
+++ /dev/null
@@ -1,161 +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.web.core;
-
-import org.apache.clerezza.platform.Constants;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesService;
-import org.apache.commons.rdf.BlankNode;
-import org.apache.commons.rdf.Graph;
-import org.apache.clerezza.rdf.core.access.security.TcPermission;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.web.ontologies.BACKUP;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.Response.Status;
-import java.net.URL;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * This JAX-RS resource provides a method to retrieve a zip file containing
- * all triple collections that the use may access. The triple collection are
- * serialized in N-Triples format. The URI path of this resource is
- * "/admin/backup".
- *
- * This class adds a global menu-item for users that can read the system graph
- * (as there's currently no dedicated backup-permission).
- *
- * @author hasan, reto
- */
-@Component
-@Service({Object.class, GlobalMenuItemsProvider.class})
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/admin/backup")
-public class Backup implements GlobalMenuItemsProvider {
-
-    final Logger logger = LoggerFactory.getLogger(Backup.class);
-    @Reference
-    private ScalaServerPagesService scalaServerPagesService;
-    private Set<ServiceRegistration> serviceRegistrations = new HashSet<ServiceRegistration>();
-
-    /**
-     * The activate method is called when SCR activates the component configuration.
-     *
-     * @param componentContext
-     */
-    protected void activate(ComponentContext componentContext) {
-        URL templateURL = getClass().getResource("backup-management.ssp");
-        serviceRegistrations.add(scalaServerPagesService.registerScalaServerPage(templateURL, BACKUP.BackupAdminPage, "naked",
-                MediaType.APPLICATION_XHTML_XML_TYPE));
-    }
-
-    protected void deactivate(ComponentContext context) {
-        for (ServiceRegistration r : serviceRegistrations) {
-            r.unregister();
-        }
-    }
-
-    /**
-     * Get a zipped file containing all triple collections which the
-     * user may access. The resource is accessible through the URI path
-     * "/admin/backup/download".
-     * The triple collections are serialized in N-Triples format before being
-     * archived in a single zipped file.
-     * A mapping of the names of the files in the archive to triple collection
-     * names is available as well in the archive as a text file named
-     * triplecollections.nt.
-     *
-     * @return a response that will cause the creation of a zipped file
-     */
-    @GET
-    @Path("download")
-    @Produces("application/zip")
-    public Response download() {
-        AccessController.checkPermission(new BackupPermission());
-        return AccessController.doPrivileged(new PrivilegedAction<Response>() {
-
-            @Override
-            public Response run() {
-                ResponseBuilder responseBuilder = Response.status(Status.OK).
-                        entity(Backup.this);
-                responseBuilder.header("Content-Disposition",
-                        "attachment; filename=backup" + getCurrentDate() + ".zip");
-                return responseBuilder.build();
-            }
-        });
-
-    }
-
-    @GET
-    public GraphNode overviewPage() {
-        Graph resultGraph = new SimpleGraph();
-        GraphNode result = new GraphNode(new BlankNode(), resultGraph);
-        result.addProperty(RDF.type, BACKUP.BackupAdminPage);
-        result.addProperty(RDF.type, PLATFORM.HeadedPage);
-        return result;
-    }
-
-    private String getCurrentDate() {
-        DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
-        Date date = new Date();
-        return dateFormat.format(date);
-    }
-
-    @Override
-    public Set<GlobalMenuItem> getMenuItems() {
-        //need backup or restore permission for the menu item to be shown
-        Set<GlobalMenuItem> result = new HashSet<GlobalMenuItem>();
-        try {
-            AccessController.checkPermission(new BackupPermission());
-        } catch (AccessControlException e) {
-            try {
-                AccessController.checkPermission(new RestorePermission());
-            } catch (AccessControlException e1) {
-                return result;
-            }
-        }
-        result.add(new GlobalMenuItem("/admin/backup",
-                "BCK", "Backup and Restore", 5, "Administration"));
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
deleted file mode 100644
index 5029eea..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.commons.rdf.Graph;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.commons.rdf.Graph;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.web.ontologies.BACKUP;
-
-/**
- * This does the actual work of producing a backup
- * 
- * @author hasan, reto
- */
-@Component
-@Service(Object.class)
-@Property(name="javax.ws.rs", boolValue=true)
-@Produces("application/zip")
-@Provider
-public class BackupMessageBodyWriter implements MessageBodyWriter<Backup> {
-
-    @Reference
-    TcManager tcManager;
-
-    @Reference
-    Serializer serializer;
-
-    final Logger logger = LoggerFactory.getLogger(BackupMessageBodyWriter.class);
-
-    private final String folder = "graphs/";
-
-
-    byte[] createBackup() {
-        ByteArrayOutputStream result = new ByteArrayOutputStream();
-        writeBackup(result);
-        return result.toByteArray();
-    }
-
-    private void archive(ZipOutputStream compressedTcs, 
-            Graph tripleCollection,
-            String fileName) throws IOException, UnsupportedFormatException {
-        Lock readLock = null;
-        compressedTcs.putNextEntry(new ZipEntry(fileName));
-        if (tripleCollection instanceof Graph) {
-            readLock = ((Graph) tripleCollection).getLock().readLock();
-            readLock.lock();
-        }
-        try {
-            serializer.serialize(compressedTcs, tripleCollection,
-                    SupportedFormat.N_TRIPLE);
-        } finally {
-            if (readLock != null) {
-                readLock.unlock();
-            }
-        }
-    }
-
-    private String getTcFileName(Iri tcUri, String extension,
-            Map<String, Integer> fileNameCount) {
-        String fileName = tcUri.getUnicodeString();
-        fileName = fileName.substring(fileName.lastIndexOf("/")+1);
-        Integer count = fileNameCount.get(fileName);
-        if (count == null) {
-            fileNameCount.put(fileName, 0);
-        } else {
-            count++;
-            fileNameCount.put(fileName, count);
-            fileName = fileName.concat("_" + count);
-        }
-        return  fileName.concat(extension);
-    }
-
-    private void writeBackup(OutputStream result) {
-        Map<String, Integer> fileNameCount = new HashMap<String, Integer>();
-        Graph backupContents = new SimpleGraph();
-        try {
-            ZipOutputStream compressedTcs = new ZipOutputStream(result);
-
-            compressedTcs.putNextEntry(new ZipEntry(folder));
-
-            Set<Iri> tripleCollections = tcManager.listGraphs();
-            Iterator<Iri> tcIris = tripleCollections.iterator();
-            while (tcIris.hasNext()) {
-                Iri tcUri = tcIris.next();
-                String fileName = folder + getTcFileName(tcUri, ".nt",
-                        fileNameCount);
-                Graph tripleCollection = tcManager.getGraph(tcUri);
-                archive(compressedTcs, tripleCollection, fileName);
-                if (tripleCollection instanceof Graph) {
-                    backupContents.add(new TripleImpl(tcUri, RDF.type,
-                            BACKUP.Graph));
-                } else {
-                    backupContents.add(new TripleImpl(tcUri, RDF.type,
-                            BACKUP.Graph));
-                }
-                backupContents.add(new TripleImpl(tcUri, BACKUP.file,
-                        LiteralFactory.getInstance().createTypedLiteral(
-                        fileName)));
-            }
-            archive(compressedTcs, backupContents, "triplecollections.nt");
-            compressedTcs.close();
-
-        } catch (UnsupportedFormatException ufe) {
-            throw new WebApplicationException(Response.status(
-                    Status.NOT_ACCEPTABLE).entity(ufe.getMessage()).build());
-        } catch (IOException ex) {
-            throw new WebApplicationException(ex);
-        }
-    }
-
-    @Override
-    public boolean isWriteable(Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
-        return Backup.class.isAssignableFrom(type);
-    }
-
-    @Override
-    public long getSize(Backup t, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
-        return -1;
-    }
-
-    @Override
-    public void writeTo(Backup t, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, Object> httpHeaders,
-            OutputStream entityStream) throws IOException, WebApplicationException {
-        writeBackup(entityStream);
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
deleted file mode 100644
index caf5d18..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-import java.security.Permission;
-
-/**
- * Permission to retrieve a backup copy of all graphs provided by TcManager
- *
- * @author reto
- */
-@PermissionInfo(value="Backup Permission", description="Permission " +
-    "to retrieve a backup of all Triple Collections")
-public class BackupPermission extends Permission {
-
-
-    public BackupPermission() {
-        super("ImmutableGraph Management permission");
-    }
-    /**
-     *
-     * @param target ignored
-     * @param action ignored
-     */
-    public BackupPermission(String target, String actions) {
-        super("ImmutableGraph Management permission");
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        return equals(permission);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return getClass().equals(obj.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-        return 77988;
-    }
-
-    @Override
-    public String getActions() {
-        return "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
deleted file mode 100644
index c00bf1b..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import org.apache.clerezza.jaxrs.utils.RedirectUtil;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.commons.rdf.Graph;
-import org.apache.commons.rdf.Graph;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.FOAF;
-import org.apache.clerezza.rdf.ontologies.OWL;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.Smusher;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
- * 
- * @author reto
- */
-@Component
-@Service(Object.class)
-@Property(name="javax.ws.rs", boolValue=true)
-@Path("/admin/graphs/delete")
-public class Delete {
-    
-    @Reference
-    private TcManager tcManager;
-
-    
-    @POST
-    public Response delete(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
-        tcManager.deleteGraph(graphName);
-        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
deleted file mode 100644
index 886d1e7..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
+++ /dev/null
@@ -1,120 +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.web.core;
-
-import java.net.URL;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.util.HashSet;
-import java.util.Set;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-import org.apache.clerezza.jaxrs.utils.TrailingSlash;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.commons.rdf.BlankNode;
-import org.apache.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.commons.rdf.Graph;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.ontologies.TCPROVIDER;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.web.ontologies.GRAPHMANAGEMENT;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * This JAX-RS resource provides an interface designed to allow various management
- * functions on triple collections. The URI path of this resource is
- * "/admin/graph-management".
- * 
- * @author reto
- */
-@Component
-@Service({Object.class, GlobalMenuItemsProvider.class})
-@Property(name="javax.ws.rs", boolValue=true)
-@Path("/admin/graphs")
-public class GraphManagement implements GlobalMenuItemsProvider {
-
-    @Reference
-    private TcManager tcManager;
-
-    @Reference
-    private RenderletManager renderletManager;
-
-    protected void activate(ComponentContext componentContext) {
-        URL templateURL = getClass().getResource("graph-management.ssp");
-        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
-                new Iri(templateURL.toString()), GRAPHMANAGEMENT.GraphManagementPage,
-                "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
-    }
-
-    @GET
-    public GraphNode mainPage(@Context UriInfo uriInfo) {
-        AccessController.checkPermission(new GraphManagementAppPermission());
-        TrailingSlash.enforcePresent(uriInfo);
-        final SimpleGraph resultGraph = new SimpleGraph();
-        GraphNode graphNode = new GraphNode(new BlankNode(), resultGraph);
-        Set<Iri> tripleCollections = tcManager.listGraphs();
-        for (Iri uriRef : tripleCollections) {
-            graphNode.addProperty(GRAPHMANAGEMENT.tripleCollection, uriRef);
-            final Graph tripleCollection = tcManager.getGraph(uriRef);
-            resultGraph.add(new TripleImpl(uriRef,GRAPHMANAGEMENT.size,
-                    LiteralFactory.getInstance().createTypedLiteral(
-                    tripleCollection.size())));
-            if (tripleCollection instanceof ImmutableGraph) {
-                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
-            } else {
-                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
-            }
-        }
-        graphNode.addProperty(RDF.type, GRAPHMANAGEMENT.GraphManagementPage);
-        graphNode.addProperty(RDF.type, PLATFORM.HeadedPage);
-        return graphNode;
-    }
-
-    @Override
-    public Set<GlobalMenuItem> getMenuItems() {
-
-        Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
-        try {
-            AccessController.checkPermission(
-                    new GraphManagementAppPermission());
-        } catch (AccessControlException e) {
-            return items;
-        }
-        String path = "/admin/graphs";
-        items.add(new GlobalMenuItem(path, "GM", "Graphs", 5,"Administration"));
-        return items;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
deleted file mode 100644
index 09ec04d..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import java.security.Permission;
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-/**
- * Permission to use the ImmutableGraph-Management page. Nothe that the user
- * additioonally needs permssion on the Graphs they manipulate.
- *
- * @author reto
- */
-@PermissionInfo(value="ImmutableGraph Management Access Permission", description="Grants access " +
-    "to the ImmutableGraph Management page")
-public class GraphManagementAppPermission extends Permission {
-
-
-    public GraphManagementAppPermission() {
-        super("ImmutableGraph Management permission");
-    }
-    /**
-     * 
-     * @param target ignored
-     * @param action ignored
-     */
-    public GraphManagementAppPermission(String target, String actions) {
-        super("ImmutableGraph Management permission");
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        return equals(permission);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return getClass().equals(obj.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-        return 77985;
-    }
-
-    @Override
-    public String getActions() {
-        return "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
deleted file mode 100644
index 2d96602..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
+++ /dev/null
@@ -1,95 +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.web.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.UriInfo;
-import org.apache.clerezza.jaxrs.utils.RedirectUtil;
-import org.apache.clerezza.jaxrs.utils.form.FormFile;
-import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-
-/**
- * A service to restore the triple collections of a clerezza platform instance
- *
- * @author reto
- */
-@Component
-@Service({Object.class, PlatformRestorer.class})
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/admin/backup/restore")
-public class PlatformRestorer {
-
-    @Reference
-    private Restorer restorer;
-
-    @Reference
-    private TcManager tcManager;
-
-    /**
-     * Restores the triple collection of TcManager from a backup
-     *
-     * @param backupData the backup data
-     */
-    public void restore(InputStream backupData) throws IOException {
-        restorer.restore(backupData, tcManager);
-    }
-
-    @POST
-    public Response restore(MultiPartBody body, @Context final UriInfo uriInfo) 
-            throws Throwable {
-        AccessController.checkPermission(new RestorePermission());
-        FormFile[] files = body.getFormFileParameterValues("file");
-        if (files.length != 1) {
-            throw new RuntimeException("Must submit exactly one file");
-        }
-        final FormFile file = files[0];
-        try {
-            return AccessController.doPrivileged(new PrivilegedExceptionAction<Response>() {
-
-                @Override
-                public Response run() throws IOException {
-                    restore(new ByteArrayInputStream(file.getContent()));
-                    return RedirectUtil.createSeeOtherResponse("/admin/backup", uriInfo);
-                }
-            });
-        } catch (PrivilegedActionException ex) {
-            throw ex.getCause();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
deleted file mode 100644
index 6080df9..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-import java.security.Permission;
-
-/**
- * Permission to restore all graphs provided by TcManager from a backup copy.
- *
- * This a very powerfull permission as it allows to write to all graphs.
- *
- * @author reto
- */
-@PermissionInfo(value="Restore Permission", description="Permission " +
-    "to replace all triple collections with the contents of backup file")
-public class RestorePermission extends Permission {
-
-
-    public RestorePermission() {
-        super("Restore permission");
-    }
-    /**
-     *
-     * @param target ignored
-     * @param action ignored
-     */
-    public RestorePermission(String target, String actions) {
-        super("Restore permission");
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        return equals(permission);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return getClass().equals(obj.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-        return 77965;
-    }
-
-    @Override
-    public String getActions() {
-        return "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
deleted file mode 100644
index d0ceed7..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
+++ /dev/null
@@ -1,178 +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.web.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.commons.rdf.ImmutableGraph;
-import org.apache.commons.rdf.Literal;
-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.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.web.ontologies.BACKUP;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A service to restore the triple collection
- *
- * @author reto
- */
-@Component
-@Service(Restorer.class)
-public class Restorer {
-
-    private final static Logger log = LoggerFactory.getLogger(Restorer.class);
-
-    @Reference
-    Parser parser;
-
-    /**
-     * Restores triple-collections from a backup to a specified TcProvider
-     *
-     * @param backupData the bytes of a backup zip
-     * @param target the TcProvider into which to restore the data
-     */
-    public void restore(InputStream backupData, TcProvider target) throws IOException {
-        ZipInputStream compressedTcs = new ZipInputStream(backupData);
-
-        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
-        String folder = "";
-        ZipEntry entry;
-        ImmutableGraph metaGraph = null;
-        while ((entry = compressedTcs.getNextEntry()) != null) {
-            String entryName = entry.getName();
-            if (entry.isDirectory()) {
-                folder = entryName;
-            } else {
-                File tempFile = File.createTempFile("graph", "data");
-                OutputStream fos = new FileOutputStream(tempFile);
-                
-                int count;
-                byte buffer[] = new byte[2048];
-                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
-                    fos.write(buffer, 0, count);
-                }
-                fos.close();
-                InputStream serializedGraph = new FileInputStream(tempFile);
-                /*
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                int count;
-                byte buffer[] = new byte[2048];
-                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
-                    baos.write(buffer, 0, count);
-                }
-                baos.close();
-                ByteArrayInputStream serializedGraph = new ByteArrayInputStream(
-                        baos.toByteArray());
-                */
-                if (entryName.equals("triplecollections.nt")) {
-                    metaGraph = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                } else {
-                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                    extractedTc.put(entryName, deserializedGraph);
-                }
-                serializedGraph.close();
-            }
-        }
-        if (metaGraph == null) {
-            throw new RuntimeException("No metadata graph found in backup.");
-        }
-        compressedTcs.close();
-        {
-            final Iterator<Triple> mGraphIterator = metaGraph.filter(null, RDF.type, BACKUP.Graph);
-            while (mGraphIterator.hasNext()) {
-                GraphNode graphGN = new GraphNode(mGraphIterator.next().getSubject(), metaGraph);
-                String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
-                Graph extracted = extractedTc.get(fileName);
-                
-                Graph mGraph;
-                boolean created = false;
-                try {
-                    mGraph = target.getGraph((Iri)graphGN.getNode());
-                    try {
-                        mGraph.clear();
-                    } catch (UnsupportedOperationException ex) {
-                        log.warn("could not restore "+graphGN.getNode()+" as the exsting triple "
-                                + "collection could not be cleared");
-                        continue;
-                    }
-                } catch (NoSuchEntityException ex) {
-                    mGraph = target.createGraph((Iri)graphGN.getNode());
-                    created = true;
-                }
-                try {
-                    mGraph.addAll(extracted);
-                } catch (Exception ex) {
-                    String actionDone = created ? "created" : "cleared";
-                    log.error("after the mgraph "+graphGN.getNode()+" could successfully be "+actionDone
-                            + ", an exception occured adding the data", ex);
-                }
-            }
-        }
-        {
-            final Iterator<Triple> graphIterator = metaGraph.filter(null, RDF.type, BACKUP.Graph);
-            while (graphIterator.hasNext()) {
-                GraphNode graphGN = new GraphNode(graphIterator.next().getSubject(), metaGraph);
-                String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
-                Graph extracted = extractedTc.get(fileName);
-                try {
-                    target.deleteGraph((Iri)graphGN.getNode());
-                } catch (UnsupportedOperationException ex) {
-                    log.warn("could not restore "+graphGN.getNode()+" as the exsting triple "
-                            + "collection could not be deleted");
-                    continue;
-                } catch (NoSuchEntityException ex) {
-                    log.debug("could not remove "+graphGN.getNode()+", no such entity");
-                }
-                target.createImmutableGraph((Iri)graphGN.getNode(), extracted);
-            }
-        }
-        for (Map.Entry<String, Graph> pathTcPair : extractedTc.entrySet()) {
-            Literal fileNameLit = LiteralFactory.getInstance().createTypedLiteral(
-                        pathTcPair.getKey());
-            Iterator<Triple> graphResIterator = metaGraph.filter(null, BACKUP.file, fileNameLit);
-        }
-    }
-}


[7/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
deleted file mode 100644
index f3678a7..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
+++ /dev/null
@@ -1,208 +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.web.core;
-
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.ext.Providers;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.commons.rdf.BlankNode;
-import org.apache.commons.rdf.Language;
-import org.apache.commons.rdf.RdfTerm;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.commons.rdf.Literal;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * MessageBodyWirter for <code>ResultSet</code>.
- * 
- * @author mir, reto
- */
-@Component
-@Service(Object.class)
-@Property(name="javax.ws.rs", boolValue=true)
-@Produces({"application/xml", "text/xml", "application/sparql-results+xml"})
-@Provider
-public class ResultSetMessageBodyWriter implements MessageBodyWriter<ResultSet> {
-
-    @Reference
-    TcManager tcManager;
-
-
-    private Providers providers;
-
-    final Logger logger = LoggerFactory.getLogger(ResultSetMessageBodyWriter.class);
-
-    @Override
-    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
-            MediaType mediaType) {
-        return ResultSet.class.isAssignableFrom(type);
-    }
-
-    @Override
-    public long getSize(ResultSet t, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
-        return -1;
-    }
-
-    @Override
-    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
-            Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
-
-        Source source = toXmlSource(resultSet);
-        MessageBodyWriter<Source> sourceMessageBodyWriter = 
-                providers.getMessageBodyWriter(Source.class, null, null, mediaType);
-        sourceMessageBodyWriter.writeTo(source, Source.class, null, null, mediaType,
-                httpHeaders, entityStream);
-    }
-
-    @Context
-    public void setProviders(Providers providers) {
-        this.providers = providers;
-    }
-
-    /**
-     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
-     * {@link DOMSource}
-     *
-     * @param queryResult
-     * @param query
-     * @param applyStyle
-     */
-    private Source toXmlSource(ResultSet queryResult) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        try {
-            Document doc = dbf.newDocumentBuilder().newDocument();
-            // adding root element
-            Element root = doc.createElement("sparql");
-            root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
-            doc.appendChild(root);
-            Element head = doc.createElement("head");
-            root.appendChild(head);
-            Set<Object> variables = new HashSet<Object>();
-            Element results = doc.createElement("results");
-            SolutionMapping solutionMapping = null;
-            while (queryResult.hasNext()) {
-                solutionMapping = queryResult.next();                
-                createResultElement(solutionMapping, results, doc);                
-            }
-            createVariable(solutionMapping, head, doc);
-            root.appendChild(results);
-
-            DOMSource source = new DOMSource(doc);
-            return source;
-
-        } catch (ParserConfigurationException e) {
-            throw createWebApplicationException(e);
-        }
-    }
-
-    /**
-     * Creates a WebApplicationexception and prints a logger entry
-     */
-    private WebApplicationException createWebApplicationException(Exception e) {
-        return new WebApplicationException(Response.status(Status.BAD_REQUEST)
-                .entity(e.getMessage().replace("<", "&lt;").replace("\n",
-                        "<br/>")).build());
-    }
-
-
-    /**
-     * Helper: creates value element from {@link RdfTerm} depending on its
-     * class
-     *
-     */
-    private Element createValueElement(RdfTerm resource, Document doc) {
-        Element value = null;
-        if (resource instanceof Iri) {
-            value = doc.createElement("uri");
-            value.appendChild(doc.createTextNode(((Iri) resource)
-                    .getUnicodeString()));
-        } else if (resource instanceof Literal) {
-            value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((Literal) resource)
-                    .getLexicalForm()));
-            value.setAttribute("datatype", (((Literal) resource)
-                    .getDataType().getUnicodeString()));
-            Language lang = ((Literal) resource).getLanguage();
-            if (lang != null) {
-                value.setAttribute("xml:lang", (lang.toString()));
-            }
-        } else {
-            value = doc.createElement("bnode");
-            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
-        }
-        return value;
-    }
-
-    /**
-     * Helper: creates results element from ResultSet
-     *
-     */
-    private void createResultElement(SolutionMapping solutionMap, Element results, Document doc) {
-        Set<Variable> keys = solutionMap.keySet();
-        Element result = doc.createElement("result");
-        results.appendChild(result);
-        for (Variable key : keys) {
-            Element bindingElement = doc.createElement("binding");
-            bindingElement.setAttribute("name", key.getName());
-            bindingElement.appendChild(createValueElement(
-                    (RdfTerm) solutionMap.get(key), doc));
-            result.appendChild(bindingElement);
-        }
-    }
-
-    private void createVariable(SolutionMapping solutionMap, Element head, Document doc) {
-        Set<Variable> keys = solutionMap.keySet();
-        for (Variable key : keys) {
-            Element varElement = doc.createElement("variable");
-            varElement.setAttribute("name", key.getName());
-            head.appendChild(varElement);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
deleted file mode 100644
index fa29fde..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.web.core;
-
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import org.apache.clerezza.jaxrs.utils.RedirectUtil;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.commons.rdf.Graph;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.FOAF;
-import org.apache.clerezza.rdf.ontologies.OWL;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.Smusher;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
- * 
- * @author reto
- */
-@Component
-@Service(Object.class)
-@Property(name="javax.ws.rs", boolValue=true)
-@Path("/admin/graphs/smush")
-public class Smush {
-    private final Iri tBoxName = new Iri("urn:x-localinstance:/tbox.graph");
-
-    @Reference
-    private TcManager tcManager;
-
-    @Reference
-    private RenderletManager renderletManager;
-
-    private Graph tBox;
-
-    protected void activate(ComponentContext componentContext) {
-        try {
-            //getting the tBox here means no read right on Tbox is necessary
-            //when smushing
-            tBox = tcManager.getGraph(tBoxName);
-        } catch (NoSuchEntityException e) {
-            tBox = new SimpleGraph();
-            tBox.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
-            tBox.add(new TripleImpl(FOAF.mbox_sha1sum, RDF.type, OWL.InverseFunctionalProperty));
-            tBox.add(new TripleImpl(PLATFORM.userName, RDF.type, OWL.InverseFunctionalProperty));
-            tBox = tcManager.createImmutableGraph(tBoxName, tBox);
-        }
-    }
-
-
-    
-    @POST
-    public Response smush(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
-        Graph mGraph = tcManager.getGraph(graphName);
-        Smusher.smush(mGraph, tBox);
-        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
deleted file mode 100644
index 69f318f..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
+++ /dev/null
@@ -1,411 +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.web.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.jaxrs.utils.TrailingSlash;
-import org.apache.clerezza.platform.Constants;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.commons.rdf.BlankNode;
-import org.apache.commons.rdf.ImmutableGraph;
-import org.apache.commons.rdf.Language;
-import org.apache.commons.rdf.Graph;
-import org.apache.commons.rdf.RdfTerm;
-import org.apache.commons.rdf.Graph;
-import org.apache.commons.rdf.Iri;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.sparql.ParseException;
-import org.apache.clerezza.rdf.core.sparql.QueryParser;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.core.sparql.query.Variable;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.web.ontologies.SPARQLENDPOINT;
-import org.apache.commons.rdf.Literal;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.ProcessingInstruction;
-
-/**
- * Provides methods to query a graph over the web.
- * 
- * @author ali, hasan
- * 
- */
-@Component
-@Service(Object.class)
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/sparql")
-public class SparqlEndpoint {
-
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-    
-    
-    @Reference
-    TcManager tcManager;
-
-    @Reference
-    private RenderletManager renderletManager;
-
-    /**
-     * The activate method is called when SCR activates the component configuration.
-     * @param componentContext
-     */
-    protected void activate(ComponentContext componentContext) {
-        URL templateURL = getClass().getResource("sparql-endpoint.ssp");
-        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
-                new Iri(templateURL.toString()), SPARQLENDPOINT.SparqlEndpoint,
-                null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
-    }
-
-    @GET
-    @Path("form")
-    public GraphNode getAvailableGraphUris(@Context UriInfo uriInfo) {
-        AccessController.checkPermission(new SparqlEndpointAccessPermission());
-        TrailingSlash.enforceNotPresent(uriInfo);
-        GraphNode graphNode = new GraphNode(new BlankNode(), new SimpleGraph());
-        Set<Iri> tripleCollections = tcManager.listGraphs();
-        for (Iri uriRef : tripleCollections) {
-            graphNode.addProperty(SPARQLENDPOINT.tripleCollection, uriRef);
-        }
-        graphNode.addProperty(RDF.type, SPARQLENDPOINT.SparqlEndpoint);
-        return graphNode;
-    }
-
-    /**
-     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
-     * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
-     * successfully carried out. A {@link DOMSource} is returned if an ASK or a
-     * SELECT sparql query was submitted and successfully carried out. The query
-     * is performed against a specified graph with the URI
-     * <code>defaultGrapfUri</code>
-     * 
-     * @param queryString
-     *            URL encoded sparql query
-     * @param defaultGraphUri
-     *            URI of the default graph, an {@link Iri} is expected
-     * @param applyStyleSheet
-     * @param serverSide
-     * @param styleSheetUri 
-     * @return either a {@link ImmutableGraph} or a {@link DOMSource}
-     */
-    @POST
-    public Object runFormQuery(@FormParam("query") String queryString,
-            @FormParam("default-graph-uri") Iri defaultGraphUri,
-            @FormParam("apply-style-sheet") String applyStyleSheet,
-            @FormParam("server-side") String serverSide,
-            @FormParam("style-sheet-uri") String styleSheetUri) {
-        AccessController.checkPermission(new SparqlEndpointAccessPermission());
-        logger.info("Executing SPARQL Query: " + queryString);
-        boolean applyStyle;
-        if (applyStyleSheet != null && applyStyleSheet.equals("on")) {
-            applyStyle = true;
-        } else {
-            applyStyle = false;
-        }
-        boolean applyServerSide;
-        if (serverSide != null && serverSide.equals("on")){
-            applyServerSide = true;
-        } else {
-            applyServerSide = false;
-        }
-        //Graph defaultGraph = null;
-        Object result = null;
-        try {
-            if (defaultGraphUri == null
-                    || defaultGraphUri.getUnicodeString().equals("")) {
-                defaultGraphUri = new Iri(Constants.CONTENT_GRAPH_URI_STRING);
-                //defaultGraph = contentGraph;
-            } else {
-                //defaultGraph = tcManager.getTriples(defaultGraphUri);
-            }
-            //this is now only used to get the variable names
-            //TODO use ResultSet.getResultVars instead
-            Query query = QueryParser.getInstance().parse(queryString);
-            result = tcManager.executeSparqlQuery(queryString, defaultGraphUri);
-            if (result instanceof ImmutableGraph) {
-                return (ImmutableGraph) result;
-            } else if ((result instanceof ResultSet)
-                    || (result instanceof Boolean)) {
-                Source source = toXmlSource(result, query, applyStyle,
-                        applyServerSide, styleSheetUri);
-                if (applyStyle && applyServerSide) {
-                    Response.ResponseBuilder rb = Response.ok(source).type(
-                            MediaType.APPLICATION_XHTML_XML_TYPE);
-                    return rb.build();
-                }
-                return source;
-            } else {
-                throw new WebApplicationException(
-                        Response.status(Status.BAD_REQUEST).entity("Only " +
-                        "queries yielding to a ImmutableGraph, a ResultSet or " +
-                        "Boolean are supported").build());
-            }
-        } catch (ParseException e) {
-            throw createWebApplicationException(e);
-        } catch (NoSuchEntityException e) {
-            throw createWebApplicationException(e);
-        }
-    }
-
-    /**
-     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
-     * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
-     * successfully carried out. A {@link DOMSource} is returned if an ASK or a
-     * SELECT sparql query was submitted and successfully carried out. The query
-     * is performed against a specified graph with the URI
-     * <code>defaultGrapfUri</code>
-     * 
-     * @param queryString
-     * @param defaultGraphUri
-     * @param styleSheetUri
-     * @param serverSide
-     * @return
-     */
-    @GET
-    public Object runGetQuery(@QueryParam("query") String queryString,
-            @QueryParam("default-graph-uri") Iri defaultGraphUri,
-            @QueryParam("style-sheet-uri") String styleSheetUri,
-            @QueryParam("server-side") String serverSide) {
-        AccessController.checkPermission(new SparqlEndpointAccessPermission());
-        String applyStyleSheet = null;
-        if(styleSheetUri != null){
-            applyStyleSheet = "on";
-        }
-        if(serverSide != null && serverSide.equals("true")){
-            serverSide = "on";
-        }
-        return runFormQuery(queryString, defaultGraphUri, applyStyleSheet,
-                serverSide,    styleSheetUri);
-    }
-
-    /**
-     * Helper: returns the variables of a sparql {@link SelectQuery}
-     * 
-     * @param queryString
-     * @return
-     */
-    private List<Variable> getVariables(Query query) {
-        if (query instanceof SelectQuery) {
-            return ((SelectQuery) query).getSelection();
-        } else {
-            return new ArrayList<Variable>();
-        }
-    }
-
-    /**
-     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
-     * {@link DOMSource}
-     * 
-     * @param queryResult
-     * @param query
-     * @param applyStyle 
-     */
-    private Source toXmlSource(Object queryResult, Query query,
-            boolean applyStyle, boolean applyServerSide, String styleSheetUri) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        try {
-            Document doc = dbf.newDocumentBuilder().newDocument();
-            // adding root element
-            Element root = doc.createElement("sparql");
-            root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
-            doc.appendChild(root);
-            Element head = doc.createElement("head");
-            root.appendChild(head);
-            if (queryResult instanceof Boolean) {
-                Element booleanElement = doc.createElement("boolean");
-                booleanElement.appendChild(doc.createTextNode(queryResult
-                        .toString()));
-                root.appendChild(booleanElement);
-            } else {
-                List<Variable> variables = getVariables(query);
-                for (Variable var : variables) {
-                    Element varElement = doc.createElement("variable");
-                    varElement.setAttribute("name", var.getName());
-                    head.appendChild(varElement);
-                }
-                root.appendChild(createResultsElement((ResultSet) queryResult,
-                        doc));
-            }
-            DOMSource source = new DOMSource(doc);
-            if (applyStyle) {
-                ProcessingInstruction instruction = doc
-                        .createProcessingInstruction("xml-stylesheet",
-                                "type=\"text/xsl\" href=\"" + styleSheetUri + "\"");
-                doc.insertBefore(instruction, root);
-                if (applyServerSide) {
-                    return applyStyleServerSide(source, styleSheetUri);
-                }
-            }
-            return source;
-
-        } catch (ParserConfigurationException e) {
-            throw createWebApplicationException(e);
-        }
-    }
-
-    /**
-     * Applies a style sheet to a XML on server side
-     * @param source
-     *            XML result
-     * @param styleSheetUri
-     *            URI of the style sheet
-     * @return
-     * @throws TransformerException
-     * @throws IOException
-     */
-    private Source applyStyleServerSide(final DOMSource source,
-            final String styleSheetUri) {
-        return AccessController.doPrivileged(new PrivilegedAction<DOMSource>() {
-            @Override
-            public DOMSource run() {
-                try {
-                    StreamResult streamResult = new StreamResult(
-                            new ByteArrayOutputStream());
-                    final TransformerFactory tf = TransformerFactory
-                            .newInstance();
-                    Transformer transformer = tf.newTransformer();
-                    transformer.transform(source, streamResult);
-                    final URL stylesheet = new URL(styleSheetUri);
-                    Source streamSource = new StreamSource(
-                            new ByteArrayInputStream(
-                            ((ByteArrayOutputStream) streamResult
-                                    .getOutputStream()).toByteArray()));
-                    DOMResult domResult = new DOMResult();
-                    StreamSource xslFileSource = new StreamSource(stylesheet
-                            .openStream());
-                    Transformer xslTransformer = tf.newTransformer(xslFileSource);
-                    xslTransformer.transform(streamSource, domResult);
-                    return new DOMSource(domResult.getNode());
-                } catch (TransformerConfigurationException ex) {
-                    throw createWebApplicationException(ex);
-                } catch (TransformerException ex) {
-                    throw createWebApplicationException(ex);
-                } catch (IOException ex) {
-                    throw createWebApplicationException(ex);
-                }
-            }
-        });
-    }
-
-    /**
-     * Creates a WebApplicationexception and prints a logger entry
-     */
-    private WebApplicationException createWebApplicationException(Exception e) {
-        logger.info(e.getClass().getSimpleName() + ": {}", e.getMessage());
-        return new WebApplicationException(Response.status(Status.BAD_REQUEST)
-                .entity(e.getMessage().replace("<", "&lt;").replace("\n",
-                        "<br/>")).build());
-    }
-
-    /**
-     * Helper: creates results element from ResultSet
-     * 
-     */
-    private Element createResultsElement(ResultSet resultSet, Document doc) {
-        Element results = doc.createElement("results");
-        while (resultSet.hasNext()) {
-            SolutionMapping solutionMap = resultSet.next();
-            Set<Variable> keys = solutionMap.keySet();
-            Element result = doc.createElement("result");
-            results.appendChild(result);
-
-            for (Variable key : keys) {
-                Element bindingElement = doc.createElement("binding");
-                bindingElement.setAttribute("name", key.getName());
-                bindingElement.appendChild(createValueElement(
-                        (RdfTerm) solutionMap.get(key), doc));
-                result.appendChild(bindingElement);
-            }
-        }
-        return results;
-    }
-
-    /**
-     * Helper: creates value element from {@link RdfTerm} depending on its
-     * class
-     * 
-     */
-    private Element createValueElement(RdfTerm resource, Document doc) {
-        Element value = null;
-        if (resource instanceof Iri) {
-            value = doc.createElement("uri");
-            value.appendChild(doc.createTextNode(((Iri) resource)
-                    .getUnicodeString()));
-        } else if (resource instanceof Literal) {
-            value = doc.createElement("literal");
-            value.appendChild(doc.createTextNode(((Literal) resource)
-                    .getLexicalForm()));
-            value.setAttribute("datatype", (((Literal) resource)
-                    .getDataType().getUnicodeString()));
-            Language lang = ((Literal) resource).getLanguage();
-            if (lang != null) {
-                value.setAttribute("xml:lang", (lang.toString()));
-            }
-        } else {
-            value = doc.createElement("bnode");
-            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
-        }
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
deleted file mode 100644
index 4dd93a3..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.rdf.web.core;
-
-import java.security.Permission;
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-/**
- * Permission to use the Sparql Endpoint GUI. Note that the user
- * additionally needs permission to read a graph.
- *
- * @author tio
- */
-@PermissionInfo(value="Sparql Endpoint Access Permission", description="Grants access " +
-    "to the Sparql Endpoint")
-public class SparqlEndpointAccessPermission extends Permission{
-
-    public SparqlEndpointAccessPermission() {
-        super("Sparql Endpoint Access permission");
-    }
-    /**
-     *
-     * @param target ignored
-     * @param action ignored
-     */
-    public SparqlEndpointAccessPermission(String target, String actions) {
-        super("Sparql Endpoint Access permission");
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        return equals(permission);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return getClass().equals(obj.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-        return 577987;
-    }
-
-    @Override
-    public String getActions() {
-        return "";
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
deleted file mode 100644
index 6a71c01..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
+++ /dev/null
@@ -1,252 +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.web.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.security.AccessController;
-import java.util.concurrent.locks.Lock;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.jaxrs.utils.RedirectUtil;
-import org.apache.clerezza.jaxrs.utils.form.FormFile;
-import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
-import org.apache.commons.rdf.ImmutableGraph;
-import org.apache.commons.rdf.Graph;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-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.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.web.fileserver.util.MediaTypeGuesser;
-
-/**
- * Provides methods to GET, PUT, and POST an SCB graph over the web.
- * To be deployed in a JAX-RS runtime.
- * 
- * @author hasan
- */
-@Component
-@Service(Object.class)
-@Property(name="javax.ws.rs", boolValue=true)
-@Path("/graph")
-public class WebAccess {
-
-    @Reference
-    TcManager tcManager;
-
-    @Reference
-    private Parser parser;
-
-    final Logger logger = LoggerFactory.getLogger(WebAccess.class);
-
-    /**
-     * Gets the Graph with specified name
-     *
-     * @param name
-     * @return
-     */
-    @GET
-    public Graph getTriples(@QueryParam("name") Iri name) {
-        AccessController.checkPermission(new WebAccessPermission());
-        if (name == null) {
-            Response r = Response.status(Response.Status.BAD_REQUEST)
-                    .entity("must specify a graph name")
-                    .type(MediaType.TEXT_PLAIN_TYPE).build();
-            throw new WebApplicationException(r);
-        }
-        Graph result = tcManager.getGraph(name);
-        logger.debug("Got graph of size {} ", result.size());
-        int i = 1;
-        if (logger.isDebugEnabled()) {
-            for (Triple triple : result) {
-                logger.debug("({}) with triples {}", i++, triple.toString());
-            }
-            logger.debug("returning");
-        }
-        return result;
-    }
-
-    /**
-     * Puts the triples replacing the triples of the existing Graph with the
-     * specified name. If the graph doesn't exist creates a new <code>Graph</code> 
-     * with the specified name and puts the triples
-     * 
-     *
-     * @param name
-     * @param triples
-     */
-    @PUT
-    public void putTriples(@QueryParam("name") Iri name, Graph triples) {
-        AccessController.checkPermission(new WebAccessPermission());
-        Graph mGraph;
-        try {
-            mGraph = tcManager.getGraph(name);
-        } catch (NoSuchEntityException e) {
-            mGraph = tcManager.createGraph(name);
-        }
-        Lock writeLock = mGraph.getLock().writeLock();
-        writeLock.lock();
-        try {
-            mGraph.clear();
-            mGraph.addAll(triples);
-        } finally {
-            writeLock.unlock();
-        }
-    }
-
-    /**
-     * Posts triples to be placed into an {@link Graph} of the specified name.
-     * If an {@link Graph} with this name doesn't already exist, a new one
-     * is created and filled with the triples posted.
-     * @param form
-     *        a multipart/form-data consisting of:
-     *        - a {@link FormFile} labeled "graph" containing the triples and
-     *            the mime-type.
-     *        - a text field labeled "name" specifying the name of the Graph.
-     *        - an optional text field labeled "mode" specifying the mode.
-     *            If the mode is "replace", existing triples of the Graph will be
-     *            deleted before new triples are added. If the mode is not
-     *            specified or is "append", posted triples are added to the Graph.
-     *        - an optional text field labeled "redirection" specifying an URI
-     *            which the client should be redirected to in case of success.
-     * @return
-     *        {@link Response}. A response with status code BAD REQUEST (400) is
-     *        returned if the required data are missing. If the request can be
-     *        satisfied, one of the following responses is returned:
-     *        - SEE OTHER (303), if redirection is specified.
-     *        - CREATED (201), if redirection is not specified and a new
-     *            {@link Graph} is created.
-     *        - NO CONTENT (204), if redirection is not specified and no new
-     *            {@link Graph} is created.
-     */
-    @POST
-    @Consumes("multipart/form-data")
-    public Response postTriples(MultiPartBody form, @Context UriInfo uriInfo) {
-
-        AccessController.checkPermission(new WebAccessPermission());
-        FormFile[] formFiles = form.getFormFileParameterValues("graph");
-        if (formFiles.length == 0) {
-            responseWithBadRequest("form file parameter 'graph' is missing");
-        }
-        FormFile formFile = formFiles[0];
-        byte[] graph = formFile.getContent();
-        if (graph == null || (graph.length == 0)) {
-            responseWithBadRequest("no triples uploaded");
-        }
-        MediaType mediaType = formFile.getMediaType();
-        if (mediaType == null) {
-            responseWithBadRequest("mime-type not specified");
-        }
-        if (mediaType.equals(MediaType.APPLICATION_OCTET_STREAM_TYPE)) {
-            MediaType guessedType = MediaTypeGuesser.getInstance().guessTypeForName(formFile.getFileName());
-            if (guessedType != null) {
-                mediaType = guessedType;
-            }
-        }
-        String graphName = getFirstTextParameterValue(form, "name", true);
-        if (graphName == null) {
-            responseWithBadRequest("graph name not specified");
-        }
-        String mode = getFirstTextParameterValue(form, "mode", false);
-        if (mode != null) {
-            if (!(mode.equals("replace") || mode.equals("append"))) {
-                responseWithBadRequest("unknown mode");
-            }
-        } else {
-            mode = "append";
-        }
-        InputStream is = new ByteArrayInputStream(graph);
-        ImmutableGraph parsedGraph = parser.parse(is, mediaType.toString());
-        Iri graphUri = new Iri(graphName);
-        Graph mGraph;
-        boolean newGraph = false;
-        try {
-            mGraph = tcManager.getGraph(graphUri);
-        } catch (NoSuchEntityException e) {
-            mGraph = tcManager.createGraph(graphUri);
-            newGraph = true;
-        }
-        Lock writeLock = mGraph.getLock().writeLock();
-        writeLock.lock();
-        try {
-            if (!newGraph && mode.equals("replace")) {
-                mGraph.clear();
-            }
-            mGraph.addAll(parsedGraph);
-        } finally {
-            writeLock.unlock();
-        }
-        String redirection = getFirstTextParameterValue(form, "redirection", false);
-        if (redirection == null) {
-            if (newGraph) {
-                return Response.status(Status.CREATED).build();
-            } else {
-                return Response.status(Status.NO_CONTENT).build();
-            }
-        }
-        return RedirectUtil.createSeeOtherResponse(redirection, uriInfo);
-    }
-
-    @GET
-    @Path("upload-form")
-    @Produces("application/xhtml+xml")
-    public InputStream getUploadForm() {
-        AccessController.checkPermission(new WebAccessPermission());
-        return getClass().getResourceAsStream("upload-form.xhtml");
-    }
-
-    private void responseWithBadRequest(String message) {
-        logger.warn(message);
-        throw new WebApplicationException(Response.status(Status.BAD_REQUEST)
-                .entity(message).build());
-    }
-
-    private String getFirstTextParameterValue(MultiPartBody form,
-            String parameterName, boolean mandatory) {
-        String[] paramValues = form.getTextParameterValues(parameterName);
-        if (paramValues.length == 0) {
-            if (mandatory) {
-                responseWithBadRequest("text parameter '" + parameterName +
-                        "' is missing");
-            }
-            return null;
-        }
-        return paramValues[0];
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
deleted file mode 100644
index 8964eda..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.rdf.web.core;
-
-import java.security.Permission;
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-/**
- * Permission to use the ImmutableGraph via Web. Note that the user
- * additionally needs permission to read a graph.
- *
- * @author mir
- */
-@PermissionInfo(value="ImmutableGraph via Web Access Permission", description="Grants access " +
-    "to the ImmutableGraph via Web")
-public class WebAccessPermission extends Permission{
-
-    public WebAccessPermission() {
-        super("ImmutableGraph via Web access permission");
-    }
-    /**
-     *
-     * @param target ignored
-     * @param action ignored
-     */
-    public WebAccessPermission(String target, String actions) {
-        super("ImmutableGraph via Web access permission");
-    }
-
-    @Override
-    public boolean implies(Permission permission) {
-        return equals(permission);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return getClass().equals(obj.getClass());
-    }
-
-    @Override
-    public int hashCode() {
-        return 477987;
-    }
-
-    @Override
-    public String getActions() {
-        return "";
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
deleted file mode 100644
index 3187d42..0000000
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Copyright 2010 mir.
- * 
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- * 
- *       http://www.apache.org/licenses/LICENSE-2.0
- * 
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *  under the License.
- */
-package org.apache.clerezza.rdf.web.core.utils;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
-
-/**
- * Wrapps a set of <code>ResultSet</code>s so it acts like a single ResultSet.
- *
- * @author mir
- */
-public class ResultSetsWrapper implements ResultSet {
-
-    private Iterator<ResultSet> resultSetsIter;
-    private ResultSet currentResultSet;
-    private List<String> varNames;
-
-    public ResultSetsWrapper(Set<ResultSet> resultSets) {
-        this.resultSetsIter = resultSets.iterator();
-        this.currentResultSet = resultSetsIter.next();
-
-        Set<String> uniqueVarNames = new HashSet<String>();
-        for (ResultSet resultSet : resultSets) {
-			uniqueVarNames.addAll(resultSet.getResultVars());
-		}
-    	this.varNames = new ArrayList<String>(uniqueVarNames);
-    }
-
-    @Override
-    public boolean hasNext() {
-        if (currentResultSet.hasNext()) {
-            return true;
-        } else {
-            if (resultSetsIter.hasNext()) {
-                currentResultSet = resultSetsIter.next();
-                return hasNext();
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public SolutionMapping next() {
-        hasNext();
-        return currentResultSet.next();
-    }
-
-    @Override
-    public void remove() {
-        currentResultSet.remove();
-    }
-    
-    @Override
-    public List<String> getResultVars() {
-    	return varNames;
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/resources/META-INF/documentation.nt
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/resources/META-INF/documentation.nt b/rdf.web/rdf.web.core/src/main/resources/META-INF/documentation.nt
deleted file mode 100644
index daf3e2e..0000000
--- a/rdf.web/rdf.web.core/src/main/resources/META-INF/documentation.nt
+++ /dev/null
@@ -1,52 +0,0 @@
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://discobits.org/ontology#pos> "1" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://discobits.org/ontology#holds> <bundle:///scb-web-content> .
-<bundle:///scb-web-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-title> <http://discobits.org/ontology#infoBit> "SCB Web"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 .
-<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 .
-<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 .
-<bundle:///scb-web-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://discobits.org/ontology#pos> "2" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2> .
-<bundle:///scb-web-content-el/0-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-content-el/0-title> <http://discobits.org/ontology#infoBit> "Upload Triples with a POST Request"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-<bundle:///scb-web-content-el/2> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 .
-<bundle:///scb-web-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///scb-web-content-el/2> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 .
-<bundle:///scb-web-content-el/1> <http://discobits.org/ontology#infoBit> "The bundle SCB Web allows access to SCB graphs over HTTP with JAX-RS."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///scb-web-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///scb-web-content-el/0> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 .
-<bundle:///scb-web-content-el/0> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2-content> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://discobits.org/ontology#pos> "1" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-<bundle:///scb-web-content-el/0-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-content-el/0-content> <http://discobits.org/ontology#infoBit> "To upload triples with a POST request, a client can use the URI path \"/graph\" and place the triples and other required information into the body as multipart/form-data which consists of\n<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n<li>a file labeled \"graph\" containing the triples and specifying the mime-type.</li>\n<li>a text field labeled \"name\" specifying the name of the MGraph. If an MGraph with this name does not already exist, a new one will be created.</li>\n<li>an optional text field labeled \"mode\" specifying the mode. If the mode is \"replace\", existing triples of the MGraph will be deleted before new triples are added. If the mode is not specified or is \"append\", posted triples will be added to the MGraph.</li>\n<li>an optional text field labeled \"redirection\" specifying an URI which the client should be redirected to in case of success.</li>\n</ul>\nA response with the status co
 de BAD REQUEST (400) is returned if the required data are missing. If the request can be satisfied, one of the following responses is returned:\n<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n<li>SEE OTHER (303), if redirection is specified.</li>\n<li>CREATED (201), if redirection is not specified and a new MGraph is created.</li>\n<li>NO CONTENT (204), if redirection is not specified and no new MGraph is created.</li>\n</ul>\n<p xmlns=\"http://www.w3.org/1999/xhtml\">\nFor your convenience you may access a web-form at the Uri-Path <code>/graph/upload-form</code>.</p>\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///scb-web-content-el/2-title> <http://discobits.org/ontology#infoBit> "Backup of Triple Collections"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///scb-web-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///scb-web-content-el/2-content> <http://discobits.org/ontology#infoBit> "The platform allows the current user to download all triple collections that he has access to through the URI path \"/admin/backup/download\". The resulted file is a compressed archive in zip format. All triple collections in this file are serialized in N-Triples format. Furthermore, a file called \"triplecollections.nt\" is contained in backup.zip, which describes the mapping of file names to triple collection names.\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://discobits.org/ontology#pos> "1" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://discobits.org/ontology#pos> "0" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2-title> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0-title> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://discobits.org/ontology#pos> "0" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://discobits.org/ontology#pos> "1" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0-content> .
-<bundle:///scb-web> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 .
-<bundle:///scb-web> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 .
-<bundle:///scb-web> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://discobits.org/ontology#pos> "0" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/1> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://discobits.org/ontology#pos> "0" .
-_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://discobits.org/ontology#holds> <bundle:///scb-web-title> .

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp b/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
deleted file mode 100644
index 0c43b13..0000000
--- a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
+++ /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.
- *
-*/
-
-resultDocModifier.setTitle("Backup and restore");
-
-<div class="tx-content">
-	<p>
-		<form method="get" action="/admin/backup/download">
-    Retrieve a backup of all graphs. WARNING: while creating the backup parts of clerezza migh be irresponsive.
-			<input type="submit" value="Retrieve Backup" />
-		</form>
-	</p>
-	<p>
-		<form method="post" action="/admin/backup/restore" enctype="multipart/form-data">
-			<input type="file" name="file" />
-			<input type="submit" value="Restore from backup" />
-		</form>
-	</p>
-</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp b/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
deleted file mode 100644
index 0b71676..0000000
--- a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
+++ /dev/null
@@ -1,62 +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.
- *
-*/
-
-def gm(s: Any) = new UriRef("http://clerezza.org/2010/03/graph-management#"+s)
-def rdf(s: Any) = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#"+s)
-def tcp(s: Any) = new UriRef("http://clerezza.org/2009/06/tcprovider#"+s)
-
-resultDocModifier.setTitle("Manage Triple Collections");
-resultDocModifier.addNodes2Elem("tx-module", <h1>Manage Triple Collections</h1>);
-
-import org.apache.clerezza.rdf.scala.utils.RichGraphNode
-
-<div id="tx-content">
-<table>
-	<tr><th>Name</th><th>Size</th><th>type</th><th colspan="3">Actions</th></tr>
-				{for (tc <- (res/gm("tripleCollection")).sortBy(tc => tc*)) yield
-					<tr>
-						<td>{tc*}</td>
-						<td>{tc/gm("size")*}</td>
-						<td>{if ((tc/rdf("type")).indexOf(new RichGraphNode(
-						new GraphNode(tcp("MGraph"), res.getGraph))) != -1) {
-						<span>MGraph</span> } else {
-						<span>Graph</span>
-						}
-						}
-						</td>
-						<td>{ifx ((tc/rdf("type")).indexOf(new RichGraphNode(
-						new GraphNode(tcp("MGraph"), res.getGraph))) != -1) {<form action="smush" method="post"><div>
-							<input type="hidden" name="graphName" value={tc*} />
-						<input type="submit" value="smush" /></div></form>}
-						}</td>
-                                                <td><form action="delete" method="post" onsubmit="return confirm('Are you sure you want to delete this graph?');"><div>
-							<input type="hidden" name="graphName" value={tc*} />
-						<input type="submit" value="delete" /></div></form>
-						</td>
-						<td><form action="/graph" method="get"><div>
-							<input type="hidden" name="name" value={tc*} />
-						<input type="submit" value="get" /></div></form>
-						</td>
-					</tr>
-				}
-</table>
-<p><a href="/graph/upload-form">UploadGraph</a></p>
-</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp b/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
deleted file mode 100644
index 1e6e233..0000000
--- a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-def se(s: Any) = new UriRef("http://clerezza.org/2009/11/sparql-endpoint#"+s)
-<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
-	<head>
-		<title>SPARQL Endpoint</title>
-		<script type="text/javascript">
-			function toggle(checkbox){{
-				var uri = document.getElementById('stylesheeturi');
-				var urilable = document.getElementById('urilable');
-				var server = document.getElementById('server');
-				var serverlabel = document.getElementById('serverlabel');
-				if (checkbox.checked){{
-					uri.style.visibility = 'visible';
-					urilable.style.visibility = 'visible';
-					server.style.visibility = 'visible';
-					serverlabel.style.visibility = 'visible';
-				}} else {{
-					uri.style.visibility = 'hidden';
-					urilable.style.visibility = 'hidden';
-					server.style.visibility = 'hidden';
-					serverlabel.style.visibility = 'hidden';
-				}}
-			}}
-		</script>
-	</head>
-	<body>
-		<h1>SPARQL Endpoint</h1>
-		<hr />
-		<h4>SPARQL Query</h4>
-		<form method="post" action="../sparql">
-			<lable for="query">Type in your query:</lable>
-			<br />
-			<textarea cols="70" rows="10" name="query" >
-PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX disco: &lt;http://discobits.org/ontology#>
-SELECT ?c where {{?c rdf:type disco:TitledContent}}
-			</textarea>
-			<br />
-			<br />
-			<label for="default-graph-uri">Select a graph URI:</label>
-			<select	name="default-graph-uri">
-				{for (tc <- (res/se("tripleCollection"))) yield
-					<option>{tc*}</option>
-				}
-			</select>
-			<br />
-			<lable for="apply-style-sheet">Add XSLT style sheet on the result: </lable>
-			<input type="checkbox" name="apply-style-sheet" id="checkbox" onclick="toggle(this)" />
-			<br />
-			<label for="style-sheet-uri" id="urilable" style="visibility:hidden">URI of XSLT style sheet</label>
-			<input type="text" name="style-sheet-uri" id="stylesheeturi" style="width:350px;visibility:hidden" value="http://www.w3.org/TR/rdf-sparql-XMLres/result-to-html.xsl" />
-			<label id="serverlabel" style="visibility:hidden">Add stylesheet on server side</label>
-			<input type="checkbox" name="server-side" id="server" checked="checked" style="visibility:hidden"/>
-			<br />
-			<br />
-			<input type="submit" value="Submit Query" />
-		</form>
-	</body>
-</html>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml b/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
deleted file mode 100644
index f2d1283..0000000
--- a/rdf.web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <head>
-        <title>Upload triples</title>
-    </head>
-    <body>
-        
-            <form method="post" enctype="multipart/form-data" action="/graph">
-				<div>
-				<label for="graph">RDF File: </label><input id="graph" type="file" name="graph" /><br/>
-				<label for="name">Graph Name: </label>
-				<input type="text" id="name" name="name" value="urn:x-localinstance:/content.graph" size="80"/><br/>
-				<label for="mode">Insertion Mode (for existing Graphs): </label><select name="mode">
-					<option value="append">Append</option>
-					<option value="replace">Replace</option>
-				</select>
-				<input type="hidden" name="redirection" value="/graph/upload-form" /><br/>
-				<input type="submit" />
-				</div>
-			</form>
-
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java b/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
deleted file mode 100644
index a43a6a2..0000000
--- a/rdf.web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
+++ /dev/null
@@ -1,250 +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.web.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-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.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
-import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.web.ontologies.BACKUP;
-import org.apache.commons.rdf.Literal;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests backup functionality.
- *
- * @author hasan
- */
-public class BackupAndRestoreTest {
-
-    private static String testGraphFileName = "test.graph";
-
-    private static Graph testGraph0 = new SimpleGraph();
-    private static Iri testGraphUri0 = // the URI of testGraph0
-            new Iri("http://localhost/test0/"+testGraphFileName);
-    // a resource in testGraph0
-    private    static Iri uri0 = new Iri("http://localhost/test0/testuri");
-
-    private static Graph testGraph1 = new SimpleGraph();
-    private static Iri testGraphUri1 = // the URI of testGraph1
-            new Iri("http://localhost/test1/"+testGraphFileName);
-
-    // a resource in testGraph1
-    private    static Iri uri1 = new Iri("http://localhost/test1/testuri");
-
-    private static ImmutableGraph testGraphA;
-    private static Iri testGraphUriA = // the URI of testGraphA
-            new Iri("http://localhost/testA/"+testGraphFileName);
-
-    // a resource in testGraphA
-    private    static Iri uriA = new Iri("http://localhost/testA/testuri");
-    
-
-    private static String backupContentFileName = "triplecollections.nt";
-    private static BackupMessageBodyWriter backup;
-    private static Parser parser = Parser.getInstance();
-
-    @Before
-    public void setUp() {
-        backup = new BackupMessageBodyWriter();
-        backup.tcManager = new TestTcManager();
-        backup.serializer = Serializer.getInstance();
-        backup.serializer.bindSerializingProvider(
-                new JenaSerializerProvider());
-        testGraph0.add(new TripleImpl(uri0, uri0, uri0));
-        testGraph1.add(new TripleImpl(uri1, uri1, uri1));
-        Graph graphBuilder = new SimpleGraph();
-        graphBuilder.add(new TripleImpl(uriA, uriA, uriA));
-        testGraphA = graphBuilder.getImmutableGraph();
-    }
-
-    @Test
-    public void testBackup() throws IOException {
-        //ImmutableGraph downloadedTestGraphX = null;
-        //ImmutableGraph downloadedTestGraphY = null;
-        ImmutableGraph downloadedBackupContentsGraph = null;
-
-        byte[] download = backup.createBackup();
-        ByteArrayInputStream bais = new ByteArrayInputStream(download);
-        ZipInputStream compressedTcs = new ZipInputStream(bais);
-
-        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
-        String folder = "";
-        ZipEntry entry;
-        while ((entry = compressedTcs.getNextEntry()) != null) {
-            String entryName = entry.getName();
-            if (entry.isDirectory()) {
-                folder = entryName;
-            } else {
-                Assert.assertTrue(entryName.startsWith(folder+testGraphFileName)
-                        || entryName.equals(backupContentFileName));
-                ByteArrayOutputStream baos = new ByteArrayOutputStream(download.length);
-                int count;
-                byte buffer[] = new byte[2048];
-                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
-                    baos.write(buffer, 0, count);
-                }
-                ByteArrayInputStream serializedGraph = new ByteArrayInputStream(
-                        baos.toByteArray());
-                /*if (entryName.equals(folder+testGraphFileName + ".nt")) {
-                    downloadedTestGraphX = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                } else if (entryName.startsWith(folder+testGraphFileName)) {
-                    downloadedTestGraphY = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                }*/
-                if (entryName.equals(backupContentFileName)) {
-                    downloadedBackupContentsGraph = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                } else {
-                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
-                            SupportedFormat.N_TRIPLE, null);
-                    extractedTc.put(entryName, deserializedGraph);
-                }
-                baos.flush();
-                baos.close();
-            }
-        }
-        compressedTcs.close();
-        checkDownloadedGraphs(extractedTc,
-                downloadedBackupContentsGraph, folder);
-    }
-
-    @Test
-    public void restoreFromBackup() throws IOException {
-        byte[] backupData = backup.createBackup();
-        TcProvider tcProvider = EasyMock.createMock(TcProvider.class);
-        EasyMock.expect(tcProvider.getGraph(testGraphUri0)).andReturn(
-                EasyMock.createNiceMock(Graph.class));
-        EasyMock.expect(tcProvider.getGraph(testGraphUri1)).andReturn(
-                EasyMock.createNiceMock(Graph.class));
-        tcProvider.deleteGraph(testGraphUriA);
-        EasyMock.expect(tcProvider.createImmutableGraph(EasyMock.eq(testGraphUriA),
-                EasyMock.notNull(Graph.class))).andReturn(new SimpleGraph().getImmutableGraph());
-        EasyMock.replay(tcProvider);
-        Restorer restore = new Restorer();
-        restore.parser = Parser.getInstance();
-        restore.restore(new ByteArrayInputStream(backupData), tcProvider);
-        EasyMock.verify(tcProvider);
-    }
-
-    private void checkDownloadedGraphs(Map<String, Graph> extractedTc,
-            ImmutableGraph downloadedBackupContentsGraph, String folder) {
-        Assert.assertFalse(extractedTc.isEmpty());
-        Assert.assertNotNull(downloadedBackupContentsGraph);
-
-        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
-                testGraphUri0, RDF.type, BACKUP.Graph)));
-
-        Iterator<Triple> triples = downloadedBackupContentsGraph.filter(
-                testGraphUri0, BACKUP.file, null);
-        Assert.assertTrue(triples.hasNext());
-
-        String fileName0 = ((Literal) triples.next().getObject()).getLexicalForm();
-        Assert.assertTrue(fileName0.startsWith(folder+testGraphFileName));
-
-        Graph extracted0 = extractedTc.get(fileName0);
-        Assert.assertNotNull(extracted0);
-        Assert.assertTrue(extracted0.filter(uri0, uri0, uri0).hasNext());
-
-        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
-                testGraphUri1, RDF.type, BACKUP.Graph)));
-
-        triples = downloadedBackupContentsGraph.filter(
-                testGraphUri1, BACKUP.file, null);
-        Assert.assertTrue(triples.hasNext());
-
-        String fileName1 = ((Literal) triples.next().getObject()).getLexicalForm();
-        Assert.assertTrue(fileName1.startsWith(folder+testGraphFileName));
-
-        Graph extracted1 = extractedTc.get(fileName1);
-        Assert.assertNotNull(extracted1);
-
-        Assert.assertTrue(extracted1.filter(uri1, uri1, uri1).hasNext());
-    
-
-
-        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
-                testGraphUriA, RDF.type, BACKUP.Graph)));
-
-        triples = downloadedBackupContentsGraph.filter(
-                testGraphUriA, BACKUP.file, null);
-        Assert.assertTrue(triples.hasNext());
-
-        String fileNameA = ((Literal) triples.next().getObject()).getLexicalForm();
-        Assert.assertTrue(fileNameA.startsWith(folder+testGraphFileName));
-        Graph extractedA = extractedTc.get(fileNameA);
-        Assert.assertNotNull(extractedA);
-
-        Assert.assertTrue(extractedA.filter(uriA, uriA, uriA).hasNext());
-
-    }
-
-    private class TestTcManager extends TcManager {
-
-        // Associates testGraphUri0 with testGraph0 and testGraphUri1 with testGraph1
-        @Override
-        public Graph getGraph(Iri name) throws NoSuchEntityException {
-            if (name.equals(testGraphUri0)) {
-                return testGraph0;
-            } else if (name.equals(testGraphUri1)) {
-                return testGraph1;
-            } else if (name.equals(testGraphUriA)) {
-                return testGraphA;
-            }
-            return null;
-        }
-
-        @Override
-        public Set<Iri> listGraphs() {
-            Set<Iri> result = new HashSet<Iri>();
-            result.add(testGraphUri0);
-            result.add(testGraphUri1);
-            result.add(testGraphUriA);
-            return result;
-        }
-    }
-}
\ No newline at end of file


[4/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
new file mode 100644
index 0000000..d0ceed7
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Restorer.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Literal;
+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.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcProvider;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.web.ontologies.BACKUP;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A service to restore the triple collection
+ *
+ * @author reto
+ */
+@Component
+@Service(Restorer.class)
+public class Restorer {
+
+    private final static Logger log = LoggerFactory.getLogger(Restorer.class);
+
+    @Reference
+    Parser parser;
+
+    /**
+     * Restores triple-collections from a backup to a specified TcProvider
+     *
+     * @param backupData the bytes of a backup zip
+     * @param target the TcProvider into which to restore the data
+     */
+    public void restore(InputStream backupData, TcProvider target) throws IOException {
+        ZipInputStream compressedTcs = new ZipInputStream(backupData);
+
+        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
+        String folder = "";
+        ZipEntry entry;
+        ImmutableGraph metaGraph = null;
+        while ((entry = compressedTcs.getNextEntry()) != null) {
+            String entryName = entry.getName();
+            if (entry.isDirectory()) {
+                folder = entryName;
+            } else {
+                File tempFile = File.createTempFile("graph", "data");
+                OutputStream fos = new FileOutputStream(tempFile);
+                
+                int count;
+                byte buffer[] = new byte[2048];
+                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
+                    fos.write(buffer, 0, count);
+                }
+                fos.close();
+                InputStream serializedGraph = new FileInputStream(tempFile);
+                /*
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                int count;
+                byte buffer[] = new byte[2048];
+                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
+                    baos.write(buffer, 0, count);
+                }
+                baos.close();
+                ByteArrayInputStream serializedGraph = new ByteArrayInputStream(
+                        baos.toByteArray());
+                */
+                if (entryName.equals("triplecollections.nt")) {
+                    metaGraph = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                } else {
+                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                    extractedTc.put(entryName, deserializedGraph);
+                }
+                serializedGraph.close();
+            }
+        }
+        if (metaGraph == null) {
+            throw new RuntimeException("No metadata graph found in backup.");
+        }
+        compressedTcs.close();
+        {
+            final Iterator<Triple> mGraphIterator = metaGraph.filter(null, RDF.type, BACKUP.Graph);
+            while (mGraphIterator.hasNext()) {
+                GraphNode graphGN = new GraphNode(mGraphIterator.next().getSubject(), metaGraph);
+                String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
+                Graph extracted = extractedTc.get(fileName);
+                
+                Graph mGraph;
+                boolean created = false;
+                try {
+                    mGraph = target.getGraph((Iri)graphGN.getNode());
+                    try {
+                        mGraph.clear();
+                    } catch (UnsupportedOperationException ex) {
+                        log.warn("could not restore "+graphGN.getNode()+" as the exsting triple "
+                                + "collection could not be cleared");
+                        continue;
+                    }
+                } catch (NoSuchEntityException ex) {
+                    mGraph = target.createGraph((Iri)graphGN.getNode());
+                    created = true;
+                }
+                try {
+                    mGraph.addAll(extracted);
+                } catch (Exception ex) {
+                    String actionDone = created ? "created" : "cleared";
+                    log.error("after the mgraph "+graphGN.getNode()+" could successfully be "+actionDone
+                            + ", an exception occured adding the data", ex);
+                }
+            }
+        }
+        {
+            final Iterator<Triple> graphIterator = metaGraph.filter(null, RDF.type, BACKUP.Graph);
+            while (graphIterator.hasNext()) {
+                GraphNode graphGN = new GraphNode(graphIterator.next().getSubject(), metaGraph);
+                String fileName = graphGN.getLiterals(BACKUP.file).next().getLexicalForm();
+                Graph extracted = extractedTc.get(fileName);
+                try {
+                    target.deleteGraph((Iri)graphGN.getNode());
+                } catch (UnsupportedOperationException ex) {
+                    log.warn("could not restore "+graphGN.getNode()+" as the exsting triple "
+                            + "collection could not be deleted");
+                    continue;
+                } catch (NoSuchEntityException ex) {
+                    log.debug("could not remove "+graphGN.getNode()+", no such entity");
+                }
+                target.createImmutableGraph((Iri)graphGN.getNode(), extracted);
+            }
+        }
+        for (Map.Entry<String, Graph> pathTcPair : extractedTc.entrySet()) {
+            Literal fileNameLit = LiteralFactory.getInstance().createTypedLiteral(
+                        pathTcPair.getKey());
+            Iterator<Triple> graphResIterator = metaGraph.filter(null, BACKUP.file, fileNameLit);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
new file mode 100644
index 0000000..f3678a7
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/ResultSetMessageBodyWriter.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.Providers;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.sparql.ResultSet;
+import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+import org.apache.clerezza.rdf.core.sparql.query.Variable;
+import org.apache.commons.rdf.Literal;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * MessageBodyWirter for <code>ResultSet</code>.
+ * 
+ * @author mir, reto
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Produces({"application/xml", "text/xml", "application/sparql-results+xml"})
+@Provider
+public class ResultSetMessageBodyWriter implements MessageBodyWriter<ResultSet> {
+
+    @Reference
+    TcManager tcManager;
+
+
+    private Providers providers;
+
+    final Logger logger = LoggerFactory.getLogger(ResultSetMessageBodyWriter.class);
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+            MediaType mediaType) {
+        return ResultSet.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public long getSize(ResultSet t, Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(ResultSet resultSet, Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,
+            Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+
+        Source source = toXmlSource(resultSet);
+        MessageBodyWriter<Source> sourceMessageBodyWriter = 
+                providers.getMessageBodyWriter(Source.class, null, null, mediaType);
+        sourceMessageBodyWriter.writeTo(source, Source.class, null, null, mediaType,
+                httpHeaders, entityStream);
+    }
+
+    @Context
+    public void setProviders(Providers providers) {
+        this.providers = providers;
+    }
+
+    /**
+     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
+     * {@link DOMSource}
+     *
+     * @param queryResult
+     * @param query
+     * @param applyStyle
+     */
+    private Source toXmlSource(ResultSet queryResult) {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        try {
+            Document doc = dbf.newDocumentBuilder().newDocument();
+            // adding root element
+            Element root = doc.createElement("sparql");
+            root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
+            doc.appendChild(root);
+            Element head = doc.createElement("head");
+            root.appendChild(head);
+            Set<Object> variables = new HashSet<Object>();
+            Element results = doc.createElement("results");
+            SolutionMapping solutionMapping = null;
+            while (queryResult.hasNext()) {
+                solutionMapping = queryResult.next();                
+                createResultElement(solutionMapping, results, doc);                
+            }
+            createVariable(solutionMapping, head, doc);
+            root.appendChild(results);
+
+            DOMSource source = new DOMSource(doc);
+            return source;
+
+        } catch (ParserConfigurationException e) {
+            throw createWebApplicationException(e);
+        }
+    }
+
+    /**
+     * Creates a WebApplicationexception and prints a logger entry
+     */
+    private WebApplicationException createWebApplicationException(Exception e) {
+        return new WebApplicationException(Response.status(Status.BAD_REQUEST)
+                .entity(e.getMessage().replace("<", "&lt;").replace("\n",
+                        "<br/>")).build());
+    }
+
+
+    /**
+     * Helper: creates value element from {@link RdfTerm} depending on its
+     * class
+     *
+     */
+    private Element createValueElement(RdfTerm resource, Document doc) {
+        Element value = null;
+        if (resource instanceof Iri) {
+            value = doc.createElement("uri");
+            value.appendChild(doc.createTextNode(((Iri) resource)
+                    .getUnicodeString()));
+        } else if (resource instanceof Literal) {
+            value = doc.createElement("literal");
+            value.appendChild(doc.createTextNode(((Literal) resource)
+                    .getLexicalForm()));
+            value.setAttribute("datatype", (((Literal) resource)
+                    .getDataType().getUnicodeString()));
+            Language lang = ((Literal) resource).getLanguage();
+            if (lang != null) {
+                value.setAttribute("xml:lang", (lang.toString()));
+            }
+        } else {
+            value = doc.createElement("bnode");
+            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
+        }
+        return value;
+    }
+
+    /**
+     * Helper: creates results element from ResultSet
+     *
+     */
+    private void createResultElement(SolutionMapping solutionMap, Element results, Document doc) {
+        Set<Variable> keys = solutionMap.keySet();
+        Element result = doc.createElement("result");
+        results.appendChild(result);
+        for (Variable key : keys) {
+            Element bindingElement = doc.createElement("binding");
+            bindingElement.setAttribute("name", key.getName());
+            bindingElement.appendChild(createValueElement(
+                    (RdfTerm) solutionMap.get(key), doc));
+            result.appendChild(bindingElement);
+        }
+    }
+
+    private void createVariable(SolutionMapping solutionMap, Element head, Document doc) {
+        Set<Variable> keys = solutionMap.keySet();
+        for (Variable key : keys) {
+            Element varElement = doc.createElement("variable");
+            varElement.setAttribute("name", key.getName());
+            head.appendChild(varElement);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
new file mode 100644
index 0000000..fa29fde
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Smush.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.web.core;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.commons.rdf.Graph;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.FOAF;
+import org.apache.clerezza.rdf.ontologies.OWL;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.Smusher;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
+ * 
+ * @author reto
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/admin/graphs/smush")
+public class Smush {
+    private final Iri tBoxName = new Iri("urn:x-localinstance:/tbox.graph");
+
+    @Reference
+    private TcManager tcManager;
+
+    @Reference
+    private RenderletManager renderletManager;
+
+    private Graph tBox;
+
+    protected void activate(ComponentContext componentContext) {
+        try {
+            //getting the tBox here means no read right on Tbox is necessary
+            //when smushing
+            tBox = tcManager.getGraph(tBoxName);
+        } catch (NoSuchEntityException e) {
+            tBox = new SimpleGraph();
+            tBox.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
+            tBox.add(new TripleImpl(FOAF.mbox_sha1sum, RDF.type, OWL.InverseFunctionalProperty));
+            tBox.add(new TripleImpl(PLATFORM.userName, RDF.type, OWL.InverseFunctionalProperty));
+            tBox = tcManager.createImmutableGraph(tBoxName, tBox);
+        }
+    }
+
+
+    
+    @POST
+    public Response smush(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
+        Graph mGraph = tcManager.getGraph(graphName);
+        Smusher.smush(mGraph, tBox);
+        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
new file mode 100644
index 0000000..69f318f
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpoint.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.clerezza.jaxrs.utils.TrailingSlash;
+import org.apache.clerezza.platform.Constants;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.sparql.ParseException;
+import org.apache.clerezza.rdf.core.sparql.QueryParser;
+import org.apache.clerezza.rdf.core.sparql.ResultSet;
+import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+import org.apache.clerezza.rdf.core.sparql.query.Query;
+import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
+import org.apache.clerezza.rdf.core.sparql.query.Variable;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.web.ontologies.SPARQLENDPOINT;
+import org.apache.commons.rdf.Literal;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.ProcessingInstruction;
+
+/**
+ * Provides methods to query a graph over the web.
+ * 
+ * @author ali, hasan
+ * 
+ */
+@Component
+@Service(Object.class)
+@Property(name = "javax.ws.rs", boolValue = true)
+@Path("/sparql")
+public class SparqlEndpoint {
+
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    
+    
+    @Reference
+    TcManager tcManager;
+
+    @Reference
+    private RenderletManager renderletManager;
+
+    /**
+     * The activate method is called when SCR activates the component configuration.
+     * @param componentContext
+     */
+    protected void activate(ComponentContext componentContext) {
+        URL templateURL = getClass().getResource("sparql-endpoint.ssp");
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new Iri(templateURL.toString()), SPARQLENDPOINT.SparqlEndpoint,
+                null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
+    }
+
+    @GET
+    @Path("form")
+    public GraphNode getAvailableGraphUris(@Context UriInfo uriInfo) {
+        AccessController.checkPermission(new SparqlEndpointAccessPermission());
+        TrailingSlash.enforceNotPresent(uriInfo);
+        GraphNode graphNode = new GraphNode(new BlankNode(), new SimpleGraph());
+        Set<Iri> tripleCollections = tcManager.listGraphs();
+        for (Iri uriRef : tripleCollections) {
+            graphNode.addProperty(SPARQLENDPOINT.tripleCollection, uriRef);
+        }
+        graphNode.addProperty(RDF.type, SPARQLENDPOINT.SparqlEndpoint);
+        return graphNode;
+    }
+
+    /**
+     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
+     * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
+     * successfully carried out. A {@link DOMSource} is returned if an ASK or a
+     * SELECT sparql query was submitted and successfully carried out. The query
+     * is performed against a specified graph with the URI
+     * <code>defaultGrapfUri</code>
+     * 
+     * @param queryString
+     *            URL encoded sparql query
+     * @param defaultGraphUri
+     *            URI of the default graph, an {@link Iri} is expected
+     * @param applyStyleSheet
+     * @param serverSide
+     * @param styleSheetUri 
+     * @return either a {@link ImmutableGraph} or a {@link DOMSource}
+     */
+    @POST
+    public Object runFormQuery(@FormParam("query") String queryString,
+            @FormParam("default-graph-uri") Iri defaultGraphUri,
+            @FormParam("apply-style-sheet") String applyStyleSheet,
+            @FormParam("server-side") String serverSide,
+            @FormParam("style-sheet-uri") String styleSheetUri) {
+        AccessController.checkPermission(new SparqlEndpointAccessPermission());
+        logger.info("Executing SPARQL Query: " + queryString);
+        boolean applyStyle;
+        if (applyStyleSheet != null && applyStyleSheet.equals("on")) {
+            applyStyle = true;
+        } else {
+            applyStyle = false;
+        }
+        boolean applyServerSide;
+        if (serverSide != null && serverSide.equals("on")){
+            applyServerSide = true;
+        } else {
+            applyServerSide = false;
+        }
+        //Graph defaultGraph = null;
+        Object result = null;
+        try {
+            if (defaultGraphUri == null
+                    || defaultGraphUri.getUnicodeString().equals("")) {
+                defaultGraphUri = new Iri(Constants.CONTENT_GRAPH_URI_STRING);
+                //defaultGraph = contentGraph;
+            } else {
+                //defaultGraph = tcManager.getTriples(defaultGraphUri);
+            }
+            //this is now only used to get the variable names
+            //TODO use ResultSet.getResultVars instead
+            Query query = QueryParser.getInstance().parse(queryString);
+            result = tcManager.executeSparqlQuery(queryString, defaultGraphUri);
+            if (result instanceof ImmutableGraph) {
+                return (ImmutableGraph) result;
+            } else if ((result instanceof ResultSet)
+                    || (result instanceof Boolean)) {
+                Source source = toXmlSource(result, query, applyStyle,
+                        applyServerSide, styleSheetUri);
+                if (applyStyle && applyServerSide) {
+                    Response.ResponseBuilder rb = Response.ok(source).type(
+                            MediaType.APPLICATION_XHTML_XML_TYPE);
+                    return rb.build();
+                }
+                return source;
+            } else {
+                throw new WebApplicationException(
+                        Response.status(Status.BAD_REQUEST).entity("Only " +
+                        "queries yielding to a ImmutableGraph, a ResultSet or " +
+                        "Boolean are supported").build());
+            }
+        } catch (ParseException e) {
+            throw createWebApplicationException(e);
+        } catch (NoSuchEntityException e) {
+            throw createWebApplicationException(e);
+        }
+    }
+
+    /**
+     * Returns either a {@link ImmutableGraph} or a {@link DOMSource}. A {@link ImmutableGraph} is
+     * returned if a CONSTRUCT or a DESCRIBE sparql query was submitted and
+     * successfully carried out. A {@link DOMSource} is returned if an ASK or a
+     * SELECT sparql query was submitted and successfully carried out. The query
+     * is performed against a specified graph with the URI
+     * <code>defaultGrapfUri</code>
+     * 
+     * @param queryString
+     * @param defaultGraphUri
+     * @param styleSheetUri
+     * @param serverSide
+     * @return
+     */
+    @GET
+    public Object runGetQuery(@QueryParam("query") String queryString,
+            @QueryParam("default-graph-uri") Iri defaultGraphUri,
+            @QueryParam("style-sheet-uri") String styleSheetUri,
+            @QueryParam("server-side") String serverSide) {
+        AccessController.checkPermission(new SparqlEndpointAccessPermission());
+        String applyStyleSheet = null;
+        if(styleSheetUri != null){
+            applyStyleSheet = "on";
+        }
+        if(serverSide != null && serverSide.equals("true")){
+            serverSide = "on";
+        }
+        return runFormQuery(queryString, defaultGraphUri, applyStyleSheet,
+                serverSide,    styleSheetUri);
+    }
+
+    /**
+     * Helper: returns the variables of a sparql {@link SelectQuery}
+     * 
+     * @param queryString
+     * @return
+     */
+    private List<Variable> getVariables(Query query) {
+        if (query instanceof SelectQuery) {
+            return ((SelectQuery) query).getSelection();
+        } else {
+            return new ArrayList<Variable>();
+        }
+    }
+
+    /**
+     * Helper: transforms a {@link ResultSet} or a {@link Boolean} to a
+     * {@link DOMSource}
+     * 
+     * @param queryResult
+     * @param query
+     * @param applyStyle 
+     */
+    private Source toXmlSource(Object queryResult, Query query,
+            boolean applyStyle, boolean applyServerSide, String styleSheetUri) {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        try {
+            Document doc = dbf.newDocumentBuilder().newDocument();
+            // adding root element
+            Element root = doc.createElement("sparql");
+            root.setAttribute("xmlns", "http://www.w3.org/2005/sparql-results#");
+            doc.appendChild(root);
+            Element head = doc.createElement("head");
+            root.appendChild(head);
+            if (queryResult instanceof Boolean) {
+                Element booleanElement = doc.createElement("boolean");
+                booleanElement.appendChild(doc.createTextNode(queryResult
+                        .toString()));
+                root.appendChild(booleanElement);
+            } else {
+                List<Variable> variables = getVariables(query);
+                for (Variable var : variables) {
+                    Element varElement = doc.createElement("variable");
+                    varElement.setAttribute("name", var.getName());
+                    head.appendChild(varElement);
+                }
+                root.appendChild(createResultsElement((ResultSet) queryResult,
+                        doc));
+            }
+            DOMSource source = new DOMSource(doc);
+            if (applyStyle) {
+                ProcessingInstruction instruction = doc
+                        .createProcessingInstruction("xml-stylesheet",
+                                "type=\"text/xsl\" href=\"" + styleSheetUri + "\"");
+                doc.insertBefore(instruction, root);
+                if (applyServerSide) {
+                    return applyStyleServerSide(source, styleSheetUri);
+                }
+            }
+            return source;
+
+        } catch (ParserConfigurationException e) {
+            throw createWebApplicationException(e);
+        }
+    }
+
+    /**
+     * Applies a style sheet to a XML on server side
+     * @param source
+     *            XML result
+     * @param styleSheetUri
+     *            URI of the style sheet
+     * @return
+     * @throws TransformerException
+     * @throws IOException
+     */
+    private Source applyStyleServerSide(final DOMSource source,
+            final String styleSheetUri) {
+        return AccessController.doPrivileged(new PrivilegedAction<DOMSource>() {
+            @Override
+            public DOMSource run() {
+                try {
+                    StreamResult streamResult = new StreamResult(
+                            new ByteArrayOutputStream());
+                    final TransformerFactory tf = TransformerFactory
+                            .newInstance();
+                    Transformer transformer = tf.newTransformer();
+                    transformer.transform(source, streamResult);
+                    final URL stylesheet = new URL(styleSheetUri);
+                    Source streamSource = new StreamSource(
+                            new ByteArrayInputStream(
+                            ((ByteArrayOutputStream) streamResult
+                                    .getOutputStream()).toByteArray()));
+                    DOMResult domResult = new DOMResult();
+                    StreamSource xslFileSource = new StreamSource(stylesheet
+                            .openStream());
+                    Transformer xslTransformer = tf.newTransformer(xslFileSource);
+                    xslTransformer.transform(streamSource, domResult);
+                    return new DOMSource(domResult.getNode());
+                } catch (TransformerConfigurationException ex) {
+                    throw createWebApplicationException(ex);
+                } catch (TransformerException ex) {
+                    throw createWebApplicationException(ex);
+                } catch (IOException ex) {
+                    throw createWebApplicationException(ex);
+                }
+            }
+        });
+    }
+
+    /**
+     * Creates a WebApplicationexception and prints a logger entry
+     */
+    private WebApplicationException createWebApplicationException(Exception e) {
+        logger.info(e.getClass().getSimpleName() + ": {}", e.getMessage());
+        return new WebApplicationException(Response.status(Status.BAD_REQUEST)
+                .entity(e.getMessage().replace("<", "&lt;").replace("\n",
+                        "<br/>")).build());
+    }
+
+    /**
+     * Helper: creates results element from ResultSet
+     * 
+     */
+    private Element createResultsElement(ResultSet resultSet, Document doc) {
+        Element results = doc.createElement("results");
+        while (resultSet.hasNext()) {
+            SolutionMapping solutionMap = resultSet.next();
+            Set<Variable> keys = solutionMap.keySet();
+            Element result = doc.createElement("result");
+            results.appendChild(result);
+
+            for (Variable key : keys) {
+                Element bindingElement = doc.createElement("binding");
+                bindingElement.setAttribute("name", key.getName());
+                bindingElement.appendChild(createValueElement(
+                        (RdfTerm) solutionMap.get(key), doc));
+                result.appendChild(bindingElement);
+            }
+        }
+        return results;
+    }
+
+    /**
+     * Helper: creates value element from {@link RdfTerm} depending on its
+     * class
+     * 
+     */
+    private Element createValueElement(RdfTerm resource, Document doc) {
+        Element value = null;
+        if (resource instanceof Iri) {
+            value = doc.createElement("uri");
+            value.appendChild(doc.createTextNode(((Iri) resource)
+                    .getUnicodeString()));
+        } else if (resource instanceof Literal) {
+            value = doc.createElement("literal");
+            value.appendChild(doc.createTextNode(((Literal) resource)
+                    .getLexicalForm()));
+            value.setAttribute("datatype", (((Literal) resource)
+                    .getDataType().getUnicodeString()));
+            Language lang = ((Literal) resource).getLanguage();
+            if (lang != null) {
+                value.setAttribute("xml:lang", (lang.toString()));
+            }
+        } else {
+            value = doc.createElement("bnode");
+            value.appendChild(doc.createTextNode(((BlankNode) resource).toString()));
+        }
+        return value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
new file mode 100644
index 0000000..4dd93a3
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/SparqlEndpointAccessPermission.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.clerezza.rdf.web.core;
+
+import java.security.Permission;
+import org.apache.clerezza.permissiondescriptions.PermissionInfo;
+
+/**
+ * Permission to use the Sparql Endpoint GUI. Note that the user
+ * additionally needs permission to read a graph.
+ *
+ * @author tio
+ */
+@PermissionInfo(value="Sparql Endpoint Access Permission", description="Grants access " +
+    "to the Sparql Endpoint")
+public class SparqlEndpointAccessPermission extends Permission{
+
+    public SparqlEndpointAccessPermission() {
+        super("Sparql Endpoint Access permission");
+    }
+    /**
+     *
+     * @param target ignored
+     * @param action ignored
+     */
+    public SparqlEndpointAccessPermission(String target, String actions) {
+        super("Sparql Endpoint Access permission");
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        return equals(permission);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return getClass().equals(obj.getClass());
+    }
+
+    @Override
+    public int hashCode() {
+        return 577987;
+    }
+
+    @Override
+    public String getActions() {
+        return "";
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
new file mode 100644
index 0000000..6a71c01
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccess.java
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.util.concurrent.locks.Lock;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.jaxrs.utils.form.FormFile;
+import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.web.fileserver.util.MediaTypeGuesser;
+
+/**
+ * Provides methods to GET, PUT, and POST an SCB graph over the web.
+ * To be deployed in a JAX-RS runtime.
+ * 
+ * @author hasan
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/graph")
+public class WebAccess {
+
+    @Reference
+    TcManager tcManager;
+
+    @Reference
+    private Parser parser;
+
+    final Logger logger = LoggerFactory.getLogger(WebAccess.class);
+
+    /**
+     * Gets the Graph with specified name
+     *
+     * @param name
+     * @return
+     */
+    @GET
+    public Graph getTriples(@QueryParam("name") Iri name) {
+        AccessController.checkPermission(new WebAccessPermission());
+        if (name == null) {
+            Response r = Response.status(Response.Status.BAD_REQUEST)
+                    .entity("must specify a graph name")
+                    .type(MediaType.TEXT_PLAIN_TYPE).build();
+            throw new WebApplicationException(r);
+        }
+        Graph result = tcManager.getGraph(name);
+        logger.debug("Got graph of size {} ", result.size());
+        int i = 1;
+        if (logger.isDebugEnabled()) {
+            for (Triple triple : result) {
+                logger.debug("({}) with triples {}", i++, triple.toString());
+            }
+            logger.debug("returning");
+        }
+        return result;
+    }
+
+    /**
+     * Puts the triples replacing the triples of the existing Graph with the
+     * specified name. If the graph doesn't exist creates a new <code>Graph</code> 
+     * with the specified name and puts the triples
+     * 
+     *
+     * @param name
+     * @param triples
+     */
+    @PUT
+    public void putTriples(@QueryParam("name") Iri name, Graph triples) {
+        AccessController.checkPermission(new WebAccessPermission());
+        Graph mGraph;
+        try {
+            mGraph = tcManager.getGraph(name);
+        } catch (NoSuchEntityException e) {
+            mGraph = tcManager.createGraph(name);
+        }
+        Lock writeLock = mGraph.getLock().writeLock();
+        writeLock.lock();
+        try {
+            mGraph.clear();
+            mGraph.addAll(triples);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    /**
+     * Posts triples to be placed into an {@link Graph} of the specified name.
+     * If an {@link Graph} with this name doesn't already exist, a new one
+     * is created and filled with the triples posted.
+     * @param form
+     *        a multipart/form-data consisting of:
+     *        - a {@link FormFile} labeled "graph" containing the triples and
+     *            the mime-type.
+     *        - a text field labeled "name" specifying the name of the Graph.
+     *        - an optional text field labeled "mode" specifying the mode.
+     *            If the mode is "replace", existing triples of the Graph will be
+     *            deleted before new triples are added. If the mode is not
+     *            specified or is "append", posted triples are added to the Graph.
+     *        - an optional text field labeled "redirection" specifying an URI
+     *            which the client should be redirected to in case of success.
+     * @return
+     *        {@link Response}. A response with status code BAD REQUEST (400) is
+     *        returned if the required data are missing. If the request can be
+     *        satisfied, one of the following responses is returned:
+     *        - SEE OTHER (303), if redirection is specified.
+     *        - CREATED (201), if redirection is not specified and a new
+     *            {@link Graph} is created.
+     *        - NO CONTENT (204), if redirection is not specified and no new
+     *            {@link Graph} is created.
+     */
+    @POST
+    @Consumes("multipart/form-data")
+    public Response postTriples(MultiPartBody form, @Context UriInfo uriInfo) {
+
+        AccessController.checkPermission(new WebAccessPermission());
+        FormFile[] formFiles = form.getFormFileParameterValues("graph");
+        if (formFiles.length == 0) {
+            responseWithBadRequest("form file parameter 'graph' is missing");
+        }
+        FormFile formFile = formFiles[0];
+        byte[] graph = formFile.getContent();
+        if (graph == null || (graph.length == 0)) {
+            responseWithBadRequest("no triples uploaded");
+        }
+        MediaType mediaType = formFile.getMediaType();
+        if (mediaType == null) {
+            responseWithBadRequest("mime-type not specified");
+        }
+        if (mediaType.equals(MediaType.APPLICATION_OCTET_STREAM_TYPE)) {
+            MediaType guessedType = MediaTypeGuesser.getInstance().guessTypeForName(formFile.getFileName());
+            if (guessedType != null) {
+                mediaType = guessedType;
+            }
+        }
+        String graphName = getFirstTextParameterValue(form, "name", true);
+        if (graphName == null) {
+            responseWithBadRequest("graph name not specified");
+        }
+        String mode = getFirstTextParameterValue(form, "mode", false);
+        if (mode != null) {
+            if (!(mode.equals("replace") || mode.equals("append"))) {
+                responseWithBadRequest("unknown mode");
+            }
+        } else {
+            mode = "append";
+        }
+        InputStream is = new ByteArrayInputStream(graph);
+        ImmutableGraph parsedGraph = parser.parse(is, mediaType.toString());
+        Iri graphUri = new Iri(graphName);
+        Graph mGraph;
+        boolean newGraph = false;
+        try {
+            mGraph = tcManager.getGraph(graphUri);
+        } catch (NoSuchEntityException e) {
+            mGraph = tcManager.createGraph(graphUri);
+            newGraph = true;
+        }
+        Lock writeLock = mGraph.getLock().writeLock();
+        writeLock.lock();
+        try {
+            if (!newGraph && mode.equals("replace")) {
+                mGraph.clear();
+            }
+            mGraph.addAll(parsedGraph);
+        } finally {
+            writeLock.unlock();
+        }
+        String redirection = getFirstTextParameterValue(form, "redirection", false);
+        if (redirection == null) {
+            if (newGraph) {
+                return Response.status(Status.CREATED).build();
+            } else {
+                return Response.status(Status.NO_CONTENT).build();
+            }
+        }
+        return RedirectUtil.createSeeOtherResponse(redirection, uriInfo);
+    }
+
+    @GET
+    @Path("upload-form")
+    @Produces("application/xhtml+xml")
+    public InputStream getUploadForm() {
+        AccessController.checkPermission(new WebAccessPermission());
+        return getClass().getResourceAsStream("upload-form.xhtml");
+    }
+
+    private void responseWithBadRequest(String message) {
+        logger.warn(message);
+        throw new WebApplicationException(Response.status(Status.BAD_REQUEST)
+                .entity(message).build());
+    }
+
+    private String getFirstTextParameterValue(MultiPartBody form,
+            String parameterName, boolean mandatory) {
+        String[] paramValues = form.getTextParameterValues(parameterName);
+        if (paramValues.length == 0) {
+            if (mandatory) {
+                responseWithBadRequest("text parameter '" + parameterName +
+                        "' is missing");
+            }
+            return null;
+        }
+        return paramValues[0];
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
new file mode 100644
index 0000000..8964eda
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/WebAccessPermission.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.clerezza.rdf.web.core;
+
+import java.security.Permission;
+import org.apache.clerezza.permissiondescriptions.PermissionInfo;
+
+/**
+ * Permission to use the ImmutableGraph via Web. Note that the user
+ * additionally needs permission to read a graph.
+ *
+ * @author mir
+ */
+@PermissionInfo(value="ImmutableGraph via Web Access Permission", description="Grants access " +
+    "to the ImmutableGraph via Web")
+public class WebAccessPermission extends Permission{
+
+    public WebAccessPermission() {
+        super("ImmutableGraph via Web access permission");
+    }
+    /**
+     *
+     * @param target ignored
+     * @param action ignored
+     */
+    public WebAccessPermission(String target, String actions) {
+        super("ImmutableGraph via Web access permission");
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        return equals(permission);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return getClass().equals(obj.getClass());
+    }
+
+    @Override
+    public int hashCode() {
+        return 477987;
+    }
+
+    @Override
+    public String getActions() {
+        return "";
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
new file mode 100644
index 0000000..3187d42
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/utils/ResultSetsWrapper.java
@@ -0,0 +1,77 @@
+/*
+ *  Copyright 2010 mir.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.clerezza.rdf.web.core.utils;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.apache.clerezza.rdf.core.sparql.ResultSet;
+import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+
+/**
+ * Wrapps a set of <code>ResultSet</code>s so it acts like a single ResultSet.
+ *
+ * @author mir
+ */
+public class ResultSetsWrapper implements ResultSet {
+
+    private Iterator<ResultSet> resultSetsIter;
+    private ResultSet currentResultSet;
+    private List<String> varNames;
+
+    public ResultSetsWrapper(Set<ResultSet> resultSets) {
+        this.resultSetsIter = resultSets.iterator();
+        this.currentResultSet = resultSetsIter.next();
+
+        Set<String> uniqueVarNames = new HashSet<String>();
+        for (ResultSet resultSet : resultSets) {
+			uniqueVarNames.addAll(resultSet.getResultVars());
+		}
+    	this.varNames = new ArrayList<String>(uniqueVarNames);
+    }
+
+    @Override
+    public boolean hasNext() {
+        if (currentResultSet.hasNext()) {
+            return true;
+        } else {
+            if (resultSetsIter.hasNext()) {
+                currentResultSet = resultSetsIter.next();
+                return hasNext();
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public SolutionMapping next() {
+        hasNext();
+        return currentResultSet.next();
+    }
+
+    @Override
+    public void remove() {
+        currentResultSet.remove();
+    }
+    
+    @Override
+    public List<String> getResultVars() {
+    	return varNames;
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/resources/META-INF/documentation.nt
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/resources/META-INF/documentation.nt b/rdf/web/rdf.web.core/src/main/resources/META-INF/documentation.nt
new file mode 100644
index 0000000..daf3e2e
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/resources/META-INF/documentation.nt
@@ -0,0 +1,52 @@
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://discobits.org/ontology#pos> "1" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 <http://discobits.org/ontology#holds> <bundle:///scb-web-content> .
+<bundle:///scb-web-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-title> <http://discobits.org/ontology#infoBit> "SCB Web"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 .
+<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 .
+<bundle:///scb-web-content> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 .
+<bundle:///scb-web-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://discobits.org/ontology#pos> "2" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2> .
+<bundle:///scb-web-content-el/0-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-content-el/0-title> <http://discobits.org/ontology#infoBit> "Upload Triples with a POST Request"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e98 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+<bundle:///scb-web-content-el/2> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 .
+<bundle:///scb-web-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
+<bundle:///scb-web-content-el/2> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 .
+<bundle:///scb-web-content-el/1> <http://discobits.org/ontology#infoBit> "The bundle SCB Web allows access to SCB graphs over HTTP with JAX-RS."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+<bundle:///scb-web-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
+<bundle:///scb-web-content-el/0> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 .
+<bundle:///scb-web-content-el/0> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2-content> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://discobits.org/ontology#pos> "1" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e94 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+<bundle:///scb-web-content-el/0-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-content-el/0-content> <http://discobits.org/ontology#infoBit> "To upload triples with a POST request, a client can use the URI path \"/graph\" and place the triples and other required information into the body as multipart/form-data which consists of\n<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n<li>a file labeled \"graph\" containing the triples and specifying the mime-type.</li>\n<li>a text field labeled \"name\" specifying the name of the MGraph. If an MGraph with this name does not already exist, a new one will be created.</li>\n<li>an optional text field labeled \"mode\" specifying the mode. If the mode is \"replace\", existing triples of the MGraph will be deleted before new triples are added. If the mode is not specified or is \"append\", posted triples will be added to the MGraph.</li>\n<li>an optional text field labeled \"redirection\" specifying an URI which the client should be redirected to in case of success.</li>\n</ul>\nA response with the status co
 de BAD REQUEST (400) is returned if the required data are missing. If the request can be satisfied, one of the following responses is returned:\n<ul xmlns=\"http://www.w3.org/1999/xhtml\">\n<li>SEE OTHER (303), if redirection is specified.</li>\n<li>CREATED (201), if redirection is not specified and a new MGraph is created.</li>\n<li>NO CONTENT (204), if redirection is not specified and no new MGraph is created.</li>\n</ul>\n<p xmlns=\"http://www.w3.org/1999/xhtml\">\nFor your convenience you may access a web-form at the Uri-Path <code>/graph/upload-form</code>.</p>\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+<bundle:///scb-web-content-el/2-title> <http://discobits.org/ontology#infoBit> "Backup of Triple Collections"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+<bundle:///scb-web-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
+<bundle:///scb-web-content-el/2-content> <http://discobits.org/ontology#infoBit> "The platform allows the current user to download all triple collections that he has access to through the URI path \"/admin/backup/download\". The resulted file is a compressed archive in zip format. All triple collections in this file are serialized in N-Triples format. Furthermore, a file called \"triplecollections.nt\" is contained in backup.zip, which describes the mapping of file names to triple collection names.\n"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://discobits.org/ontology#pos> "1" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e97 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://discobits.org/ontology#pos> "0" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e95 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/2-title> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0-title> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://discobits.org/ontology#pos> "0" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e93 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://discobits.org/ontology#pos> "1" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e92 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/0-content> .
+<bundle:///scb-web> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e99 .
+<bundle:///scb-web> <http://discobits.org/ontology#contains> _:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 .
+<bundle:///scb-web> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://discobits.org/ontology#pos> "0" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e96 <http://discobits.org/ontology#holds> <bundle:///scb-web-content-el/1> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://discobits.org/ontology#pos> "0" .
+_:AX2dX5ddb458X3aX126d34f9135X3aXX2dX7e91 <http://discobits.org/ontology#holds> <bundle:///scb-web-title> .

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
new file mode 100644
index 0000000..0c43b13
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/backup-management.ssp
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+resultDocModifier.setTitle("Backup and restore");
+
+<div class="tx-content">
+	<p>
+		<form method="get" action="/admin/backup/download">
+    Retrieve a backup of all graphs. WARNING: while creating the backup parts of clerezza migh be irresponsive.
+			<input type="submit" value="Retrieve Backup" />
+		</form>
+	</p>
+	<p>
+		<form method="post" action="/admin/backup/restore" enctype="multipart/form-data">
+			<input type="file" name="file" />
+			<input type="submit" value="Restore from backup" />
+		</form>
+	</p>
+</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
new file mode 100644
index 0000000..0b71676
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/graph-management.ssp
@@ -0,0 +1,62 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+def gm(s: Any) = new UriRef("http://clerezza.org/2010/03/graph-management#"+s)
+def rdf(s: Any) = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#"+s)
+def tcp(s: Any) = new UriRef("http://clerezza.org/2009/06/tcprovider#"+s)
+
+resultDocModifier.setTitle("Manage Triple Collections");
+resultDocModifier.addNodes2Elem("tx-module", <h1>Manage Triple Collections</h1>);
+
+import org.apache.clerezza.rdf.scala.utils.RichGraphNode
+
+<div id="tx-content">
+<table>
+	<tr><th>Name</th><th>Size</th><th>type</th><th colspan="3">Actions</th></tr>
+				{for (tc <- (res/gm("tripleCollection")).sortBy(tc => tc*)) yield
+					<tr>
+						<td>{tc*}</td>
+						<td>{tc/gm("size")*}</td>
+						<td>{if ((tc/rdf("type")).indexOf(new RichGraphNode(
+						new GraphNode(tcp("MGraph"), res.getGraph))) != -1) {
+						<span>MGraph</span> } else {
+						<span>Graph</span>
+						}
+						}
+						</td>
+						<td>{ifx ((tc/rdf("type")).indexOf(new RichGraphNode(
+						new GraphNode(tcp("MGraph"), res.getGraph))) != -1) {<form action="smush" method="post"><div>
+							<input type="hidden" name="graphName" value={tc*} />
+						<input type="submit" value="smush" /></div></form>}
+						}</td>
+                                                <td><form action="delete" method="post" onsubmit="return confirm('Are you sure you want to delete this graph?');"><div>
+							<input type="hidden" name="graphName" value={tc*} />
+						<input type="submit" value="delete" /></div></form>
+						</td>
+						<td><form action="/graph" method="get"><div>
+							<input type="hidden" name="name" value={tc*} />
+						<input type="submit" value="get" /></div></form>
+						</td>
+					</tr>
+				}
+</table>
+<p><a href="/graph/upload-form">UploadGraph</a></p>
+</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
new file mode 100644
index 0000000..1e6e233
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/sparql-endpoint.ssp
@@ -0,0 +1,79 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+def se(s: Any) = new UriRef("http://clerezza.org/2009/11/sparql-endpoint#"+s)
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
+	<head>
+		<title>SPARQL Endpoint</title>
+		<script type="text/javascript">
+			function toggle(checkbox){{
+				var uri = document.getElementById('stylesheeturi');
+				var urilable = document.getElementById('urilable');
+				var server = document.getElementById('server');
+				var serverlabel = document.getElementById('serverlabel');
+				if (checkbox.checked){{
+					uri.style.visibility = 'visible';
+					urilable.style.visibility = 'visible';
+					server.style.visibility = 'visible';
+					serverlabel.style.visibility = 'visible';
+				}} else {{
+					uri.style.visibility = 'hidden';
+					urilable.style.visibility = 'hidden';
+					server.style.visibility = 'hidden';
+					serverlabel.style.visibility = 'hidden';
+				}}
+			}}
+		</script>
+	</head>
+	<body>
+		<h1>SPARQL Endpoint</h1>
+		<hr />
+		<h4>SPARQL Query</h4>
+		<form method="post" action="../sparql">
+			<lable for="query">Type in your query:</lable>
+			<br />
+			<textarea cols="70" rows="10" name="query" >
+PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX disco: &lt;http://discobits.org/ontology#>
+SELECT ?c where {{?c rdf:type disco:TitledContent}}
+			</textarea>
+			<br />
+			<br />
+			<label for="default-graph-uri">Select a graph URI:</label>
+			<select	name="default-graph-uri">
+				{for (tc <- (res/se("tripleCollection"))) yield
+					<option>{tc*}</option>
+				}
+			</select>
+			<br />
+			<lable for="apply-style-sheet">Add XSLT style sheet on the result: </lable>
+			<input type="checkbox" name="apply-style-sheet" id="checkbox" onclick="toggle(this)" />
+			<br />
+			<label for="style-sheet-uri" id="urilable" style="visibility:hidden">URI of XSLT style sheet</label>
+			<input type="text" name="style-sheet-uri" id="stylesheeturi" style="width:350px;visibility:hidden" value="http://www.w3.org/TR/rdf-sparql-XMLres/result-to-html.xsl" />
+			<label id="serverlabel" style="visibility:hidden">Add stylesheet on server side</label>
+			<input type="checkbox" name="server-side" id="server" checked="checked" style="visibility:hidden"/>
+			<br />
+			<br />
+			<input type="submit" value="Submit Query" />
+		</form>
+	</body>
+</html>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
new file mode 100644
index 0000000..f2d1283
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/resources/org/apache/clerezza/rdf/web/core/upload-form.xhtml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>Upload triples</title>
+    </head>
+    <body>
+        
+            <form method="post" enctype="multipart/form-data" action="/graph">
+				<div>
+				<label for="graph">RDF File: </label><input id="graph" type="file" name="graph" /><br/>
+				<label for="name">Graph Name: </label>
+				<input type="text" id="name" name="name" value="urn:x-localinstance:/content.graph" size="80"/><br/>
+				<label for="mode">Insertion Mode (for existing Graphs): </label><select name="mode">
+					<option value="append">Append</option>
+					<option value="replace">Replace</option>
+				</select>
+				<input type="hidden" name="redirection" value="/graph/upload-form" /><br/>
+				<input type="submit" />
+				</div>
+			</form>
+
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java b/rdf/web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
new file mode 100644
index 0000000..a43a6a2
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/test/java/org/apache/clerezza/rdf/web/core/BackupAndRestoreTest.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+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.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.access.TcProvider;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
+import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.web.ontologies.BACKUP;
+import org.apache.commons.rdf.Literal;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests backup functionality.
+ *
+ * @author hasan
+ */
+public class BackupAndRestoreTest {
+
+    private static String testGraphFileName = "test.graph";
+
+    private static Graph testGraph0 = new SimpleGraph();
+    private static Iri testGraphUri0 = // the URI of testGraph0
+            new Iri("http://localhost/test0/"+testGraphFileName);
+    // a resource in testGraph0
+    private    static Iri uri0 = new Iri("http://localhost/test0/testuri");
+
+    private static Graph testGraph1 = new SimpleGraph();
+    private static Iri testGraphUri1 = // the URI of testGraph1
+            new Iri("http://localhost/test1/"+testGraphFileName);
+
+    // a resource in testGraph1
+    private    static Iri uri1 = new Iri("http://localhost/test1/testuri");
+
+    private static ImmutableGraph testGraphA;
+    private static Iri testGraphUriA = // the URI of testGraphA
+            new Iri("http://localhost/testA/"+testGraphFileName);
+
+    // a resource in testGraphA
+    private    static Iri uriA = new Iri("http://localhost/testA/testuri");
+    
+
+    private static String backupContentFileName = "triplecollections.nt";
+    private static BackupMessageBodyWriter backup;
+    private static Parser parser = Parser.getInstance();
+
+    @Before
+    public void setUp() {
+        backup = new BackupMessageBodyWriter();
+        backup.tcManager = new TestTcManager();
+        backup.serializer = Serializer.getInstance();
+        backup.serializer.bindSerializingProvider(
+                new JenaSerializerProvider());
+        testGraph0.add(new TripleImpl(uri0, uri0, uri0));
+        testGraph1.add(new TripleImpl(uri1, uri1, uri1));
+        Graph graphBuilder = new SimpleGraph();
+        graphBuilder.add(new TripleImpl(uriA, uriA, uriA));
+        testGraphA = graphBuilder.getImmutableGraph();
+    }
+
+    @Test
+    public void testBackup() throws IOException {
+        //ImmutableGraph downloadedTestGraphX = null;
+        //ImmutableGraph downloadedTestGraphY = null;
+        ImmutableGraph downloadedBackupContentsGraph = null;
+
+        byte[] download = backup.createBackup();
+        ByteArrayInputStream bais = new ByteArrayInputStream(download);
+        ZipInputStream compressedTcs = new ZipInputStream(bais);
+
+        Map<String, Graph> extractedTc = new HashMap<String, Graph>();
+        String folder = "";
+        ZipEntry entry;
+        while ((entry = compressedTcs.getNextEntry()) != null) {
+            String entryName = entry.getName();
+            if (entry.isDirectory()) {
+                folder = entryName;
+            } else {
+                Assert.assertTrue(entryName.startsWith(folder+testGraphFileName)
+                        || entryName.equals(backupContentFileName));
+                ByteArrayOutputStream baos = new ByteArrayOutputStream(download.length);
+                int count;
+                byte buffer[] = new byte[2048];
+                while ((count = compressedTcs.read(buffer, 0, 2048)) != -1) {
+                    baos.write(buffer, 0, count);
+                }
+                ByteArrayInputStream serializedGraph = new ByteArrayInputStream(
+                        baos.toByteArray());
+                /*if (entryName.equals(folder+testGraphFileName + ".nt")) {
+                    downloadedTestGraphX = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                } else if (entryName.startsWith(folder+testGraphFileName)) {
+                    downloadedTestGraphY = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                }*/
+                if (entryName.equals(backupContentFileName)) {
+                    downloadedBackupContentsGraph = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                } else {
+                    ImmutableGraph deserializedGraph = parser.parse(serializedGraph,
+                            SupportedFormat.N_TRIPLE, null);
+                    extractedTc.put(entryName, deserializedGraph);
+                }
+                baos.flush();
+                baos.close();
+            }
+        }
+        compressedTcs.close();
+        checkDownloadedGraphs(extractedTc,
+                downloadedBackupContentsGraph, folder);
+    }
+
+    @Test
+    public void restoreFromBackup() throws IOException {
+        byte[] backupData = backup.createBackup();
+        TcProvider tcProvider = EasyMock.createMock(TcProvider.class);
+        EasyMock.expect(tcProvider.getGraph(testGraphUri0)).andReturn(
+                EasyMock.createNiceMock(Graph.class));
+        EasyMock.expect(tcProvider.getGraph(testGraphUri1)).andReturn(
+                EasyMock.createNiceMock(Graph.class));
+        tcProvider.deleteGraph(testGraphUriA);
+        EasyMock.expect(tcProvider.createImmutableGraph(EasyMock.eq(testGraphUriA),
+                EasyMock.notNull(Graph.class))).andReturn(new SimpleGraph().getImmutableGraph());
+        EasyMock.replay(tcProvider);
+        Restorer restore = new Restorer();
+        restore.parser = Parser.getInstance();
+        restore.restore(new ByteArrayInputStream(backupData), tcProvider);
+        EasyMock.verify(tcProvider);
+    }
+
+    private void checkDownloadedGraphs(Map<String, Graph> extractedTc,
+            ImmutableGraph downloadedBackupContentsGraph, String folder) {
+        Assert.assertFalse(extractedTc.isEmpty());
+        Assert.assertNotNull(downloadedBackupContentsGraph);
+
+        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
+                testGraphUri0, RDF.type, BACKUP.Graph)));
+
+        Iterator<Triple> triples = downloadedBackupContentsGraph.filter(
+                testGraphUri0, BACKUP.file, null);
+        Assert.assertTrue(triples.hasNext());
+
+        String fileName0 = ((Literal) triples.next().getObject()).getLexicalForm();
+        Assert.assertTrue(fileName0.startsWith(folder+testGraphFileName));
+
+        Graph extracted0 = extractedTc.get(fileName0);
+        Assert.assertNotNull(extracted0);
+        Assert.assertTrue(extracted0.filter(uri0, uri0, uri0).hasNext());
+
+        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
+                testGraphUri1, RDF.type, BACKUP.Graph)));
+
+        triples = downloadedBackupContentsGraph.filter(
+                testGraphUri1, BACKUP.file, null);
+        Assert.assertTrue(triples.hasNext());
+
+        String fileName1 = ((Literal) triples.next().getObject()).getLexicalForm();
+        Assert.assertTrue(fileName1.startsWith(folder+testGraphFileName));
+
+        Graph extracted1 = extractedTc.get(fileName1);
+        Assert.assertNotNull(extracted1);
+
+        Assert.assertTrue(extracted1.filter(uri1, uri1, uri1).hasNext());
+    
+
+
+        Assert.assertTrue(downloadedBackupContentsGraph.contains(new TripleImpl(
+                testGraphUriA, RDF.type, BACKUP.Graph)));
+
+        triples = downloadedBackupContentsGraph.filter(
+                testGraphUriA, BACKUP.file, null);
+        Assert.assertTrue(triples.hasNext());
+
+        String fileNameA = ((Literal) triples.next().getObject()).getLexicalForm();
+        Assert.assertTrue(fileNameA.startsWith(folder+testGraphFileName));
+        Graph extractedA = extractedTc.get(fileNameA);
+        Assert.assertNotNull(extractedA);
+
+        Assert.assertTrue(extractedA.filter(uriA, uriA, uriA).hasNext());
+
+    }
+
+    private class TestTcManager extends TcManager {
+
+        // Associates testGraphUri0 with testGraph0 and testGraphUri1 with testGraph1
+        @Override
+        public Graph getGraph(Iri name) throws NoSuchEntityException {
+            if (name.equals(testGraphUri0)) {
+                return testGraph0;
+            } else if (name.equals(testGraphUri1)) {
+                return testGraph1;
+            } else if (name.equals(testGraphUriA)) {
+                return testGraphA;
+            }
+            return null;
+        }
+
+        @Override
+        public Set<Iri> listGraphs() {
+            Set<Iri> result = new HashSet<Iri>();
+            result.add(testGraphUri0);
+            result.add(testGraphUri1);
+            result.add(testGraphUriA);
+            return result;
+        }
+    }
+}
\ No newline at end of file


[2/9] clerezza git commit: CLEREZZA-989: All bundle and components in linked data launchers satisfied, some runtime problems

Posted by re...@apache.org.
CLEREZZA-989: All bundle and components in linked data launchers satisfied, some runtime problems

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

Branch: refs/heads/rdf-commons
Commit: c8c34941b1c8505ff9c5e30d0af74bae25270c5b
Parents: 9677f50
Author: Reto Gmuer <re...@apache.org>
Authored: Tue Mar 24 10:33:40 2015 +0000
Committer: Reto Gmuer <re...@apache.org>
Committed: Tue Mar 24 10:33:40 2015 +0000

----------------------------------------------------------------------
 jaxrs.rdf.providers/pom.xml                     |   4 +-
 .../jaxrs/rdf/providers/GraphNodeWriter.java    |  46 +++----
 .../jaxrs/rdf/providers/GraphReader.java        |  12 +-
 .../jaxrs/rdf/providers/GraphWriter.java        |  10 +-
 .../rdf/providers/ImmutableGraphReader.java     |  66 ++++++++++
 .../rdf/providers/TripleCollectionReader.java   |  66 ----------
 .../ResultSetCsvMessageBodyWriter.java          |  27 ++---
 .../ResultSetJsonMessageBodyWriter.java         |  35 +++---
 .../ResultSetTsvMessageBodyWriter.java          |  27 ++---
 .../ResultSetXmlMessageBodyWriter.java          |  31 ++---
 platform/config/pom.xml                         |  14 +++
 platform/graphnodeprovider/pom.xml              |   6 +-
 .../PlatformGraphNodeProvider.scala             |  39 +++---
 platform/graphprovider.content/pom.xml          |   8 ++
 .../content/ContentGraphProvider.java           |   8 +-
 platform/typehandlerspace.jaxrs2/pom.xml        |   8 +-
 .../jaxrs/TypeHandlerSpace.java                 |  24 ++--
 platform/typehandlerspace/pom.xml               |  16 ++-
 .../typehandlerspace/TypeHandlerDiscovery.java  |   4 +-
 .../impl/TypeHandlerDiscoveryImpl.java          |  18 +--
 .../typehandlerspace/GraphWriterDummy.java      |  12 +-
 .../typehandlerspace/TypeHandlerSpaceTest.java  |  54 ++-------
 platform/typepriority/pom.xml                   |   4 +
 platform/typerendering.scalaserverpages/pom.xml |   8 ++
 .../platform.typerendering.core/pom.xml         |   8 ++
 platform/usermanager/pom.xml                    |   4 +
 .../launchers/linked-data-launcher/pom.xml      |  20 ++--
 provisioning/rdf.web/pom.xml                    |  17 ++-
 provisioning/rdf/pom.xml                        |   2 +-
 provisioning/security/pom.xml                   |   2 +-
 provisioning/typehandlerspace/pom.xml           |  12 +-
 rdf.storage.web/src/main/scala/WebProxy.scala   |   4 +-
 rdf.web/pom.xml                                 |   8 +-
 rdf.web/rdf.web.core/pom.xml                    |  33 +++--
 .../apache/clerezza/rdf/web/core/Backup.java    |  10 +-
 .../rdf/web/core/BackupMessageBodyWriter.java   |  37 +++---
 .../clerezza/rdf/web/core/BackupPermission.java |   4 +-
 .../apache/clerezza/rdf/web/core/Delete.java    |  16 +--
 .../clerezza/rdf/web/core/GraphManagement.java  |  28 ++---
 .../web/core/GraphManagementAppPermission.java  |  12 +-
 .../apache/clerezza/rdf/web/core/Restorer.java  |  36 +++---
 .../web/core/ResultSetMessageBodyWriter.java    |  35 +++---
 .../org/apache/clerezza/rdf/web/core/Smush.java |  25 ++--
 .../clerezza/rdf/web/core/SparqlEndpoint.java   |  75 ++++++------
 .../apache/clerezza/rdf/web/core/WebAccess.java |  53 ++++----
 .../rdf/web/core/WebAccessPermission.java       |  10 +-
 .../rdf/web/core/BackupAndRestoreTest.java      | 120 +++++++++----------
 rdf.web/rdf.web.ontologies/pom.xml              |   9 +-
 rdf/jena/parser/pom.xml                         |   6 +-
 rdf/jena/serializer/pom.xml                     |   8 ++
 rdf/jena/tdb.storage/pom.xml                    |   8 ++
 .../rdf/jena/tdb/storage/TdbTcProvider.java     |   4 +-
 52 files changed, 593 insertions(+), 560 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/pom.xml
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/pom.xml b/jaxrs.rdf.providers/pom.xml
index 2845b48..527f922 100644
--- a/jaxrs.rdf.providers/pom.xml
+++ b/jaxrs.rdf.providers/pom.xml
@@ -36,12 +36,12 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.utils</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.googlecode.json-simple</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
index ceaff14..bde5c83 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphNodeWriter.java
@@ -38,11 +38,11 @@ import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-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.impl.SimpleMGraph;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+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.utils.GraphNode;
 
 /**
@@ -98,17 +98,17 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
         this.uriInfo = uriInfo;
     }
 
-    private TripleCollection getExpandedContext(GraphNode node) {
-        final TripleCollection result = new SimpleMGraph(node.getNodeContext());
-        final Set<Resource> expandedResources = new HashSet<Resource>();
+    private Graph getExpandedContext(GraphNode node) {
+        final Graph result = new SimpleGraph(node.getNodeContext());
+        final Set<RdfTerm> expandedResources = new HashSet<RdfTerm>();
         expandedResources.add(node.getNode());
         while (true) {
-            Set<Resource> additionalExpansionRes = getAdditionalExpansionResources(result);
+            Set<RdfTerm> additionalExpansionRes = getAdditionalExpansionResources(result);
             additionalExpansionRes.removeAll(expandedResources);
             if (additionalExpansionRes.size() == 0) {
                 return result;
             }
-            for (Resource resource : additionalExpansionRes) {
+            for (RdfTerm resource : additionalExpansionRes) {
                 final GraphNode additionalNode = new GraphNode(resource, node.getGraph());
                 result.addAll(additionalNode.getNodeContext());
                 expandedResources.add(resource);
@@ -116,14 +116,14 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
         }
     }
 
-    private Set<Resource> getAdditionalExpansionResources(TripleCollection tc) {
-        final Set<UriRef> subjectExpansionProperties = getSubjectExpansionProperties();
-        final Set<UriRef> objectExpansionProperties = getObjectExpansionProperties();
-        final Set<Resource> result = new HashSet<Resource>();
+    private Set<RdfTerm> getAdditionalExpansionResources(Graph tc) {
+        final Set<Iri> subjectExpansionProperties = getSubjectExpansionProperties();
+        final Set<Iri> objectExpansionProperties = getObjectExpansionProperties();
+        final Set<RdfTerm> result = new HashSet<RdfTerm>();
         if ((subjectExpansionProperties.size() > 0)
                 || (objectExpansionProperties.size() > 0)) {
             for (Triple triple : tc) {
-                final UriRef predicate = triple.getPredicate();
+                final Iri predicate = triple.getPredicate();
                 if (subjectExpansionProperties.contains(predicate)) {
                     result.add(triple.getSubject());
                 }
@@ -135,28 +135,28 @@ public class GraphNodeWriter implements MessageBodyWriter<GraphNode> {
         return result;
     }
 
-    private Set<UriRef> getSubjectExpansionProperties() {
+    private Set<Iri> getSubjectExpansionProperties() {
         final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
         final List<String> paramValues = queryParams.get(SUBJ_EXP_PARAM);
         if (paramValues == null) {
-            return new HashSet<UriRef>(0);
+            return new HashSet<Iri>(0);
         }
-        final Set<UriRef> result = new HashSet<UriRef>(paramValues.size());
+        final Set<Iri> result = new HashSet<Iri>(paramValues.size());
         for (String uriString : paramValues) {
-            result.add(new UriRef(uriString));
+            result.add(new Iri(uriString));
         }
         return result;
     }
 
-    private Set<UriRef> getObjectExpansionProperties() {
+    private Set<Iri> getObjectExpansionProperties() {
         final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
         final List<String> paramValues = queryParams.get(OBJ_EXP_PARAM);
         if (paramValues == null) {
-            return new HashSet<UriRef>(0);
+            return new HashSet<Iri>(0);
         }
-        final Set<UriRef> result = new HashSet<UriRef>(paramValues.size());
+        final Set<Iri> result = new HashSet<Iri>(paramValues.size());
         for (String uriString : paramValues) {
-            result.add(new UriRef(uriString));
+            result.add(new Iri(uriString));
         }
         return result;
     }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
index a53fae3..b1c4922 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphReader.java
@@ -28,9 +28,11 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
+
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.core.Graph;
 
 /**
  * @scr.component
@@ -49,6 +51,7 @@ public class GraphReader implements MessageBodyReader<Graph> {
      * @scr.reference
      */
     private Parser parser;
+    
     @Override
     public boolean isReadable(Class<?> type, Type genericType,
             Annotation[] annotations, MediaType mediaType) {
@@ -56,11 +59,8 @@ public class GraphReader implements MessageBodyReader<Graph> {
     }
 
     @Override
-    public Graph readFrom(Class<Graph> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, String> httpHeaders,
-            InputStream entityStream)
-            throws IOException, WebApplicationException {
+    public Graph readFrom(Class<Graph> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
+        Graph result = new SimpleGraph();
         return parser.parse(entityStream, mediaType.toString());
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
index 7d6ed0c..9bcc33a 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/GraphWriter.java
@@ -30,7 +30,7 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 
@@ -46,7 +46,7 @@ import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 @Produces({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
     SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
     SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
-public class GraphWriter implements MessageBodyWriter<TripleCollection> {
+public class GraphWriter implements MessageBodyWriter<Graph> {
 
     /**
      * @scr.reference
@@ -56,17 +56,17 @@ public class GraphWriter implements MessageBodyWriter<TripleCollection> {
     @Override
     public boolean isWriteable(Class<?> type, Type genericType, 
             Annotation[] annotations, MediaType mediaType) {
-        return TripleCollection.class.isAssignableFrom(type);
+        return Graph.class.isAssignableFrom(type);
     }
 
     @Override
-    public long getSize(TripleCollection t, Class<?> type, Type genericType, 
+    public long getSize(Graph t, Class<?> type, Type genericType, 
             Annotation[] annotations, MediaType mediaType) {
         return -1;
     }
 
     @Override
-    public void writeTo(TripleCollection t, Class<?> type, Type genericType,
+    public void writeTo(Graph t, Class<?> type, Type genericType,
             Annotation[] annotations, MediaType mediaType,
             MultivaluedMap<String, Object> httpHeaders,
             OutputStream entityStream) throws IOException, WebApplicationException {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
new file mode 100644
index 0000000..c2af5a8
--- /dev/null
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/ImmutableGraphReader.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.jaxrs.rdf.providers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.commons.rdf.ImmutableGraph;
+
+/**
+ * @scr.component
+ * @scr.service interface="java.lang.Object"
+ * @scr.property name="javax.ws.rs" type="Boolean" value="true"
+ * 
+ * @author reto
+ */
+@Provider
+@Consumes({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
+    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
+    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
+public class ImmutableGraphReader implements MessageBodyReader<ImmutableGraph> {
+
+    /**
+     * @scr.reference
+     */
+    private Parser parser;
+    @Override
+    public boolean isReadable(Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType) {
+        return type.isAssignableFrom(ImmutableGraph.class);
+    }
+
+    @Override
+    public ImmutableGraph readFrom(Class<ImmutableGraph> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType,
+            MultivaluedMap<String, String> httpHeaders,
+            InputStream entityStream)
+            throws IOException, WebApplicationException {
+        return parser.parse(entityStream, mediaType.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/TripleCollectionReader.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/TripleCollectionReader.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/TripleCollectionReader.java
deleted file mode 100644
index 7be80fa..0000000
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/rdf/providers/TripleCollectionReader.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.jaxrs.rdf.providers;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.Provider;
-
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- * @scr.component
- * @scr.service interface="java.lang.Object"
- * @scr.property name="javax.ws.rs" type="Boolean" value="true"
- * 
- * @author reto
- */
-@Provider
-@Consumes({SupportedFormat.N3, SupportedFormat.N_TRIPLE,
-    SupportedFormat.RDF_XML, SupportedFormat.TURTLE,
-    SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON})
-public class TripleCollectionReader implements MessageBodyReader<TripleCollection> {
-
-    /**
-     * @scr.reference
-     */
-    private Parser parser;
-    
-    @Override
-    public boolean isReadable(Class<?> type, Type genericType,
-            Annotation[] annotations, MediaType mediaType) {
-        return type.isAssignableFrom(TripleCollection.class);
-    }
-
-    @Override
-    public TripleCollection readFrom(Class<TripleCollection> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
-        TripleCollection result = new SimpleMGraph();
-        return parser.parse(entityStream, mediaType.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
index 848ace0..a9b549e 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetCsvMessageBodyWriter.java
@@ -32,13 +32,12 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
 import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+import org.apache.commons.rdf.Literal;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
@@ -180,7 +179,7 @@ public class ResultSetCsvMessageBodyWriter implements MessageBodyWriter<ResultSe
       if( !first ) {
         outputStream.write( separator );
       }
-      Resource resource = lineData.get( header );
+      RdfTerm resource = lineData.get( header );
       if( resource != null ) {
         writeEscaped( outputStream, getResourceValue( resource ) );
       }
@@ -190,17 +189,15 @@ public class ResultSetCsvMessageBodyWriter implements MessageBodyWriter<ResultSe
   }
 
   /**
-   * Helper to get the proper string representation for the given Resource.
+   * Helper to get the proper string representation for the given RdfTerm.
    */
-  private String getResourceValue( Resource resource ) {
+  private String getResourceValue( RdfTerm resource ) {
     StringBuilder value = new StringBuilder();
-    if( resource instanceof UriRef ) {
-      value.append( ((UriRef) resource).getUnicodeString() );
-    } else if( resource instanceof TypedLiteral ) {
-      value.append( ((TypedLiteral) resource).getLexicalForm() );
-    } else if( resource instanceof PlainLiteral ) {
-      value.append( ((PlainLiteral) resource).getLexicalForm() );
-    } else if( resource instanceof BNode ) {
+    if( resource instanceof Iri ) {
+      value.append( ((Iri) resource).getUnicodeString() );
+    } else if( resource instanceof Literal ) {
+      value.append( ((Literal) resource).getLexicalForm() );
+    } else if( resource instanceof BlankNode ) {
       value.append( "/" );
     } else {
       value.append( resource.toString() );

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
index 8a7f7cc..f80f4a8 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetJsonMessageBodyWriter.java
@@ -32,15 +32,14 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
 import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
 import org.apache.clerezza.rdf.core.sparql.query.Variable;
+import org.apache.commons.rdf.Literal;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
@@ -115,27 +114,27 @@ public class ResultSetJsonMessageBodyWriter implements MessageBodyWriter<ResultS
 	}
 
 	/**
-	 * Helper: creates value element from {@link Resource} depending on its
+	 * Helper: creates value element from {@link RdfTerm} depending on its
 	 * class
 	 *
 	 */
-	private JSONObject createResultElement(Resource resource) {
+	private JSONObject createResultElement(RdfTerm resource) {
 		JSONObject element = new JSONObject();
-		if (resource instanceof UriRef) {
+		if (resource instanceof Iri) {
 			element.put("type", "uri");
-			element.put("value", UriRef.class.cast(resource).getUnicodeString());
-		} else if (resource instanceof PlainLiteral) {
+			element.put("value", Iri.class.cast(resource).getUnicodeString());
+		} else if (resource instanceof Literal) {
 			element.put("type", "literal");
-			element.put("value", PlainLiteral.class.cast(resource).getLexicalForm());
-			Language lang = PlainLiteral.class.cast(resource).getLanguage();
+			element.put("value", Literal.class.cast(resource).getLexicalForm());
+			Language lang = Literal.class.cast(resource).getLanguage();
 			if (lang != null) {
 				element.put("xml:lang", lang.toString());
 			}
-		} else if (resource instanceof TypedLiteral) {
+		} else if (resource instanceof Literal) {
 			element.put("type", "typed-literal");
-			element.put("datatype", TypedLiteral.class.cast(resource).getDataType().getUnicodeString());
-			element.put("value", TypedLiteral.class.cast(resource).getLexicalForm());
-		} else if (resource instanceof BNode) {
+			element.put("datatype", Literal.class.cast(resource).getDataType().getUnicodeString());
+			element.put("value", Literal.class.cast(resource).getLexicalForm());
+		} else if (resource instanceof BlankNode) {
 			element.put("type", "bnode");
 			element.put("value", "/");
 		} else {
@@ -152,7 +151,7 @@ public class ResultSetJsonMessageBodyWriter implements MessageBodyWriter<ResultS
 		JSONObject result = new JSONObject();
 		Set<Variable> keys = solutionMap.keySet();
 		for (Variable key : keys) {
-			result.put(key.getName(), createResultElement((Resource) solutionMap.get(key)));
+			result.put(key.getName(), createResultElement((RdfTerm) solutionMap.get(key)));
 		}
 		return result;
 	}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
index bf9dcd4..22ebc7c 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetTsvMessageBodyWriter.java
@@ -32,13 +32,12 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
 import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+import org.apache.commons.rdf.Literal;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
@@ -180,7 +179,7 @@ public class ResultSetTsvMessageBodyWriter implements MessageBodyWriter<ResultSe
       if( !first ) {
         outputStream.write( separator );
       }
-      Resource resource = lineData.get( header );
+      RdfTerm resource = lineData.get( header );
       if( resource != null ) {
         writeEscaped( outputStream, getResourceValue( resource ) );
       }
@@ -190,21 +189,17 @@ public class ResultSetTsvMessageBodyWriter implements MessageBodyWriter<ResultSe
   }
 
   /**
-   * Helper to get the proper string representation for the given Resource.
+   * Helper to get the proper string representation for the given RdfTerm.
    */
-  private String getResourceValue( Resource resource ) {
+  private String getResourceValue( RdfTerm resource ) {
     StringBuilder value = new StringBuilder();
-    if( resource instanceof UriRef ) {
+    if( resource instanceof Iri ) {
       value.append( resource.toString() );
-    } else if( resource instanceof TypedLiteral ) {
+    } else if( resource instanceof Literal ) {
       value.append( "\"" );
-      value.append( escapedDQuotes(((TypedLiteral) resource).getLexicalForm()) );
+      value.append( escapedDQuotes(((Literal) resource).getLexicalForm()) );
       value.append( "\"" );
-    } else if( resource instanceof PlainLiteral ) {
-      value.append( "\"" );
-      value.append( escapedDQuotes(((PlainLiteral) resource).getLexicalForm()) );
-      value.append( "\"" );
-    } else if( resource instanceof BNode ) {
+    } else if( resource instanceof BlankNode ) {
       value.append( "/" );
     } else {
       value.append( resource.toString() );

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
index 074b829..8d2657a 100644
--- a/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
+++ b/jaxrs.rdf.providers/src/main/java/org/apache/clerezza/jaxrs/sparql/providers/ResultSetXmlMessageBodyWriter.java
@@ -40,14 +40,13 @@ import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Language;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
 import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
 import org.apache.clerezza.rdf.core.sparql.query.Variable;
+import org.apache.commons.rdf.Literal;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
@@ -148,27 +147,23 @@ public class ResultSetXmlMessageBodyWriter implements MessageBodyWriter<ResultSe
 
 
 	/**
-	 * Helper: creates value element from {@link Resource} depending on its
+	 * Helper: creates value element from {@link RdfTerm} depending on its
 	 * class
 	 *
 	 */
-	private Element createValueElement(Resource resource, Document doc) {
+	private Element createValueElement(RdfTerm resource, Document doc) {
 		Element value = null;
-		if (resource instanceof UriRef) {
+		if (resource instanceof Iri) {
 			value = doc.createElement("uri");
-			value.appendChild(doc.createTextNode(((UriRef) resource)
+			value.appendChild(doc.createTextNode(((Iri) resource)
 					.getUnicodeString()));
-		} else if (resource instanceof TypedLiteral) {
+		} else if (resource instanceof Literal) {
 			value = doc.createElement("literal");
-			value.appendChild(doc.createTextNode(((TypedLiteral) resource)
+			value.appendChild(doc.createTextNode(((Literal) resource)
 					.getLexicalForm()));
-			value.setAttribute("datatype", (((TypedLiteral) resource)
+			value.setAttribute("datatype", (((Literal) resource)
 					.getDataType().getUnicodeString()));
-		} else if (resource instanceof PlainLiteral) {
-			value = doc.createElement("literal");
-			value.appendChild(doc.createTextNode(((PlainLiteral) resource)
-					.getLexicalForm()));
-			Language lang = ((PlainLiteral) resource).getLanguage();
+			Language lang = ((Literal) resource).getLanguage();
 			if (lang != null) {
 				value.setAttribute("xml:lang", (lang.toString()));
 			}
@@ -191,7 +186,7 @@ public class ResultSetXmlMessageBodyWriter implements MessageBodyWriter<ResultSe
 			Element bindingElement = doc.createElement("binding");
 			bindingElement.setAttribute("name", key.getName());
 			bindingElement.appendChild(createValueElement(
-					(Resource) solutionMap.get(key), doc));
+					(RdfTerm) solutionMap.get(key), doc));
 			result.appendChild(bindingElement);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/config/pom.xml
----------------------------------------------------------------------
diff --git a/platform/config/pom.xml b/platform/config/pom.xml
index 7537a21..c726a0b 100644
--- a/platform/config/pom.xml
+++ b/platform/config/pom.xml
@@ -36,6 +36,20 @@
     provides a service to access configuration default values, and a GUI to
     edit such values.
     </description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <!-- a problem with more recent versions and combined targets target="(&amp;(foo=bar)(name=foo)"  -->
+                <version>2.5.0</version>
+            </plugin>
+        </plugins>
+    </build>
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/graphnodeprovider/pom.xml
----------------------------------------------------------------------
diff --git a/platform/graphnodeprovider/pom.xml b/platform/graphnodeprovider/pom.xml
index fdd198f..cd5535d 100644
--- a/platform/graphnodeprovider/pom.xml
+++ b/platform/graphnodeprovider/pom.xml
@@ -65,7 +65,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.usermanager</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -103,6 +103,10 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/graphnodeprovider/src/main/scala/org/apache/clerezza/platform/graphnodeprovider/PlatformGraphNodeProvider.scala
----------------------------------------------------------------------
diff --git a/platform/graphnodeprovider/src/main/scala/org/apache/clerezza/platform/graphnodeprovider/PlatformGraphNodeProvider.scala b/platform/graphnodeprovider/src/main/scala/org/apache/clerezza/platform/graphnodeprovider/PlatformGraphNodeProvider.scala
index e1b4630..8d12669 100644
--- a/platform/graphnodeprovider/src/main/scala/org/apache/clerezza/platform/graphnodeprovider/PlatformGraphNodeProvider.scala
+++ b/platform/graphnodeprovider/src/main/scala/org/apache/clerezza/platform/graphnodeprovider/PlatformGraphNodeProvider.scala
@@ -20,6 +20,7 @@ package org.apache.clerezza.platform.graphnodeprovider
  */
 
 import java.net.{HttpURLConnection, URL}
+import org.apache.commons.rdf._
 import org.slf4j.scala._
 import org.apache.clerezza.rdf.core.access._
 import org.apache.clerezza.rdf.core._
@@ -27,10 +28,12 @@ import org.apache.clerezza.platform.config.PlatformConfig
 import org.apache.clerezza.platform.Constants
 import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider
 import org.apache.clerezza.platform.users.WebIdGraphsService
-import org.apache.clerezza.rdf.utils.{UnionMGraph, UriMutatingTripleCollection, GraphNode}
 import java.util.concurrent.locks.Lock
 import org.apache.clerezza.platform.usermanager.UserManager
 import java.security.{PrivilegedAction, AccessController}
+import org.apache.clerezza.rdf.utils.GraphNode
+import org.apache.clerezza.rdf.utils.UnionGraph
+import org.apache.clerezza.rdf.utils.UriMutatingGraph
 import org.apache.clerezza.rdf.utils.graphnodeprovider.GraphNodeProvider
 
 /**
@@ -44,7 +47,7 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
   /**
    * Get a GraphNode for the specified resource, see class comments for details.
    */
-  def get(uriRef: UriRef): GraphNode = {
+  def get(uriRef: Iri): GraphNode = {
     val uriString = uriRef.getUnicodeString
     val isLocal: Boolean = {
       import scala.collection.JavaConversions._
@@ -56,10 +59,10 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
 
   /**
    * Get a GraphNode for the specified resource, The resource is assumed to be local, i.e. the method behaves like
-   * get(UriRef) for a Uri with an authority section contained in the Set retuned by
+   * get(Iri) for a Uri with an authority section contained in the Set retuned by
    * <code>org.apache.clerezza.platform.config.PlatformConfig#getBaseUris()</code>
    */
-  def getLocal(uriRef: UriRef): GraphNode = {
+  def getLocal(uriRef: Iri): GraphNode = {
     get(uriRef, true)
   }
     
@@ -67,17 +70,17 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
     /**
      *return true iff getLocal(uriRef).getNodeContext.size > 0
      */
-    def existsLocal(uriRef: UriRef): Boolean = {
+    def existsLocal(uriRef: Iri): Boolean = {
         val cgGraph = cgProvider.getContentGraph
         lazy val localInstanceUri = {
             val uri = new java.net.URI(uriRef.getUnicodeString)
-      new UriRef(Constants.URN_LOCAL_INSTANCE + uri.getPath)
+      new Iri(Constants.URN_LOCAL_INSTANCE + uri.getPath)
     }
         //TODO handle /user/
         existsInGraph(uriRef,cgGraph) || existsInGraph(localInstanceUri, cgGraph)
     }
   
-    private[this] def existsInGraph(nodeUri: UriRef, tc: LockableMGraph): Boolean = {
+    private[this] def existsInGraph(nodeUri: Iri, tc: Graph): Boolean = {
         var readLock: Lock = tc.getLock.readLock
         readLock.lock
         try {
@@ -89,7 +92,7 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
     }
     
   
-  private def get(uriRef: UriRef, isLocal: Boolean): GraphNode = {
+  private def get(uriRef: Iri, isLocal: Boolean): GraphNode = {
     val uriString = uriRef.getUnicodeString
     
 
@@ -103,17 +106,17 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
       uri.getScheme+"://"+uri.getAuthority
     }
 
-    val anyHostUri = new UriRef(Constants.URN_LOCAL_INSTANCE + uriPath)
+    val anyHostUri = new Iri(Constants.URN_LOCAL_INSTANCE + uriPath)
 
-    var mGraphs: List[TripleCollection] = Nil
+    var mGraphs: List[Graph] = Nil
 
-    def addToUnion(mGraph: LockableMGraph) {
+    def addToUnion(mGraph: Graph) {
       //adding uncondinionately if (existsInGraph(uriRef, mGraph)) {
       mGraphs ::= mGraph
       //}
       if (isLocal) {
         if (existsInGraph(anyHostUri, mGraph)) {
-          mGraphs ::= new UriMutatingTripleCollection(mGraph, Constants.URN_LOCAL_INSTANCE, uriPrefix)
+          mGraphs ::= new UriMutatingGraph(mGraph, Constants.URN_LOCAL_INSTANCE, uriPrefix)
         }
       }
     }
@@ -126,12 +129,12 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
       val nextSlash = uriPath.indexOf('/',6)    
       if (nextSlash != -1) {
         val userName = uriPath.substring(6, nextSlash)
-        val webIdOption = AccessController.doPrivileged(new PrivilegedAction[Option[UriRef]]() {
-            def run(): Option[UriRef] = {
+        val webIdOption = AccessController.doPrivileged(new PrivilegedAction[Option[Iri]]() {
+            def run(): Option[Iri] = {
               val userNode: GraphNode = userManager.getUserInSystemGraph(userName)
               if (userNode != null) {
                 userNode.getNode match {
-                  case u: UriRef => Some(u)
+                  case u: Iri => Some(u)
                   case _ => None
                 }
               } else {
@@ -188,11 +191,11 @@ class PlatformGraphNodeProvider extends GraphNodeProvider with Logging {
         }
       }
       
-      addToUnion(tcManager.getMGraph(new UriRef(graphUriString)))
+      addToUnion(tcManager.getGraph(new Iri(graphUriString)))
     }
 
-    val unionMGraph = new UnionMGraph(mGraphs:_*);
-    new GraphNode(uriRef, unionMGraph)
+    val unionGraph = new UnionGraph(mGraphs:_*);
+    new GraphNode(uriRef, unionGraph)
   }
 
   private var tcManager: TcManager = null;

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/graphprovider.content/pom.xml
----------------------------------------------------------------------
diff --git a/platform/graphprovider.content/pom.xml b/platform/graphprovider.content/pom.xml
index cecf185..437bdaf 100644
--- a/platform/graphprovider.content/pom.xml
+++ b/platform/graphprovider.content/pom.xml
@@ -35,6 +35,14 @@
     <packaging>bundle</packaging>
     <name>Clerezza - Platform Graph Provider Content</name>
     <description>A service that provides the content-graph</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
----------------------------------------------------------------------
diff --git a/platform/graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java b/platform/graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
index de3b483..8d6ace8 100644
--- a/platform/graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
+++ b/platform/graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
@@ -30,6 +30,8 @@ import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.utils.UnionGraph;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 
 /**
  * A service providing a method to retrieve a <code>UnionGraph</code> containing
@@ -41,11 +43,9 @@ import org.apache.clerezza.rdf.utils.UnionGraph;
  * Temporarily means that after restarting the org.apache.clerezza.platform.graphprovider.content
  * bundle, these graphs will no longer be returned in the <code>UnionGraph</code>.
  * 
- * @scr.component
- * @scr.service interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider"
- * 
- * @author rbn, mir
  */
+@Component
+@Service(ContentGraphProvider.class)
 public class ContentGraphProvider {
 
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace.jaxrs2/pom.xml
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace.jaxrs2/pom.xml b/platform/typehandlerspace.jaxrs2/pom.xml
index c7aed18..b82c6de 100644
--- a/platform/typehandlerspace.jaxrs2/pom.xml
+++ b/platform/typehandlerspace.jaxrs2/pom.xml
@@ -24,8 +24,8 @@
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>0.5</version>
-        <relativePath>../parent</relativePath>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>platform.typehandlerspace.jaxrs</artifactId>
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typehandlerspace</artifactId>
-            <version>0.9</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>javax.ws.rs</groupId>
@@ -50,7 +50,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.graphnodeprovider</artifactId>
-            <version>0.2</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace.jaxrs2/src/main/java/org/apache/clerezza/platform/typehandlerspace/jaxrs/TypeHandlerSpace.java
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace.jaxrs2/src/main/java/org/apache/clerezza/platform/typehandlerspace/jaxrs/TypeHandlerSpace.java b/platform/typehandlerspace.jaxrs2/src/main/java/org/apache/clerezza/platform/typehandlerspace/jaxrs/TypeHandlerSpace.java
index 75e91f8..84e3e85 100644
--- a/platform/typehandlerspace.jaxrs2/src/main/java/org/apache/clerezza/platform/typehandlerspace/jaxrs/TypeHandlerSpace.java
+++ b/platform/typehandlerspace.jaxrs2/src/main/java/org/apache/clerezza/platform/typehandlerspace/jaxrs/TypeHandlerSpace.java
@@ -31,8 +31,8 @@ import javax.ws.rs.core.UriInfo;
 
 import org.apache.clerezza.rdf.utils.graphnodeprovider.GraphNodeProvider;
 import org.apache.clerezza.platform.typehandlerspace.TypeHandlerDiscovery;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.felix.scr.annotations.Component;
@@ -89,13 +89,13 @@ public class TypeHandlerSpace {
     }
 
     private Object getTypeHandler(String absoluteUriPath) {
-        UriRef uri = new UriRef(absoluteUriPath);
+        Iri uri = new Iri(absoluteUriPath);
         if (gnp.existsLocal(uri)) {
             GraphNode node = gnp.getLocal(uri);
             Lock lock =node.readLock();
             lock.lock();
             try {
-                Set<UriRef> rdfTypes = getRdfTypesOfUriRef(node);
+                Set<Iri> rdfTypes = getRdfTypesOfIri(node);
                 return typeHandlerDiscovery.getTypeHandler(rdfTypes);
             } finally {
                 lock.unlock();
@@ -105,17 +105,17 @@ public class TypeHandlerSpace {
         return null;
     }
 
-    private Set<UriRef> getRdfTypesOfUriRef(GraphNode node) {
-        Set<UriRef> rdfTypes = new HashSet<UriRef>();
-        Iterator<Resource> types = node.getObjects(RDF.type);
+    private Set<Iri> getRdfTypesOfIri(GraphNode node) {
+        Set<Iri> rdfTypes = new HashSet<Iri>();
+        Iterator<RdfTerm> types = node.getObjects(RDF.type);
         while (types.hasNext()) {
-            Resource typeStmtObj = types.next();
-            if (!(typeStmtObj instanceof UriRef)) {
+            RdfTerm typeStmtObj = types.next();
+            if (!(typeStmtObj instanceof Iri)) {
                 throw new RuntimeException(
                         "RDF type is expected to be a URI but is " + typeStmtObj
                         + "(of " + node.getNode() + ")");
             }
-            UriRef rdfType = (UriRef) typeStmtObj;
+            Iri rdfType = (Iri) typeStmtObj;
             rdfTypes.add(rdfType);
         }
         
@@ -127,8 +127,8 @@ public class TypeHandlerSpace {
         @GET
         public Object getDescription(@Context UriInfo uriInfo){
             String absoluteUriPath = uriInfo.getAbsolutePath().toString();
-            //MGraph contentMGraph = cgp.getContentGraph();
-                UriRef uri = new UriRef(absoluteUriPath.substring(0,
+            //Graph contentGraph = cgp.getContentGraph();
+                Iri uri = new Iri(absoluteUriPath.substring(0,
                         absoluteUriPath.length() - DESCRIPTION_SUFFIX.length()));
                 GraphNode graphNode = gnp.getLocal(uri);
                 return graphNode.getNodeContext();

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace/pom.xml
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace/pom.xml b/platform/typehandlerspace/pom.xml
index 43756c3..1586dd7 100644
--- a/platform/typehandlerspace/pom.xml
+++ b/platform/typehandlerspace/pom.xml
@@ -24,8 +24,8 @@
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>0.5</version>
-        <relativePath>../parent</relativePath>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>platform.typehandlerspace</artifactId>
@@ -40,22 +40,22 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.utils</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <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>platform.typepriority</artifactId>
-            <version>0.2</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <!--  
         <dependency>
@@ -73,6 +73,10 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.xsite</groupId>
                 <artifactId>xsite-maven-plugin</artifactId>
                 <configuration>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerDiscovery.java
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerDiscovery.java b/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerDiscovery.java
index 5b2c929..2db91ee 100644
--- a/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerDiscovery.java
+++ b/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerDiscovery.java
@@ -20,7 +20,7 @@ package org.apache.clerezza.platform.typehandlerspace;
 
 import java.util.Set;
 
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 
 /**
  * Implementations of this interface map RDF-types to type handlers. A type
@@ -41,6 +41,6 @@ public interface TypeHandlerDiscovery {
      *            be handled
      * @return the type handler for most important rdf-type in the set
      */
-    public Object getTypeHandler(Set<UriRef> rdfTypes);
+    public Object getTypeHandler(Set<Iri> rdfTypes);
 
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/impl/TypeHandlerDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/impl/TypeHandlerDiscoveryImpl.java b/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/impl/TypeHandlerDiscoveryImpl.java
index 57b89f1..789cc4d 100644
--- a/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/impl/TypeHandlerDiscoveryImpl.java
+++ b/platform/typehandlerspace/src/main/java/org/apache/clerezza/platform/typehandlerspace/impl/TypeHandlerDiscoveryImpl.java
@@ -35,7 +35,7 @@ import org.apache.felix.scr.annotations.Service;
 import org.apache.clerezza.platform.typehandlerspace.SupportedTypes;
 import org.apache.clerezza.platform.typehandlerspace.TypeHandlerDiscovery;
 import org.apache.clerezza.platform.typepriority.TypePrioritizer;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Iri;
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.felix.scr.annotations.ReferencePolicy;
 
@@ -56,8 +56,8 @@ public class TypeHandlerDiscoveryImpl implements TypeHandlerDiscovery {
     @Reference
     private TypePrioritizer typePrioritizer;
 
-    private final Map<UriRef, Object> typeHandlerMap = Collections.synchronizedMap(
-            new HashMap<UriRef, Object>());
+    private final Map<Iri, Object> typeHandlerMap = Collections.synchronizedMap(
+            new HashMap<Iri, Object>());
     
     protected void bindTypeHandler(Object typeHandler) {
         SupportedTypes supportedTypes = typeHandler.getClass()
@@ -66,17 +66,17 @@ public class TypeHandlerDiscoveryImpl implements TypeHandlerDiscovery {
             return;
         }
         for (String typeUriString : supportedTypes.types()) {
-            UriRef typeUri = new UriRef(typeUriString);
+            Iri typeUri = new Iri(typeUriString);
             typeHandlerMap.put(typeUri, typeHandler);
         }
     }
         
     protected void unbindTypeHandler(Object typeHandler) {
-        Iterator<UriRef> keys = typeHandlerMap.keySet().iterator();
-        Set<UriRef> toRemove = new HashSet<UriRef>(typeHandlerMap.size());
+        Iterator<Iri> keys = typeHandlerMap.keySet().iterator();
+        Set<Iri> toRemove = new HashSet<Iri>(typeHandlerMap.size());
         synchronized(typeHandlerMap) {
             while (keys.hasNext()) {
-                UriRef uriRef = keys.next();
+                Iri uriRef = keys.next();
                 if(typeHandlerMap.get(uriRef) == typeHandler) {
                     toRemove.add(uriRef);
                 }
@@ -89,12 +89,12 @@ public class TypeHandlerDiscoveryImpl implements TypeHandlerDiscovery {
     }
 
     @Override
-    public Object getTypeHandler(final Set<UriRef> types) {
+    public Object getTypeHandler(final Set<Iri> types) {
         return AccessController.doPrivileged(new PrivilegedAction<Object>() {
 
             @Override
             public Object run() {
-                Iterator<UriRef> prioritizedTypes = typePrioritizer.iterate(types);
+                Iterator<Iri> prioritizedTypes = typePrioritizer.iterate(types);
                 while (prioritizedTypes.hasNext()) {
                     Object result = typeHandlerMap.get(prioritizedTypes.next());
                     if (result != null) {

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/GraphWriterDummy.java
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/GraphWriterDummy.java b/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/GraphWriterDummy.java
index 4552132..31222a7 100644
--- a/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/GraphWriterDummy.java
+++ b/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/GraphWriterDummy.java
@@ -31,7 +31,7 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.commons.rdf.Graph;
 
 /**
  * 
@@ -40,26 +40,26 @@ import org.apache.clerezza.rdf.core.TripleCollection;
  */
 @Provider
 @Produces("application/rdf+xml")
-public class GraphWriterDummy implements MessageBodyWriter<TripleCollection> {
+public class GraphWriterDummy implements MessageBodyWriter<Graph> {
 
     @Override
     public boolean isWriteable(Class<?> type, Type genericType, 
             Annotation[] annotations, MediaType mediaType) {
-        return TripleCollection.class.isAssignableFrom(type);
+        return Graph.class.isAssignableFrom(type);
     }
 
     @Override
-    public long getSize(TripleCollection t, Class<?> type, Type genericType, 
+    public long getSize(Graph t, Class<?> type, Type genericType, 
             Annotation[] annotations, MediaType mediaType) {
         return -1;
     }
 
     @Override
-    public void writeTo(TripleCollection t, Class<?> type, Type genericType,
+    public void writeTo(Graph t, Class<?> type, Type genericType,
             Annotation[] annotations, MediaType mediaType,
             MultivaluedMap<String, Object> httpHeaders,
             OutputStream entityStream) throws IOException, WebApplicationException {
-        entityStream.write("Graph writer".getBytes());
+        entityStream.write("ImmutableGraph writer".getBytes());
         entityStream.close();
     }
 }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerSpaceTest.java
----------------------------------------------------------------------
diff --git a/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerSpaceTest.java b/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerSpaceTest.java
index 645ba8a..1e89023 100644
--- a/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerSpaceTest.java
+++ b/platform/typehandlerspace/src/test/java/org/apache/clerezza/platform/typehandlerspace/TypeHandlerSpaceTest.java
@@ -18,40 +18,8 @@
  */
 package org.apache.clerezza.platform.typehandlerspace;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import java.util.concurrent.locks.ReadWriteLock;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Application;
-
-import org.junit.Assert;
 import org.junit.Test;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.event.FilterTriple;
-import org.apache.clerezza.rdf.core.event.GraphListener;
-//import org.apache.clerezza.jaxrs.testutils.TestWebServer;
-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.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.RDF;
 
 /**
  * @author mir
@@ -64,9 +32,9 @@ public class TypeHandlerSpaceTest {
     }
     
 //    
-//    private static LockableMGraph mGraph = new LockableMGraphWrapper(new SimpleMGraph());
+//    private static LockableGraph mGraph = new LockableGraphWrapper(new SimpleGraph());
 //
-//    UriRef myType = new UriRef("org.example/myType");
+//    Iri myType = new Iri("org.example/myType");
 //    
 //    @Path("/myTypeHandler")
 //    public static class MyTypeHandler {
@@ -106,7 +74,7 @@ public class TypeHandlerSpaceTest {
 //        
 //        int port = createTestWebServer().getPort();
 //
-//        UriRef uri = new UriRef("http://localhost:" + port + "/test");
+//        Iri uri = new Iri("http://localhost:" + port + "/test");
 //        // Setup mGraph
 //        Triple triple = new TripleImpl(uri, RDF.type, myType);
 //        mGraph.add(triple);
@@ -141,7 +109,7 @@ public class TypeHandlerSpaceTest {
 //    public void testGet() throws IOException {
 //        
 //        int port = createTestWebServer().getPort();        
-//        UriRef uri = new UriRef("http://localhost:" + port + "/test");
+//        Iri uri = new Iri("http://localhost:" + port + "/test");
 //        
 //        // Setup mGraph
 //        Triple triple = new TripleImpl(uri, RDF.type, myType);
@@ -170,7 +138,7 @@ public class TypeHandlerSpaceTest {
 //    public void testGetDescription() throws IOException {
 //        
 //        int port = createTestWebServer().getPort();
-//        UriRef uri = new UriRef("http://localhost:" + port + "/test");
+//        Iri uri = new Iri("http://localhost:" + port + "/test");
 //        
 //        // Setup mGraph
 //        Triple triple = new TripleImpl(uri, RDF.type, myType);
@@ -188,7 +156,7 @@ public class TypeHandlerSpaceTest {
 //        for (int ch = requestInput.read(); ch != -1; ch = requestInput.read()) {
 //            baos.write(ch);
 //        }
-//        Assert.assertEquals("Graph writer", baos.toString());
+//        Assert.assertEquals("ImmutableGraph writer", baos.toString());
 //    }
 //
 //    private TestWebServer createTestWebServer() {
@@ -209,8 +177,8 @@ public class TypeHandlerSpaceTest {
 //                TypeHandlerSpace typeHandlerSpace = new TypeHandlerSpace();
 //                typeHandlerSpace.tcManager = new TcManager(){
 //                    @Override
-//                    public LockableMGraph getMGraph(UriRef name) {
-//                        return new LockableMGraph() {
+//                    public LockableGraph getGraph(Iri name) {
+//                        return new LockableGraph() {
 //
 //                            @Override
 //                            public ReadWriteLock getLock() {
@@ -218,12 +186,12 @@ public class TypeHandlerSpaceTest {
 //                            }
 //
 //                            @Override
-//                            public Graph getGraph() {
+//                            public ImmutableGraph getGraph() {
 //                                return mGraph.getGraph();
 //                            }
 //
 //                            @Override
-//                            public Iterator<Triple> filter(NonLiteral subject, UriRef predicate, Resource object) {
+//                            public Iterator<Triple> filter(BlankNodeOrIri subject, Iri predicate, RdfTerm object) {
 //                                return mGraph.filter(subject, predicate, object);
 //                            }
 //
@@ -313,7 +281,7 @@ public class TypeHandlerSpaceTest {
 //                typeHandlerSpace.typeHandlerDiscovery = new TypeHandlerDiscovery() {
 //
 //                    @Override
-//                    public Object getTypeHandler(Set<UriRef> rdfTypes) {
+//                    public Object getTypeHandler(Set<Iri> rdfTypes) {
 //                        if (rdfTypes.contains(myType)){
 //                            return typeHandler;
 //                        }

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typepriority/pom.xml
----------------------------------------------------------------------
diff --git a/platform/typepriority/pom.xml b/platform/typepriority/pom.xml
index 519811a..1d0810c 100644
--- a/platform/typepriority/pom.xml
+++ b/platform/typepriority/pom.xml
@@ -80,6 +80,10 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.xsite</groupId>
                 <artifactId>xsite-maven-plugin</artifactId>
                 <configuration>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typerendering.scalaserverpages/pom.xml
----------------------------------------------------------------------
diff --git a/platform/typerendering.scalaserverpages/pom.xml b/platform/typerendering.scalaserverpages/pom.xml
index 7d5cdc6..3a9d3e7 100644
--- a/platform/typerendering.scalaserverpages/pom.xml
+++ b/platform/typerendering.scalaserverpages/pom.xml
@@ -31,6 +31,14 @@
     <version>1.0.0-SNAPSHOT</version>
     <name>Clerezza - Platform ScalaServerPages Renderlet</name>
     <description>Renderlet implementation wrapping org.apache.clerezza.scala</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencies>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/typerendering/platform.typerendering.core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/typerendering/platform.typerendering.core/pom.xml b/platform/typerendering/platform.typerendering.core/pom.xml
index bc6f83f..2b14401 100644
--- a/platform/typerendering/platform.typerendering.core/pom.xml
+++ b/platform/typerendering/platform.typerendering.core/pom.xml
@@ -35,6 +35,14 @@
     <description>
     This project provides a JAX-RS MessageBodyWriter to render GraphNodes. Rendering requests are delegated to registered renderlets. 
     </description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/platform/usermanager/pom.xml
----------------------------------------------------------------------
diff --git a/platform/usermanager/pom.xml b/platform/usermanager/pom.xml
index ba579d7..e8d6151 100644
--- a/platform/usermanager/pom.xml
+++ b/platform/usermanager/pom.xml
@@ -80,6 +80,10 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.xsite</groupId>
                 <artifactId>xsite-maven-plugin</artifactId>
                 <configuration>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/provisioning/launchers/linked-data-launcher/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/launchers/linked-data-launcher/pom.xml b/provisioning/launchers/linked-data-launcher/pom.xml
index 5e0acb0..35eb3ab 100644
--- a/provisioning/launchers/linked-data-launcher/pom.xml
+++ b/provisioning/launchers/linked-data-launcher/pom.xml
@@ -19,8 +19,8 @@
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>0.5</version>
-        <relativePath>../../../parent</relativePath>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza.provisioning</groupId>
     <artifactId>linked-data-launcher</artifactId>
@@ -205,7 +205,7 @@
             <!-- The Apache Stanbol launchpad -->
             <groupId>org.apache.stanbol</groupId>
             <artifactId>org.apache.stanbol.commons.launchpad</artifactId>
-            <version>0.11.0</version>
+            <version>0.12.0</version>
         </dependency>
         <dependency>
             <!-- maven-launchpad-plugin builds on the launchpad.base app -->
@@ -218,7 +218,7 @@
         <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>felixosgi</artifactId>
-            <version>0.1</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
         <dependency>
@@ -230,21 +230,21 @@
        <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>rdf</artifactId>
-            <version>0.1</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
 		
         <dependency>
              <groupId>org.apache.clerezza.provisioning</groupId>
              <artifactId>rdf.tdb</artifactId>
-             <version>0.1</version>
+             <version>1.0.0-SNAPSHOT</version>
              <type>partialbundlelist</type>
          </dependency>
 		 
         <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>platform.graphnodeprovider</artifactId>
-            <version>0.1</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
       <dependency>
@@ -256,19 +256,19 @@
         <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>typehandlerspace</artifactId>
-            <version>0.2</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>typerendering</artifactId>
-            <version>0.1</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>rdf.web</artifactId>
-            <version>0.1</version>
+            <version>1.0.0-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/provisioning/rdf.web/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/rdf.web/pom.xml b/provisioning/rdf.web/pom.xml
index f503b5a..4254294 100644
--- a/provisioning/rdf.web/pom.xml
+++ b/provisioning/rdf.web/pom.xml
@@ -23,10 +23,10 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>0.5</version>
-        <relativePath>../../parent</relativePath>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     
     <groupId>org.apache.clerezza.provisioning</groupId>
@@ -47,17 +47,17 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>jaxrs.rdf.providers</artifactId>
-            <version>0.15</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.web.core</artifactId>
-            <version>0.4</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.web.ontologies</artifactId>
-            <version>0.4</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -65,6 +65,11 @@
             <version>0.9</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.clerezza.ext</groupId>
+            <artifactId>org.json.simple</artifactId>
+            <version>0.4</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.globalmenu.api</artifactId>
             <version>0.3</version>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/provisioning/rdf/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/rdf/pom.xml b/provisioning/rdf/pom.xml
index 2d97a87..ce10945 100644
--- a/provisioning/rdf/pom.xml
+++ b/provisioning/rdf/pom.xml
@@ -175,7 +175,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.file.storage</artifactId>
-            <version>0.4</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza.ext</groupId>            

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/provisioning/security/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/security/pom.xml b/provisioning/security/pom.xml
index b5cf21f..f8202c0 100644
--- a/provisioning/security/pom.xml
+++ b/provisioning/security/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+?<xml version="1.0" encoding="UTF-8"?>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/provisioning/typehandlerspace/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/typehandlerspace/pom.xml b/provisioning/typehandlerspace/pom.xml
index 459f4fc..7af1994 100644
--- a/provisioning/typehandlerspace/pom.xml
+++ b/provisioning/typehandlerspace/pom.xml
@@ -23,10 +23,10 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <artifactId>clerezza</artifactId>
         <groupId>org.apache.clerezza</groupId>
-        <version>0.5</version>
-        <relativePath>../../parent</relativePath>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
 
     <groupId>org.apache.clerezza.provisioning</groupId>
@@ -44,19 +44,19 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typepriority</artifactId>
-            <version>0.2</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency> 	
  
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typehandlerspace.jaxrs</artifactId>
-            <version>0.9</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency> 	
 
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typehandlerspace</artifactId>
-            <version>0.9</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.storage.web/src/main/scala/WebProxy.scala
----------------------------------------------------------------------
diff --git a/rdf.storage.web/src/main/scala/WebProxy.scala b/rdf.storage.web/src/main/scala/WebProxy.scala
index 8c8ec54..3a03e3b 100644
--- a/rdf.storage.web/src/main/scala/WebProxy.scala
+++ b/rdf.storage.web/src/main/scala/WebProxy.scala
@@ -148,8 +148,8 @@ class WebProxy extends WeightedTcProvider with Logging {
 
   def listGraphs: java.util.Set[Iri] = {
     var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
-    result.addAll(listGraphs)
-    result.addAll(listGraphs)
+    result.addAll(listMGraphs)
+    result.addAll(listImmutableGraphs)
     return result
   }
 

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/pom.xml b/rdf.web/pom.xml
index 73ea91d..7dc74da 100644
--- a/rdf.web/pom.xml
+++ b/rdf.web/pom.xml
@@ -24,15 +24,15 @@
     <parent>
         <groupId>org.apache.clerezza</groupId>
         <artifactId>clerezza</artifactId>
-        <version>0.5</version>
-        <relativePath>../parent</relativePath>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.web</artifactId>
     <packaging>pom</packaging>
     <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - SCB Web Access</name>
-    <description>Allows access to SCB graphs over HTTP with JAX-RS</description>
+    <name>Clerezza - RDF Web Access</name>
+    <description>Allows access to Clerezza graphs over HTTP with JAX-RS</description>
     <modules>
         <module>rdf.web.core</module>
         <module>rdf.web.ontologies</module>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/pom.xml b/rdf.web/rdf.web.core/pom.xml
index 772fd5a..2cad597 100644
--- a/rdf.web/rdf.web.core/pom.xml
+++ b/rdf.web/rdf.web.core/pom.xml
@@ -18,20 +18,29 @@
  specific language governing permissions and limitations
  under the License.
 
--->
+    -->
 
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.clerezza</groupId>
-        <artifactId>rdf.web</artifactId>
-        <version>0.10</version>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
     </parent>
     <groupId>org.apache.clerezza</groupId>
     <artifactId>rdf.web.core</artifactId>
     <packaging>bundle</packaging>
     <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - SCB Web Access Core</name>
-    <description>The core part of SCB Web Access</description>
+    <name>Clerezza - RDF Web Access Core</name>
+    <description>The core part of Clerezza RDF  Web Access</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -41,29 +50,29 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typerendering.core</artifactId>
-            <version>0.3</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typerendering.scalaserverpages</artifactId>
-            <version>0.4</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.core</artifactId>
-            <version>0.14</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.serializer</artifactId>
             <scope>test</scope>
-            <version>0.11</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.parser</artifactId>
             <scope>test</scope>
-            <version>0.12</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.easymock</groupId>
@@ -82,12 +91,12 @@
         <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.web.ontologies</artifactId>
-            <version>0.4</version>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/c8c34941/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
index cfb0a64..440e877 100644
--- a/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
+++ b/rdf.web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
@@ -22,10 +22,10 @@ import org.apache.clerezza.platform.Constants;
 import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
 import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
 import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesService;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Graph;
 import org.apache.clerezza.rdf.core.access.security.TcPermission;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.clerezza.rdf.web.ontologies.BACKUP;
@@ -128,8 +128,8 @@ public class Backup implements GlobalMenuItemsProvider {
 
     @GET
     public GraphNode overviewPage() {
-        MGraph resultGraph = new SimpleMGraph();
-        GraphNode result = new GraphNode(new BNode(), resultGraph);
+        Graph resultGraph = new SimpleGraph();
+        GraphNode result = new GraphNode(new BlankNode(), resultGraph);
         result.addProperty(RDF.type, BACKUP.BackupAdminPage);
         result.addProperty(RDF.type, PLATFORM.HeadedPage);
         return result;


[9/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

Posted by re...@apache.org.
CLEREZZA-966: moved ported rdf.* modules to hierarchy

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

Branch: refs/heads/rdf-commons
Commit: d0f43e94efa7f9d58dc6e153705f796e9c00e54b
Parents: c8c3494
Author: Reto Gmuer <re...@apache.org>
Authored: Tue Mar 24 10:50:51 2015 +0000
Committer: Reto Gmuer <re...@apache.org>
Committed: Tue Mar 24 10:50:51 2015 +0000

----------------------------------------------------------------------
 pom.xml                                         |   3 -
 provisioning/security/pom.xml                   |   2 +-
 rdf.file.storage/LICENSE                        | 201 ---------
 rdf.file.storage/pom.xml                        |  70 ----
 .../clerezza/rdf/file/storage/FileGraph.java    | 205 ---------
 .../rdf/file/storage/FileTcProvider.java        | 240 -----------
 ....clerezza.rdf.core.access.WeightedTcProvider |   1 -
 .../rdf/file/storage/FileGraphTest.java         | 132 ------
 .../rdf/file/storage/FileTcProviderTest.java    | 233 -----------
 .../clerezza/rdf/file/storage/FileUtil.java     |  65 ---
 .../apache/clerezza/rdf/file/storage/test-04.nt |   2 -
 .../clerezza/rdf/file/storage/test-04.rdf       |  32 --
 .../clerezza/rdf/file/storage/test-04.ttl       |   4 -
 rdf.rdfa/LICENSE                                | 201 ---------
 rdf.storage.web/LICENSE                         | 201 ---------
 rdf.storage.web/pom.xml                         | 120 ------
 .../resources/OSGI-INF/metatype/metatype.xml    |  32 --
 .../resources/OSGI-INF/serviceComponents.xml    |  39 --
 rdf.storage.web/src/main/scala/WebProxy.scala   | 271 ------------
 rdf.web/LICENSE                                 | 201 ---------
 rdf.web/pom.xml                                 |  40 --
 rdf.web/rdf.web.core/LICENSE                    | 201 ---------
 rdf.web/rdf.web.core/nbactions.xml              |  11 -
 rdf.web/rdf.web.core/pom.xml                    | 117 ------
 .../apache/clerezza/rdf/web/core/Backup.java    | 161 --------
 .../rdf/web/core/BackupMessageBodyWriter.java   | 180 --------
 .../clerezza/rdf/web/core/BackupPermission.java |  67 ---
 .../apache/clerezza/rdf/web/core/Delete.java    |  67 ---
 .../clerezza/rdf/web/core/GraphManagement.java  | 120 ------
 .../web/core/GraphManagementAppPermission.java  |  67 ---
 .../clerezza/rdf/web/core/PlatformRestorer.java |  95 -----
 .../rdf/web/core/RestorePermission.java         |  69 ----
 .../apache/clerezza/rdf/web/core/Restorer.java  | 178 --------
 .../web/core/ResultSetMessageBodyWriter.java    | 208 ----------
 .../org/apache/clerezza/rdf/web/core/Smush.java |  88 ----
 .../clerezza/rdf/web/core/SparqlEndpoint.java   | 411 -------------------
 .../core/SparqlEndpointAccessPermission.java    |  66 ---
 .../apache/clerezza/rdf/web/core/WebAccess.java | 252 ------------
 .../rdf/web/core/WebAccessPermission.java       |  66 ---
 .../rdf/web/core/utils/ResultSetsWrapper.java   |  77 ----
 .../main/resources/META-INF/documentation.nt    |  52 ---
 .../clerezza/rdf/web/core/backup-management.ssp |  37 --
 .../clerezza/rdf/web/core/graph-management.ssp  |  62 ---
 .../clerezza/rdf/web/core/sparql-endpoint.ssp   |  79 ----
 .../clerezza/rdf/web/core/upload-form.xhtml     |  45 --
 .../rdf/web/core/BackupAndRestoreTest.java      | 250 -----------
 rdf.web/rdf.web.ontologies/LICENSE              | 201 ---------
 rdf.web/rdf.web.ontologies/pom.xml              |  66 ---
 .../clerezza/rdf/web/ontologies/backup.rdf      |  73 ----
 .../rdf/web/ontologies/graphmanagement.rdf      |  70 ----
 .../rdf/web/ontologies/sparqlendpoint.rdf       |  62 ---
 rdf/file.storage/LICENSE                        | 201 +++++++++
 rdf/file.storage/pom.xml                        |  70 ++++
 .../clerezza/rdf/file/storage/FileGraph.java    | 205 +++++++++
 .../rdf/file/storage/FileTcProvider.java        | 240 +++++++++++
 ....clerezza.rdf.core.access.WeightedTcProvider |   1 +
 .../rdf/file/storage/FileGraphTest.java         | 132 ++++++
 .../rdf/file/storage/FileTcProviderTest.java    | 233 +++++++++++
 .../clerezza/rdf/file/storage/FileUtil.java     |  65 +++
 .../apache/clerezza/rdf/file/storage/test-04.nt |   2 +
 .../clerezza/rdf/file/storage/test-04.rdf       |  32 ++
 .../clerezza/rdf/file/storage/test-04.ttl       |   4 +
 rdf/pom.xml                                     |   3 +
 rdf/storage.web/LICENSE                         | 201 +++++++++
 rdf/storage.web/pom.xml                         | 120 ++++++
 .../resources/OSGI-INF/metatype/metatype.xml    |  32 ++
 .../resources/OSGI-INF/serviceComponents.xml    |  39 ++
 rdf/storage.web/src/main/scala/WebProxy.scala   | 271 ++++++++++++
 rdf/web/LICENSE                                 | 201 +++++++++
 rdf/web/pom.xml                                 |  40 ++
 rdf/web/rdf.web.core/LICENSE                    | 201 +++++++++
 rdf/web/rdf.web.core/nbactions.xml              |  11 +
 rdf/web/rdf.web.core/pom.xml                    | 117 ++++++
 .../apache/clerezza/rdf/web/core/Backup.java    | 161 ++++++++
 .../rdf/web/core/BackupMessageBodyWriter.java   | 180 ++++++++
 .../clerezza/rdf/web/core/BackupPermission.java |  67 +++
 .../apache/clerezza/rdf/web/core/Delete.java    |  67 +++
 .../clerezza/rdf/web/core/GraphManagement.java  | 120 ++++++
 .../web/core/GraphManagementAppPermission.java  |  67 +++
 .../clerezza/rdf/web/core/PlatformRestorer.java |  95 +++++
 .../rdf/web/core/RestorePermission.java         |  69 ++++
 .../apache/clerezza/rdf/web/core/Restorer.java  | 178 ++++++++
 .../web/core/ResultSetMessageBodyWriter.java    | 208 ++++++++++
 .../org/apache/clerezza/rdf/web/core/Smush.java |  88 ++++
 .../clerezza/rdf/web/core/SparqlEndpoint.java   | 411 +++++++++++++++++++
 .../core/SparqlEndpointAccessPermission.java    |  66 +++
 .../apache/clerezza/rdf/web/core/WebAccess.java | 252 ++++++++++++
 .../rdf/web/core/WebAccessPermission.java       |  66 +++
 .../rdf/web/core/utils/ResultSetsWrapper.java   |  77 ++++
 .../main/resources/META-INF/documentation.nt    |  52 +++
 .../clerezza/rdf/web/core/backup-management.ssp |  37 ++
 .../clerezza/rdf/web/core/graph-management.ssp  |  62 +++
 .../clerezza/rdf/web/core/sparql-endpoint.ssp   |  79 ++++
 .../clerezza/rdf/web/core/upload-form.xhtml     |  45 ++
 .../rdf/web/core/BackupAndRestoreTest.java      | 250 +++++++++++
 rdf/web/rdf.web.ontologies/LICENSE              | 201 +++++++++
 rdf/web/rdf.web.ontologies/pom.xml              |  66 +++
 .../clerezza/rdf/web/ontologies/backup.rdf      |  73 ++++
 .../rdf/web/ontologies/graphmanagement.rdf      |  70 ++++
 .../rdf/web/ontologies/sparqlendpoint.rdf       |  62 +++
 100 files changed, 5591 insertions(+), 5792 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c67c0f0..eb7bcc5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,11 +72,9 @@
                 <module>rdf</module>
                 <module>rdf.cris</module>
                 <module>rdf.enrichment</module>
-                <module>rdf.file.storage</module>
                 <module>rdf.locking</module>
                 <module>rdf.rdfjson</module>
                 <module>rdf.stable.serializer</module>
-                <module>rdf.web</module>
                 <module>shell</module>
                 <module>shell.felixshellcommand</module>
                 <module>bundledevtool</module>
@@ -93,7 +91,6 @@
                 <module>web.resources.scripts</module>
                 <module>web.resources.yui</module>
                 <module>rdf.storage.externalizer</module>
-                <module>rdf.storage.web</module>
 
                 <module>ext.virtuoso.jdbc</module>
                 <module>rdf.virtuoso.storage</module>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/provisioning/security/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/security/pom.xml b/provisioning/security/pom.xml
index f8202c0..b5cf21f 100644
--- a/provisioning/security/pom.xml
+++ b/provisioning/security/pom.xml
@@ -1,4 +1,4 @@
-?<xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.file.storage/pom.xml b/rdf.file.storage/pom.xml
deleted file mode 100644
index 4932a7c..0000000
--- a/rdf.file.storage/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-    <modelVersion>4.0.0</modelVersion>
-     <parent>
-        <artifactId>clerezza</artifactId>
-        <groupId>org.apache.clerezza</groupId>
-        <version>7-SNAPSHOT</version>
-        <relativePath />
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.file.storage</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - RDF File Storage Provider</name>
-    <description>A file base storage provider</description>
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core.test</artifactId>
-            <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.parser</artifactId>
-            <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.jena.serializer</artifactId>
-            <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
deleted file mode 100644
index e9143f9..0000000
--- a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
+++ /dev/null
@@ -1,205 +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.file.storage;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.util.Collection;
-
-import java.util.Iterator;
-import org.apache.commons.rdf.ImmutableGraph;
-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.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- *
- * @author mir
- */
-public class FileGraph extends SimpleGraph {
-
-    private Serializer serializer;
-    private File file;
-    private String fileType;
-
-    FileGraph(Iri uri, Parser parser,
-            Serializer serializer) {
-        this(new File(URI.create(uri.getUnicodeString())), parser, serializer);    
-    }
-
-    public FileGraph(File file, Parser parser, Serializer serializer) {
-        this.file = file;
-        String fileEnding = extractFileEnding(file.getPath());
-        fileType = getMediaTypeForFileEnding(fileEnding);
-        this.serializer = serializer;
-        try {
-            if (file.exists() && file.length() != 0) {
-                InputStream fio = new FileInputStream(file);
-                ImmutableGraph graph = parser.parse(fio, fileType);
-                addAllNoFileAccess(graph);
-            } else {
-                file.createNewFile();
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-    
-    @Override
-    public boolean add(Triple e) {
-        boolean result = super.add(e);
-        writeToFile();
-        return result;
-    }
-    
-    @Override
-    public boolean addAll(Collection<? extends Triple> c) {
-        boolean modified = addAllNoFileAccess(c);
-        writeToFile();
-        return modified;
-    }
-
-    @Override
-    public boolean remove(Object o) {
-        Iterator<Triple> e = super.filter(null, null, null);
-        while (e.hasNext()) {
-            if (o.equals(e.next())) {
-                e.remove();
-                writeToFile();
-                return true;
-            }
-        }        
-        return false;
-    }
-
-    @Override
-    public boolean removeAll(Collection<?> c) {
-        boolean modified = false;
-        Iterator<Triple> e = super.filter(null, null, null);
-        while (e.hasNext()) {
-            if (c.contains(e.next())) {
-                e.remove();
-                modified = true;
-            }            
-        }
-        writeToFile();
-        return modified;
-    }
-
-    @Override
-    public boolean retainAll(Collection<?> c) {
-        boolean result = super.retainAll(c);
-        writeToFile();
-        return result;
-    }
-    
-    @Override
-    public Iterator<Triple> filter(final BlankNodeOrIri subject,
-            final Iri predicate,
-            final RdfTerm object) {
-        final Iterator<Triple> baseIter = super.filter(subject, predicate, object);
-        Iterator<Triple> iterator = new Iterator<Triple>() {
-
-            @Override
-            public boolean hasNext() {
-                return baseIter.hasNext();
-            }
-
-            @Override
-            public Triple next() {
-                return baseIter.next();
-            }
-
-            @Override
-            public void remove() {
-                baseIter.remove();
-                writeToFile();
-            }
-
-        };
-        return iterator;
-    }
-
-    private boolean addAllNoFileAccess(Collection<? extends Triple> c) {
-        boolean modified = false;
-        Iterator<? extends Triple> e = c.iterator();
-        while (e.hasNext()) {
-            if (super.add(e.next())) {
-                modified = true;
-            }
-        }
-        return modified;
-    }
-
-    private String extractFileEnding(String uriString) {
-        String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
-        return fileEnding;
-    }
-
-    private String getMediaTypeForFileEnding(String fileEnding) {
-        if (fileEnding.equals("rdf")) {
-            return SupportedFormat.RDF_XML;
-        }
-        if (fileEnding.equals("nt")) {
-            return SupportedFormat.N_TRIPLE;
-        }
-        if (fileEnding.equals("ttl")) {
-            return SupportedFormat.TURTLE;
-        }
-        if (fileEnding.equals("n3")) {
-            return SupportedFormat.N3;
-        }
-        return null;
-    }
-
-    private void writeToFile() {
-        synchronized(this) {
-            OutputStream out;
-            try {
-                out = new FileOutputStream(file);
-            } catch (FileNotFoundException ex) {
-                throw new RuntimeException(ex);
-            }
-            try {
-                serializer.serialize(out, this, fileType);
-            } finally {
-                try {
-                    out.close();
-                } catch (IOException ex) {
-                    throw new RuntimeException(ex);
-                }
-            }
-        }
-    }
-
-    public void delete() {
-        file.delete();
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
deleted file mode 100644
index 0b4fd33..0000000
--- a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
+++ /dev/null
@@ -1,240 +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.file.storage;
-
-import java.io.BufferedReader;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.osgi.service.component.ComponentContext;
-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.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-
-/**
- * The <code>FileTcProvider</code> is a <code>WeightedTcProvider</code> that
- * stores <code>Graph</code>S in the file system. <code>ImmutableGraph</code>S are not
- * supported.
- * The <code>Iri</code> of a Graph is location of the file in the file system
- * (e.g. "file:///home/user/myGraph.rdf"). The format of the rdf data in the file
- * depends on the file ending, for example ".rdf" or ".ttl".
- * <code>FileTcProvider</code> uses
- * <code>org.apache.clerezza.rdf.core.serializedform.Parser</code> and
- * <code>org.apache.clerezza.rdf.core.serializedform.Serializer</code> for
- * parsing and serialization, therefore the supported formats depend on the
- * availability of these services.
- * The default weight of the provider is 300.
- *
- * @scr.component
- * @scr.service interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"
- * @scr.property name="weight" type="Integer" value="300"
- * 
- * @author mir
- */
-public class FileTcProvider implements WeightedTcProvider {
-
-    /**
-     * @scr.reference
-     */
-    private Parser parser;
-    /**
-     * @scr.reference
-     */
-    private Serializer serializer;
-    
-    private Map<Iri, FileGraph> uriRef2GraphMap =
-            new HashMap<Iri, FileGraph>();
-
-    protected static File dataFile = new File("data");
-
-    boolean initialized = false;
-
-    private int weight = 300;
-
-
-    public FileTcProvider() {
-        this.parser = Parser.getInstance();
-        this.serializer = Serializer.getInstance();
-    }
-
-    protected void activate(final ComponentContext componentContext) {
-        weight = (Integer) componentContext.getProperties().get("weight");
-        dataFile = componentContext.getBundleContext().
-                        getDataFile("data");
-    }
-
-    @Override
-    public int getWeight() {
-        return weight;
-    }
-
-    @Override
-    public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
-        throw new NoSuchEntityException(name);
-    }
-
-    /**
-     * Get an <code>Graph</code> by its name. If the file at the specified
-     * location already exists, then a Graph is returned even though it was not
-     * created with createGraph().
-     *
-     * @param the name of the <code>Graph</code>
-     * @return name the <code>Graph</code> with the specified name
-     * @throws NoSuchEntityException if there is no <code>Graph</code>
-     *         with the specified name or the file didn't exist.
-     */
-    @Override
-    public Graph getMGraph(Iri name) throws NoSuchEntityException {
-        initialize();
-        Graph mGraph = uriRef2GraphMap.get(name);
-        if (mGraph == null) {
-            final String uriString = name.getUnicodeString();
-            if (!uriString.startsWith("file:")) {
-                throw new NoSuchEntityException(name);
-            }
-            File file = new File(URI.create(uriString));
-            if (file.exists()) {
-                return createGraph(name);
-            } else {
-                throw new NoSuchEntityException(name);
-            }            
-        }
-        return mGraph;
-    }
-
-    @Override
-    public Graph getGraph(Iri name) throws NoSuchEntityException {
-        return getMGraph(name);
-    }
-
-    @Override
-    public Set<Iri> listImmutableGraphs() {
-        throw new UnsupportedOperationException("Not supported.");
-    }
-
-    @Override
-    public Set<Iri> listMGraphs() {
-        initialize();
-        return uriRef2GraphMap.keySet();
-    }
-
-    @Override
-    public Set<Iri> listGraphs() {
-        return listMGraphs();
-    }
-
-
-    @Override
-    public Graph createGraph(Iri name) throws 
-            UnsupportedOperationException, EntityAlreadyExistsException {
-        initialize();
-        if (uriRef2GraphMap.containsKey(name)) {
-            throw new EntityAlreadyExistsException(name);
-        }
-        FileGraph mGraph = new FileGraph(name, parser, serializer);
-        uriRef2GraphMap.put(name, mGraph);
-        writeDataFile();
-        return mGraph;
-    }
-
-    @Override
-    public ImmutableGraph createImmutableGraph(Iri name, Graph triples) throws
-            UnsupportedOperationException, EntityAlreadyExistsException {
-        throw new UnsupportedOperationException("Not supported.");
-    }
-
-    @Override
-    public void deleteGraph(Iri name) throws 
-            UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException {
-        initialize();
-        FileGraph mGraph = (FileGraph)getGraph(name);
-        mGraph.delete();
-        uriRef2GraphMap.remove(name);
-        writeDataFile();
-    }
-
-    @Override
-    public Set<Iri> getNames(ImmutableGraph graph) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    private void initialize() throws RuntimeException {
-        if (!initialized) {
-            readDataFile();
-            initialized = true;
-        }
-    }
-
-    private void readDataFile() throws RuntimeException {
-        try {
-            if (dataFile.exists()) {
-                FileInputStream fstream = new FileInputStream(dataFile);
-                DataInputStream in = new DataInputStream(fstream);
-                BufferedReader br = new BufferedReader(new InputStreamReader(in));
-                String strLine;
-                while ((strLine = br.readLine()) != null) {
-                    Iri uriRef = new Iri(strLine);
-                    uriRef2GraphMap.put(uriRef, new FileGraph(uriRef, parser, serializer));
-                }
-                in.close();
-            } else {
-                dataFile.createNewFile();
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-    
-    private void writeDataFile() {
-        FileOutputStream fout = null;
-        try {
-            fout = new FileOutputStream(dataFile);
-            for (Iri uri : uriRef2GraphMap.keySet()) {
-                fout.write((uri.getUnicodeString() + "\n").getBytes());
-            }
-        } catch (FileNotFoundException ex) {
-            throw new RuntimeException(ex);
-        } catch (IOException ex) {
-            throw new RuntimeException(ex);
-        }
-        finally {
-            try {
-                fout.close();
-            } catch (IOException ex) {
-                Logger.getLogger(FileTcProvider.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider b/rdf.file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
deleted file mode 100644
index cd429a2..0000000
--- a/rdf.file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.clerezza.rdf.file.storage.FileTcProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
deleted file mode 100644
index e24edb9..0000000
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
+++ /dev/null
@@ -1,132 +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.file.storage;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Iterator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.apache.commons.rdf.Triple;
-import org.apache.commons.rdf.Iri;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author mir
- */
-public class FileGraphTest {
-
-    private static String tempDir = System.getProperty("java.io.tmpdir");
-    private static final String FILE_PROTOCOL = "file://";
-
-    protected static final String NT_FILE_NAME = "test-04.nt";
-    protected static final String RDF_FILE_NAME = "test-04.rdf";
-    protected static final String TURTLE_FILE_NAME = "test-04.ttl";
-
-    private static final Iri uriA = new Iri("http://example.com/a");
-    private static final Iri uriB = new Iri("http://example.com/b");
-    private static final Iri uriC = new Iri("http://example.com/c");
-
-
-    @BeforeClass
-    public static void setup() throws Exception {
-        createTempFileFromRdfTerm(NT_FILE_NAME);
-        createTempFileFromRdfTerm(RDF_FILE_NAME);
-        createTempFileFromRdfTerm(TURTLE_FILE_NAME);
-    }
-
-    @AfterClass
-    public static void cleanUp() throws Exception {
-        deleteTempFile(NT_FILE_NAME);
-        deleteTempFile(RDF_FILE_NAME);
-        deleteTempFile(TURTLE_FILE_NAME);
-    }
-
-    private static void createTempFileFromRdfTerm(String resourceName) 
-            throws FileNotFoundException, IOException {
-        InputStream in = FileTcProviderTest.class.getResourceAsStream(resourceName);
-        File file = new File(URI.create(getTempFileUri(resourceName)));
-        FileOutputStream fout = new FileOutputStream(file);
-        int inByte;
-        while ((inByte = in.read()) != -1) {
-            fout.write(inByte);
-        }
-    }
-    
-    protected static String getTempFileUri(String name) {
-                String prefix = tempDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
-        return prefix + tempDir.replace(File.separatorChar, '/') + "/" + name;
-    }
-
-    private static void deleteTempFile(String name)
-            throws FileNotFoundException, IOException {
-        File file = new File(tempDir + "/" + name);
-        file.delete();
-    }
-    
-    @Test
-    public void testReadingFromFile() {
-        FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(RDF_FILE_NAME)),
-                Parser.getInstance(), Serializer.getInstance());
-        assertEquals(2, mGraph.size());
-
-        mGraph = new FileGraph(new Iri(getTempFileUri(TURTLE_FILE_NAME)),
-                Parser.getInstance(), Serializer.getInstance());
-        assertEquals(2, mGraph.size());
-
-        mGraph = new FileGraph(new Iri(getTempFileUri(NT_FILE_NAME)),
-                Parser.getInstance(), Serializer.getInstance());
-        assertEquals(2, mGraph.size());
-    }
-    
-    @Test
-    public void testFilter() throws IOException {
-        String fileName = "filter.rdf";
-        FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
-                Parser.getInstance(), Serializer.getInstance());
-
-        mGraph.add(new TripleImpl(uriA, uriB, uriC));
-        mGraph.add(new TripleImpl(uriC, uriB, uriA));
-
-        mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
-                Parser.getInstance(), Serializer.getInstance());
-        
-        
-        assertEquals(2, mGraph.size());
-        Iterator<Triple> iterator = mGraph.filter(null, null, null);
-
-        iterator.next();
-        iterator.remove();
-        assertEquals(1, mGraph.size());
-
-        mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
-                Parser.getInstance(), Serializer.getInstance());
-        assertEquals(1, mGraph.size());
-        deleteTempFile(fileName);
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
deleted file mode 100644
index aeff78d..0000000
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
+++ /dev/null
@@ -1,233 +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.file.storage;
-
-import java.io.BufferedReader;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import java.util.Set;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-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.NoSuchEntityException;
-
-import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.test.TcProviderTest;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author mir
- */
-public class FileTcProviderTest extends TcProviderTest {
-    private static final String FILE_PROTOCOL = "file://";
-    private static String tempDir = System.getProperty("java.io.tmpdir");
-    private static String testDir = tempDir + "/FileTcProviderTest";
-    
-    
-    @Override
-    protected Iri generateUri(String name) {
-            String prefix = testDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
-        String path =  prefix + testDir.replace('\\', '/') + "/";
-        return new Iri(path + name + ".rdf");
-    }
-
-    @Before
-    public void setupDirectory() {
-        FileUtil.setUpEmptyDirectory(testDir);
-    }
-
-    @After
-    public void deleteDataFile() {
-        FileUtil.delete(FileTcProvider.dataFile);
-    }
-    
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testCreateImmutableGraph() {
-        super.testCreateImmutableGraph();
-    }
-    
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testCreateImmutableGraphExtended() throws Exception {
-        super.testCreateImmutableGraphExtended();
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testGetImmutableGraph() {
-        super.testGetImmutableGraph();
-    }
-
-    
-    @Test
-    @Override
-    public void testGetTriples() {
-        TcProvider fileTcProvider = getInstance();
-        // add Graphs
-        Graph mGraph = new SimpleGraph();
-        // add Graphs
-        mGraph = fileTcProvider.createGraph(uriRefA1);
-        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
-        mGraph = fileTcProvider.createGraph(uriRefB1);
-        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
-
-        // get a Graph
-        Graph tripleCollection2 = fileTcProvider.getGraph(uriRefB1);
-
-        Iterator<Triple> iterator = tripleCollection2.iterator();
-        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
-        assertFalse(iterator.hasNext());
-    }
-
-    @Test
-    @Override
-    public void testDeleteEntity() {
-        TcProvider fileTcProvider = getInstance();
-        Graph mGraph = fileTcProvider.createGraph(uriRefA);
-        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
-        fileTcProvider.deleteGraph(uriRefA);
-        try {
-            fileTcProvider.getGraph(uriRefA);
-            assertTrue(false);
-        } catch (NoSuchEntityException e) {
-            assertTrue(true);
-        }
-        fileTcProvider = getInstance();
-        try {
-            fileTcProvider.getGraph(uriRefA);
-            assertTrue(false);
-        } catch (NoSuchEntityException e) {
-            assertTrue(true);
-        }
-    }
-
-    @Override
-    protected TcProvider getInstance() {
-        FileTcProvider fileTcProvider = new FileTcProvider();
-        return fileTcProvider;
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testGetNames() {
-        //super.testGetNames();
-        getInstance().getNames(new SimpleGraph().getImmutableGraph());
-    }
-
-    
-    /*@Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testCreateGraphExtended() throws Exception {
-        super.testCreateGraphExtended();
-    }*/
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testCreateGraphNoDuplicateNames() throws Exception {
-        super.testCreateGraphNoDuplicateNames();
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testCreateGraphWithInitialCollection() throws Exception {
-        super.testCreateGraphWithInitialCollection();
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testGraphIsNotMutable() throws Exception {
-        super.testGraphIsNotMutable();
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testGraphDeletion() throws Exception {
-        super.testGraphDeletion();
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    @Override
-    public void testGetTriplesGraph() throws Exception {
-        super.testGetTriples();
-    }
-
-    @Test
-    public void testDataFile() {
-        TcProvider provider = getInstance();
-        provider.createGraph(uriRefA);
-        File dataFile = new File("data");
-        assertTrue(dataFile.exists());
-
-        Set<String> expected = new HashSet<String>();
-        expected.add(uriRefA.getUnicodeString());
-        assertTrue(expected.equals(getLinesFromFile(dataFile)));
-
-        provider.createGraph(uriRefB);
-        expected.add(uriRefB.getUnicodeString());
-        assertTrue(expected.equals(getLinesFromFile(dataFile)));
-    
-        provider.deleteGraph(uriRefA);
-        expected.remove(uriRefA.getUnicodeString());
-        assertTrue(expected.equals(getLinesFromFile(dataFile)));
-        
-        provider.deleteGraph(uriRefB);
-        expected.remove(uriRefB.getUnicodeString());
-        assertTrue(expected.equals(getLinesFromFile(dataFile)));
-    }
-
-    @Test
-    public void testAutoGraphCreationFromExistingFile() throws Exception{
-        FileGraphTest.setup();
-        TcProvider provider = getInstance();
-        Graph mGraph = provider.getGraph(new Iri(
-                FileGraphTest.getTempFileUri(FileGraphTest.RDF_FILE_NAME)));
-        assertEquals(2 ,mGraph.size());
-        FileGraphTest.cleanUp();
-    }
-    
-    private Set<String> getLinesFromFile(File file) throws RuntimeException {
-        try {
-            FileInputStream fstream = new FileInputStream(file);
-            DataInputStream in = new DataInputStream(fstream);
-            BufferedReader br = new BufferedReader(new InputStreamReader(in));
-            String strLine;
-            Set<String> lines = new HashSet<String>();
-            while ((strLine = br.readLine()) != null) {
-                lines.add(strLine);
-            }
-            in.close();
-            return lines;
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
deleted file mode 100644
index e163f8a..0000000
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.file.storage;
-
-import java.io.File;
-
-/**
- *
- * @author mir
- */
-public class FileUtil {
-
-     /**
-     * Sets up a new <code>SesameGraph</code>.
-     * @param testName  Name of the test to support.
-     * @throws RepositoryException  If it failed to activate the graph.
-     */
-    public static void setUpEmptyDirectory(String directory) {
-        final File dataDir= new File(directory);
-        dataDir.mkdirs();
-        cleanDirectory(dataDir);
-    }
-
-
-    /**
-     * Cleans the content of the specified directory recursively.
-     * @param dir  Abstract path denoting the directory to clean.
-     */
-    public static void cleanDirectory(File dir) {
-        File[] files= dir.listFiles();
-        if (files!=null && files.length>0) {
-            for (File file: files) {
-                delete(file);
-            }
-        }
-    }
-
-    /**
-     * Deletes the specified file or directory.
-     * @param file  Abstract path denoting the file or directory to clean.
-     */
-    public static void delete(File file) {
-        if (file.isDirectory()) {
-            cleanDirectory(file);
-        }
-        file.delete();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt b/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
deleted file mode 100644
index 414e4b8..0000000
--- a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
+++ /dev/null
@@ -1,2 +0,0 @@
-_:genid1 <http://example.org/base#a> <http://example.org/base#b> .
-<http://example.org/base#c> <http://example.org/base#d> _:genid2 .

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf b/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
deleted file mode 100644
index d046a1b..0000000
--- a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:j.0="http://example.org/base#" > 
-  <rdf:Description rdf:about="http://example.org/base#c">
-    <j.0:d rdf:nodeID="A0"/>
-  </rdf:Description>
-  <rdf:Description rdf:nodeID="A1">
-    <j.0:a rdf:resource="http://example.org/base#b"/>
-  </rdf:Description>
-</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl b/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
deleted file mode 100644
index c518147..0000000
--- a/rdf.file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
+++ /dev/null
@@ -1,4 +0,0 @@
-# Test empty [] operator; not allowed as predicate
-@prefix : <http://example.org/base#> .
-[] :a :b .
-:c :d [] .

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

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.storage.web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.storage.web/pom.xml b/rdf.storage.web/pom.xml
deleted file mode 100644
index 4315683..0000000
--- a/rdf.storage.web/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.clerezza</groupId>
-        <artifactId>clerezza</artifactId>
-        <version>7-SNAPSHOT</version>
-        <relativePath />
-    </parent>
-    <artifactId>rdf.storage.web</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-    <packaging>bundle</packaging>
-    <name>Clerezza - RDF Storage Web (Caching Web Storage Provider)</name>
-    <description>A (currently read-only) storage provider retrieving graphs from the web. It
-        implements a caching proxy, relying on another provider for storing triples.</description>
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.ontologies</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.utils</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.scala.utils</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>osgi.services</artifactId>
-            <version>0.2</version>
-        </dependency>
-        <dependency>
-          <groupId>org.scala-lang</groupId>
-          <artifactId>scala-library</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>jsr311-api</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.apache.clerezza.ext</groupId>
-          <artifactId>slf4j-scala-api</artifactId>
-            <version>1.6.3</version>
-        </dependency>
-    </dependencies>
-    <build>
-        <sourceDirectory>src/main/scala</sourceDirectory>
-        <testSourceDirectory>src/test/scala</testSourceDirectory>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
-                        <Export-Package>${project.groupId}.${project.artifactId}</Export-Package>
-                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
-                    </instructions>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-eclipse-plugin</artifactId>
-                <configuration>
-                    <downloadSources>true</downloadSources>
-                    <downloadJavadocs>true</downloadJavadocs>
-                    <buildcommands>
-                        <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
-                    </buildcommands>
-                    <additionalProjectnatures>
-                        <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
-                    </additionalProjectnatures>
-                    <classpathContainers>
-                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER
-                        </classpathContainer>
-                        <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER
-                        </classpathContainer>
-                    </classpathContainers>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.scala-tools</groupId>
-                <artifactId>maven-scala-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>
\ No newline at end of file


[6/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/pom.xml b/rdf.web/rdf.web.ontologies/pom.xml
deleted file mode 100644
index 1713a43..0000000
--- a/rdf.web/rdf.web.ontologies/pom.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.clerezza</groupId>
-        <artifactId>clerezza</artifactId>
-        <version>7-SNAPSHOT</version>
-        <relativePath />
-    </parent>
-    <groupId>org.apache.clerezza</groupId>
-    <artifactId>rdf.web.ontologies</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.0.0-SNAPSHOT</version>
-    <name>Clerezza - SCB Web Access Ontologies</name>
-    <description>Ontologies defined for local use in SCB Web Access</description>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.clerezza</groupId>
-            <artifactId>rdf.core</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.clerezza</groupId>
-                <artifactId>maven-ontologies-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <phase>generate-sources</phase>
-                        <configuration>
-                            <resourcePath>${basedir}/src/main/resources</resourcePath>
-                            <sources>
-                                <source>${basedir}/target/generated-sources/main/java</source>
-                            </sources>
-                        </configuration>
-                        <goals>
-                            <goal>generate</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <version>1.0.0-SNAPSHOT</version>
-        </plugin>
-        </plugins>
-    </build>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
deleted file mode 100644
index 17d70ee..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2009/11/backup#"
-	xml:base="http://clerezza.org/2009/11/backup"
-	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-	xmlns:owl="http://www.w3.org/2002/07/owl#"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:skos="http://www.w3.org/2008/05/skos#"
-	xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2009/11/backup#">
-	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
-	<dc:title xml:lang="en">
-		Clerezza Backup
-	</dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#Graph">
-	<rdf:type rdf:resource="owl:Class"/>
-	<rdfs:label xml:lang="en">Graph</rdfs:label>
-	<skos:definition xml:lang="en">An RDF graph.</skos:definition>
-</rdfs:Class>
-
-<rdfs:Class rdf:about="#MGraph">
-	<rdf:type rdf:resource="owl:Class"/>
-	<rdfs:label xml:lang="en">MGraph</rdfs:label>
-	<skos:definition xml:lang="en">A mutable RDF graph.</skos:definition>
-</rdfs:Class>
-
-<rdfs:Class rdf:about="#BackupAdminPage">
-	<rdf:type rdf:resource="owl:Class"/>
-	<rdfs:label xml:lang="en">BackupAdminPage</rdfs:label>
-	<skos:definition xml:lang="en">The administrative page to get backups and restore from backups.</skos:definition>
-</rdfs:Class>
-
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#file">
-	<rdf:type rdf:resource="owl:DatatypeProperty" />
-	<rdfs:label xml:lang="en">file</rdfs:label>
-	<skos:definition xml:lang="en">Points to the backup filename of the subject.
-	</skos:definition>
-	<rdfs:domain rdf:resource="#Graph"/>
-	<rdfs:range rdf:resource="xsd:string"/>
-</rdf:Property>
-
-</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
deleted file mode 100644
index 3368915..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2010/03/graph-management#"
-	xml:base="http://clerezza.org/2010/03/graph-management"
-	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-	xmlns:owl="http://www.w3.org/2002/07/owl#"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:skos="http://www.w3.org/2008/05/skos#"
-	xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2010/03/graph-management#">
-	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
-	<dc:title xml:lang="en">
-		Ontology for Graph Management Page related concepts
-	</dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#GraphManagementPage">
-	<rdf:type rdf:resource="owl:Class"/>
-	<rdfs:label xml:lang="en">GraphManagementPage</rdfs:label>
-	<skos:definition xml:lang="en">
-		A web page fro managing triple collections
-	</skos:definition>
-</rdfs:Class>
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#tripleCollection">
-	<rdf:type rdf:resource="owl:ObjectProperty" />
-	<rdfs:label xml:lang="en">tripleCollection</rdfs:label>
-	<skos:definition xml:lang="en">Points to a Triple Collection.
-	</skos:definition>
-	<rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-<rdf:Property rdf:about="#size">
-	<rdf:type rdf:resource="owl:DatatypeProperty" />
-	<rdfs:label xml:lang="en">size</rdfs:label>
-	<skos:definition xml:lang="en">The size (in triples) of a Triple Collection
-	</skos:definition>
-	<rdfs:domain rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-</rdf:RDF>
-

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
deleted file mode 100644
index 60dc58d..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2009/11/sparql-endpoint#"
-	xml:base="http://clerezza.org/2009/11/sparql-endpoint"
-	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-	xmlns:owl="http://www.w3.org/2002/07/owl#"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:skos="http://www.w3.org/2008/05/skos#"
-	xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2009/11/sparql-endpoint#">
-	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
-	<dc:title xml:lang="en">
-		Clerezza Sparql-Endpoint
-	</dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#SparqlEndpoint">
-	<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
-	<rdfs:label xml:lang="en">SparqlEndpoint</rdfs:label>
-	<skos:definition xml:lang="en">
-		A web page containing a form for entering a SPARQL query.
-	</skos:definition>
-</rdfs:Class>
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#tripleCollection">
-	<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty" />
-	<rdfs:label xml:lang="en">tripleCollection</rdfs:label>
-	<skos:definition xml:lang="en">Points to a Triple Collection.
-	</skos:definition>
-	<rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-</rdf:RDF>
-

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/file.storage/pom.xml b/rdf/file.storage/pom.xml
new file mode 100644
index 0000000..4932a7c
--- /dev/null
+++ b/rdf/file.storage/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+     <parent>
+        <artifactId>clerezza</artifactId>
+        <groupId>org.apache.clerezza</groupId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>rdf.file.storage</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - RDF File Storage Provider</name>
+    <description>A file base storage provider</description>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core.test</artifactId>
+            <scope>test</scope>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.parser</artifactId>
+            <scope>test</scope>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.serializer</artifactId>
+            <scope>test</scope>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
new file mode 100644
index 0000000..e9143f9
--- /dev/null
+++ b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.file.storage;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Collection;
+
+import java.util.Iterator;
+import org.apache.commons.rdf.ImmutableGraph;
+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.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraph extends SimpleGraph {
+
+    private Serializer serializer;
+    private File file;
+    private String fileType;
+
+    FileGraph(Iri uri, Parser parser,
+            Serializer serializer) {
+        this(new File(URI.create(uri.getUnicodeString())), parser, serializer);    
+    }
+
+    public FileGraph(File file, Parser parser, Serializer serializer) {
+        this.file = file;
+        String fileEnding = extractFileEnding(file.getPath());
+        fileType = getMediaTypeForFileEnding(fileEnding);
+        this.serializer = serializer;
+        try {
+            if (file.exists() && file.length() != 0) {
+                InputStream fio = new FileInputStream(file);
+                ImmutableGraph graph = parser.parse(fio, fileType);
+                addAllNoFileAccess(graph);
+            } else {
+                file.createNewFile();
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    @Override
+    public boolean add(Triple e) {
+        boolean result = super.add(e);
+        writeToFile();
+        return result;
+    }
+    
+    @Override
+    public boolean addAll(Collection<? extends Triple> c) {
+        boolean modified = addAllNoFileAccess(c);
+        writeToFile();
+        return modified;
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        Iterator<Triple> e = super.filter(null, null, null);
+        while (e.hasNext()) {
+            if (o.equals(e.next())) {
+                e.remove();
+                writeToFile();
+                return true;
+            }
+        }        
+        return false;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        boolean modified = false;
+        Iterator<Triple> e = super.filter(null, null, null);
+        while (e.hasNext()) {
+            if (c.contains(e.next())) {
+                e.remove();
+                modified = true;
+            }            
+        }
+        writeToFile();
+        return modified;
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        boolean result = super.retainAll(c);
+        writeToFile();
+        return result;
+    }
+    
+    @Override
+    public Iterator<Triple> filter(final BlankNodeOrIri subject,
+            final Iri predicate,
+            final RdfTerm object) {
+        final Iterator<Triple> baseIter = super.filter(subject, predicate, object);
+        Iterator<Triple> iterator = new Iterator<Triple>() {
+
+            @Override
+            public boolean hasNext() {
+                return baseIter.hasNext();
+            }
+
+            @Override
+            public Triple next() {
+                return baseIter.next();
+            }
+
+            @Override
+            public void remove() {
+                baseIter.remove();
+                writeToFile();
+            }
+
+        };
+        return iterator;
+    }
+
+    private boolean addAllNoFileAccess(Collection<? extends Triple> c) {
+        boolean modified = false;
+        Iterator<? extends Triple> e = c.iterator();
+        while (e.hasNext()) {
+            if (super.add(e.next())) {
+                modified = true;
+            }
+        }
+        return modified;
+    }
+
+    private String extractFileEnding(String uriString) {
+        String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
+        return fileEnding;
+    }
+
+    private String getMediaTypeForFileEnding(String fileEnding) {
+        if (fileEnding.equals("rdf")) {
+            return SupportedFormat.RDF_XML;
+        }
+        if (fileEnding.equals("nt")) {
+            return SupportedFormat.N_TRIPLE;
+        }
+        if (fileEnding.equals("ttl")) {
+            return SupportedFormat.TURTLE;
+        }
+        if (fileEnding.equals("n3")) {
+            return SupportedFormat.N3;
+        }
+        return null;
+    }
+
+    private void writeToFile() {
+        synchronized(this) {
+            OutputStream out;
+            try {
+                out = new FileOutputStream(file);
+            } catch (FileNotFoundException ex) {
+                throw new RuntimeException(ex);
+            }
+            try {
+                serializer.serialize(out, this, fileType);
+            } finally {
+                try {
+                    out.close();
+                } catch (IOException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        }
+    }
+
+    public void delete() {
+        file.delete();
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
new file mode 100644
index 0000000..0b4fd33
--- /dev/null
+++ b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.file.storage;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.osgi.service.component.ComponentContext;
+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.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+
+/**
+ * The <code>FileTcProvider</code> is a <code>WeightedTcProvider</code> that
+ * stores <code>Graph</code>S in the file system. <code>ImmutableGraph</code>S are not
+ * supported.
+ * The <code>Iri</code> of a Graph is location of the file in the file system
+ * (e.g. "file:///home/user/myGraph.rdf"). The format of the rdf data in the file
+ * depends on the file ending, for example ".rdf" or ".ttl".
+ * <code>FileTcProvider</code> uses
+ * <code>org.apache.clerezza.rdf.core.serializedform.Parser</code> and
+ * <code>org.apache.clerezza.rdf.core.serializedform.Serializer</code> for
+ * parsing and serialization, therefore the supported formats depend on the
+ * availability of these services.
+ * The default weight of the provider is 300.
+ *
+ * @scr.component
+ * @scr.service interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"
+ * @scr.property name="weight" type="Integer" value="300"
+ * 
+ * @author mir
+ */
+public class FileTcProvider implements WeightedTcProvider {
+
+    /**
+     * @scr.reference
+     */
+    private Parser parser;
+    /**
+     * @scr.reference
+     */
+    private Serializer serializer;
+    
+    private Map<Iri, FileGraph> uriRef2GraphMap =
+            new HashMap<Iri, FileGraph>();
+
+    protected static File dataFile = new File("data");
+
+    boolean initialized = false;
+
+    private int weight = 300;
+
+
+    public FileTcProvider() {
+        this.parser = Parser.getInstance();
+        this.serializer = Serializer.getInstance();
+    }
+
+    protected void activate(final ComponentContext componentContext) {
+        weight = (Integer) componentContext.getProperties().get("weight");
+        dataFile = componentContext.getBundleContext().
+                        getDataFile("data");
+    }
+
+    @Override
+    public int getWeight() {
+        return weight;
+    }
+
+    @Override
+    public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
+        throw new NoSuchEntityException(name);
+    }
+
+    /**
+     * Get an <code>Graph</code> by its name. If the file at the specified
+     * location already exists, then a Graph is returned even though it was not
+     * created with createGraph().
+     *
+     * @param the name of the <code>Graph</code>
+     * @return name the <code>Graph</code> with the specified name
+     * @throws NoSuchEntityException if there is no <code>Graph</code>
+     *         with the specified name or the file didn't exist.
+     */
+    @Override
+    public Graph getMGraph(Iri name) throws NoSuchEntityException {
+        initialize();
+        Graph mGraph = uriRef2GraphMap.get(name);
+        if (mGraph == null) {
+            final String uriString = name.getUnicodeString();
+            if (!uriString.startsWith("file:")) {
+                throw new NoSuchEntityException(name);
+            }
+            File file = new File(URI.create(uriString));
+            if (file.exists()) {
+                return createGraph(name);
+            } else {
+                throw new NoSuchEntityException(name);
+            }            
+        }
+        return mGraph;
+    }
+
+    @Override
+    public Graph getGraph(Iri name) throws NoSuchEntityException {
+        return getMGraph(name);
+    }
+
+    @Override
+    public Set<Iri> listImmutableGraphs() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public Set<Iri> listMGraphs() {
+        initialize();
+        return uriRef2GraphMap.keySet();
+    }
+
+    @Override
+    public Set<Iri> listGraphs() {
+        return listMGraphs();
+    }
+
+
+    @Override
+    public Graph createGraph(Iri name) throws 
+            UnsupportedOperationException, EntityAlreadyExistsException {
+        initialize();
+        if (uriRef2GraphMap.containsKey(name)) {
+            throw new EntityAlreadyExistsException(name);
+        }
+        FileGraph mGraph = new FileGraph(name, parser, serializer);
+        uriRef2GraphMap.put(name, mGraph);
+        writeDataFile();
+        return mGraph;
+    }
+
+    @Override
+    public ImmutableGraph createImmutableGraph(Iri name, Graph triples) throws
+            UnsupportedOperationException, EntityAlreadyExistsException {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    @Override
+    public void deleteGraph(Iri name) throws 
+            UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException {
+        initialize();
+        FileGraph mGraph = (FileGraph)getGraph(name);
+        mGraph.delete();
+        uriRef2GraphMap.remove(name);
+        writeDataFile();
+    }
+
+    @Override
+    public Set<Iri> getNames(ImmutableGraph graph) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    private void initialize() throws RuntimeException {
+        if (!initialized) {
+            readDataFile();
+            initialized = true;
+        }
+    }
+
+    private void readDataFile() throws RuntimeException {
+        try {
+            if (dataFile.exists()) {
+                FileInputStream fstream = new FileInputStream(dataFile);
+                DataInputStream in = new DataInputStream(fstream);
+                BufferedReader br = new BufferedReader(new InputStreamReader(in));
+                String strLine;
+                while ((strLine = br.readLine()) != null) {
+                    Iri uriRef = new Iri(strLine);
+                    uriRef2GraphMap.put(uriRef, new FileGraph(uriRef, parser, serializer));
+                }
+                in.close();
+            } else {
+                dataFile.createNewFile();
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    private void writeDataFile() {
+        FileOutputStream fout = null;
+        try {
+            fout = new FileOutputStream(dataFile);
+            for (Iri uri : uriRef2GraphMap.keySet()) {
+                fout.write((uri.getUnicodeString() + "\n").getBytes());
+            }
+        } catch (FileNotFoundException ex) {
+            throw new RuntimeException(ex);
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+        finally {
+            try {
+                fout.close();
+            } catch (IOException ex) {
+                Logger.getLogger(FileTcProvider.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider b/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
new file mode 100644
index 0000000..cd429a2
--- /dev/null
+++ b/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
@@ -0,0 +1 @@
+org.apache.clerezza.rdf.file.storage.FileTcProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
new file mode 100644
index 0000000..e24edb9
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Iterator;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraphTest {
+
+    private static String tempDir = System.getProperty("java.io.tmpdir");
+    private static final String FILE_PROTOCOL = "file://";
+
+    protected static final String NT_FILE_NAME = "test-04.nt";
+    protected static final String RDF_FILE_NAME = "test-04.rdf";
+    protected static final String TURTLE_FILE_NAME = "test-04.ttl";
+
+    private static final Iri uriA = new Iri("http://example.com/a");
+    private static final Iri uriB = new Iri("http://example.com/b");
+    private static final Iri uriC = new Iri("http://example.com/c");
+
+
+    @BeforeClass
+    public static void setup() throws Exception {
+        createTempFileFromRdfTerm(NT_FILE_NAME);
+        createTempFileFromRdfTerm(RDF_FILE_NAME);
+        createTempFileFromRdfTerm(TURTLE_FILE_NAME);
+    }
+
+    @AfterClass
+    public static void cleanUp() throws Exception {
+        deleteTempFile(NT_FILE_NAME);
+        deleteTempFile(RDF_FILE_NAME);
+        deleteTempFile(TURTLE_FILE_NAME);
+    }
+
+    private static void createTempFileFromRdfTerm(String resourceName) 
+            throws FileNotFoundException, IOException {
+        InputStream in = FileTcProviderTest.class.getResourceAsStream(resourceName);
+        File file = new File(URI.create(getTempFileUri(resourceName)));
+        FileOutputStream fout = new FileOutputStream(file);
+        int inByte;
+        while ((inByte = in.read()) != -1) {
+            fout.write(inByte);
+        }
+    }
+    
+    protected static String getTempFileUri(String name) {
+                String prefix = tempDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
+        return prefix + tempDir.replace(File.separatorChar, '/') + "/" + name;
+    }
+
+    private static void deleteTempFile(String name)
+            throws FileNotFoundException, IOException {
+        File file = new File(tempDir + "/" + name);
+        file.delete();
+    }
+    
+    @Test
+    public void testReadingFromFile() {
+        FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(RDF_FILE_NAME)),
+                Parser.getInstance(), Serializer.getInstance());
+        assertEquals(2, mGraph.size());
+
+        mGraph = new FileGraph(new Iri(getTempFileUri(TURTLE_FILE_NAME)),
+                Parser.getInstance(), Serializer.getInstance());
+        assertEquals(2, mGraph.size());
+
+        mGraph = new FileGraph(new Iri(getTempFileUri(NT_FILE_NAME)),
+                Parser.getInstance(), Serializer.getInstance());
+        assertEquals(2, mGraph.size());
+    }
+    
+    @Test
+    public void testFilter() throws IOException {
+        String fileName = "filter.rdf";
+        FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+                Parser.getInstance(), Serializer.getInstance());
+
+        mGraph.add(new TripleImpl(uriA, uriB, uriC));
+        mGraph.add(new TripleImpl(uriC, uriB, uriA));
+
+        mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+                Parser.getInstance(), Serializer.getInstance());
+        
+        
+        assertEquals(2, mGraph.size());
+        Iterator<Triple> iterator = mGraph.filter(null, null, null);
+
+        iterator.next();
+        iterator.remove();
+        assertEquals(1, mGraph.size());
+
+        mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+                Parser.getInstance(), Serializer.getInstance());
+        assertEquals(1, mGraph.size());
+        deleteTempFile(fileName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
new file mode 100644
index 0000000..aeff78d
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import java.util.Set;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+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.NoSuchEntityException;
+
+import org.apache.clerezza.rdf.core.access.TcProvider;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.test.TcProviderTest;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mir
+ */
+public class FileTcProviderTest extends TcProviderTest {
+    private static final String FILE_PROTOCOL = "file://";
+    private static String tempDir = System.getProperty("java.io.tmpdir");
+    private static String testDir = tempDir + "/FileTcProviderTest";
+    
+    
+    @Override
+    protected Iri generateUri(String name) {
+            String prefix = testDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
+        String path =  prefix + testDir.replace('\\', '/') + "/";
+        return new Iri(path + name + ".rdf");
+    }
+
+    @Before
+    public void setupDirectory() {
+        FileUtil.setUpEmptyDirectory(testDir);
+    }
+
+    @After
+    public void deleteDataFile() {
+        FileUtil.delete(FileTcProvider.dataFile);
+    }
+    
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testCreateImmutableGraph() {
+        super.testCreateImmutableGraph();
+    }
+    
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testCreateImmutableGraphExtended() throws Exception {
+        super.testCreateImmutableGraphExtended();
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testGetImmutableGraph() {
+        super.testGetImmutableGraph();
+    }
+
+    
+    @Test
+    @Override
+    public void testGetTriples() {
+        TcProvider fileTcProvider = getInstance();
+        // add Graphs
+        Graph mGraph = new SimpleGraph();
+        // add Graphs
+        mGraph = fileTcProvider.createGraph(uriRefA1);
+        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+        mGraph = fileTcProvider.createGraph(uriRefB1);
+        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+        // get a Graph
+        Graph tripleCollection2 = fileTcProvider.getGraph(uriRefB1);
+
+        Iterator<Triple> iterator = tripleCollection2.iterator();
+        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
+        assertFalse(iterator.hasNext());
+    }
+
+    @Test
+    @Override
+    public void testDeleteEntity() {
+        TcProvider fileTcProvider = getInstance();
+        Graph mGraph = fileTcProvider.createGraph(uriRefA);
+        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+        fileTcProvider.deleteGraph(uriRefA);
+        try {
+            fileTcProvider.getGraph(uriRefA);
+            assertTrue(false);
+        } catch (NoSuchEntityException e) {
+            assertTrue(true);
+        }
+        fileTcProvider = getInstance();
+        try {
+            fileTcProvider.getGraph(uriRefA);
+            assertTrue(false);
+        } catch (NoSuchEntityException e) {
+            assertTrue(true);
+        }
+    }
+
+    @Override
+    protected TcProvider getInstance() {
+        FileTcProvider fileTcProvider = new FileTcProvider();
+        return fileTcProvider;
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    public void testGetNames() {
+        //super.testGetNames();
+        getInstance().getNames(new SimpleGraph().getImmutableGraph());
+    }
+
+    
+    /*@Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testCreateGraphExtended() throws Exception {
+        super.testCreateGraphExtended();
+    }*/
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testCreateGraphNoDuplicateNames() throws Exception {
+        super.testCreateGraphNoDuplicateNames();
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testCreateGraphWithInitialCollection() throws Exception {
+        super.testCreateGraphWithInitialCollection();
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testGraphIsNotMutable() throws Exception {
+        super.testGraphIsNotMutable();
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testGraphDeletion() throws Exception {
+        super.testGraphDeletion();
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    @Override
+    public void testGetTriplesGraph() throws Exception {
+        super.testGetTriples();
+    }
+
+    @Test
+    public void testDataFile() {
+        TcProvider provider = getInstance();
+        provider.createGraph(uriRefA);
+        File dataFile = new File("data");
+        assertTrue(dataFile.exists());
+
+        Set<String> expected = new HashSet<String>();
+        expected.add(uriRefA.getUnicodeString());
+        assertTrue(expected.equals(getLinesFromFile(dataFile)));
+
+        provider.createGraph(uriRefB);
+        expected.add(uriRefB.getUnicodeString());
+        assertTrue(expected.equals(getLinesFromFile(dataFile)));
+    
+        provider.deleteGraph(uriRefA);
+        expected.remove(uriRefA.getUnicodeString());
+        assertTrue(expected.equals(getLinesFromFile(dataFile)));
+        
+        provider.deleteGraph(uriRefB);
+        expected.remove(uriRefB.getUnicodeString());
+        assertTrue(expected.equals(getLinesFromFile(dataFile)));
+    }
+
+    @Test
+    public void testAutoGraphCreationFromExistingFile() throws Exception{
+        FileGraphTest.setup();
+        TcProvider provider = getInstance();
+        Graph mGraph = provider.getGraph(new Iri(
+                FileGraphTest.getTempFileUri(FileGraphTest.RDF_FILE_NAME)));
+        assertEquals(2 ,mGraph.size());
+        FileGraphTest.cleanUp();
+    }
+    
+    private Set<String> getLinesFromFile(File file) throws RuntimeException {
+        try {
+            FileInputStream fstream = new FileInputStream(file);
+            DataInputStream in = new DataInputStream(fstream);
+            BufferedReader br = new BufferedReader(new InputStreamReader(in));
+            String strLine;
+            Set<String> lines = new HashSet<String>();
+            while ((strLine = br.readLine()) != null) {
+                lines.add(strLine);
+            }
+            in.close();
+            return lines;
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
new file mode 100644
index 0000000..e163f8a
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+
+/**
+ *
+ * @author mir
+ */
+public class FileUtil {
+
+     /**
+     * Sets up a new <code>SesameGraph</code>.
+     * @param testName  Name of the test to support.
+     * @throws RepositoryException  If it failed to activate the graph.
+     */
+    public static void setUpEmptyDirectory(String directory) {
+        final File dataDir= new File(directory);
+        dataDir.mkdirs();
+        cleanDirectory(dataDir);
+    }
+
+
+    /**
+     * Cleans the content of the specified directory recursively.
+     * @param dir  Abstract path denoting the directory to clean.
+     */
+    public static void cleanDirectory(File dir) {
+        File[] files= dir.listFiles();
+        if (files!=null && files.length>0) {
+            for (File file: files) {
+                delete(file);
+            }
+        }
+    }
+
+    /**
+     * Deletes the specified file or directory.
+     * @param file  Abstract path denoting the file or directory to clean.
+     */
+    public static void delete(File file) {
+        if (file.isDirectory()) {
+            cleanDirectory(file);
+        }
+        file.delete();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
new file mode 100644
index 0000000..414e4b8
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
@@ -0,0 +1,2 @@
+_:genid1 <http://example.org/base#a> <http://example.org/base#b> .
+<http://example.org/base#c> <http://example.org/base#d> _:genid2 .

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
new file mode 100644
index 0000000..d046a1b
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
@@ -0,0 +1,32 @@
+<?xml version='1.0'?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:j.0="http://example.org/base#" > 
+  <rdf:Description rdf:about="http://example.org/base#c">
+    <j.0:d rdf:nodeID="A0"/>
+  </rdf:Description>
+  <rdf:Description rdf:nodeID="A1">
+    <j.0:a rdf:resource="http://example.org/base#b"/>
+  </rdf:Description>
+</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
new file mode 100644
index 0000000..c518147
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
@@ -0,0 +1,4 @@
+# Test empty [] operator; not allowed as predicate
+@prefix : <http://example.org/base#> .
+[] :a :b .
+:c :d [] .

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/pom.xml b/rdf/pom.xml
index ba6f7e4..de62088 100644
--- a/rdf/pom.xml
+++ b/rdf/pom.xml
@@ -53,7 +53,10 @@
         <module>ontologies</module>
         <module>rdfa</module>
         <module>simple.storage</module>
+        <module>storage.web</module>
+        <module>file.storage</module>
         <module>utils</module>
+        <module>web</module>
     </modules>
 
 </project>

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


[5/9] clerezza git commit: CLEREZZA-966: moved ported rdf.* modules to hierarchy

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/storage.web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/storage.web/pom.xml b/rdf/storage.web/pom.xml
new file mode 100644
index 0000000..4315683
--- /dev/null
+++ b/rdf/storage.web/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <artifactId>rdf.storage.web</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza - RDF Storage Web (Caching Web Storage Provider)</name>
+    <description>A (currently read-only) storage provider retrieving graphs from the web. It
+        implements a caching proxy, relying on another provider for storing triples.</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.ontologies</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.utils</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.scala.utils</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>osgi.services</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+          <groupId>org.scala-lang</groupId>
+          <artifactId>scala-library</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.clerezza.ext</groupId>
+          <artifactId>slf4j-scala-api</artifactId>
+            <version>1.6.3</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <sourceDirectory>src/main/scala</sourceDirectory>
+        <testSourceDirectory>src/test/scala</testSourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
+                        <Export-Package>${project.groupId}.${project.artifactId}</Export-Package>
+                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-eclipse-plugin</artifactId>
+                <configuration>
+                    <downloadSources>true</downloadSources>
+                    <downloadJavadocs>true</downloadJavadocs>
+                    <buildcommands>
+                        <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
+                    </buildcommands>
+                    <additionalProjectnatures>
+                        <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
+                    </additionalProjectnatures>
+                    <classpathContainers>
+                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER
+                        </classpathContainer>
+                        <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER
+                        </classpathContainer>
+                    </classpathContainers>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.scala-tools</groupId>
+                <artifactId>maven-scala-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
----------------------------------------------------------------------
diff --git a/rdf/storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml b/rdf/storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
new file mode 100644
index 0000000..e1bd1fb
--- /dev/null
+++ b/rdf/storage.web/src/main/resources/OSGI-INF/metatype/metatype.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="OSGI-INF/metatype/metatype">
+    <OCD id="org.apache.clerezza.rdf.storage.web.WebProxy"
+         name="Clerezza SCB Web Storage Provider"
+         description="%org.apache.clerezza.rdf.storage.web.WebProxy.description">
+        <AD id="network-timeout" type="int" default="false" name="Network Timeout" description="Specifies the network timeout in ms."/>
+    </OCD>
+    <Designate pid="org.apache.clerezza.rdf.storage.web.WebProxy">
+        <Object ocdref="org.apache.clerezza.rdf.storage.web.WebProxy"/>
+    </Designate>
+</metatype:MetaData>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
----------------------------------------------------------------------
diff --git a/rdf/storage.web/src/main/resources/OSGI-INF/serviceComponents.xml b/rdf/storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
new file mode 100644
index 0000000..ff9b296
--- /dev/null
+++ b/rdf/storage.web/src/main/resources/OSGI-INF/serviceComponents.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+
+    <scr:component enabled="true" name="org.apache.clerezza.rdf.storage.web.WebProxy">
+        <implementation class="org.apache.clerezza.rdf.storage.web.WebProxy"/>
+        <service servicefactory="false">
+            <provide interface="org.apache.clerezza.rdf.storage.web.WebProxy"/>
+            <provide interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"/>
+        </service>
+        <!-- hard coded <property name="weight" type="Integer" value="0"/> -->
+        <reference name="weightedTcProvider" interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"
+                   cardinality="1..n" policy="dynamic" bind="bindWeightedTcProvider" unbind="unbindWeightedTcProvider"/>
+        <reference name="parser" interface="org.apache.clerezza.rdf.core.serializedform.Parser"
+        cardinality="1..1" policy="static" bind="bindParser" unbind="unbindParser"/>
+        <property name="network-timeout" value="3000" type="Integer"/>
+    </scr:component>
+
+</components>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/storage.web/src/main/scala/WebProxy.scala
----------------------------------------------------------------------
diff --git a/rdf/storage.web/src/main/scala/WebProxy.scala b/rdf/storage.web/src/main/scala/WebProxy.scala
new file mode 100644
index 0000000..3a03e3b
--- /dev/null
+++ b/rdf/storage.web/src/main/scala/WebProxy.scala
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.storage.web
+
+
+import org.apache.commons.rdf.ImmutableGraph
+import org.apache.commons.rdf.Iri
+import org.apache.commons.rdf._
+import org.apache.commons.rdf.impl.utils.AbstractGraph
+import org.osgi.service.component.ComponentContext
+import java.io.IOException
+import java.net.{HttpURLConnection, URL}
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat
+import org.apache.clerezza.rdf.core.serializedform.Parser
+import java.security.{PrivilegedExceptionAction, PrivilegedActionException, AccessController}
+
+import org.slf4j.scala._
+import org.apache.clerezza.rdf.core.access._
+import org.apache.clerezza.rdf.core._
+import java.sql.Time
+
+/**
+ * The Web Proxy Service enables applications to request remote (and local) graphs.
+ * It keeps cached version of the remote graphs in store for faster delivery.
+ *
+ */
+class WebProxy extends WeightedTcProvider with Logging {
+
+  val networkTimeoutKey = "network-timeout"
+
+  private var networkTimeout: Int = _
+
+  private var tcProvider: TcProviderMultiplexer = new TcProviderMultiplexer
+
+  /**
+   * Register a provider
+   *
+   * @param provider
+   *            the provider to be registered
+   */
+  protected def bindWeightedTcProvider(provider: WeightedTcProvider): Unit = {
+    tcProvider.addWeightedTcProvider(provider)
+  }
+
+  /**
+   * Deregister a provider
+   *
+   * @param provider
+   *            the provider to be deregistered
+   */
+  protected def unbindWeightedTcProvider(provider: WeightedTcProvider): Unit = {
+    tcProvider.removeWeightedTcProvider(provider)
+  }
+
+  /**OSGI method, called on activation */
+  protected def activate(context: ComponentContext) = {
+    networkTimeout = Integer.parseInt(context.getProperties.get(networkTimeoutKey).toString)
+  }
+
+
+  private var parser: Parser = null
+
+  protected def bindParser(p: Parser) = {
+    parser = p
+  }
+
+  protected def unbindParser(p: Parser) = {
+    parser = null
+  }
+
+  def getWeight: Int = {
+    return 0
+  }
+
+  /**
+   * Any Graph is available as ImmutableGraph as well as immutable Graph
+   *
+   * @param name
+   * @return
+   * @throws NoSuchEntityException
+   */
+  def getMGraph(name: Iri): Graph = {
+    val graph = getImmutableGraph(name)
+    return new AbstractGraph() {
+      protected def performFilter(subject: BlankNodeOrIri, predicate: Iri, `object` : RdfTerm): java.util.Iterator[Triple] = {
+        graph.filter(subject, predicate, `object`)
+      }
+
+      def performSize = graph.size
+    }
+  }
+
+  def getImmutableGraph(name: Iri): ImmutableGraph = {
+    try {
+      getGraph(name, Cache.Fetch)
+    } catch {
+      case e: IOException => {
+          logger.debug("could not get graph by dereferencing uri", e)
+          throw new NoSuchEntityException(name)
+      }
+
+    }
+  }
+
+  def getGraph(name: Iri): Graph = {
+    return getMGraph(name)
+  }
+
+  def createGraph(name: Iri): Graph = {
+    throw new UnsupportedOperationException
+  }
+
+  def createImmutableGraph(name: Iri, triples: Graph): ImmutableGraph = {
+    throw new UnsupportedOperationException
+  }
+
+  def deleteGraph(name: Iri): Unit = {
+    throw new UnsupportedOperationException
+  }
+
+  def getNames(graph: ImmutableGraph): java.util.Set[Iri] = {
+    var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
+    import collection.JavaConversions._
+    for (name <- listGraphs) {
+      if (getImmutableGraph(name).equals(graph)) {
+        result.add(name)
+      }
+    }
+    return result
+  }
+
+  def listGraphs: java.util.Set[Iri] = {
+    var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
+    result.addAll(listMGraphs)
+    result.addAll(listImmutableGraphs)
+    return result
+  }
+
+  def listMGraphs: java.util.Set[Iri] = {
+    //or should we list graphs for which we have a cached version?
+    return java.util.Collections.emptySet[Iri]
+  }
+
+  def listImmutableGraphs: java.util.Set[Iri] = {
+    return java.util.Collections.emptySet[Iri]
+  }
+
+  /**
+   * The semantics of this resource
+   * @param update if a remote URI, update information on the resource first
+   */
+  def getGraph(name: Iri, updatePolicy: Cache.Value): ImmutableGraph = {
+    logger.debug("getting graph " + name)
+    if (name.getUnicodeString.indexOf('#') != -1) {
+      logger.debug("not dereferencing URI with hash sign. Please see CLEREZZA-533 for debate.")
+      throw new NoSuchEntityException(name)
+    }
+    if (name.getUnicodeString.startsWith("urn")) {
+      //these are not dereferenceable
+      throw new NoSuchEntityException(name)
+    }
+    val cacheGraphName = new Iri("urn:x-localinstance:/cache/" + name.getUnicodeString)
+    //todo: follow redirects and keep track of them
+    //todo: keep track of headers especially date and etag. test for etag similarity
+    //todo: for https connection allow user to specify his webid and send his key: ie allow web server to be an agent
+    //todo: add GRDDL functionality, so that other return types can be processed too
+    //todo: enable ftp and other formats (though content negotiation won't work there)
+    def updateGraph() {
+      val url = new URL(name.getUnicodeString)
+      val connection = url.openConnection()
+      connection match {
+        case hc: HttpURLConnection => {
+          hc.addRequestProperty("Accept", acceptHeader)
+          hc.setReadTimeout(networkTimeout)
+          hc.setConnectTimeout(networkTimeout)
+        };
+      }
+      connection.connect()
+      val in = connection.getInputStream()
+      val mediaType = connection.getContentType()
+      val remoteTriples = parser.parse(in, mediaType, name)
+      tcProvider.synchronized {
+        try {
+          tcProvider.deleteGraph(cacheGraphName)
+        } catch {
+          case e: NoSuchEntityException =>;
+        }
+        tcProvider.createImmutableGraph(cacheGraphName, remoteTriples)
+      }
+    }
+    try {
+      //the logic here is not quite right, as we don't look at time of previous fetch.
+      updatePolicy match {
+        case Cache.Fetch => try {
+          tcProvider.getImmutableGraph(cacheGraphName)
+        } catch {
+          case e: NoSuchEntityException => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
+        }
+        case Cache.ForceUpdate => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
+        case Cache.CacheOnly => tcProvider.getImmutableGraph(cacheGraphName)
+      }
+    } catch {
+      case ex: PrivilegedActionException => {
+        var cause: Throwable = ex.getCause
+        if (cause.isInstanceOf[UnsupportedOperationException]) {
+          throw cause.asInstanceOf[UnsupportedOperationException]
+        }
+        if (cause.isInstanceOf[EntityAlreadyExistsException]) {
+          throw cause.asInstanceOf[EntityAlreadyExistsException]
+        }
+        if (cause.isInstanceOf[RuntimeException]) {
+          throw cause.asInstanceOf[RuntimeException]
+        }
+        throw new RuntimeException(cause)
+      }
+    }
+  }
+
+
+  private lazy val acceptHeader = {
+
+    import scala.collection.JavaConversions._
+
+    (for (f <- parser.getSupportedFormats) yield {
+      val qualityOfFormat = {
+        f match {
+          //the default, well established format
+          case SupportedFormat.RDF_XML => "1.0";
+          //n3 is a bit less well defined and/or many parsers supports only subsets
+          case SupportedFormat.N3 => "0.6";
+          //we prefer most dedicated formats to (X)HTML, not because those are "better",
+          //but just because it is quite likely that the pure RDF format will be
+          //lighter (contain less presentation markup), and it is also possible that HTML does not
+          //contain any RDFa, but just points to another format.
+          case SupportedFormat.XHTML => "0.5";
+          //we prefer XHTML over html, because parsing (should) be easier
+          case SupportedFormat.HTML => "0.4";
+          //all other formats known currently are structured formats
+          case _ => "0.8"
+        }
+      }
+      f + "; q=" + qualityOfFormat + ","
+    }).mkString + " *; q=.1" //is that for GRDDL?
+  }
+}
+
+object Cache extends Enumeration {
+  /**fetch if not in cache, if version in cache is out of date, or return cache */
+  val Fetch = Value
+  /**fetch from source whatever is in cache */
+  val ForceUpdate = Value
+  /**only get cached version. If none exists return empty graph */
+  val CacheOnly = Value
+}

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/web/pom.xml b/rdf/web/pom.xml
new file mode 100644
index 0000000..7dc74da
--- /dev/null
+++ b/rdf/web/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>rdf.web</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - RDF Web Access</name>
+    <description>Allows access to Clerezza graphs over HTTP with JAX-RS</description>
+    <modules>
+        <module>rdf.web.core</module>
+        <module>rdf.web.ontologies</module>
+    </modules>
+</project>
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/nbactions.xml
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/nbactions.xml b/rdf/web/rdf.web.core/nbactions.xml
new file mode 100644
index 0000000..49e8307
--- /dev/null
+++ b/rdf/web/rdf.web.core/nbactions.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+    <action>
+        <actionName>CUSTOM-deploy to localhost:8080</actionName>
+        <displayName>deploy to localhost:8080</displayName>
+        <goals>
+            <goal>install</goal>
+            <goal>org.apache.sling:maven-sling-plugin:install</goal>
+        </goals>
+    </action>
+</actions>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/pom.xml b/rdf/web/rdf.web.core/pom.xml
new file mode 100644
index 0000000..2cad597
--- /dev/null
+++ b/rdf/web/rdf.web.core/pom.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7-SNAPSHOT</version>
+        <relativePath />
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>rdf.web.core</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - RDF Web Access Core</name>
+    <description>The core part of Clerezza RDF  Web Access</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.core</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.scalaserverpages</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.serializer</artifactId>
+            <scope>test</scope>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.parser</artifactId>
+            <scope>test</scope>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>jaxrs.utils</artifactId>
+            <version>0.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.ontologies</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.web.ontologies</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.globalmenu.api</artifactId>
+            <version>0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>permissiondescriptions</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>web.fileserver</artifactId>
+            <version>0.10</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
new file mode 100644
index 0000000..440e877
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Backup.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import org.apache.clerezza.platform.Constants;
+import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
+import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesService;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.Graph;
+import org.apache.clerezza.rdf.core.access.security.TcPermission;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.web.ontologies.BACKUP;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+import java.net.URL;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * This JAX-RS resource provides a method to retrieve a zip file containing
+ * all triple collections that the use may access. The triple collection are
+ * serialized in N-Triples format. The URI path of this resource is
+ * "/admin/backup".
+ *
+ * This class adds a global menu-item for users that can read the system graph
+ * (as there's currently no dedicated backup-permission).
+ *
+ * @author hasan, reto
+ */
+@Component
+@Service({Object.class, GlobalMenuItemsProvider.class})
+@Property(name = "javax.ws.rs", boolValue = true)
+@Path("/admin/backup")
+public class Backup implements GlobalMenuItemsProvider {
+
+    final Logger logger = LoggerFactory.getLogger(Backup.class);
+    @Reference
+    private ScalaServerPagesService scalaServerPagesService;
+    private Set<ServiceRegistration> serviceRegistrations = new HashSet<ServiceRegistration>();
+
+    /**
+     * The activate method is called when SCR activates the component configuration.
+     *
+     * @param componentContext
+     */
+    protected void activate(ComponentContext componentContext) {
+        URL templateURL = getClass().getResource("backup-management.ssp");
+        serviceRegistrations.add(scalaServerPagesService.registerScalaServerPage(templateURL, BACKUP.BackupAdminPage, "naked",
+                MediaType.APPLICATION_XHTML_XML_TYPE));
+    }
+
+    protected void deactivate(ComponentContext context) {
+        for (ServiceRegistration r : serviceRegistrations) {
+            r.unregister();
+        }
+    }
+
+    /**
+     * Get a zipped file containing all triple collections which the
+     * user may access. The resource is accessible through the URI path
+     * "/admin/backup/download".
+     * The triple collections are serialized in N-Triples format before being
+     * archived in a single zipped file.
+     * A mapping of the names of the files in the archive to triple collection
+     * names is available as well in the archive as a text file named
+     * triplecollections.nt.
+     *
+     * @return a response that will cause the creation of a zipped file
+     */
+    @GET
+    @Path("download")
+    @Produces("application/zip")
+    public Response download() {
+        AccessController.checkPermission(new BackupPermission());
+        return AccessController.doPrivileged(new PrivilegedAction<Response>() {
+
+            @Override
+            public Response run() {
+                ResponseBuilder responseBuilder = Response.status(Status.OK).
+                        entity(Backup.this);
+                responseBuilder.header("Content-Disposition",
+                        "attachment; filename=backup" + getCurrentDate() + ".zip");
+                return responseBuilder.build();
+            }
+        });
+
+    }
+
+    @GET
+    public GraphNode overviewPage() {
+        Graph resultGraph = new SimpleGraph();
+        GraphNode result = new GraphNode(new BlankNode(), resultGraph);
+        result.addProperty(RDF.type, BACKUP.BackupAdminPage);
+        result.addProperty(RDF.type, PLATFORM.HeadedPage);
+        return result;
+    }
+
+    private String getCurrentDate() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
+        Date date = new Date();
+        return dateFormat.format(date);
+    }
+
+    @Override
+    public Set<GlobalMenuItem> getMenuItems() {
+        //need backup or restore permission for the menu item to be shown
+        Set<GlobalMenuItem> result = new HashSet<GlobalMenuItem>();
+        try {
+            AccessController.checkPermission(new BackupPermission());
+        } catch (AccessControlException e) {
+            try {
+                AccessController.checkPermission(new RestorePermission());
+            } catch (AccessControlException e1) {
+                return result;
+            }
+        }
+        result.add(new GlobalMenuItem("/admin/backup",
+                "BCK", "Backup and Restore", 5, "Administration"));
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
new file mode 100644
index 0000000..5029eea
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupMessageBodyWriter.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.commons.rdf.Graph;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.web.ontologies.BACKUP;
+
+/**
+ * This does the actual work of producing a backup
+ * 
+ * @author hasan, reto
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Produces("application/zip")
+@Provider
+public class BackupMessageBodyWriter implements MessageBodyWriter<Backup> {
+
+    @Reference
+    TcManager tcManager;
+
+    @Reference
+    Serializer serializer;
+
+    final Logger logger = LoggerFactory.getLogger(BackupMessageBodyWriter.class);
+
+    private final String folder = "graphs/";
+
+
+    byte[] createBackup() {
+        ByteArrayOutputStream result = new ByteArrayOutputStream();
+        writeBackup(result);
+        return result.toByteArray();
+    }
+
+    private void archive(ZipOutputStream compressedTcs, 
+            Graph tripleCollection,
+            String fileName) throws IOException, UnsupportedFormatException {
+        Lock readLock = null;
+        compressedTcs.putNextEntry(new ZipEntry(fileName));
+        if (tripleCollection instanceof Graph) {
+            readLock = ((Graph) tripleCollection).getLock().readLock();
+            readLock.lock();
+        }
+        try {
+            serializer.serialize(compressedTcs, tripleCollection,
+                    SupportedFormat.N_TRIPLE);
+        } finally {
+            if (readLock != null) {
+                readLock.unlock();
+            }
+        }
+    }
+
+    private String getTcFileName(Iri tcUri, String extension,
+            Map<String, Integer> fileNameCount) {
+        String fileName = tcUri.getUnicodeString();
+        fileName = fileName.substring(fileName.lastIndexOf("/")+1);
+        Integer count = fileNameCount.get(fileName);
+        if (count == null) {
+            fileNameCount.put(fileName, 0);
+        } else {
+            count++;
+            fileNameCount.put(fileName, count);
+            fileName = fileName.concat("_" + count);
+        }
+        return  fileName.concat(extension);
+    }
+
+    private void writeBackup(OutputStream result) {
+        Map<String, Integer> fileNameCount = new HashMap<String, Integer>();
+        Graph backupContents = new SimpleGraph();
+        try {
+            ZipOutputStream compressedTcs = new ZipOutputStream(result);
+
+            compressedTcs.putNextEntry(new ZipEntry(folder));
+
+            Set<Iri> tripleCollections = tcManager.listGraphs();
+            Iterator<Iri> tcIris = tripleCollections.iterator();
+            while (tcIris.hasNext()) {
+                Iri tcUri = tcIris.next();
+                String fileName = folder + getTcFileName(tcUri, ".nt",
+                        fileNameCount);
+                Graph tripleCollection = tcManager.getGraph(tcUri);
+                archive(compressedTcs, tripleCollection, fileName);
+                if (tripleCollection instanceof Graph) {
+                    backupContents.add(new TripleImpl(tcUri, RDF.type,
+                            BACKUP.Graph));
+                } else {
+                    backupContents.add(new TripleImpl(tcUri, RDF.type,
+                            BACKUP.Graph));
+                }
+                backupContents.add(new TripleImpl(tcUri, BACKUP.file,
+                        LiteralFactory.getInstance().createTypedLiteral(
+                        fileName)));
+            }
+            archive(compressedTcs, backupContents, "triplecollections.nt");
+            compressedTcs.close();
+
+        } catch (UnsupportedFormatException ufe) {
+            throw new WebApplicationException(Response.status(
+                    Status.NOT_ACCEPTABLE).entity(ufe.getMessage()).build());
+        } catch (IOException ex) {
+            throw new WebApplicationException(ex);
+        }
+    }
+
+    @Override
+    public boolean isWriteable(Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType) {
+        return Backup.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public long getSize(Backup t, Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(Backup t, Class<?> type, Type genericType,
+            Annotation[] annotations, MediaType mediaType,
+            MultivaluedMap<String, Object> httpHeaders,
+            OutputStream entityStream) throws IOException, WebApplicationException {
+        writeBackup(entityStream);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
new file mode 100644
index 0000000..caf5d18
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/BackupPermission.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.web.core;
+
+import org.apache.clerezza.permissiondescriptions.PermissionInfo;
+
+import java.security.Permission;
+
+/**
+ * Permission to retrieve a backup copy of all graphs provided by TcManager
+ *
+ * @author reto
+ */
+@PermissionInfo(value="Backup Permission", description="Permission " +
+    "to retrieve a backup of all Triple Collections")
+public class BackupPermission extends Permission {
+
+
+    public BackupPermission() {
+        super("ImmutableGraph Management permission");
+    }
+    /**
+     *
+     * @param target ignored
+     * @param action ignored
+     */
+    public BackupPermission(String target, String actions) {
+        super("ImmutableGraph Management permission");
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        return equals(permission);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return getClass().equals(obj.getClass());
+    }
+
+    @Override
+    public int hashCode() {
+        return 77988;
+    }
+
+    @Override
+    public String getActions() {
+        return "";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
new file mode 100644
index 0000000..c00bf1b
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/Delete.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.web.core;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Graph;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.FOAF;
+import org.apache.clerezza.rdf.ontologies.OWL;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.Smusher;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * Provides a method to remove duplicate noded from (aka smush) a ImmutableGraph
+ * 
+ * @author reto
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/admin/graphs/delete")
+public class Delete {
+    
+    @Reference
+    private TcManager tcManager;
+
+    
+    @POST
+    public Response delete(@Context UriInfo uriInfo, @FormParam("graphName") Iri graphName) {
+        tcManager.deleteGraph(graphName);
+        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
new file mode 100644
index 0000000..886d1e7
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagement.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.web.core;
+
+import java.net.URL;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.TrailingSlash;
+import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
+import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.commons.rdf.Graph;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.ontologies.TCPROVIDER;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.web.ontologies.GRAPHMANAGEMENT;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * This JAX-RS resource provides an interface designed to allow various management
+ * functions on triple collections. The URI path of this resource is
+ * "/admin/graph-management".
+ * 
+ * @author reto
+ */
+@Component
+@Service({Object.class, GlobalMenuItemsProvider.class})
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/admin/graphs")
+public class GraphManagement implements GlobalMenuItemsProvider {
+
+    @Reference
+    private TcManager tcManager;
+
+    @Reference
+    private RenderletManager renderletManager;
+
+    protected void activate(ComponentContext componentContext) {
+        URL templateURL = getClass().getResource("graph-management.ssp");
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new Iri(templateURL.toString()), GRAPHMANAGEMENT.GraphManagementPage,
+                "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+    }
+
+    @GET
+    public GraphNode mainPage(@Context UriInfo uriInfo) {
+        AccessController.checkPermission(new GraphManagementAppPermission());
+        TrailingSlash.enforcePresent(uriInfo);
+        final SimpleGraph resultGraph = new SimpleGraph();
+        GraphNode graphNode = new GraphNode(new BlankNode(), resultGraph);
+        Set<Iri> tripleCollections = tcManager.listGraphs();
+        for (Iri uriRef : tripleCollections) {
+            graphNode.addProperty(GRAPHMANAGEMENT.tripleCollection, uriRef);
+            final Graph tripleCollection = tcManager.getGraph(uriRef);
+            resultGraph.add(new TripleImpl(uriRef,GRAPHMANAGEMENT.size,
+                    LiteralFactory.getInstance().createTypedLiteral(
+                    tripleCollection.size())));
+            if (tripleCollection instanceof ImmutableGraph) {
+                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
+            } else {
+                resultGraph.add(new TripleImpl(uriRef,RDF.type, TCPROVIDER.Graph));
+            }
+        }
+        graphNode.addProperty(RDF.type, GRAPHMANAGEMENT.GraphManagementPage);
+        graphNode.addProperty(RDF.type, PLATFORM.HeadedPage);
+        return graphNode;
+    }
+
+    @Override
+    public Set<GlobalMenuItem> getMenuItems() {
+
+        Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
+        try {
+            AccessController.checkPermission(
+                    new GraphManagementAppPermission());
+        } catch (AccessControlException e) {
+            return items;
+        }
+        String path = "/admin/graphs";
+        items.add(new GlobalMenuItem(path, "GM", "Graphs", 5,"Administration"));
+        return items;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
new file mode 100644
index 0000000..09ec04d
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/GraphManagementAppPermission.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.web.core;
+
+import java.security.Permission;
+import org.apache.clerezza.permissiondescriptions.PermissionInfo;
+
+/**
+ * Permission to use the ImmutableGraph-Management page. Nothe that the user
+ * additioonally needs permssion on the Graphs they manipulate.
+ *
+ * @author reto
+ */
+@PermissionInfo(value="ImmutableGraph Management Access Permission", description="Grants access " +
+    "to the ImmutableGraph Management page")
+public class GraphManagementAppPermission extends Permission {
+
+
+    public GraphManagementAppPermission() {
+        super("ImmutableGraph Management permission");
+    }
+    /**
+     * 
+     * @param target ignored
+     * @param action ignored
+     */
+    public GraphManagementAppPermission(String target, String actions) {
+        super("ImmutableGraph Management permission");
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        return equals(permission);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return getClass().equals(obj.getClass());
+    }
+
+    @Override
+    public int hashCode() {
+        return 77985;
+    }
+
+    @Override
+    public String getActions() {
+        return "";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
new file mode 100644
index 0000000..2d96602
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/PlatformRestorer.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.jaxrs.utils.form.FormFile;
+import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+
+/**
+ * A service to restore the triple collections of a clerezza platform instance
+ *
+ * @author reto
+ */
+@Component
+@Service({Object.class, PlatformRestorer.class})
+@Property(name = "javax.ws.rs", boolValue = true)
+@Path("/admin/backup/restore")
+public class PlatformRestorer {
+
+    @Reference
+    private Restorer restorer;
+
+    @Reference
+    private TcManager tcManager;
+
+    /**
+     * Restores the triple collection of TcManager from a backup
+     *
+     * @param backupData the backup data
+     */
+    public void restore(InputStream backupData) throws IOException {
+        restorer.restore(backupData, tcManager);
+    }
+
+    @POST
+    public Response restore(MultiPartBody body, @Context final UriInfo uriInfo) 
+            throws Throwable {
+        AccessController.checkPermission(new RestorePermission());
+        FormFile[] files = body.getFormFileParameterValues("file");
+        if (files.length != 1) {
+            throw new RuntimeException("Must submit exactly one file");
+        }
+        final FormFile file = files[0];
+        try {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<Response>() {
+
+                @Override
+                public Response run() throws IOException {
+                    restore(new ByteArrayInputStream(file.getContent()));
+                    return RedirectUtil.createSeeOtherResponse("/admin/backup", uriInfo);
+                }
+            });
+        } catch (PrivilegedActionException ex) {
+            throw ex.getCause();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
----------------------------------------------------------------------
diff --git a/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
new file mode 100644
index 0000000..6080df9
--- /dev/null
+++ b/rdf/web/rdf.web.core/src/main/java/org/apache/clerezza/rdf/web/core/RestorePermission.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.web.core;
+
+import org.apache.clerezza.permissiondescriptions.PermissionInfo;
+
+import java.security.Permission;
+
+/**
+ * Permission to restore all graphs provided by TcManager from a backup copy.
+ *
+ * This a very powerfull permission as it allows to write to all graphs.
+ *
+ * @author reto
+ */
+@PermissionInfo(value="Restore Permission", description="Permission " +
+    "to replace all triple collections with the contents of backup file")
+public class RestorePermission extends Permission {
+
+
+    public RestorePermission() {
+        super("Restore permission");
+    }
+    /**
+     *
+     * @param target ignored
+     * @param action ignored
+     */
+    public RestorePermission(String target, String actions) {
+        super("Restore permission");
+    }
+
+    @Override
+    public boolean implies(Permission permission) {
+        return equals(permission);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return getClass().equals(obj.getClass());
+    }
+
+    @Override
+    public int hashCode() {
+        return 77965;
+    }
+
+    @Override
+    public String getActions() {
+        return "";
+    }
+
+}