Working on converting addRoleToPersonTwoStage to date time with precision NIHVIVO-631
This commit is contained in:
parent
05d1dd8721
commit
fcfbf97f54
1 changed files with 136 additions and 18 deletions
|
@ -47,7 +47,9 @@
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
|
||||||
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
||||||
|
|
||||||
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%><c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
|
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%>
|
||||||
|
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%>
|
||||||
|
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%><c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
|
||||||
|
|
||||||
<%!
|
<%!
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.addRoleToPersonTwoStage.jsp");
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.addRoleToPersonTwoStage.jsp");
|
||||||
|
@ -144,9 +146,21 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
<c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
|
<c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
|
||||||
<c:set var="vivoCore" value="${vivoOnt}/core#" />
|
<c:set var="vivoCore" value="${vivoOnt}/core#" />
|
||||||
<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" />
|
<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" />
|
||||||
|
<c:set var="type" value="<%= VitroVocabulary.RDF_TYPE %>" />
|
||||||
<c:set var="label" value="${rdfs}label" />
|
<c:set var="label" value="${rdfs}label" />
|
||||||
<c:set var="defaultNamespace" value=""/> <%--blank triggers default URI generation behavior --%>
|
<c:set var="defaultNamespace" value=""/> <%--blank triggers default URI generation behavior --%>
|
||||||
|
|
||||||
|
<c:set var="startYearPred" value="${vivoCore}startYear" />
|
||||||
|
<c:set var="endYearPred" value="${vivoCore}endYear" />
|
||||||
|
<c:set var="dateTimeValueType" value="${vivoCore}DateTimeValue"/>
|
||||||
|
<c:set var="dateTimePrecision" value="${vivoCore}dateTimePrecision"/>
|
||||||
|
<c:set var="dateTimeValue" value="${vivoCore}dateTime"/>
|
||||||
|
|
||||||
|
<c:set var="roleToInterval" value="${vivoCore}dateTimeInterval"/>
|
||||||
|
<c:set var="intervalType" value="${vivoCore}DateTimeInterval"/>
|
||||||
|
<c:set var="intervalToStart" value="${vivoCore}start"/>
|
||||||
|
<c:set var="intervalToEnd" value="${vivoCore}end"/>
|
||||||
|
|
||||||
<%-- label and type required if we are doing an add or a repair, but not an edit --%>
|
<%-- label and type required if we are doing an add or a repair, but not an edit --%>
|
||||||
<c:set var="labelRequired" ><%= (mode == 1 || mode == 3) ?"\"nonempty\"," : "" %></c:set>
|
<c:set var="labelRequired" ><%= (mode == 1 || mode == 3) ?"\"nonempty\"," : "" %></c:set>
|
||||||
<c:set var="typeRequired" ><%= (mode == 1 || mode == 3) ?"\"nonempty\"" : "" %></c:set>
|
<c:set var="typeRequired" ><%= (mode == 1 || mode == 3) ?"\"nonempty\"" : "" %></c:set>
|
||||||
|
@ -207,6 +221,24 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
?role ?inverseRolePredicate ?person.
|
?role ?inverseRolePredicate ?person.
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="n3ForStart">
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToStart}> ?startNode .
|
||||||
|
?startNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?startNode <${dateTimeValue}> ?startField.value .
|
||||||
|
?startNode <${dateTimePrecision}> ?startField.precision .
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="n3ForEnd">
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToEnd}> ?endNode .
|
||||||
|
?endNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?endNode <${dateTimeValue}> ?endField.value .
|
||||||
|
?endNode <${dateTimePrecision}> ?endField.precision .
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
<v:jsonset var="activityLabelQuery">
|
<v:jsonset var="activityLabelQuery">
|
||||||
PREFIX core: <${vivoCore}>
|
PREFIX core: <${vivoCore}>
|
||||||
PREFIX rdfs: <${rdfs}>
|
PREFIX rdfs: <${rdfs}>
|
||||||
|
@ -240,6 +272,64 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
}
|
}
|
||||||
</v:jsonset>
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingIntervalNodeQuery" >
|
||||||
|
SELECT ?existingIntervalNode WHERE {
|
||||||
|
?role <${roleToInterval}> ?existingIntervalNode .
|
||||||
|
?existingIntervalNode <${type}> <${intervalType}> . }
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingStartNodeQuery" >
|
||||||
|
SELECT ?existingStartNode WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToStart}> ?existingStartNode .
|
||||||
|
?existingStartNode <${type}> <${dateTimeValueType}> .}
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingStartDateQuery" >
|
||||||
|
SELECT ?existingDateStart WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToStart}> ?startNode .
|
||||||
|
?startNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?startNode <${dateTimeValue}> ?existingDateStart . }
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingStartPrecisionQuery" >
|
||||||
|
SELECT ?existingStartPrecision WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToStart}> ?startNode .
|
||||||
|
?startNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?startNode <${dateTimePrecision}> ?existingStartPrecision . }
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingEndNodeQuery" >
|
||||||
|
SELECT ?existingEndNode WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToEnd}> ?existingEndNode .
|
||||||
|
?existingEndNode <${type}> <${dateTimeValueType}> .}
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingEndDateQuery" >
|
||||||
|
SELECT ?existingEndDate WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToEnd}> ?endNode .
|
||||||
|
?endNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?endNode <${dateTimeValue}> ?existingEndDate . }
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
|
<v:jsonset var="existingEndPrecisionQuery" >
|
||||||
|
SELECT ?existingEndPrecision WHERE {
|
||||||
|
?role <${roleToInterval}> ?intervalNode .
|
||||||
|
?intervalNode <${type}> <${intervalType}> .
|
||||||
|
?intervalNode <${intervalToEnd}> ?endNode .
|
||||||
|
?endNode <${type}> <${dateTimeValueType}> .
|
||||||
|
?endNode <${dateTimePrecision}> ?existingEndPrecision . }
|
||||||
|
</v:jsonset>
|
||||||
|
|
||||||
<c:set var="editjson" scope="request">
|
<c:set var="editjson" scope="request">
|
||||||
{
|
{
|
||||||
"formUrl" : "${formUrl}",
|
"formUrl" : "${formUrl}",
|
||||||
|
@ -250,11 +340,14 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
"predicate" : ["rolePredicate", "${predicateUriJson}" ],
|
"predicate" : ["rolePredicate", "${predicateUriJson}" ],
|
||||||
"object" : ["role", "${objectUriJson}", "URI" ],
|
"object" : ["role", "${objectUriJson}", "URI" ],
|
||||||
|
|
||||||
"n3required" : [ "${n3ForNewRole}", "${startYearAssertion}", "${roleLabelAssertion}" ],
|
"n3required" : [ "${n3ForNewRole}", "${n3ForStart}", "${roleLabelAssertion}" ],
|
||||||
"n3optional" : [ "${n3ForActivityLabel}", "${n3ForActivityType}", "${n3ForInverse}", "${endYearAssertion}" ],
|
"n3optional" : [ "${n3ForActivityLabel}", "${n3ForActivityType}", "${n3ForInverse}", "${n3ForEnd}" ],
|
||||||
|
|
||||||
"newResources" : { "role" : "${defaultNamespace}",
|
"newResources" : { "role" : "${defaultNamespace}",
|
||||||
"roleActivity" : "${defaultNamespace}" },
|
"roleActivity" : "${defaultNamespace}",
|
||||||
|
"intervalNode" : "${defaultNamespace}",
|
||||||
|
"startNode" : "${defaultNamespace}",
|
||||||
|
"endNode" : "${defaultNamespace}" },
|
||||||
|
|
||||||
"urisInScope" : { "inverseRolePredicate" : "${inversePredicate}" },
|
"urisInScope" : { "inverseRolePredicate" : "${inversePredicate}" },
|
||||||
"literalsInScope": { },
|
"literalsInScope": { },
|
||||||
|
@ -263,8 +356,21 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
"filesOnForm" : [ ],
|
"filesOnForm" : [ ],
|
||||||
"sparqlForLiterals" : { },
|
"sparqlForLiterals" : { },
|
||||||
"sparqlForUris" : { },
|
"sparqlForUris" : { },
|
||||||
"sparqlForExistingLiterals" : { "activityLabel":"${activityLabelQuery}", "roleLabel":"${roleLabelQuery}", "startYear":"${startYearQuery}", "endYear":"${endYearQuery}" },
|
"sparqlForExistingLiterals" : {
|
||||||
"sparqlForExistingUris" : { "roleActivity":"${activityQuery}" , "roleActivityType":"${activityTypeQuery}" },
|
"activityLabel":"${activityLabelQuery}",
|
||||||
|
"roleLabel":"${roleLabelQuery}",
|
||||||
|
"startField.value" : "${existingStartDateQuery}",
|
||||||
|
"endField.value" : "${existingEndDateQuery}"
|
||||||
|
},
|
||||||
|
"sparqlForExistingUris" : {
|
||||||
|
"roleActivity":"${activityQuery}" ,
|
||||||
|
"roleActivityType":"${activityTypeQuery}" ,
|
||||||
|
"intervalNode" : "${existingIntervalNodeQuery}",
|
||||||
|
"startNode" : "${existingStartNodeQuery}",
|
||||||
|
"endNode" : "${existingEndNodeQuery}",
|
||||||
|
"startField.precision": "${existingStartPrecisionQuery}",
|
||||||
|
"endField.precision" : "${existingEndPrecisionQuery}"
|
||||||
|
},
|
||||||
"fields" : {
|
"fields" : {
|
||||||
"activityLabel" : {
|
"activityLabel" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
|
@ -310,27 +416,27 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
"rangeLang" : "",
|
"rangeLang" : "",
|
||||||
"assertions" : ["${roleLabelAssertion}" ]
|
"assertions" : ["${roleLabelAssertion}" ]
|
||||||
},
|
},
|
||||||
"startYear" : {
|
"startField" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
"validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ],
|
"validators" : [ ],
|
||||||
"optionsType" : "UNDEFINED",
|
"optionsType" : "UNDEFINED",
|
||||||
"literalOptions" : [ ],
|
"literalOptions" : [ ],
|
||||||
"predicateUri" : "",
|
"predicateUri" : "",
|
||||||
"objectClassUri" : "",
|
"objectClassUri" : "",
|
||||||
"rangeDatatypeUri" : "${gYearDatatypeUriJson}",
|
"rangeDatatypeUri" : "",
|
||||||
"rangeLang" : "",
|
"rangeLang" : "",
|
||||||
"assertions" : ["${startYearAssertion}"]
|
"assertions" : [ "${n3ForStart}" ]
|
||||||
},
|
},
|
||||||
"endYear" : {
|
"endField" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
"validators" : [ "datatype:${gYearDatatypeUriJson}" ],
|
"validators" : [ ],
|
||||||
"optionsType" : "UNDEFINED",
|
"optionsType" : "UNDEFINED",
|
||||||
"literalOptions" : [ ],
|
"literalOptions" : [ ],
|
||||||
"predicateUri" : "",
|
"predicateUri" : "",
|
||||||
"objectClassUri" : "",
|
"objectClassUri" : "",
|
||||||
"rangeDatatypeUri" : "${gYearDatatypeUriJson}",
|
"rangeDatatypeUri" : "",
|
||||||
"rangeLang" : "",
|
"rangeLang" : "",
|
||||||
"assertions" : ["${endYearAssertion}"]
|
"assertions" : ["${n3ForEnd}" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,9 +447,21 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
if (editConfig == null) {
|
if (editConfig == null) {
|
||||||
editConfig = new EditConfiguration((String) request.getAttribute("editjson"));
|
editConfig = new EditConfiguration((String) request.getAttribute("editjson"));
|
||||||
EditConfiguration.putConfigInSession(editConfig,session);
|
EditConfiguration.putConfigInSession(editConfig,session);
|
||||||
|
|
||||||
|
//setup date time edit elements
|
||||||
|
Field startField = editConfig.getField("startField");
|
||||||
|
startField.setEditElement(
|
||||||
|
new DateTimeWithPrecision(startField,
|
||||||
|
VitroVocabulary.Precision.YEAR.uri(),
|
||||||
|
VitroVocabulary.Precision.MONTH.uri()));
|
||||||
|
Field endField = editConfig.getField("endField");
|
||||||
|
endField.setEditElement(
|
||||||
|
new DateTimeWithPrecision(endField,
|
||||||
|
VitroVocabulary.Precision.YEAR.uri(),
|
||||||
|
VitroVocabulary.Precision.YEAR.uri()));
|
||||||
}
|
}
|
||||||
|
|
||||||
editConfig.addValidator(new StartYearBeforeEndYear("startYear","endYear") );
|
editConfig.addValidator(new StartYearBeforeEndYear("startField.value","endYear.value") );
|
||||||
|
|
||||||
Model model = (Model) application.getAttribute("jenaOntModel");
|
Model model = (Model) application.getAttribute("jenaOntModel");
|
||||||
String objectUri = (String) request.getAttribute("objectUri");
|
String objectUri = (String) request.getAttribute("objectUri");
|
||||||
|
@ -423,12 +541,12 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
|
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${numDateFields == 1}">
|
<c:when test="${numDateFields == 1}">
|
||||||
<v:input type="text" label="Year ${requiredHint} ${yearHint}" id="startYear" size="7"/>
|
<v:input id="startField" label="Year ${requiredHint} ${yearHint}" size="7"/>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<h4 class="label">Years of Participation in ###</h4>
|
<h4 class="label">Years of Participation in ###</h4>
|
||||||
<v:input type="text" label="Start Year ${requiredHint} ${yearHint}" id="startYear" size="7"/>
|
<v:input id="startField" label="Start Year ${requiredHint} ${yearHint}" size="7"/>
|
||||||
<v:input type="text" label="End Year ${yearHint}" id="endYear" size="7"/>
|
<v:input id="endField" label="End Year ${yearHint}" size="7"/>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue