NIHVIVO-436 code for automatic prefixes to SPARQL construct added.
This commit is contained in:
parent
7eed885b7c
commit
c2ceee460b
1 changed files with 108 additions and 89 deletions
|
@ -1,14 +1,14 @@
|
||||||
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
||||||
|
|
||||||
<%@ page import="com.hp.hpl.jena.ontology.Individual" %>
|
<%@ page import="com.hp.hpl.jena.ontology.Individual"%>
|
||||||
<%@ page import="com.hp.hpl.jena.ontology.OntModel" %>
|
<%@ page import="com.hp.hpl.jena.ontology.OntModel"%>
|
||||||
<%@ page import="com.hp.hpl.jena.rdf.model.ModelMaker" %>
|
<%@ page import="com.hp.hpl.jena.rdf.model.ModelMaker"%>
|
||||||
<%@ page import="com.hp.hpl.jena.shared.Lock" %>
|
<%@ page import="com.hp.hpl.jena.shared.Lock"%>
|
||||||
<%@ page import="java.util.Iterator" %>
|
<%@ page import="java.util.Iterator"%>
|
||||||
<%@ page import="java.util.List" %>
|
<%@ page import="java.util.List"%>
|
||||||
<%@ page import="java.net.URLEncoder" %>
|
<%@ page import="java.net.URLEncoder"%>
|
||||||
|
|
||||||
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
|
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
|
|
||||||
|
@ -19,34 +19,34 @@
|
||||||
|
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
||||||
<%@page import="java.util.HashSet"%>
|
<%@page import="java.util.HashSet"%>
|
||||||
<%@page import="java.util.Set"%>
|
<%@page import="java.util.Set"%>
|
||||||
<%@page import="java.util.Arrays"%>
|
<%@page import="java.util.Arrays"%>
|
||||||
<%@page import="java.util.ArrayList"%><h2>Execute SPARQL CONSTRUCT Query</h2>
|
<%@page import="java.util.ArrayList"%><h2>Execute SPARQL CONSTRUCT
|
||||||
|
Query</h2>
|
||||||
|
|
||||||
<p><a href="ingest">Ingest Home</a></p>
|
<p><a href="ingest">Ingest Home</a></p>
|
||||||
|
|
||||||
<c:if test="${requestScope.constructedStmtCount != null}">
|
<c:if test="${requestScope.constructedStmtCount != null}">
|
||||||
<h3 class="notice">${requestScope.constructedStmtCount} statements CONSTRUCTed</h3>
|
<h3 class="notice">${requestScope.constructedStmtCount} statements
|
||||||
</c:if>
|
CONSTRUCTed</h3>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<c:if test="${errorMsg != null}">
|
<c:if test="${errorMsg != null}">
|
||||||
<h3 class="error">${requestScope.errorMsg}</h3>
|
<h3 class="error">${requestScope.errorMsg}</h3>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="${requestScope.validationMessage != null}">
|
<c:if test="${requestScope.validationMessage != null}">
|
||||||
<h3 class="notice">${requestScope.validationMessage}</h3>
|
<h3 class="notice">${requestScope.validationMessage}</h3>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<form action="ingest" method="post">
|
<form action="ingest" method="post"><input type="hidden"
|
||||||
<input type="hidden" name="action" value="executeSparql"/>
|
name="action" value="executeSparql" />
|
||||||
|
|
||||||
<h3>SPARQL Query
|
<h3>SPARQL Query <select name="savedQuery">
|
||||||
|
<option value="">select saved query</option>
|
||||||
<select name="savedQuery">
|
<%
|
||||||
<option value="">select saved query</option>
|
|
||||||
<%
|
|
||||||
OntModel jenaOntModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
OntModel jenaOntModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
||||||
jenaOntModel.enterCriticalSection(Lock.READ);
|
jenaOntModel.enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
|
@ -55,15 +55,15 @@
|
||||||
Individual savedQuery = (Individual) it.next();
|
Individual savedQuery = (Individual) it.next();
|
||||||
String queryURI = savedQuery.getURI();
|
String queryURI = savedQuery.getURI();
|
||||||
String queryLabel = savedQuery.getLabel(null);
|
String queryLabel = savedQuery.getLabel(null);
|
||||||
%> <option value="<%=queryURI%>"><%=queryLabel%></option> <%
|
%>
|
||||||
|
<option value="<%=queryURI%>"><%=queryLabel%></option>
|
||||||
|
<%
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
jenaOntModel.leaveCriticalSection();
|
jenaOntModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
</select>
|
</select> <textarea rows="16" cols="40" name="sparqlQueryStr"><c:choose>
|
||||||
|
|
||||||
<textarea rows="16" cols="40" name="sparqlQueryStr"><c:choose>
|
|
||||||
<c:when test="${param.sparqlQueryStr != null}">
|
<c:when test="${param.sparqlQueryStr != null}">
|
||||||
${param.sparqlQueryStr}
|
${param.sparqlQueryStr}
|
||||||
</c:when>
|
</c:when>
|
||||||
|
@ -73,16 +73,29 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
||||||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
||||||
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
||||||
|
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
|
||||||
|
PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#><%List prefixes = (List)request.getAttribute("prefixList");
|
||||||
|
if(prefixes != null){
|
||||||
|
Iterator prefixItr = prefixes.iterator();
|
||||||
|
Integer count = 0;
|
||||||
|
while (prefixItr.hasNext()){
|
||||||
|
String prefixText = (String) prefixItr.next();
|
||||||
|
if(prefixText.equals("(not yet specified)")){
|
||||||
|
count++;
|
||||||
|
prefixText = "j." + count.toString();
|
||||||
|
}
|
||||||
|
String urlText = (String) prefixItr.next();%>
|
||||||
|
PREFIX <%=prefixText%>: <<%=urlText%>><%}}%>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
|
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
<h3>Select Source Models</h3>
|
<h3>Select Source Models</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<%
|
<%
|
||||||
List<String> sourceModelNameList = new ArrayList<String>();
|
List<String> sourceModelNameList = new ArrayList<String>();
|
||||||
String[] sourceModelParamVals = request.getParameterValues("sourceModelName");
|
String[] sourceModelParamVals = request.getParameterValues("sourceModelName");
|
||||||
if (sourceModelParamVals != null) {
|
if (sourceModelParamVals != null) {
|
||||||
|
@ -90,77 +103,83 @@ PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<li><input type="checkbox" name="sourceModelName" value="vitro:jenaOntModel"
|
<li><input type="checkbox" name="sourceModelName"
|
||||||
<%
|
value="vitro:jenaOntModel"
|
||||||
|
<%
|
||||||
if (sourceModelNameList.contains("vitro:jenaOntModel")) {
|
if (sourceModelNameList.contains("vitro:jenaOntModel")) {
|
||||||
%>checked="checked"<%
|
%>
|
||||||
|
checked="checked" <%
|
||||||
}
|
}
|
||||||
%>
|
%> />webapp
|
||||||
/>webapp model</li>
|
model</li>
|
||||||
<li><input type="checkbox" name="sourceModelName" value="vitro:baseOntModel"
|
<li><input type="checkbox" name="sourceModelName"
|
||||||
<%
|
value="vitro:baseOntModel"
|
||||||
|
<%
|
||||||
if (sourceModelNameList.contains("vitro:baseOntModel")) {
|
if (sourceModelNameList.contains("vitro:baseOntModel")) {
|
||||||
%>checked="checked"<%
|
%>
|
||||||
|
checked="checked" <%
|
||||||
}
|
}
|
||||||
%>
|
%> />webapp
|
||||||
/>webapp assertions</li>
|
assertions</li>
|
||||||
<%
|
<%
|
||||||
for (Iterator it = maker.listModels(); it.hasNext(); ) {
|
for (Iterator it = maker.listModels(); it.hasNext(); ) {
|
||||||
String modelName = (String) it.next();
|
String modelName = (String) it.next();
|
||||||
%> <li> <input type="checkbox" name="sourceModelName" value="<%=modelName%>"
|
%>
|
||||||
<%
|
<li><input type="checkbox" name="sourceModelName"
|
||||||
|
value="<%=modelName%>"
|
||||||
|
<%
|
||||||
if (sourceModelNameList.contains(modelName)) {
|
if (sourceModelNameList.contains(modelName)) {
|
||||||
%> checked="checked" <%
|
%>
|
||||||
|
checked="checked" <%
|
||||||
}
|
}
|
||||||
%>
|
%> /><%=modelName%></li>
|
||||||
/><%=modelName%></li>
|
<%
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Select Destination Model</h3>
|
<h3>Select Destination Model</h3>
|
||||||
|
|
||||||
<select name="destinationModelName">
|
<select name="destinationModelName">
|
||||||
<option value="vitro:jenaOntModel"
|
<option value="vitro:jenaOntModel"
|
||||||
<% if ("vitro:jenaOntModel".equals(request.getParameter("destinationModelName"))) {
|
<% if ("vitro:jenaOntModel".equals(request.getParameter("destinationModelName"))) {
|
||||||
%> selected="selected" <%
|
%>
|
||||||
|
selected="selected" <%
|
||||||
}
|
}
|
||||||
%>
|
%> />webapp
|
||||||
/>webapp model</option>
|
model</option>
|
||||||
<option value="vitro:baseOntModel"
|
<option value="vitro:baseOntModel"
|
||||||
<% if ("vitro:baseOntModel".equals(request.getParameter("destinationModelName"))) {
|
<% if ("vitro:baseOntModel".equals(request.getParameter("destinationModelName"))) {
|
||||||
%> selected="selected" <%
|
%>
|
||||||
|
selected="selected" <%
|
||||||
}
|
}
|
||||||
%>
|
%> />webapp
|
||||||
/>webapp assertions</option>
|
assertions</option>
|
||||||
<%
|
<%
|
||||||
for (Iterator it = maker.listModels(); it.hasNext(); ) {
|
for (Iterator it = maker.listModels(); it.hasNext(); ) {
|
||||||
String modelName = (String) it.next();
|
String modelName = (String) it.next();
|
||||||
%> <option value="<%=modelName%>"
|
%>
|
||||||
<%
|
<option value="<%=modelName%>"
|
||||||
|
<%
|
||||||
if (modelName.equals(request.getParameter("destinationModelName"))) {
|
if (modelName.equals(request.getParameter("destinationModelName"))) {
|
||||||
%> selected="selected" <%
|
%>
|
||||||
|
selected="selected" <%
|
||||||
}
|
}
|
||||||
%>
|
%> /><%=modelName%></option>
|
||||||
/><%=modelName%></option>
|
<%
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
</select>
|
</select> <c:choose>
|
||||||
|
<c:when test="${paramValues['reasoning'] != null}">
|
||||||
<c:choose>
|
<c:forEach var="paramValue" items="${paramValues['reasoning']}">
|
||||||
<c:when test="${paramValues['reasoning'] != null}">
|
<c:if test="${paramValue eq 'pellet'}">
|
||||||
<c:forEach var="paramValue" items="${paramValues['reasoning']}">
|
<p><input type="checkbox" name="reasoning" value="pellet"
|
||||||
<c:if test="${paramValue eq 'pellet'}">
|
checked="checked" /> include pellet reasoning</p>
|
||||||
<p><input type="checkbox" name="reasoning" value="pellet" checked="checked"/> include pellet reasoning </p>
|
</c:if>
|
||||||
</c:if>
|
</c:forEach>
|
||||||
</c:forEach>
|
</c:when>
|
||||||
</c:when>
|
<c:otherwise>
|
||||||
<c:otherwise>
|
<p><input type="checkbox" name="reasoning" value="pellet" />
|
||||||
<p><input type="checkbox" name="reasoning" value="pellet" /> include Pellet OWL-DL reasoning </p>
|
include Pellet OWL-DL reasoning</p>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose> <input type="submit" value="Execute CONSTRUCT" />
|
||||||
|
|
||||||
<input type="submit" value="Execute CONSTRUCT"/>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue