NIHVIVO-799 Added select list type UNSORTED_LITERALS to specify a list of literals with no alpha sorting. Allows putting "Select one" as first option without getting sorted into the middle of the list.

This commit is contained in:
rjy7 2010-07-14 22:14:31 +00:00
parent 49b18c57aa
commit 66df54d2a3
11 changed files with 48 additions and 52 deletions

View file

@ -4,7 +4,7 @@
<jsp:param name="roleActivityTypeLabel" value="clinical activity" /> <jsp:param name="roleActivityTypeLabel" value="clinical activity" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ClinicalRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ClinicalRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" value='["http://vivoweb.org/ontology/core#Project", "Project" ], [ "http://vivoweb.org/ontology/core#Service","Service"] ' /> <jsp:param name="roleActivityType_literalOptions" value='["Select one"], ["http://vivoweb.org/ontology/core#Project", "Project" ], [ "http://vivoweb.org/ontology/core#Service","Service"] ' />
</jsp:include> </jsp:include>

View file

@ -25,6 +25,7 @@ This is intended to create a set of statements like:
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StartYearBeforeEndYear"%>
<%@ 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" %>
@ -39,6 +40,7 @@ This is intended to create a set of statements like:
String intDatatypeUri = XSD.xint.toString(); String intDatatypeUri = XSD.xint.toString();
vreq.setAttribute("intDatatypeUri", intDatatypeUri); vreq.setAttribute("intDatatypeUri", intDatatypeUri);
vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri)); vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri));
vreq.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString())); vreq.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
String predicateUri = (String)request.getAttribute("predicateUri"); String predicateUri = (String)request.getAttribute("predicateUri");
@ -194,6 +196,7 @@ if ( ((String)request.getAttribute("predicateUri")).endsWith("hasPrincipalInvest
//validator for addGrantRoleToPerson.jsp? //validator for addGrantRoleToPerson.jsp?
//editConfig.addValidator(new AddGrantRoleToPersonValidator()); //editConfig.addValidator(new AddGrantRoleToPersonValidator());
editConfig.addValidator(new StartYearBeforeEndYear("startYear","endYear") );
Model model = (Model) application.getAttribute("jenaOntModel"); Model model = (Model) application.getAttribute("jenaOntModel");
editConfig.prepareForNonUpdate(model); editConfig.prepareForNonUpdate(model);

View file

@ -4,11 +4,12 @@
<jsp:param name="roleActivityTypeLabel" value="head of" /> <jsp:param name="roleActivityTypeLabel" value="head of" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#LeaderRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#LeaderRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" <jsp:param name="roleActivityType_literalOptions"
value='["http://purl.org/NET/c4dm/event.owl#Event", "Event" ], value='["Select one"],
["http://purl.org/NET/c4dm/event.owl#Event", "Event" ],
["http://xmlns.com/foaf/0.1/Organization", "Organization" ], ["http://xmlns.com/foaf/0.1/Organization", "Organization" ],
["http://vivoweb.org/ontology/core#Project", "Project" ], ["http://vivoweb.org/ontology/core#Project", "Project" ],
[ "http://vivoweb.org/ontology/core#Program", "Program" ], [ "http://vivoweb.org/ontology/core#Program", "Program" ],

View file

@ -6,5 +6,5 @@
<jsp:param name="roleActivityType_optionsType" value="CHILD_VCLASSES" /> <jsp:param name="roleActivityType_optionsType" value="CHILD_VCLASSES" />
<jsp:param name="roleActivityType_objectClassUri" value="http://xmlns.com/foaf/0.1/Organization" /> <jsp:param name="roleActivityType_objectClassUri" value="http://xmlns.com/foaf/0.1/Organization" />
<jsp:param name="roleActivityType_literalOptions" value="[ '', 'Select one' ]" /> <jsp:param name="roleActivityType_literalOptions" value="[ 'Select one' ]" />
</jsp:include> </jsp:include>

View file

@ -4,10 +4,11 @@
<jsp:param name="roleActivityTypeLabel" value="outreach & community service" /> <jsp:param name="roleActivityTypeLabel" value="outreach & community service" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#OutreachProviderRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#OutreachProviderRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" <jsp:param name="roleActivityType_literalOptions"
value='["http://purl.org/NET/c4dm/event.owl#Event", "Event" ], value='["Select one"],
["http://purl.org/NET/c4dm/event.owl#Event", "Event" ],
["http://xmlns.com/foaf/0.1/Organization", "Organization" ], ["http://xmlns.com/foaf/0.1/Organization", "Organization" ],
["http://vivoweb.org/ontology/core#Project", "Project" ], ["http://vivoweb.org/ontology/core#Project", "Project" ],
[ "http://vivoweb.org/ontology/core#Program", "Program" ], [ "http://vivoweb.org/ontology/core#Program", "Program" ],

View file

@ -5,7 +5,7 @@
<jsp:param name="roleActivityTypeLabel" value="presentation" /> <jsp:param name="roleActivityTypeLabel" value="presentation" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#PresenterRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#PresenterRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" value='["http://vivoweb.org/ontology/core#Presentation", "Presentation" ], [ "http://vivoweb.org/ontology/core#InvitedTalk","Invited Talk"] ' /> <jsp:param name="roleActivityType_literalOptions" value='["Select one"], ["http://vivoweb.org/ontology/core#Presentation", "Presentation" ], [ "http://vivoweb.org/ontology/core#InvitedTalk","Invited Talk"] ' />
</jsp:include> </jsp:include>

View file

@ -4,7 +4,7 @@
<jsp:param name="roleActivityTypeLabel" value="research activity" /> <jsp:param name="roleActivityTypeLabel" value="research activity" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ResearcherRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ResearcherRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" value='["http://vivoweb.org/ontology/core#Grant", "Grant" ], [ "http://vivoweb.org/ontology/core#Project","Project"] ' /> <jsp:param name="roleActivityType_literalOptions" value='["Select one"], ["http://vivoweb.org/ontology/core#Grant", "Grant" ], [ "http://vivoweb.org/ontology/core#Project","Project"] ' />
</jsp:include> </jsp:include>

View file

@ -38,7 +38,8 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.TitleCase" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.utils.TitleCase" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StartDateBeforeEndDate"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StartYearBeforeEndYear"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>
@ -46,22 +47,19 @@
<%@ 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" %>
<c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%><c:set var="vivoOnt" value="http://vivoweb.org/ontology" />
<c:set var="vivoCore" value="${vivoOnt}/core#" /> <c:set var="vivoCore" value="${vivoOnt}/core#" />
<%-- <%--
These are the parameters that MUST be set of this form: These are the parameters that MUST be set of this form:
sparqlForAcFilter
role type role type
predicate inverse predicate inverse
role activity type label (should be singular) role activity type label (should be singular)
super type of role types for roleActivityType select list generation super type of role types for roleActivityType select list generation
--%> --%>
<c:set var="sparqlForAcFilter">${param.sparqlForAcFilter}</c:set>
<c:set var="roleActivityTypeLabel">${param.roleActivityTypeLabel}</c:set> <c:set var="roleActivityTypeLabel">${param.roleActivityTypeLabel}</c:set>
<c:set var="roleType">${param.roleType}</c:set> <c:set var="roleType">${param.roleType}</c:set>
<c:set var="roleActivityType_optionsType" >${param.roleActivityType_optionsType}</c:set> <c:set var="roleActivityType_optionsType" >${param.roleActivityType_optionsType}</c:set>
<c:set var="roleActivityType_objectClassUri" >${param.roleActivityType_objectClassUri}</c:set> <c:set var="roleActivityType_objectClassUri" >${param.roleActivityType_objectClassUri}</c:set>
<c:set var="roleActivityType_literalOptions" >${param.roleActivityType_literalOptions}</c:set> <c:set var="roleActivityType_literalOptions" >${param.roleActivityType_literalOptions}</c:set>
@ -83,7 +81,7 @@
vreq.setAttribute("intDatatypeUri", intDatatypeUri); vreq.setAttribute("intDatatypeUri", intDatatypeUri);
vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri)); vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri));
vreq.setAttribute("gYearMonthDatatypeUriJson", MiscWebUtils.escape(XSD.gYearMonth.toString())); vreq.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
vreq.setAttribute("roleActivityTitleCase", TitleCase.toTitleCase(vreq.getParameter("roleActivityTypeLabel"))); vreq.setAttribute("roleActivityTitleCase", TitleCase.toTitleCase(vreq.getParameter("roleActivityTypeLabel")));
ObjectProperty op = wdf.getObjectPropertyDao().getObjectPropertyByURI( predicateUri ); ObjectProperty op = wdf.getObjectPropertyDao().getObjectPropertyByURI( predicateUri );
@ -99,22 +97,14 @@
<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="startYearMonthUri" value="${vivoCore}startYearMonth" /> <c:set var="startYearUri" value="${vivoCore}startYear" />
<v:jsonset var="startYearMonthExisting" > <v:jsonset var="startYearAssertion" >
SELECT ?existingStartYearMonth WHERE { ?role <${startYearUri}> ?startYear .
?role <${startYearMonthUri}> ?existingStartYearMonth }
</v:jsonset>
<v:jsonset var="startYearMonthAssertion" >
?role <${startYearMonthUri}> ?startYearMonth .
</v:jsonset> </v:jsonset>
<c:set var="endYearMonthUri" value="${vivoCore}endYearMonth" /> <c:set var="endYearUri" value="${vivoCore}endYear" />
<v:jsonset var="endYearMonthExisting"> <v:jsonset var="endYearAssertion" >
SELECT ?existingEndYearMonth WHERE { ?role <${endYearUri}> ?endYear .
?role <${endYearMonthUri}> ?existingEndYearMonth }
</v:jsonset>
<v:jsonset var="endYearMonthAssertion" >
?role <${endYearMonthUri}> ?endYearMonth .
</v:jsonset> </v:jsonset>
<v:jsonset var="n3ForNewRole"> <v:jsonset var="n3ForNewRole">
@ -148,8 +138,8 @@
"predicate" : ["rolePredicate", "${predicateUriJson}" ], "predicate" : ["rolePredicate", "${predicateUriJson}" ],
"object" : ["role", "${objectUriJson}", "URI" ], "object" : ["role", "${objectUriJson}", "URI" ],
"n3required" : [ "${n3ForNewRole}", "${startYearMonthAssertion}" ], "n3required" : [ "${n3ForNewRole}", "${startYearAssertion}" ],
"n3optional" : [ "${n3ForNewActivity}", "${n3ForInverse}", "${endYearMonthAssertion}" ], "n3optional" : [ "${n3ForNewActivity}", "${n3ForInverse}", "${endYearAssertion}" ],
"newResources" : { "role" : "${defaultNamespace}", "newResources" : { "role" : "${defaultNamespace}",
"roleActivity" : "${defaultNamespace}" }, "roleActivity" : "${defaultNamespace}" },
@ -157,7 +147,7 @@
"urisInScope" : { "inverseRolePredicate" : "${inversePredicate}" }, "urisInScope" : { "inverseRolePredicate" : "${inversePredicate}" },
"literalsInScope": { }, "literalsInScope": { },
"urisOnForm" : [ "roleActivity", "roleActivityType" ], "urisOnForm" : [ "roleActivity", "roleActivityType" ],
"literalsOnForm" : [ "title", "startYearMonth", "endYearMonth" ], "literalsOnForm" : [ "title", "startYear", "endYear" ],
"filesOnForm" : [ ], "filesOnForm" : [ ],
"sparqlForLiterals" : { }, "sparqlForLiterals" : { },
"sparqlForUris" : { }, "sparqlForUris" : { },
@ -197,27 +187,27 @@
"rangeLang" : "", "rangeLang" : "",
"assertions" : [ ] "assertions" : [ ]
}, },
"startYearMonth" : { "startYear" : {
"newResource" : "false", "newResource" : "false",
"validators" : [ "datatype:${gYearMonthDatatypeUriJson}" ], "validators" : [ "datatype:${gYearDatatypeUriJson}" ],
"optionsType" : "UNDEFINED", "optionsType" : "UNDEFINED",
"literalOptions" : [ ], "literalOptions" : [ ],
"predicateUri" : "", "predicateUri" : "",
"objectClassUri" : "", "objectClassUri" : "",
"rangeDatatypeUri" : "${gYearMonthDatatypeUriJson}", "rangeDatatypeUri" : "${gYearDatatypeUriJson}",
"rangeLang" : "", "rangeLang" : "",
"assertions" : ["${startYearMonthAssertion}"] "assertions" : ["${startYearAssertion}"]
}, },
"endYearMonth" : { "endYear" : {
"newResource" : "false", "newResource" : "false",
"validators" : [ "datatype:${gYearMonthDatatypeUriJson}" ], "validators" : [ "datatype:${gYearDatatypeUriJson}" ],
"optionsType" : "UNDEFINED", "optionsType" : "UNDEFINED",
"literalOptions" : [ ], "literalOptions" : [ ],
"predicateUri" : "", "predicateUri" : "",
"objectClassUri" : "", "objectClassUri" : "",
"rangeDatatypeUri" : "${gYearMonthDatatypeUriJson}", "rangeDatatypeUri" : "${gYearDatatypeUriJson}",
"rangeLang" : "", "rangeLang" : "",
"assertions" : ["${endYearMonthAssertion}"] "assertions" : ["${endYearAssertion}"]
} }
} }
} }
@ -230,7 +220,7 @@
EditConfiguration.putConfigInSession(editConfig,session); EditConfiguration.putConfigInSession(editConfig,session);
} }
editConfig.addValidator(new StartDateBeforeEndDate("startYearMonth","endYearMonth") ); editConfig.addValidator(new StartYearBeforeEndYear("startYear","endYear") );
//this will return the browser to the new activity entity after an edit. //this will return the browser to the new activity entity after an edit.
editConfig.setEntityToReturnTo("?roleActivity"); editConfig.setEntityToReturnTo("?roleActivity");
@ -273,9 +263,10 @@
<p class="inline"><label></label><span class="acSelectionInfo"></span> <a href="<c:url value="/individual?uri=" />" class="verifyMatch">(Verify this match)</a></p> <p class="inline"><label></label><span class="acSelectionInfo"></span> <a href="<c:url value="/individual?uri=" />" class="verifyMatch">(Verify this match)</a></p>
<input type="hidden" id="roleActivityURI" name="roleActivity" class="acReceiver" value="" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="roleActivityURI" name="roleActivity" class="acReceiver" value="" /> <!-- Field value populated by JavaScript -->
</div> </div>
<v:input type="text" label="Start Year and Month ${yearMonthHint} ${requiredHint}" id="startYearMonth" size="7"/> <h4>Dates of Participation</h4>
<v:input type="text" label="End Year and Month ${yearMonthHint}" id="endYearMonth" size="7"/> <v:input type="text" label="Start Year ${requiredHint} ${yearHint}" id="startYear" size="7"/>
<v:input type="text" label="End Year ${yearHint}" id="endYear" size="7"/>
</div> </div>
<p class="submit"><v:input type="submit" id="submit" value="${roleActivityTitleCase}" cancel="true" /></p> <p class="submit"><v:input type="submit" id="submit" value="${roleActivityTitleCase}" cancel="true" /></p>

