Merge pull request #7 from vivo-project/feature/concept2departments

Feature/concept2departments

Thanks, Stephen, and thanks to Tim, for reviewing.
This commit is contained in:
Jim Blake 2013-08-26 12:25:45 -07:00
commit fbdbf5eb9d
8 changed files with 167 additions and 5 deletions

View file

@ -0,0 +1,12 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Individual profile page template for skos:Concept individuals (extends individual.ftl in vivo)-->
<#-- Do not show the link for temporal visualization unless it's enabled -->
<#assign affiliatedResearchAreas>
<#include "individual-affiliated-departments.ftl">
</#assign>
<#include "individual.ftl">

View file

@ -0,0 +1,35 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#if departmentsResults?has_content>
<#-- is strictly a usability issue so we can refer accurately to "faculty members" within the dept. -->
<#assign urlForDetailsPage = "affiliatedDepartments" />
<#assign headingText = "${i18n().affiliated_departments}" />
<h2 id="facultyResearchAreas" class="mainPropGroup">
${headingText}
</h2>
<ul id="individual-hasResearchArea" role="list">
<#assign moreDisplayed = false>
<#list departmentsResults as resultRow>
<li class="raLink">
<a class="raLink" href="${urls.base}/${urlForDetailsPage}?orgURI=${resultRow["dept"]}&raURI=${individual.uri}" title="${i18n().organization}">
${resultRow["deptLabel"]}
</a>
</li>
</#list>
</ul>
</#if>
<script>
$('a#raMore').click(function() {
$('li.raLinkMore').each(function() {
$(this).show();
});
$('li#raMoreContainer').hide();
$('li#raLessContainer').show();
});
$('a#raLess').click(function() {
$('li.raLinkMore').each(function() {
$(this).hide();
});
$('li#raMoreContainer').show();
$('li#raLessContainer').hide();
});
</script>

View file

@ -0,0 +1,25 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#if deptResearchAreas?has_content>
<section id="pageList">
<#list deptResearchAreas as firstRow>
<#assign raLink = "${urls.base}/individual?uri=${firstRow['raURI']}" />
<div class="tab">
<h2>${firstRow["orgLabel"]}</h2>
<p>${i18n().individuals_with_dept(firstRow['raLabel'],raLink)} <a href="${urls.base}/individual?uri=${firstRow["orgURI"]}">${i18n().view_all_individuals_in_dept}</a></p>
</div>
<#break>
</#list>
</section>
<section id="deptResearchAreas">
<ul role="list" class="deptDetailsList">
<#list deptResearchAreas as resultRow>
<li class="deptDetailsListItem">
<a href="${urls.base}/individual${resultRow["person"]?substring(resultRow["person"]?last_index_of("/"))}" title="${i18n().person_name}">${resultRow["personLabel"]}</a>
</li>
</#list>
</ul>
</section>
</#if>

View file

@ -3,11 +3,12 @@
<section id="pageList">
<#list affiliatedResearchAreas as firstRow>
<#assign firstOrgLabel = firstRow["orgLabel"]?upper_case />
<#assign deptLink = "${urls.base}/individual?uri=${firstRow['orgURI']}" />
<#assign i18TextString1 = "" />
<#if ( firstOrgLabel?index_of("THE") == 0 ) >
<#assign i18TextString1 = "${i18n().individuals_with_researh_area_one(firstRow['orgLabel'])}" />
<#assign i18TextString1 = "${i18n().individuals_with_researh_area_one(firstRow['orgLabel'],deptLink)}" />
<#else>
<#assign i18TextString1 = "${i18n().individuals_with_researh_area_two(firstRow['orgLabel'])}" />
<#assign i18TextString1 = "${i18n().individuals_with_researh_area_two(firstRow['orgLabel'],deptLink)}" />
</#if>
<div class="tab">
<h2>${firstRow["raLabel"]}</h2>

View file

