updates for adding concepts and removing redirectToPublication.jsp
This commit is contained in:
parent
9c0ab640fa
commit
b8c70867e0
5 changed files with 29 additions and 87 deletions
|
@ -1,70 +0,0 @@
|
||||||
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
|
||||||
|
|
||||||
<%--
|
|
||||||
This form will not allow an edit but will redirect to the publication.
|
|
||||||
This can be used to skip over an authorship context node.
|
|
||||||
|
|
||||||
What does this do on an add?
|
|
||||||
It shouldn't encounter an add, it will redirect to the subject. Hide the add with in a policy.
|
|
||||||
|
|
||||||
What about the delete link?
|
|
||||||
The delete link will not go to this form. You should hide the delete link with the policy.
|
|
||||||
--%>
|
|
||||||
<%@ page import="java.util.List" %>
|
|
||||||
<%@ page import="java.util.ArrayList" %>
|
|
||||||
<%@ page import="java.util.Arrays" %>
|
|
||||||
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
|
|
||||||
|
|
||||||
<%@ page import="org.apache.commons.logging.Log" %>
|
|
||||||
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
|
||||||
|
|
||||||
<%!
|
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.redirectToObject.jsp");
|
|
||||||
public static String nodeToPubProp = "http://vivoweb.org/ontology/core#linkedInformationResource";
|
|
||||||
%>
|
|
||||||
<%
|
|
||||||
VitroRequest vreq = new VitroRequest(request);
|
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
|
||||||
|
|
||||||
Individual subject = (Individual) request.getAttribute("subject");
|
|
||||||
Individual obj = (Individual) request.getAttribute("object");
|
|
||||||
|
|
||||||
if( obj == null ){
|
|
||||||
log.warn("this custom form is intended to redirect to the object but none was found.");
|
|
||||||
%>
|
|
||||||
<jsp:forward page="/individual">
|
|
||||||
<jsp:param value="${subjectUri}" name="uri"/>
|
|
||||||
</jsp:forward>
|
|
||||||
<%
|
|
||||||
}else{
|
|
||||||
List<ObjectPropertyStatement> stmts = obj.getObjectPropertyStatements( nodeToPubProp );
|
|
||||||
if( stmts == null || stmts.size() == 0 ){
|
|
||||||
%>
|
|
||||||
<jsp:forward page="/individual">
|
|
||||||
<jsp:param value="${subjectUri}" name="uri"/>
|
|
||||||
</jsp:forward>
|
|
||||||
<%
|
|
||||||
} else {
|
|
||||||
ObjectPropertyStatement ops = stmts.get(0);
|
|
||||||
String pubUri = ops.getObjectURI();
|
|
||||||
if( pubUri != null ){
|
|
||||||
%>
|
|
||||||
<jsp:forward page="/individual">
|
|
||||||
<jsp:param value="<%= pubUri %>" name="uri"/>
|
|
||||||
</jsp:forward>
|
|
||||||
<%
|
|
||||||
} else{
|
|
||||||
%>
|
|
||||||
<jsp:forward page="/individual">
|
|
||||||
<jsp:param value="${subjectUri}" name="uri"/>
|
|
||||||
</jsp:forward>
|
|
||||||
<% }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
<#--This is set for testing purposes - will be retrieved dynamically from the generator later-->
|
<#--This is set for testing purposes - will be retrieved dynamically from the generator later-->
|
||||||
<#assign sources = [{"uri":"UMLS", "label":"UMLS"}, {"uri":"Agrovoc", "label":"Agrovoc"}]/>
|
<#assign sources = [{"uri":"http://link.informatics.stonybrook.edu/umls/", "label":"UMLS"}, {"uri":"http://www.agrovoc.com", "label":"Agrovoc"}]/>
|
||||||
<#assign selectedSource = "UMLS" />
|
<#assign selectedSource = "UMLS" />
|
||||||
|
|
||||||
<h2>Manage Concepts</h2>
|
<h2>Manage Concepts</h2>
|
||||||
|
|
|
@ -161,7 +161,8 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
||||||
private List<String> generateN3Required(VitroRequest vreq) {
|
private List<String> generateN3Required(VitroRequest vreq) {
|
||||||
return list(
|
return list(
|
||||||
getPrefixesString() + "\n" +
|
getPrefixesString() + "\n" +
|
||||||
"?subject ?predicate ?conceptNode .\n"
|
"?subject ?predicate ?conceptNode .\n" +
|
||||||
|
"?conceptNode <" + RDF.type.getURI() + "> <http://www.w3.org/2002/07/owl#Thing> ."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,4 @@ public abstract class VivoBaseGenerator extends BaseEditConfigurationGenerator i
|
||||||
final static String orgClass ="http://xmlns.com/foaf/0.1/Organization" ;
|
final static String orgClass ="http://xmlns.com/foaf/0.1/Organization" ;
|
||||||
final static String personClass = foaf + "Person";
|
final static String personClass = foaf + "Person";
|
||||||
|
|
||||||
//TODO: Define these elsewhere
|
|
||||||
final static String UMLSClass = vivoCore + "UMLS";
|
|
||||||
final static String AgrovocClass = vivoCore + "Agrovoc";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,10 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
private static String conceptNodeBase = "conceptNode";
|
private static String conceptNodeBase = "conceptNode";
|
||||||
private static String sourceBase = "conceptSource";
|
private static String sourceBase = "conceptSource";
|
||||||
private static String labelBase = "conceptLabel";
|
private static String labelBase = "conceptLabel";
|
||||||
//Also storing submission
|
//Also storing submission values
|
||||||
|
private static String conceptNodeValues = null;
|
||||||
|
private static String conceptLabelValues = null;
|
||||||
|
private static String conceptSourceValues = null;
|
||||||
private static MultiValueEditSubmission submission = null;
|
private static MultiValueEditSubmission submission = null;
|
||||||
|
|
||||||
// String datatype
|
// String datatype
|
||||||
|
@ -46,7 +49,7 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
// Get the input elements for concept node and concept label as well
|
// Get the input elements for concept node and concept label as well
|
||||||
// as vocab uri (which is based on thge
|
// as vocab uri (which is based on thge
|
||||||
// For query parameters, check whether CUI
|
// For query parameters, check whether CUI
|
||||||
String conceptNodeValues = getConceptNodeValues();
|
copySubmissionValues();
|
||||||
|
|
||||||
if (conceptNodeValues != null) {
|
if (conceptNodeValues != null) {
|
||||||
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
||||||
|
@ -60,11 +63,22 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Since we will change the uris and literals from form, we should make copies
|
||||||
|
//of the original values and store them, this will also make iterations
|
||||||
|
//and updates to the submission independent from accessing the values
|
||||||
|
private void copySubmissionValues() {
|
||||||
|
conceptLabelValues = getConceptLabelValues();
|
||||||
|
conceptNodeValues = getConceptNodeValues();
|
||||||
|
conceptSourceValues = getConceptSourceValues();
|
||||||
|
}
|
||||||
|
|
||||||
private void processConceptNodes(int numberConcepts) {
|
private void processConceptNodes(int numberConcepts) {
|
||||||
//There are no "new" resources b/c the concept nodes are URIs from external vocabularies
|
//There are no "new" resources b/c the concept nodes are URIs from external vocabularies
|
||||||
// Add N3Required
|
// Add N3Required
|
||||||
addN3Required(numberConcepts);
|
addN3Required(numberConcepts);
|
||||||
|
//Add N3 Optional as well
|
||||||
|
addN3Optional(numberConcepts);
|
||||||
// Add URIs on Form and Add Literals On Form
|
// Add URIs on Form and Add Literals On Form
|
||||||
addLiteralsAndUrisOnForm(numberConcepts);
|
addLiteralsAndUrisOnForm(numberConcepts);
|
||||||
// Add fields
|
// Add fields
|
||||||
|
@ -88,13 +102,13 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConceptNodeInputs(int numberConcepts) {
|
private void addConceptNodeInputs(int numberConcepts) {
|
||||||
//Get the current value
|
|
||||||
String conceptNodeValues = getConceptNodeValues();
|
|
||||||
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
||||||
if(conceptNodes != null && conceptNodes.length == numberConcepts) {
|
if(conceptNodes != null && conceptNodes.length == numberConcepts) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 1; i <= numberConcepts; i++) {
|
//iterate through the concept nodes converted string array
|
||||||
int suffix = i;
|
for(i = 0; i < numberConcepts; i++) {
|
||||||
|
int suffix = i + 1;
|
||||||
String conceptInputName = conceptNodeBase + suffix;
|
String conceptInputName = conceptNodeBase + suffix;
|
||||||
String[] nodeValues = new String[1];
|
String[] nodeValues = new String[1];
|
||||||
nodeValues[0] = conceptNodes[i];
|
nodeValues[0] = conceptNodes[i];
|
||||||
|
@ -110,12 +124,11 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConceptSourceInputs(int numberConcepts) {
|
private void addConceptSourceInputs(int numberConcepts) {
|
||||||
String conceptSourceValues = getConceptSourceValues();
|
|
||||||
String[] conceptSources = convertDelimitedStringToArray(conceptSourceValues);
|
String[] conceptSources = convertDelimitedStringToArray(conceptSourceValues);
|
||||||
if(conceptSources != null && conceptSources.length == numberConcepts) {
|
if(conceptSources != null && conceptSources.length == numberConcepts) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 1; i <= numberConcepts; i++) {
|
for(i = 0; i < numberConcepts; i++) {
|
||||||
int suffix = i;
|
int suffix = i + 1;
|
||||||
String conceptInputName = sourceBase + suffix;
|
String conceptInputName = sourceBase + suffix;
|
||||||
String[] sourceValues = new String[1];
|
String[] sourceValues = new String[1];
|
||||||
sourceValues[0] = conceptSources[i];
|
sourceValues[0] = conceptSources[i];
|
||||||
|
@ -130,12 +143,11 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConceptLabelInputs(int numberConcepts) {
|
private void addConceptLabelInputs(int numberConcepts) {
|
||||||
String conceptLabelValues = getConceptLabelValues();
|
|
||||||
String[] labels = convertDelimitedStringToArray(conceptLabelValues);
|
String[] labels = convertDelimitedStringToArray(conceptLabelValues);
|
||||||
if(labels != null && labels.length == numberConcepts) {
|
if(labels != null && labels.length == numberConcepts) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 1; i <= numberConcepts; i++) {
|
for(i = 0; i < numberConcepts; i++) {
|
||||||
int suffix = i;
|
int suffix = i + 1;
|
||||||
String labelInputName = labelBase + suffix;
|
String labelInputName = labelBase + suffix;
|
||||||
String[] labelValues = new String[1];
|
String[] labelValues = new String[1];
|
||||||
labelValues[0] = labels[i];
|
labelValues[0] = labels[i];
|
||||||
|
@ -301,5 +313,7 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
return null;
|
return null;
|
||||||
return inputList.get(0);
|
return inputList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue