Tweak the build script, so a developer can build vitro-core and it won't have any effect when they build vivoweb in the same workspace.

This commit is contained in:
jeb228 2010-01-29 22:12:41 +00:00
commit 3f17d16d7b
68 changed files with 40148 additions and 0 deletions

398
modifications/counter.jsp Normal file
View file

@ -0,0 +1,398 @@
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://djpowell.net/tmp/sparql-tag/0.1/" prefix="sparql" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %>
<%@ page import="java.net.URLDecoder" %>
<div id="content">
<h2>Linkage Information</h2>
<ul>
<!--
Author-Resource
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="inforauthorships">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(?author) as ?counts) WHERE {
?author rdf:type core:Authorship .
?author core:linkedInformationResource ?infor .
?infor rdf:type core:InformationResource .
}
</sparql:select>
<c:forEach items="${inforauthorships.rows}" var="inforauthorship" varStatus="counter">
<li><a href="#">'Person'-'InformationResource' linkages</a> (${inforauthorship.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="inforauthors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?author) as ?counts) WHERE {
?author core:authorInAuthorship ?obj .
?author rdf:type foaf:Person .
?obj core:linkedInformationResource ?infor .
?infor rdf:type core:InformationResource .
}
</sparql:select>
<c:forEach items="${inforauthors.rows}" var="inforauthor" varStatus="counter">
<li><a href="#">'Person' entities which published 'InformationResource' entities</a> (${inforauthor.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="infors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?infor) as ?counts) WHERE {
?subj core:linkedInformationResource ?infor .
?infor rdf:type core:InformationResource .
}
</sparql:select>
<c:forEach items="${infors.rows}" var="infor" varStatus="counter">
<li><a href="#">'InformationResource' entities</a> (${infor.counts.string})</li>
</c:forEach>
</sparql:sparql>
</ul>
<ul>
<!--
Author-Conference_Paper
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="confauthorships">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(?author) as ?counts) WHERE {
?author rdf:type core:Authorship .
?author core:linkedInformationResource ?infor .
?infor rdf:type core:ConferencePaper .
}
</sparql:select>
<c:forEach items="${confauthorships.rows}" var="confauthorship" varStatus="counter">
<li><a href="#">'Person'-'ConferencePaper' linkages</a> (${confauthorship.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="confauthors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?author) as ?counts) WHERE {
?author core:authorInAuthorship ?obj .
?author rdf:type foaf:Person .
?obj core:linkedInformationResource ?infor .
?infor rdf:type core:ConferencePaper .
}
</sparql:select>
<c:forEach items="${confauthors.rows}" var="confauthor" varStatus="counter">
<li><a href="#">'Person' entities which published 'ConferencePaper' entities</a> (${confauthor.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="confs">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?infor) as ?counts) WHERE {
?subj core:linkedInformationResource ?infor .
?infor rdf:type core:ConferencePaper .
}
</sparql:select>
<c:forEach items="${confs.rows}" var="conf" varStatus="counter">
<li><a href="#">'ConferencePaper' entities</a> (${conf.counts.string})</li>
</c:forEach>
</sparql:sparql>
</ul>
<ul>
<!--
Author-Academic_Article
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="acaauthorships">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(?author) as ?counts) WHERE {
?author rdf:type core:Authorship .
?author core:linkedInformationResource ?infor .
?infor rdf:type bibo:AcademicArticle .
}
</sparql:select>
<c:forEach items="${acaauthorships.rows}" var="acaauthorship" varStatus="counter">
<li><a href="#">'Person'-'AcademicArticle' linkages</a> (${acaauthorship.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="acaauthors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?author) as ?counts) WHERE {
?author core:authorInAuthorship ?obj .
?author rdf:type foaf:Person .
?obj core:linkedInformationResource ?infor .
?infor rdf:type bibo:AcademicArticle .
}
</sparql:select>
<c:forEach items="${acaauthors.rows}" var="acaauthor" varStatus="counter">
<li><a href="#">'Person' entities which published 'AcademicArticle' entities</a> (${acaauthor.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="acas">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?infor) as ?counts) WHERE {
?subj core:linkedInformationResource ?infor .
?infor rdf:type bibo:AcademicArticle .
}
</sparql:select>
<c:forEach items="${acas.rows}" var="aca" varStatus="counter">
<li><a href="#">'AcademicArticle' entities</a> (${aca.counts.string})</li>
</c:forEach>
</sparql:sparql>
</ul>
<ul>
<!--
Investigator-Grant
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="piships">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(*) as ?counts) WHERE {
?grant core:hasInvestigator ?pi .
}
</sparql:select>
<c:forEach items="${piships.rows}" var="piship" varStatus="counter">
<li><a href="#">'Person'-'Grant' linkages</a> (${piship.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="pis">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?pi) as ?counts) WHERE {
?grant core:hasInvestigator ?pi .
?grant rdf:type core:Grant .
}
</sparql:select>
<c:forEach items="${pis.rows}" var="pi" varStatus="counter">
<li><a href="#">'Person' entities which are (co-)investigators on 'Grant' entities</a> (${pi.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="grants">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?grant) as ?counts) WHERE {
?grant rdf:type core:Grant .
}
</sparql:select>
<c:forEach items="${grants.rows}" var="grant" varStatus="counter">
<li><a href="#">'Grant' entities</a> (${grant.counts.string})</li>
</c:forEach>
</sparql:sparql>
</ul>
<ul>
<!--
Teacher-Course
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="teachings">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(*) as ?counts) WHERE {
?teacher core:teaching ?obj .
}
</sparql:select>
<c:forEach items="${teachings.rows}" var="teaching" varStatus="counter">
<li><a href="#">'Person'-'CourseSection' linkages</a> (${teaching.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="teachers">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(distinct ?teacher) as ?counts) WHERE {
?teacher core:teaching ?obj .
}
</sparql:select>
<c:forEach items="${teachers.rows}" var="teacher" varStatus="counter">
<li><a href="#">'Person' entities which teach 'CourseSection' entities</a> (${teacher.counts.string})</li>
</c:forEach>
</sparql:sparql>
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="courses">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(?course) as ?counts) WHERE {
?course rdf:type core:CourseSection .
}
</sparql:select>
<c:forEach items="${courses.rows}" var="course" varStatus="counter">
<li><a href="#">'CourseSection' entities</a> (${course.counts.string})</li>
</c:forEach>
</sparql:sparql>
</ul>
<ul>
<!--
Co-Author Linkage
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="coauthors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(*) as ?counts) WHERE {
?author1 rdf:type core:Authorship .
?author2 rdf:type core:Authorship .
?author1 core:linkedInformationResource ?infor .
?author2 core:linkedInformationResource ?infor .
?infor rdf:type core:InformationResource .
FILTER (str(?author1) < str(?author2))
}
</sparql:select>
<c:forEach items="${coauthors.rows}" var="coauthor" varStatus="counter">
<li><a href="#">Total co-author linkages</a> (${coauthor.counts.string})</li>
</c:forEach>
</sparql:sparql>
<!--
Distinct Co-Author Linkage
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="discoauthors">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT DISTINCT ?author1 ?author2 WHERE {
?author1 rdf:type core:Authorship .
?author2 rdf:type core:Authorship .
?author1 core:linkedInformationResource ?infor .
?author2 core:linkedInformationResource ?infor .
?infor rdf:type core:InformationResource .
FILTER (str(?author1) < str(?author2))
}
</sparql:select>
<li><a href="#">Unique co-author linkages</a> (${fn:length(discoauthors.rows)})</li>
</sparql:sparql>
</ul>
<ul>
<!--
Co-Investigator Linkage
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="copis">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT (count(*) as ?counts) WHERE {
?grant core:hasInvestigator ?pi1 .
?grant core:hasInvestigator ?pi2 .
FILTER (str(?pi1) < str(?pi2))
}
</sparql:select>
<c:forEach items="${copis.rows}" var="copi" varStatus="counter">
<li><a href="#">Total co-investigator linkages</a> (${copi.counts.string})</li>
</c:forEach>
</sparql:sparql>
<!--
Distinct Co-Investigator Linkage
-->
<sparql:sparql>
<sparql:select model="${applicationScope.jenaOntModel}" var="discopis">
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX akt: <http://www.aktors.org/ontology/portal#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
SELECT DISTINCT ?pi1 ?pi2 WHERE {
?grant core:hasInvestigator ?pi1 .
?grant core:hasInvestigator ?pi2 .
FILTER (str(?pi1) < str(?pi2))
}
</sparql:select>
<li><a href="#">Unique co-investigator linkages</a> (${fn:length(discopis.rows)})</li>
</sparql:sparql>
</ul>
</div>

