NIHVIVO-195 First draft of custom short view for activities (service, teaching, research, and outreach)
This commit is contained in:
parent
0822ebbb2d
commit
89380115b5
4 changed files with 70 additions and 376 deletions
|
@ -890,7 +890,7 @@
|
|||
<j.0:selectFromExistingAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</j.0:selectFromExistingAnnot>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#ServiceActivity">
|
||||
<j.0:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">serviceActivityShortView.jsp</j.0:customShortViewAnnot>
|
||||
<j.0:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">activityShortView.jsp</j.0:customShortViewAnnot>
|
||||
<j.0:displayLimitAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayLimitAnnot>
|
||||
<j.0:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayRankAnnot>
|
||||
<j.0:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
|
@ -2091,6 +2091,7 @@
|
|||
<j.0:selectFromExistingAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</j.0:selectFromExistingAnnot>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#OutreachActivity">
|
||||
<j.0:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">activityShortView.jsp</j.0:customShortViewAnnot>
|
||||
<j.0:displayLimitAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayLimitAnnot>
|
||||
<j.0:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayRankAnnot>
|
||||
<j.0:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
|
@ -2343,6 +2344,7 @@
|
|||
<j.0:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#TeachingActivity">
|
||||
<j.0:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">activityShortView.jsp</j.0:customShortViewAnnot>
|
||||
<j.0:displayLimitAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayLimitAnnot>
|
||||
<j.0:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayRankAnnot>
|
||||
<j.0:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
|
@ -2527,6 +2529,7 @@
|
|||
<j.0:fullPropertyNameAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mailingAddressFor</j.0:fullPropertyNameAnnot>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#ResearchActivity">
|
||||
<j.0:customShortViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">activityShortView.jsp</j.0:customShortViewAnnot>
|
||||
<j.0:displayLimitAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayLimitAnnot>
|
||||
<j.0:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:displayRankAnnot>
|
||||
<j.0:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
|
|
|
@ -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 --%>
|
||||
<v:jsonset var="titleExisting" >
|
||||
SELECT ?titleExisting WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#titleOrRole> ?titleExisting }
|
||||
</v:jsonset>
|
||||
|
||||
<%-- 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) --%>
|
||||
<v:jsonset var="titleAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#titleOrRole> ?title .
|
||||
?activityUri <http://www.w3.org/2000/01/rdf-schema#label> ?title.
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="descriptionExisting" >
|
||||
SELECT ?descriptionExisting WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#description> ?descriptionExisting }
|
||||
</v:jsonset>
|
||||
<v:jsonset var="descriptionAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#description> ?description .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="organizationNameExisting" >
|
||||
SELECT ?existingOrgName WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?existingOrgName }
|
||||
</v:jsonset>
|
||||
<v:jsonset var="organizationNameAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?organizationName .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="startYearMonthExisting" >
|
||||
SELECT ?startYearMonthExisting WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonthExisting }
|
||||
</v:jsonset>
|
||||
<v:jsonset var="startYearMonthAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonth .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="endYearMonthExisting" >
|
||||
SELECT ?endYearMonthExisting WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonthExisting }
|
||||
</v:jsonset>
|
||||
<v:jsonset var="endYearMonthAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonth .
|
||||
</v:jsonset>
|
||||
|
||||
<%-- 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 --%>
|
||||
<v:jsonset var="organizationUriExisting" >
|
||||
SELECT ?existingOrgUri WHERE {
|
||||
?activityUri <http://vivoweb.org/ontology/core#activityRelatedOrganization> ?existingOrgUri }
|
||||
</v:jsonset>
|
||||
<v:jsonset var="organizationUriAssertion" >
|
||||
?activityUri <http://vivoweb.org/ontology/core#activityRelatedOrganization> ?organizationUri .
|
||||
?organizationUri <http://vivoweb.org/ontology/core#organizationRelatedActivity> ?activityUri .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="serviceSubClassAssertion">
|
||||
?activityUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?serviceSubClass .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="n3ForStmtToPerson" >
|
||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
|
||||
@prefix core: <http://vivoweb.org/ontology/core#>.
|
||||
|
||||
?person core:professionalServiceActivity ?activityUri .
|
||||
?activityUri core:professionalServiceActivityBy ?person .
|
||||
?activityUri rdf:type core:ServiceActivity .
|
||||
?activityUri rdf:type <${flagURI}> .
|
||||
</v:jsonset>
|
||||
|
||||
<v:jsonset var="activityClass">http://vivoweb.org/ontology/core#ServiceActivity</v:jsonset>
|
||||
<v:jsonset var="organizationClass">http://xmlns.com/foaf/0.1/Organization</v:jsonset>
|
||||
|
||||
<c:set var="editjson" scope="request">
|
||||
{
|
||||
"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}"]
|
||||
}
|
||||
}
|
||||
}
|
||||
</c:set>
|
||||
<%
|
||||
|
||||
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 <title> 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}"/>
|
||||
|
66
productMods/templates/entity/activityShortView.jsp
Normal file
66
productMods/templates/entity/activityShortView.jsp
Normal file
|
@ -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>
|
|
@ -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>
|
Loading…
Add table
Reference in a new issue