From 9ab78ca9cf6488d92c8960b7881397ecf4bae3cb Mon Sep 17 00:00:00 2001 From: nac26 Date: Thu, 6 Jan 2011 14:44:04 +0000 Subject: [PATCH] NIHVIVO-1339 core:relatedRole custom list view is a work in progress. To review potential implementation options with Rebecca --- .../WEB-INF/ontologies/app/listViewConfig.owl | 4 ++ .../config/listViewConfig-relatedRole.xml | 36 ++++++++++++++ .../individual/propStatement-relatedRole.ftl | 47 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 productMods/config/listViewConfig-relatedRole.xml create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl diff --git a/productMods/WEB-INF/ontologies/app/listViewConfig.owl b/productMods/WEB-INF/ontologies/app/listViewConfig.owl index 5c4a4624..b9741f12 100644 --- a/productMods/WEB-INF/ontologies/app/listViewConfig.owl +++ b/productMods/WEB-INF/ontologies/app/listViewConfig.owl @@ -99,4 +99,8 @@ end roles (from person) config ****************************************************************** --> + + + listViewConfig-relatedRole.xml + \ No newline at end of file diff --git a/productMods/config/listViewConfig-relatedRole.xml b/productMods/config/listViewConfig-relatedRole.xml new file mode 100644 index 00000000..dc50afca --- /dev/null +++ b/productMods/config/listViewConfig-relatedRole.xml @@ -0,0 +1,36 @@ + + + + + + + + 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 ?subclass ?role (afn:localname(?role) AS ?roleName) + ?specificRole ?person ?personName ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE { + GRAPH ?g1 { ?subject ?property ?role } + OPTIONAL { GRAPH ?g2 { ?role core:memberRoleOf ?person } + GRAPH ?g3 { ?person rdfs:label ?personName } + } + OPTIONAL { GRAPH ?g4 { ?subclass rdfs:subClassOf core:Role } + GRAPH ?g5 { ?role a ?subclass } + FILTER (?g5 != <http://vitro.mannlib.cornell.edu/default/inferred-tbox> && + ?g5 != <http://vitro.mannlib.cornell.edu/default/vitro-kb-inf> ) + } + OPTIONAL { GRAPH ?g6 { ?role rdfs:label ?specificRole } } + OPTIONAL { GRAPH ?g7 { ?role core:dateTimeInterval ?dateTimeInterval } + OPTIONAL { GRAPH ?g8 { ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart } + } + OPTIONAL { GRAPH ?g9 { ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd } + } + } + } ORDER BY ?subclass DESC(?dateTimeStart) DESC(?dateTimeEnd) ?personName + + + + \ No newline at end of file diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl new file mode 100644 index 00000000..c4787053 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.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#relatedRole --> + +<#import "lib-sequence.ftl" as s> +<#import "lib-datetime.ftl" as dt> + +<@showRole statement /> + +<#-- Use a macro to keep variable assignments local; otherwise the values get passed to the next + statement --> +<#macro showRole statement> + + <#local linkedIndividual> + <#if statement.person??> + ${statement.personName} + <#else> + <#-- This shouldn't happen, but we must provide for it --> + ${statement.roleName} (no linked person) + + + + <#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 dateInRole> + <#if dateTimeInterval?has_content> + ${dateTimeInterval} + + + + ${linkedIndividual} ${statement.specificRole} ${dateInRole!} + + \ No newline at end of file