From e07a78d3a8d2ed955cad37c57eb851fad6032bcc Mon Sep 17 00:00:00 2001 From: nac26 Date: Tue, 4 Jan 2011 13:28:48 +0000 Subject: [PATCH] NIHVIVO-1338 Custom list view for core:personInPosition --- .../WEB-INF/ontologies/app/listViewConfig.owl | 3 ++ .../listViewConfig-personInPosition.xml | 29 ++++++++++++ .../propStatement-personInPosition.ftl | 47 +++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 productMods/config/listViewConfig-personInPosition.xml create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-personInPosition.ftl diff --git a/productMods/WEB-INF/ontologies/app/listViewConfig.owl b/productMods/WEB-INF/ontologies/app/listViewConfig.owl index fd44f79a..0d81559c 100644 --- a/productMods/WEB-INF/ontologies/app/listViewConfig.owl +++ b/productMods/WEB-INF/ontologies/app/listViewConfig.owl @@ -27,5 +27,8 @@ listViewConfig-informationResourceInAuthorship.xml + + listViewConfig-personInPosition.xml + diff --git a/productMods/config/listViewConfig-personInPosition.xml b/productMods/config/listViewConfig-personInPosition.xml new file mode 100644 index 00000000..b2a8be08 --- /dev/null +++ b/productMods/config/listViewConfig-personInPosition.xml @@ -0,0 +1,29 @@ + + + + + + + + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + + SELECT DISTINCT ?position (afn:localname(?position) AS ?positionName) + ?positionTitle ?org ?orgName ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE { + GRAPH ?g1 { ?subject ?property ?position } + OPTIONAL { GRAPH ?g2 { ?position core:positionInOrganization ?org } + GRAPH ?g3 { ?org rdfs:label ?orgName } + } + OPTIONAL { GRAPH ?g4 { ?position rdfs:label ?positionTitle } } + OPTIONAL { GRAPH ?g5 { ?position core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart } } + OPTIONAL { GRAPH ?g5 { ?position core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd } } + } ORDER BY DESC(?dateTimeStart) DESC(?dateTimeEnd) ?orgName + + + + \ No newline at end of file diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-personInPosition.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-personInPosition.ftl new file mode 100644 index 00000000..44a7b104 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-personInPosition.ftl @@ -0,0 +1,47 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Custom object property statement view for http://vivoweb.org/ontology/core#personInPosition --> + +<#import "lib-sequence.ftl" as s> +<#import "lib-datetime.ftl" as dt> + +<@showPosition statement /> + +<#-- Use a macro to keep variable assignments local; otherwise the values get passed to the next + statement --> +<#macro showPosition statement> + + <#local linkedIndividual> + <#if statement.org??> + ${statement.orgName} + <#else> + <#-- This shouldn't happen, but we must provide for it --> + ${statement.positionName} (no linked organization) + + + + <#local dateTimeInterval> + <#if statement.dateTimeStart??> + <#local startYear = dt.xsdDateTimeToYear(statement.dateTimeStart)> + + <#if statement.dateTimeEnd??> + <#local endYear = dt.xsdDateTimeToYear(statement.dateTimeEnd)> + + <#if startYear?? && endYear??> + ${startYear} - ${endYear} + <#elseif startYear??> + ${startYear} - + <#elseif endYear ??> + - ${endYear} + + + + <#local dateInPosition> + <#if dateTimeInterval?has_content> + ${dateTimeInterval} + + + + <@s.join [ linkedIndividual, statement.positionTitle! ] /> ${dateInPosition!} + + \ No newline at end of file