@ -0,0 +1,82 @@
# $This file is distributed under the terms of the license in /doc/license.txt$
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix core: <http://vivoweb.org/ontology/core#> .
@prefix vivoweb: <http://vivoweb.org/ontology#> .
@prefix afn: <http://jena.hpl.hp.com/ARQ/function#> .
#### n3 for research areas ####
## associate the classes with the datagetter ##
<http://www.w3.org/2004/02/skos/core#Concept> display:hasDataGetter display:getDepartmentDataGetter .
## define the datagetter ##
display:getDepartmentDataGetter
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter>;
display:saveToVar "departmentsResults";
display:query
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
SELECT DISTINCT (str(?departmentLabel) AS ?deptLabel) ?dept
WHERE {
?individualURI vivo:researchAreaOf ?person .
?person vivo:personInPosition ?posn .
?posn vivo:positionInOrganization ?dept .
?dept rdfs:label ?departmentLabel
OPTIONAL { ?posn vivo:dateTimeInterval ?dti
OPTIONAL { ?dti vivo:end ?end .
?end vivo:dateTime ?endDate
}
}
FILTER ( !bound(?endDate) ||
afn:substring(str(?endDate), 0, 4) >= afn:substring(str(afn:now()), 0, 4) )
}
ORDER BY ?deptLabel
""" .
## detail page for dept research areas ##
<http://vitro.mannlib.cornell.edu/ns/default#n55553333>
a <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page> ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasDataGetter> <http://vitro.mannlib.cornell.edu/ns/default#n55552222> ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#requiresBodyTemplate> "individual-affiliated-dept-details.ftl" ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#title> "Affiliated Departments" ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#urlMapping> "/affiliatedDepartments" .
<http://vitro.mannlib.cornell.edu/ns/default#n55552222>
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter> ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#query>
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
SELECT DISTINCT (str (?prsnLabel) AS ?personLabel)
?person
(Str(?researchAreaLabel) AS ?raLabel)
(str(?departmentLabel) AS ?orgLabel)
?raURI
?orgURI
WHERE {
?orgURI vivo:organizationForPosition ?posn .
?orgURI rdfs:label ?orgLabel .
?posn vivo:positionForPerson ?person .
?person rdfs:label ?prsnLabel .
?person vivo:hasResearchArea ?raURI .
?raURI rdfs:label ?researchAreaLabel
}
ORDER BY ?personLabel
""" ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#saveToVar>
"deptResearchAreas" .

View file

@ -69,6 +69,7 @@ display:getResearchAreaDataGetter
(str(?researchAreaLabel) AS ?raLabel)
(str(?organizationLabel) AS ?orgLabel)
?raURI
?orgURI
WHERE {
?orgURI vivo:organizationForPosition ?posn .
?orgURI rdfs:label ?organizationLabel .
@ -101,6 +102,7 @@ display:getResearchAreaDataGetter
(Str(?researchAreaLabel) AS ?raLabel)
(str(?departmentLabel) AS ?orgLabel)
?raURI
?orgURI
WHERE {
?orgURI vivo:organizationForPosition ?posn .
?orgURI rdfs:label ?orgLabel .

View file

@ -2953,6 +2953,7 @@
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
<vitro:inClassGroup rdf:resource="http://vivoweb.org/ontology#vitroClassGrouppublications"/>
<vitro:customDisplayViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">individual--skos-concept.ftl</vitro:customDisplayViewAnnot>
<vitro:displayLimitAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
>-1</vitro:displayLimitAnnot>
<vitro:displayRankAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#int"

View file

@ -61,14 +61,18 @@ view_all_faculty = view all faculty
view_all_members_of_org = View all the members of this organization.
faculty_memberships = Faculty Memberships
individuals_with_researh_area_one = Here are the individuals in {0} who have an interest in this research area.
individuals_with_researh_area_two = Here are the individuals in the {0} who have an interest in this research area.
individuals_with_researh_area_one = Here are the individuals in <a href="{1}">{0}</a> who have an interest in this research area.
individuals_with_researh_area_two = Here are the individuals in the <a href="{1}">{0}</a> who have an interest in this research area.
individuals_with_dept = Here are the individuals with an interest in <a href="{1}">{0}</a> who are in this organization.
faculty_with_researh_area = Here are the faculty members in the {0} department who have an interest in this research area.
view_all_individuals_in_area = View all individuals with an interest in this area.
view_all_individuals_in_dept = View all individuals in this organization.
view_all_faculty_in_area = View all faculty with an interest in this area.
faculty_research_areas = Faculty Research Areas
affiliated_research_areas = Affiliated Research Areas
research_area = research area
affiliated_departments = Associated Departments
research_area = individuals in the department with this research area
organization = individuals with the research area in this organization
display_more = more
display_less = less