From 4739e32b34afd636a9d88ef5e96a033b2aedfd34 Mon Sep 17 00:00:00 2001 From: nac26 Date: Thu, 6 Jan 2011 16:01:40 +0000 Subject: [PATCH] NIHVIVO-1339 Completed core:relatedRole custom list view thanks to Rebecca's help in using rdfs:subPropertyOf to keep this streamlined and generic. It does not assume that the individual in the role is of class foaf:Person --- .../config/listViewConfig-relatedRole.xml | 27 ++++++++++--------- .../individual/propStatement-relatedRole.ftl | 6 ++--- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/productMods/config/listViewConfig-relatedRole.xml b/productMods/config/listViewConfig-relatedRole.xml index dc50afca..014c430b 100644 --- a/productMods/config/listViewConfig-relatedRole.xml +++ b/productMods/config/listViewConfig-relatedRole.xml @@ -10,26 +10,29 @@ 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 { + ?specificRole ?indivInRole ?indivName ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE { GRAPH ?g1 { ?subject ?property ?role } - OPTIONAL { GRAPH ?g2 { ?role core:memberRoleOf ?person } - GRAPH ?g3 { ?person rdfs:label ?personName } + OPTIONAL { GRAPH ?g2 { ?roleProp rdfs:subPropertyOf core:roleOf } + GRAPH ?g3 { ?role ?roleProp ?indivInRole } + FILTER (?g3 != <http://vitro.mannlib.cornell.edu/default/inferred-tbox> && + ?g3 != <http://vitro.mannlib.cornell.edu/default/vitro-kb-inf> ) + GRAPH ?g4 { ?indivInRole rdfs:label ?indivName } } - 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 ?g5 { ?subclass rdfs:subClassOf core:Role } + GRAPH ?g6 { ?role a ?subclass } + FILTER (?g6 != <http://vitro.mannlib.cornell.edu/default/inferred-tbox> && + ?g6 != <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 . + OPTIONAL { GRAPH ?g7 { ?role rdfs:label ?specificRole } } + OPTIONAL { GRAPH ?g8 { ?role core:dateTimeInterval ?dateTimeInterval } + OPTIONAL { GRAPH ?g9 { ?dateTimeInterval core:start ?dateTimeStartValue . ?dateTimeStartValue core:dateTime ?dateTimeStart } } - OPTIONAL { GRAPH ?g9 { ?dateTimeInterval core:end ?dateTimeEndValue . + OPTIONAL { GRAPH ?g10 { ?dateTimeInterval core:end ?dateTimeEndValue . ?dateTimeEndValue core:dateTime ?dateTimeEnd } } } - } ORDER BY ?subclass DESC(?dateTimeStart) DESC(?dateTimeEnd) ?personName + } ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart) ?indivName diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl index c4787053..c89497dd 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl @@ -12,11 +12,11 @@ <#macro showRole statement> <#local linkedIndividual> - <#if statement.person??> - ${statement.personName} + <#if statement.indivInRole??> + ${statement.indivName} <#else> <#-- This shouldn't happen, but we must provide for it --> - ${statement.roleName} (no linked person) + ${statement.roleName} (no linked individual in this role)