clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] git commit: CLEREZZA-875: added delete graph functionality
Date Sun, 09 Feb 2014 15:15:52 GMT
Updated Branches:
  refs/heads/master b84bb594b -> ab8d5fe97


CLEREZZA-875: added delete graph functionality

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

Branch: refs/heads/master
Commit: af20ec70c6337524a1e120016ed920a5fe40e4ac
Parents: 83c1997
Author: retobg <reto@apache.org>
Authored: Sun Feb 9 16:14:31 2014 +0100
Committer: retobg <reto@apache.org>
Committed: Sun Feb 9 16:14:31 2014 +0100

----------------------------------------------------------------------
 .../apache/clerezza/rdf/web/core/Delete.java    | 67 ++++++++++++++++++++
 .../clerezza/rdf/web/core/graph-management.ssp  |  6 +-
 2 files changed, 72 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/af20ec70/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..f08e5ce
--- /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.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.TripleCollection;
+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.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.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 Graph
+ * 
+ * @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") UriRef graphName)
{
+        tcManager.deleteTripleCollection(graphName);
+        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af20ec70/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
index ebef72e..da4cb30 100644
--- 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
@@ -30,7 +30,7 @@ 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="2">Actions</th></tr>
+	<tr><th>Name</th><th>Size</th><th>type</th><th
colspan="3">Actions</th></tr>
 				{for (tc <- (res/gm("tripleCollection"))) yield
 					<tr>
 						<td>{tc*}</td>
@@ -47,6 +47,10 @@ import org.apache.clerezza.rdf.scala.utils.RichGraphNode
 							<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>


Mime
View raw message