You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/09/09 12:16:29 UTC
[1/3] git commit: MARMOTTA-249: implemented web services
infrastructure to delete prefixes
Updated Branches:
refs/heads/develop 8253fe55d -> 41ae20b2e
MARMOTTA-249: implemented web services infrastructure to delete prefixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/211ce675
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/211ce675
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/211ce675
Branch: refs/heads/develop
Commit: 211ce675ec7f25648caa5e7a733dc7172fd427f7
Parents: 36067d7
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Sep 9 09:06:30 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Sep 9 09:06:30 2013 +0200
----------------------------------------------------------------------
.../platform/core/api/prefix/PrefixService.java | 8 ++++++++
.../core/services/prefix/PrefixServiceImpl.java | 11 +++++++++++
.../core/webservices/prefix/PrefixWebService.java | 18 ++++++++++++++++++
3 files changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/211ce675/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
index 3f49598..497b217 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
@@ -84,6 +84,14 @@ public interface PrefixService {
* @return mappings
*/
Map<String, String> getMappings();
+
+ /**
+ * Delete a prefix mapping
+ *
+ * @param prefix
+ * @return
+ */
+ boolean remove(String prefix);
/**
* Get the CURIE for this URI if possible
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/211ce675/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixServiceImpl.java
index 60d9cc0..b26afe3 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixServiceImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixServiceImpl.java
@@ -127,6 +127,17 @@ public class PrefixServiceImpl implements PrefixService {
public Map<String, String> getMappings() {
return Collections.unmodifiableMap(cache);
}
+
+ @Override
+ public boolean remove(String prefix) {
+ if (cache.containsKey(prefix)) {
+ cache.remove(prefix);
+ configurationService.removeConfiguration(CONFIGURATION_PREFIX + "." + prefix);
+ return true;
+ } else {
+ return false;
+ }
+ }
@Override
public boolean containsPrefix(String prefix) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/211ce675/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
index cf732f0..d76a0a0 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.validation.constraints.NotNull;
+import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -85,6 +86,23 @@ public class PrefixWebService {
return Response.status(Response.Status.NOT_FOUND).entity("prefix " + prefix + " mapping not found").build();
}
}
+
+ /**
+ * Removes a prefix
+ *
+ * @param prefix prefix
+ * @return Response with the result of the operation
+ */
+ @DELETE
+ @Path("/" + PREFIX_PATTERN)
+ @Produces("application/json")
+ public Response deleteMapping(@PathParam("prefix") String prefix) {
+ if (prefixService.remove(prefix)) {
+ return Response.ok().entity(prefix + " deleted").build();
+ } else {
+ return Response.status(Response.Status.NOT_FOUND).entity("prefix " + prefix + " mapping not found").build();
+ }
+ }
/**
* Add new mapping
[3/3] git commit: Merge branch 'develop' of
https://git-wip-us.apache.org/repos/asf/incubator-marmotta into develop
Posted by wi...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-marmotta into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/41ae20b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/41ae20b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/41ae20b2
Branch: refs/heads/develop
Commit: 41ae20b2e7340f5c8af1cbf5a2a01ae2e5fc19d7
Parents: 681a39e 8253fe5
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Sep 9 12:16:14 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Sep 9 12:16:14 2013 +0200
----------------------------------------------------------------------
.../sesame/model/StatementCommonsTest.java | 59 ++--
.../kiwi/reasoner/engine/ReasoningEngine.java | 14 +-
.../kiwi/reasoner/util/JustificationUtils.java | 26 ++
.../engine/JustificationResolutionTest.java | 315 +++++++++++++++++++
.../KiWiRDFSchemaRepositoryConnectionTest.java | 22 +-
.../kiwi/persistence/KiWiConnection.java | 306 +++++++++++-------
parent/pom.xml | 14 +-
7 files changed, 600 insertions(+), 156 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: MARMOTTA-249: fixed delete endpoint, and added ui
Posted by wi...@apache.org.
MARMOTTA-249: fixed delete endpoint, and added ui
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/681a39e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/681a39e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/681a39e1
Branch: refs/heads/develop
Commit: 681a39e13117bcc5183bb0d7e64a172d741a8ee9
Parents: 211ce67
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Sep 9 12:16:06 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Sep 9 12:16:06 2013 +0200
----------------------------------------------------------------------
.../webservices/prefix/PrefixWebService.java | 4 ++--
.../src/main/resources/web/admin/prefixes.html | 23 +++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/681a39e1/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
index d76a0a0..740d53d 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/prefix/PrefixWebService.java
@@ -32,6 +32,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import java.net.URISyntaxException;
import java.util.HashMap;
@@ -95,10 +96,9 @@ public class PrefixWebService {
*/
@DELETE
@Path("/" + PREFIX_PATTERN)
- @Produces("application/json")
public Response deleteMapping(@PathParam("prefix") String prefix) {
if (prefixService.remove(prefix)) {
- return Response.ok().entity(prefix + " deleted").build();
+ return Response.status(Status.NO_CONTENT).build();
} else {
return Response.status(Response.Status.NOT_FOUND).entity("prefix " + prefix + " mapping not found").build();
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/681a39e1/platform/marmotta-core/src/main/resources/web/admin/prefixes.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/prefixes.html b/platform/marmotta-core/src/main/resources/web/admin/prefixes.html
index 65ae361..cdbe6f2 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/prefixes.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/prefixes.html
@@ -36,6 +36,7 @@
<tr>
<th>Prefix</th>
<th>Namespace</th>
+ <th> </th>
</tr>
</table>
@@ -59,13 +60,33 @@
jQuery(document).ready(function() {
function appendPrefix(prefix, namespace) {
- $("table#prefixes > tbody:last").append("<tr><td>" + prefix + "</td><td><a href=\"" + namespace + "\">" + namespace + "</a></td></tr>");
+ $("table#prefixes > tbody:last").append("<tr id=\"prefix-" + prefix + "\"><td>" + prefix + "</td><td><a href=\"" + namespace + "\">" + namespace + "</a></td><td><a href=\"#\" class=\"deletePrefix\">delete</a></td></tr>");
}
+ function deletePrefix(prefix) {
+ $.ajax({
+ url: "../../prefix/" + prefix,
+ type: "DELETE",
+ dataType: "text",
+ statusCode: {
+ 204: function() {
+ alert("Prefix " + prefix + " deleted!");
+ $("tr#prefix-" + prefix).remove();
+ }
+ }
+ });
+ }
+
$.getJSON("../../prefix", function(data) {
$.each(data, function(prefix, namespace) {
appendPrefix(prefix, namespace);
});
+ $("a.deletePrefix").click(function() {
+ var row = $(this).closest("td").closest("tr");
+ var prefix = row.find("td:first").text();
+ deletePrefix(prefix);
+ return false;
+ });
});
$("#add-new-prefix-button").click(function() {