diff --git a/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf b/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf index aa5bbe5c..1b024496 100644 --- a/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf +++ b/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf @@ -890,7 +890,7 @@ true - serviceActivityShortView.jsp + activityShortView.jsp -1 -1 @@ -2091,6 +2091,7 @@ true + activityShortView.jsp -1 -1 @@ -2343,6 +2344,7 @@ + activityShortView.jsp -1 -1 @@ -2527,6 +2529,7 @@ mailingAddressFor + activityShortView.jsp -1 -1 diff --git a/productMods/edit/forms/personHasServiceActivity.jsp b/productMods/edit/forms/personHasServiceActivity.jsp deleted file mode 100644 index 757d43a4..00000000 --- a/productMods/edit/forms/personHasServiceActivity.jsp +++ /dev/null @@ -1,268 +0,0 @@ -<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> - -<%@ page import="com.hp.hpl.jena.rdf.model.Literal"%> -<%@ page import="com.hp.hpl.jena.rdf.model.Model"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> -<%@ page - import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> -<%@ page - import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> - -<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> -<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> - -<% - VitroRequest vreq = new VitroRequest(request); - WebappDaoFactory wdf = vreq.getWebappDaoFactory(); - vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior - - String flagURI = null; - if (vreq.getAppBean().isFlag1Active()) { - flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; - } else { - flagURI = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering - } - vreq.setAttribute("flagURI",flagURI); -%> - -<%-- RY *** SET VARIABLES for uris & namespaces --%> - -<%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing" - to convey that the expression is used to retrieve any existing value for the field in an existing individual. - Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below - and in the literalsOnForm --%> - - SELECT ?titleExisting WHERE { - ?activityUri ?titleExisting } - - -<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field. - The actual assertion inserted in the model will be created via string substitution into the ? variables. - NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%> - - ?activityUri ?title . - ?activityUri ?title. - - - - SELECT ?descriptionExisting WHERE { - ?activityUri ?descriptionExisting } - - - ?activityUri ?description . - - - - SELECT ?existingOrgName WHERE { - ?activityUri ?existingOrgName } - - - ?activityUri ?organizationName . - - - - SELECT ?startYearMonthExisting WHERE { - ?activityUri ?startYearMonthExisting } - - - ?activityUri ?startYearMonth . - - - - SELECT ?endYearMonthExisting WHERE { - ?activityUri ?endYearMonthExisting } - - - ?activityUri ?endYearMonth . - - -<%-- Note there is really no difference in how things are set up for an object property except - below in the n3ForEdit section, in whether the ..Existing variable goes in SparqlForExistingLiterals - or in the SparqlForExistingUris, as well as perhaps in how the options are prepared --%> - - SELECT ?existingOrgUri WHERE { - ?activityUri ?existingOrgUri } - - - ?activityUri ?organizationUri . - ?organizationUri ?activityUri . - - - - ?activityUri ?serviceSubClass . - - - - @prefix rdf: . - @prefix core: . - - ?person core:professionalServiceActivity ?activityUri . - ?activityUri core:professionalServiceActivityBy ?person . - ?activityUri rdf:type core:ServiceActivity . - ?activityUri rdf:type <${flagURI}> . - - -http://vivoweb.org/ontology/core#ServiceActivity -http://xmlns.com/foaf/0.1/Organization - - - { - "formUrl" : "${formUrl}", - "editKey" : "${editKey}", - "urlPatternToReturnTo" : "/entity", - - "subject" : ["person", "${subjectUriJson}" ], - "predicate" : ["predicate", "${predicateUriJson}" ], - "object" : ["activityUri", "${objectUriJson}", "URI" ], - - "n3required" : [ "${n3ForStmtToPerson}", "${titleAssertion}", "${startYearMonthAssertion}" ], - "n3optional" : [ "${descriptionAssertion}", "${organizationNameAssertion}","${organizationUriAssertion}", - "${endYearMonthAssertion}", "${serviceSubClassAssertion}"], - "newResources" : { "activityUri" : "${defaultNamespace}" }, - "urisInScope" : { }, - "literalsInScope": { }, - "urisOnForm" : [ "organizationUri" , "serviceSubClass" ], - "literalsOnForm" : [ "title", "description", "organizationName", - "startYearMonth", "endYearMonth" ], - "filesOnForm" : [ ], - "sparqlForLiterals" : { }, - "sparqlForUris" : { }, - "sparqlForExistingLiterals" : { - "title" : "${titleExisting}", - "description" : "${descriptionExisting}", - "organizationName" : "${organizationNameExisting}", - "startYearMonth" : "${startYearMonthExisting}", - "endYearMonth" : "${endYearMonthExisting}" - }, - "sparqlForExistingUris" : { - "organizationUri" : "${organizationUriExisting}" - }, - "fields" : { - "title" : { - "newResource" : "false", - "validators" : [ "nonempty" ], - "optionsType" : "UNDEFINED", - "literalOptions" : [ ], - "predicateUri" : "", - "objectClassUri" : "", - "rangeDatatypeUri" : "", - "rangeLang" : "", - "assertions" : [ "${titleAssertion}" ] - }, - "description" : { - "newResource" : "false", - "validators" : [ ], - "optionsType" : "UNDEFINED", - "literalOptions" : [ ], - "predicateUri" : "", - "objectClassUri" : "", - "rangeDatatypeUri" : "", - "rangeLang" : "", - "assertions" : [ "${descriptionAssertion}" ] - }, - "organizationUri" : { - "newResource" : "false", - "validators" : [ ], - "optionsType" : "INDIVIDUALS_VIA_VCLASS", - "literalOptions" : [ "--" ], - "predicateUri" : "", - "objectClassUri" : "${organizationClass}", - "rangeDatatypeUri" : "", - "rangeLang" : "", - "assertions" : [ "${organizationUriAssertion}" ] - }, - "serviceSubClass" : { - "newResource" : "false", - "validators" : [ ], - "optionsType" : "CHILD_VCLASSES", - "literalOptions" : [ "--" ], - "predicateUri" : "", - "objectClassUri" : "${activityClass}", - "rangeDatatypeUri" : "", - "rangeLang" : "", - "assertions" : [ "${serviceSubClassAssertion}" ] - }, - "organizationName" : { - "newResource" : "false", - "validators" : [ ], - "optionsType" : "UNDEFINED", - "literalOptions" : [ ], - "predicateUri" : "", - "objectClassUri" : "", - "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#string", - "rangeLang" : "", - "assertions" : [ "${organizationNameAssertion}" ] - }, - "startYearMonth" : { - "newResource" : "false", - "validators" : [ "nonempty", "datatype:http://www.w3.org/2001/XMLSchema#gYearMonth" ], - "optionsType" : "UNDEFINED", - "literalOptions" : [ ], - "predicateUri" : "", - "objectClassUri" : "", - "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth", - "rangeLang" : "", - "assertions" : ["${startYearMonthAssertion}"] - }, - "endYearMonth" : { - "newResource" : "false", - "validators" : [ "datatype:http://www.w3.org/2001/XMLSchema#gYearMonth" ], - "optionsType" : "UNDEFINED", - "literalOptions" : [ ], - "predicateUri" : "", - "objectClassUri" : "", - "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth", - "rangeLang" : "", - "assertions" : ["${endYearMonthAssertion}"] - } - } -} - -<% - - EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request); - if (editConfig == null) { - editConfig = new EditConfiguration( - (String) request - .getAttribute("editjson")); - EditConfiguration.putConfigInSession(editConfig,session); - } - - Model model = (Model) application.getAttribute("jenaOntModel"); - String objectUri = (String) request.getAttribute("objectUri"); - if (objectUri != null) { - editConfig.prepareForObjPropUpdate(model); - } else { - editConfig.prepareForNonUpdate(model); - } - - /* prepare the and text for the submit button */ - Individual subject = (Individual) request.getAttribute("subject"); - String submitLabel = ""; - if (objectUri != null) { - request.setAttribute("title","Edit professional service activity entry for "+ subject.getName()); - submitLabel = "Save changes"; - } else { - request.setAttribute("title","Create a new professional service activity entry for " + subject.getName()); - submitLabel = "Create new professional service activity entry"; - } -%> - -<jsp:include page="${preForm}"/> - -<h2>${title}</h2> -<form action="<c:url value="/edit/processRdfForm2.jsp"/>" > - <v:input type="text" label="title" id="title" size="30" /> - <v:input type="select" label="activity type" id="serviceSubClass"/> - <v:input type="textarea" label="description" id="description" rows="5" cols="30" /> - <v:input type="select" label="organization" id="organizationUri" /> - <v:input type="text" label="organization name (if not in dropdown above)" id="organizationName" size="30" /> - <v:input type="text" label="start year and month (YYYY-MM)" id="startYearMonth" size="7"/> - <v:input type="text" label="end year and month (YYYY-MM)" id="endYearMonth" size="7"/> - <p class="submit"><v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/></p> -</form> - -<jsp:include page="${postForm}"/> - diff --git a/productMods/templates/entity/activityShortView.jsp b/productMods/templates/entity/activityShortView.jsp new file mode 100644 index 00000000..cd4331aa --- /dev/null +++ b/productMods/templates/entity/activityShortView.jsp @@ -0,0 +1,66 @@ +<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> + +<%-- Custom short view for ResearchActivity, TeachingActivity, OutreachActivity, and ServiceActivity + + SUBJECT - entity + PREDICATE - predicateUri + OBJECT - individual + + Predicates: on Person page: Person professionalServiceActivity ServiceActivity + +--%> + +<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> + +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %> + +<c:set var="vivoCore" value="http://vivoweb.org/ontology/core#" /> +<c:set var="rdfs" value="<%= VitroVocabulary.RDFS %>" /> +<c:set var="labelUri" value="${rdfs}label" /> + +<c:set var="researchActivityUri" value="${vivoCore}hasResearchActivity" /> +<c:set var="teachingActivityUri" value="${vivoCore}hasTeachingActivity" /> +<c:set var="serviceActivityUri" value="${vivoCore}professionalServiceActivity" /> +<c:set var="outreachActivityUri" value="${vivoCore}hasOutreachActivity" /> + +<c:set var="predicateIsActivity" value="${predicateUri == researchActivityUri || + predicateUri == teachingActivityUri || + predicateUri == serviceActivityUri || + predicateUri == outreachActivityUri}" /> +<c:choose> + <c:when test="${!empty individual}"><%-- individual is the OBJECT of the property referenced - in this case, the Activity object --%> + <c:choose> + <c:when test="${!empty predicateUri}"> + <%-- RY may need another branch in here; predicateIsActivity vs predicate is something else... + depends if this would display on something other than a person page. --%> + <c:set var="activity" value="${individual}" /> + + <%-- Get the Activity label --%> + <c:set var="activityLabel" value=" ${activity.name}"/> + + <%-- Get the role of the person in the activity --%> + <c:set var="role" value=" ${activity.dataPropertyMap['http://vivoweb.org/ontology/core#role'].dataPropertyStatements[0].data}"/> + + <%-- Get the start date of the activity --%> + <c:set var="startDate" value="${activity.dataPropertyMap['http://vivoweb.org/ontology/core#startYearMonth'].dataPropertyStatements[0].data}"/> + + <%-- Create an html link element to the activity --%> + <c:url var="activityUrl" value="/individual"><c:param name="uri" value="${activity.URI}"/></c:url> + <c:set var="activityLink" ><a href='${activityUrl}'><p:process>${activityLabel}</p:process></a></c:set> + + <%-- Final output --%> + <strong>${activityLink}</strong> <p:process>${role}, ${startDate}</p:process> + </c:when> + + <c:otherwise> <%-- no predicate --%> + <c:out value="No predicate available for custom rendering ..."/> + </c:otherwise> + </c:choose> + </c:when> + + <c:otherwise> <%-- no object --%> + <c:out value="Got nothing to draw here ..."/> + </c:otherwise> +</c:choose> diff --git a/productMods/templates/entity/serviceActivityShortView.jsp b/productMods/templates/entity/serviceActivityShortView.jsp deleted file mode 100644 index 538f3ba1..00000000 --- a/productMods/templates/entity/serviceActivityShortView.jsp +++ /dev/null @@ -1,107 +0,0 @@ -<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> - -<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %> - -<%-- Custom short view for ServiceActivity - - SUBJECT - entity - PREDICATE - predicateUri - OBJECT - individual - - Predicates: professionalServiceActivity on Person page: Person professionalServiceActivity ServiceActivity - organizationRelatedActivity on Organization page: Organization organizationRelatedActivity ServiceActivity ---%> - -<c:choose> - <c:when test="${!empty individual}"><%-- individual is the OBJECT of the property referenced - in this case, a ServiceActivity object --%> - <c:choose> - <c:when test="${!empty predicateUri}"> - <c:set var="serviceActivity" value="${individual}" /> - - <%-- Get the ServiceActivity title --%> - <c:set var="title" value=" ${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#titleOrRole'].dataPropertyStatements[0].data}"/> - - <%-- Get the time span of the service activity --%> - <c:set var="startYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#startYearMonth'].dataPropertyStatements[0].data}"/> - <c:set var="endYearMonth" value="${serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#endYearMonth'].dataPropertyStatements[0].data}"/> - <c:if test="${!empty startYearMonth}"> - <%-- RY Don't know whether we should display just the year, or month and year. - Latter looks like too much info, but why collect it if we aren't going to display it? - Needs reformatting, otherwise we get e.g., "2008-10 - 2009-12" - <c:set var="startDate" value="${fn:substring(startYearMonth, 0, 4)}" /> --%> - <c:set var="start" value="${fn:split(startYearMonth, '-')}" /> - <c:set var="startDate" value="${start[1]}/${start[0]}" /> - <c:set var="timeSpan" value=", ${startDate} - "/> - <c:if test="${!empty endYearMonth}"> - <%-- <c:set var="endDate" value="${fn:substring(endYearMonth, 0, 4)}" /> --%> - <c:set var="end" value="${fn:split(endYearMonth, '-')}" /> - <c:set var="endDate" value="${end[1]}/${end[0]}" /> - <c:set var="timeSpan" value="${timeSpan}${endDate}"/> - </c:if> - </c:if> - - <c:choose> - <%-- CASE 1: SUBJECT is Person, OBJECT is ServiceActivity --%> - <c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#professionalServiceActivity'}"> - <%-- The head object of the short view is the Organization object's name or data property organization name. Get it from the service activity. --%> - <c:choose> - <%-- This ServiceActivity object is linked to an Organization object --%> - <c:when test="${!empty serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#activityRelatedOrganization']}"> - <c:set var="obj" value="${serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#activityRelatedOrganization'].objectPropertyStatements[0].object}" /> - <c:set var="objName" value="${obj.name}"/> - <c:set var="objUri" value="${obj.URI}"/> - </c:when> - - <%-- The ServiceActivity object has an organization name data property --%> - <c:when test="${!empty serviceActivity.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"> - <c:set var="objName" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"/> - </c:when> - <%-- otherwise case defined below --%> - </c:choose> - </c:when> - - <%-- CASE 2: SUBJECT is Organization, OBJECT is ServiceActivity --%> - <c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#organizationRelatedActivity'}"> - <c:if test="${!empty serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#professionalServiceActivityBy']}"> - <c:set var="obj" value="${serviceActivity.objectPropertyMap['http://vivoweb.org/ontology/core#professionalServiceActivityBy'].objectPropertyStatements[0].object}" /> - <c:set var="objName" value="${obj.name}"/> - <c:set var="objUri" value="${obj.URI}"/> - </c:if> - <%-- else case handled below --%> - </c:when> - - <%-- CASE 3: Other predicate --%> - <c:otherwise> - <c:set var="objName" value="unknown object"/> - </c:otherwise> - </c:choose> - - <%-- No objName defined in either Case 1 or Case 2 --%> - <c:if test="${empty objName}"> - <c:set var="objName" value="${title}"/> - <c:set var="title" value="" /><%-- don't output title twice --%> - </c:if> - - <%-- Create an html link element to the objUri --%> - <c:if test="${!empty objUri}"> - <c:url var="orgLink" value="/entity"><c:param name="uri" value="${objUri}"/></c:url> - <c:set var="openLink" value="<a href='${orgLink}'>" /> - <c:set var="closeLink" value="</a>" /> - </c:if> - - <%-- Final output --%> - ${openLink}<p:process><strong>${objName}</strong></p:process>${closeLink}<p:process>${title}${timeSpan}</p:process> - </c:when> - - <c:otherwise> <%-- no predicate --%> - <c:out value="No predicate available for custom rendering ..."/> - </c:otherwise> - </c:choose> - </c:when> - - <c:otherwise> <%-- no object --%> - <c:out value="Got nothing to draw here ..."/> - </c:otherwise> -</c:choose>