View file

@ -0,0 +1,309 @@
<%@ 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"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%-- This form is for the object property between Organizations and Positions. --%>
<%
VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
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);
%>
<v:jsonset var="personClassUri">http://xmlns.com/foaf/0.1/Person</v:jsonset>
<%-- 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 {
?positionUri <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" >
?positionUri <http://vivoweb.org/ontology/core#titleOrRole> ?title .
?positionUri <http://www.w3.org/2000/01/rdf-schema#label> ?title.
</v:jsonset>
<%--
<v:jsonset var="organizationNameExisting" >
SELECT ?existingOrgName WHERE {
?positionUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?existingOrgName }
</v:jsonset>
<v:jsonset var="organizationNameAssertion" >
?positionUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?organizationName .
</v:jsonset>
--%>
<v:jsonset var="startYearExisting" >
SELECT ?startYearExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startYear> ?startYearExisting }
</v:jsonset>
<v:jsonset var="startYearAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startYear> ?startYear .
</v:jsonset>
<v:jsonset var="startYearMonthExisting" >
SELECT ?startYearMonthExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonthExisting }
</v:jsonset>
<v:jsonset var="startYearMonthAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonth .
</v:jsonset>
<v:jsonset var="startDateExisting" >
SELECT ?startDateExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startDate> ?startDateExisting }
</v:jsonset>
<v:jsonset var="startDateAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startDate> ?startDate .
</v:jsonset>
<v:jsonset var="endYearExisting" >
SELECT ?endYearExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endYear> ?endYearExisting }
</v:jsonset>
<v:jsonset var="endYearAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endYear> ?endYear .
</v:jsonset>
<v:jsonset var="endYearMonthExisting" >
SELECT ?endYearMonthExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonthExisting }
</v:jsonset>
<v:jsonset var="endYearMonthAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonth .
</v:jsonset>
<v:jsonset var="endDateExisting" >
SELECT ?endDateExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endDate> ?endDateExisting }
</v:jsonset>
<v:jsonset var="endDateAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endDate> ?endDate .
</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="personUriExisting" >
SELECT ?existingPersonUri WHERE {
?positionUri <http://vivoweb.org/ontology/core#???> ?existingPersonUri }
</v:jsonset>
<v:jsonset var="personUriAssertion" >
?positionUri <http://vivoweb.org/ontology/core#positionForPerson> ?personUri .
?personUri <http://vivoweb.org/ontology/core#personInPosition> ?positionUri .
</v:jsonset>
<v:jsonset var="n3ForStmtToOrg" >
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix core: <http://vivoweb.org/ontology/core#>.
?organizationUri core:organizationForPosition ?positionUri .
?positionUri core:positionInOrganization ?organizationUri .
?positionUri rdf:type core:Position .
?positionUri rdf:type <${flagURI}> .
</v:jsonset>
<c:set var="editjson" scope="request">
{
"formUrl" : "${formUrl}",
"editKey" : "${editKey}",
"urlPatternToReturnTo" : "/entity",
"subject" : ["organizationUri", "${subjectUriJson}" ],
"predicate" : ["predicate", "${predicateUriJson}" ],
"object" : ["positionUri", "${objectUriJson}", "URI" ],
"n3required" : [ "${n3ForStmtToOrg}", "${titleAssertion}" , "${personUriAssertion}" ],
"n3optional" : [ "${startYearAssertion}","${startYearMonthAssertion}","${startDateAssertion}",
"${endYearAssertion}","${endYearMonthAssertion}","${endDateAssertion}"],
"newResources" : { "positionUri" : "${defaultNamespace}/position" },
"urisInScope" : { },
"literalsInScope": { },
"urisOnForm" : [ "personUri" ],
"literalsOnForm" : [ "title",
"startYear", "startYearMonth", "startDate",
"endYear", "endYearMonth", "endDate" ],
"filesOnForm" : [ ],
"sparqlForLiterals" : { },
"sparqlForUris" : { },
"sparqlForExistingLiterals" : {
"title" : "${titleExisting}",
"startYear" : "${startYearExisting}",
"startYearMonth" : "${startYearMonthExisting}",
"startDate" : "${startDateExisting}",
"endYear" : "${endYearExisting}",
"endYearMonth" : "${endYearMonthExisting}",
"endDate" : "${endDateExisting}"
},
"sparqlForExistingUris" : {
"personUri" : "${personUriExisting}"
},
"fields" : {
"title" : {
"newResource" : "false",
"validators" : [ "nonempty" ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "",
"rangeLang" : "",
"assertions" : [ "${titleAssertion}" ]
},
"personUri" : {
"newResource" : "false",
"validators" : [ "nonempty" ],
"optionsType" : "INDIVIDUALS_VIA_VCLASS",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "${personClassUri}",
"rangeDatatypeUri" : "",
"rangeLang" : "",
"assertions" : [ "${personUriAssertion}" ]
},
"startYear" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYear",
"rangeLang" : "",
"assertions" : ["${startYearAssertion}"]
},
"startYearMonth" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth";
"rangeLang" : "",
"assertions" : [ "${startYearMonthAssertion}" ]
},
"startDate" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#Date",
"rangeLang" : "",
"assertions" : [ "${startDateAssertion}" ]
},
"endYear" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYear",
"rangeLang" : "",
"assertions" : ["${endYearAssertion}"]
},
"endYearMonth" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth";
"rangeLang" : "",
"assertions" : [ "${endYearMonthAssertion}" ]
},
"endDate" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#Date",
"rangeLang" : "",
"assertions" : [ "${endDateAssertion}" ]
}
}
}
</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 position history entry for "+ subject.getName());
submitLabel = "Save changes";
} else {
request.setAttribute("title","Create a new position history entry for " + subject.getName());
submitLabel = "Create new position history 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="person" id="personUri" />
<v:input type="text" label="start year (YYYY)" id="startYear" size="4"/>
<%--
<v:input type="text" label="startYearMonth" id="startYearMonth" size="7"/>
<v:input type="text" label="start date" id="startDate" size="10"/>
--%>
<v:input type="text" label="end year (YYYY)" id="endYear" size="4"/>
<%--
<v:input type="text" label="end year-month" id="endYearMonth" size="7"/>
<v:input type="text" label="end date" id="endDate" size="10"/>
--%>
<v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/>
</form>
<jsp:include page="${postForm}"/>

View file

@ -0,0 +1,325 @@
<%@ 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" %>
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%
VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
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);
%>
<%-- 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 {
?positionUri <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" >
?positionUri <http://vivoweb.org/ontology/core#titleOrRole> ?title .
?positionUri <http://www.w3.org/2000/01/rdf-schema#label> ?title.
</v:jsonset>
<v:jsonset var="organizationNameExisting" >
SELECT ?existingOrgName WHERE {
?positionUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?existingOrgName }
</v:jsonset>
<v:jsonset var="organizationNameAssertion" >
?positionUri <http://vivoweb.org/ontology/core#involvedOrganizationName> ?organizationName .
</v:jsonset>
<v:jsonset var="startYearExisting" >
SELECT ?startYearExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startYear> ?startYearExisting }
</v:jsonset>
<v:jsonset var="startYearAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startYear> ?startYear .
</v:jsonset>
<v:jsonset var="startYearMonthExisting" >
SELECT ?startYearMonthExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonthExisting }
</v:jsonset>
<v:jsonset var="startYearMonthAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startYearMonth> ?startYearMonth .
</v:jsonset>
<v:jsonset var="startDateExisting" >
SELECT ?startDateExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#startDate> ?startDateExisting }
</v:jsonset>
<v:jsonset var="startDateAssertion" >
?positionUri <http://vivoweb.org/ontology/core#startDate> ?startDate .
</v:jsonset>
<v:jsonset var="endYearExisting" >
SELECT ?endYearExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endYear> ?endYearExisting }
</v:jsonset>
<v:jsonset var="endYearAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endYear> ?endYear .
</v:jsonset>
<v:jsonset var="endYearMonthExisting" >
SELECT ?endYearMonthExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonthExisting }
</v:jsonset>
<v:jsonset var="endYearMonthAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endYearMonth> ?endYearMonth .
</v:jsonset>
<v:jsonset var="endDateExisting" >
SELECT ?endDateExisting WHERE {
?positionUri <http://vivoweb.org/ontology/core#endDate> ?endDateExisting }
</v:jsonset>
<v:jsonset var="endDateAssertion" >
?positionUri <http://vivoweb.org/ontology/core#endDate> ?endDate .
</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 {
?positionUri <http://vivoweb.org/ontology/core#positionInOrganization> ?existingOrgUri }
</v:jsonset>
<v:jsonset var="organizationUriAssertion" >
?positionUri <http://vivoweb.org/ontology/core#positionInOrganization> ?organizationUri .
?organizationUri <http://vivoweb.org/ontology/core#organizationForPosition> ?positionUri .
</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:personInPosition ?positionUri .
?positionUri core:positionForPerson ?person .
?positionUri rdf:type core:Position .
?positionUri rdf:type <${flagURI}> .
</v:jsonset>
<v:jsonset var="postionClass">http://vivoweb.org/ontology/core#Position</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" : ["positionUri", "${objectUriJson}", "URI" ],
"n3required" : [ "${n3ForStmtToPerson}", "${titleAssertion}" ],
"n3optional" : [ "${organizationNameAssertion}","${organizationUriAssertion}",
"${startYearAssertion}","${startYearMonthAssertion}","${startDateAssertion}",
"${endYearAssertion}","${endYearMonthAssertion}","${endDateAssertion}"],
"newResources" : { "positionUri" : "${defaultNamespace}/position" },
"urisInScope" : { },
"literalsInScope": { },
"urisOnForm" : [ "organizationUri" ],
"literalsOnForm" : [ "title", "organizationName",
"startYear", "startYearMonth", "startDate",
"endYear", "endYearMonth", "endDate" ],
"filesOnForm" : [ ],
"sparqlForLiterals" : { },
"sparqlForUris" : { },
"sparqlForExistingLiterals" : {
"title" : "${titleExisting}",
"organizationName" : "${organizationNameExisting}",
"startYear" : "${startYearExisting}",
"startYearMonth" : "${startYearMonthExisting}",
"startDate" : "${startDateExisting}",
"endYear" : "${endYearExisting}",
"endYearMonth" : "${endYearMonthExisting}",
"endDate" : "${endDateExisting}"
},
"sparqlForExistingUris" : {
"organizationUri" : "${organizationUriExisting}"
},
"fields" : {
"title" : {
"newResource" : "false",
"validators" : [ "nonempty" ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "",
"rangeLang" : "",
"assertions" : [ "${titleAssertion}" ]
},
"organizationUri" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "INDIVIDUALS_VIA_VCLASS",
"literalOptions" : [ "--" ],
"predicateUri" : "",
"objectClassUri" : "${organizationClass}",
"rangeDatatypeUri" : "",
"rangeLang" : "",
"assertions" : [ "${organizationUriAssertion}" ]
},
"organizationName" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#string",
"rangeLang" : "",
"assertions" : [ "${organizationNameAssertion}" ]
},
"startYear" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYear",
"rangeLang" : "",
"assertions" : ["${startYearAssertion}"]
},
"startYearMonth" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth";
"rangeLang" : "",
"assertions" : [ "${startYearMonthAssertion}" ]
},
"startDate" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#Date",
"rangeLang" : "",
"assertions" : [ "${startDateAssertion}" ]
},
"endYear" : {
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYear",
"rangeLang" : "",
"assertions" : ["${endYearAssertion}"]
},
"endYearMonth" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth";
"rangeLang" : "",
"assertions" : [ "${endYearMonthAssertion}" ]
},
"endDate" : {
"newResource" : "false",
"validators" : [],
"optionsType" : "UNDEFINED",
"literalOptions" : [],
"predicateUri" : "",
"objectClassUri" : "",
"rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#Date",
"rangeLang" : "",
"assertions" : [ "${endDateAssertion}" ]
}
}
}
</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 position history entry for "+ subject.getName());
submitLabel = "Save changes";
} else {
request.setAttribute("title","Create a new position history entry for " + subject.getName());
submitLabel = "Create new position history 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="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 (YYYY)" id="startYear" size="4"/>
<%--
<v:input type="text" label="startYearMonth" id="startYearMonth" size="7"/>
<v:input type="text" label="start date" id="startDate" size="10"/>
--%>
<v:input type="text" label="end year (YYYY)" id="endYear" size="4"/>
<%--
<v:input type="text" label="end year-month" id="endYearMonth" size="7"/>
<v:input type="text" label="end date" id="endDate" size="10"/>
--%>
<p class="submit"><v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/></p>
</form>
<jsp:include page="${postForm}"/>

View file

@ -0,0 +1,78 @@
<%@ 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:choose>
<c:when test="${!empty individual}"><%-- individual is the OBJECT of the property referenced -- the Authorship individual, not the Person or Publication --%>
<%-- c:set var="authorRank" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorRank'].dataPropertyStatements[0].data}"/ --%>
<c:choose>
<c:when test="${!empty predicateUri}">
<c:choose>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#authorInAuthorship'}"><%-- SUBJECT is a Person, so get info from Authorship about related Publication --%>
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource']}"><%-- this Position is linked to an Organization --%>
<c:set var="name" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource'].objectPropertyStatements[0].object.name}"/>
<c:set var="moniker" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource'].objectPropertyStatements[0].object.moniker}"/>
<c:set var="year" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource'].objectPropertyStatements[0].object.dataPropertyMap['http://vivoweb.org/ontology/core#year'].dataPropertyStatements[0].data}"/>
<c:set var="label" value="${moniker} ${year}"/>
<c:set var="uri" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource'].objectPropertyStatements[0].object.URI}"/>
</c:when>
<c:otherwise><%-- this Position is not linked to a Publication yet; use Authorship name as a placeholder and add link to the Authorship so user can add more information --%>
<c:choose>
<c:when test="${!empty individual.name}">
<c:set var="name" value="${individual.name}"/>
</c:when>
<c:otherwise>
<c:set var="name" value="unlabeled authorship"/>
</c:otherwise>
</c:choose>
<c:set var="label" value="(no publication linked yet)"/>
<c:set var="uri" value="${individual.URI}"/>
</c:otherwise>
</c:choose>
</c:when>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#informationResourceInAuthorship'}"><%-- SUBJECT is a Publication, so get info from Authorship about the related Person --%>
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor']}"><%-- there is a related Person --%>
<c:set var="name" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor'].objectPropertyStatements[0].object.name}"/>
<c:set var="label" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor'].objectPropertyStatements[0].object.moniker}"/>
<c:set var="uri" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedAuthor'].objectPropertyStatements[0].object.URI}"/>
</c:when>
<c:when test="${!empty individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorNameAsListed'].dataPropertyStatements[0].data}"><%-- only an author name has been specified --%>
<c:set var="name" value="<strong>${individual.dataPropertyMap['http://vivoweb.org/ontology/core#authorNameAsListed'].dataPropertyStatements[0].data}</strong>"/>
</c:when>
<c:otherwise><%-- no related Person yet (likely from before custom form available) --%>
<c:choose>
<c:when test="${!empty individual.name}"><c:set var="name" value="${individual.name}"/></c:when>
<c:otherwise><c:set var="name" value="unlabeled authorship"/></c:otherwise>
</c:choose>
<c:set var="label" value="(no author linked yet)"/>
<c:set var="uri" value="${individual.URI}"/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:set var="name" value="unknown predicate"/>
<c:set var="label" value="please contact your VIVO support team"/>
<c:set var="uri" value="${predicateUri}"/>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty uri}">
<c:url var="olink" value="/entity"><c:param name="uri" value="${uri}"/></c:url>
<a href="<c:out value="${olink}"/>"><p:process>${name}</p:process></a> <p:process>${label}</p:process>
</c:when>
<c:otherwise>
<p:process><strong>${name}</strong> ${label}</p:process>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="No predicate available for custom rendering ..."/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="Got nothing to draw here ..."/>
</c:otherwise>
</c:choose>

View file

@ -0,0 +1,104 @@
<%@ 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:choose>
<c:when test="${!empty individual}"><%-- individual is the OBJECT of the property referenced -- the Position, not the Person or Organization --%>
<c:set var="startYear" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#startYear'].dataPropertyStatements[0].data}"/>
<c:set var="endYear" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#endYear'].dataPropertyStatements[0].data}"/>
<c:choose><%-- use working title in preference to HR title --%>
<c:when test="${!empty individual.dataPropertyMap['http://vivoweb.org/ontology/core#titleOrRole'].dataPropertyStatements[0].data}">
<c:set var="title" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#titleOrRole'].dataPropertyStatements[0].data}"/>
</c:when>
<c:when test="${!empty individual.dataPropertyMap['http://vivoweb.org/ontology/core#hrJobTitle'].dataPropertyStatements[0].data}">
<c:set var="title" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#hrJobTitle'].dataPropertyStatements[0].data}"/>
</c:when>
<c:otherwise>
<c:set var="title" value="${individual.name}"/>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty predicateUri}">
<c:choose>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#personInPosition'}"><%-- SUBJECT is a Person, so get info from Position about related Organization --%>
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionInOrganization']}"><%-- this Position is linked to an Organization --%>
<c:set var="objName" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionInOrganization'].objectPropertyStatements[0].object.name}"/>
<c:choose>
<c:when test="${!empty title}">
<c:set var="objLabel" value="${title}"/>
</c:when>
<c:otherwise>
<c:set var="objLabel" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionInOrganization'].objectPropertyStatements[0].object.moniker}"/>
</c:otherwise>
</c:choose>
<c:set var="objUri" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionInOrganization'].objectPropertyStatements[0].object.URI}"/>
</c:when>
<c:otherwise><%-- this Position is not linked to an Organization --%>
<c:choose>
<c:when test="${!empty individual.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"><%-- an Organization name has been specified --%>
<c:set var="objName" value="${individual.dataPropertyMap['http://vivoweb.org/ontology/core#involvedOrganizationName'].dataPropertyStatements[0].data}"/>
<c:set var="objLabel" value="${title}"/>
</c:when>
<c:otherwise><%-- not even an organization name, so just display the title in place of the name --%>
<c:set var="objName" value="${title}"/>
<c:set var="title" value=""/><%-- don't show title twice --%>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
</c:when>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#organizationForPosition'}"><%-- SUBJECT is an Organization, so get info from Position about the related Person --%>
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionForPerson']}"><%-- there is a related Person --%>
<c:set var="objName" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionForPerson'].objectPropertyStatements[0].object.name}"/>
<c:choose>
<c:when test="${!empty title}">
<c:set var="objLabel" value="${title}"/>
</c:when>
<c:otherwise>
<c:set var="objLabel" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionForPerson'].objectPropertyStatements[0].object.moniker}"/>
</c:otherwise>
</c:choose>
<c:set var="objUri" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#positionForPerson'].objectPropertyStatements[0].object.URI}"/>
</c:when>
<c:otherwise><%-- no related Person, which should not happen --%>
<c:set var="objName" value="${individual.name}"/>
<c:set var="objLabel" value="${title}"/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:set var="objName" value="unknown predicate"/>
<c:set var="objUri" value="${predicateUri}"/>
</c:otherwise>
</c:choose>
<c:if test="${!empty startYear}">
<c:choose>
<c:when test="${!empty endYear}">
<c:set var="timeSpan" value=", ${startYear} - ${endYear}"/>
</c:when>
<c:otherwise>
<c:set var="timeSpan" value=", ${startYear} - "/>
</c:otherwise>
</c:choose>
</c:if>
<c:choose>
<c:when test="${!empty objUri}">
<c:url var="objLink" value="/entity"><c:param name="uri" value="${objUri}"/></c:url>
<a href="<c:out value="${objLink}"/>"><p:process>${objName}</p:process></a> <p:process>${objLabel} ${timeSpan}</p:process>
</c:when>
<c:otherwise>
<p:process><strong>${objName}</strong> ${objLabel} ${timeSpan}</p:process>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="No predicate available for custom rendering ..."/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="Got nothing to draw here ..."/>
</c:otherwise>
</c:choose>