2010-01-29 22:13:57 +00:00
|
|
|
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
|
|
|
|
2010-10-14 19:10:21 +00:00
|
|
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
|
|
|
|
2013-03-08 17:48:27 -05:00
|
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
2010-01-29 22:13:57 +00:00
|
|
|
|
2011-04-27 20:20:25 +00:00
|
|
|
<%@taglib prefix="vitro" uri="/WEB-INF/tlds/VitroUtils.tld" %>
|
2011-12-21 23:02:31 +00:00
|
|
|
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission" %>
|
2014-10-10 10:07:56 -04:00
|
|
|
<%@page import="edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess"%>
|
|
|
|
<%@page import="edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames"%>
|
2011-12-21 23:02:31 +00:00
|
|
|
<% request.setAttribute("requestedActions", SimplePermission.USE_MISCELLANEOUS_CURATOR_PAGES.ACTION); %>
|
2011-04-27 20:20:25 +00:00
|
|
|
<vitro:confirmAuthorization />
|
2010-01-29 22:13:57 +00:00
|
|
|
|
|
|
|
<%
|
|
|
|
String resourceURIStr = request.getParameter("resourceURI");
|
|
|
|
if (resourceURIStr != null) {
|
|
|
|
|
|
|
|
String describeQueryStr =
|
|
|
|
"DESCRIBE <" + resourceURIStr + ">";
|
|
|
|
|
2014-10-10 10:07:56 -04:00
|
|
|
OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel(ModelNames.FULL_ASSERTIONS);
|
2010-01-29 22:13:57 +00:00
|
|
|
Model resourceDescription = ModelFactory.createDefaultModel();
|
|
|
|
try {
|
|
|
|
ontModel.enterCriticalSection(Lock.READ);
|
|
|
|
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
|
|
|
|
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
|
|
|
|
qe.execDescribe(resourceDescription);
|
|
|
|
|
|
|
|
resourceDescription.add(ontModel.listStatements((Resource) null, (Property) null, ontModel.getResource(resourceURIStr)));
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
ontModel.leaveCriticalSection();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> actionStrList = (request.getParameterValues("action") != null)
|
|
|
|
? Arrays.asList(request.getParameterValues("action"))
|
|
|
|
: new ArrayList<String>();
|
|
|
|
if (actionStrList.contains("remove")) {
|
|
|
|
try {
|
|
|
|
ontModel.enterCriticalSection(Lock.WRITE);
|
|
|
|
ontModel.remove(resourceDescription);
|
|
|
|
} finally {
|
|
|
|
ontModel.leaveCriticalSection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (actionStrList.contains("describe")) {
|
|
|
|
resourceDescription.write(response.getOutputStream(), "TTL");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
|
|
<%@page import="com.hp.hpl.jena.ontology.OntModel"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.shared.Lock"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.query.Syntax"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.query.Query"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.query.QueryFactory"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.query.QueryExecutionFactory"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.ModelFactory"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.Model"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.query.QueryExecution"%>
|
|
|
|
<%@page import="java.util.Arrays"%>
|
|
|
|
<%@page import="java.util.List"%>
|
|
|
|
<%@page import="java.util.ArrayList"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.Resource"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.Property"%>
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.AnonId"%><html>
|
|
|
|
<head>
|
|
|
|
<title>Anonymous Concept Repair Tools</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Remove resource using DESCRIBE</h1>
|
|
|
|
<form action="" method="post">
|
|
|
|
<p>Resource URI: <input name="resourceURI"/></p>
|
|
|
|
<p><input type="checkbox" name="action" value="describe"/> describe resource</p>
|
|
|
|
<p><input type="checkbox" name="action" value="remove"/> remove resource</p>
|
|
|
|
<p><input type="submit" value="Perform action"/></p>
|
|
|
|
</form>
|
|
|
|
</body></html>
|
|
|
|
|