View file

@ -4,10 +4,11 @@
<jsp:param name="roleActivityTypeLabel" value="service to the profession" /> <jsp:param name="roleActivityTypeLabel" value="service to the profession" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ServiceProviderRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#ServiceProviderRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" <jsp:param name="roleActivityType_literalOptions"
value='["http://purl.org/NET/c4dm/event.owl#Event", "Event" ], value='["Select one"],
["http://purl.org/NET/c4dm/event.owl#Event", "Event" ],
["http://xmlns.com/foaf/0.1/Organization", "Organization" ], ["http://xmlns.com/foaf/0.1/Organization", "Organization" ],
["http://vivoweb.org/ontology/core#Project", "Project" ], ["http://vivoweb.org/ontology/core#Project", "Project" ],
[ "http://vivoweb.org/ontology/core#Program", "Program" ], [ "http://vivoweb.org/ontology/core#Program", "Program" ],

View file

@ -4,7 +4,7 @@
<jsp:param name="roleActivityTypeLabel" value="teaching activity" /> <jsp:param name="roleActivityTypeLabel" value="teaching activity" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#TeacherRole" /> <jsp:param name="roleType" value="http://vivoweb.org/ontology/core#TeacherRole" />
<jsp:param name="roleActivityType_optionsType" value="LITERALS" /> <jsp:param name="roleActivityType_optionsType" value="UNSORTED_LITERALS" />
<jsp:param name="roleActivityType_objectClassUri" value="" /> <jsp:param name="roleActivityType_objectClassUri" value="" />
<jsp:param name="roleActivityType_literalOptions" value='["http://purl.org/ontology/bibo/Conference", "Conference" ], [ "http://vivoweb.org/ontology/core#Course","Course"], [ "http://purl.org/ontology/bibo/Workshop","Workshop"] ' /> <jsp:param name="roleActivityType_literalOptions" value='["Select one"], ["http://purl.org/ontology/bibo/Conference", "Conference" ], [ "http://vivoweb.org/ontology/core#Course","Course"], [ "http://purl.org/ontology/bibo/Workshop","Workshop"] ' />
</jsp:include> </jsp:include>

View file

@ -9,7 +9,6 @@ import com.hp.hpl.jena.rdf.model.Literal;
public class PublicationHasAuthorValidator implements N3Validator { public class PublicationHasAuthorValidator implements N3Validator {
private static String MISSING_AUTHOR_ERROR = "Must specify a new or existing author.";
private static String MISSING_FIRST_NAME_ERROR = "Must specify the author's first name."; private static String MISSING_FIRST_NAME_ERROR = "Must specify the author's first name.";
private static String MISSING_LAST_NAME_ERROR = "Must specify the author's last name."; private static String MISSING_LAST_NAME_ERROR = "Must specify the author's last name.";
private static String MALFORMED_LAST_NAME_ERROR = "Last name may not contain a comma. Please enter first name in first name field."; private static String MALFORMED_LAST_NAME_ERROR = "Last name may not contain a comma. Please enter first name in first name field.";