NIHVIVO-1338 Custom list view for core:organizationForPosition

This commit is contained in:
nac26 2011-01-04 14:04:55 +00:00
parent e07a78d3a8
commit 583ec198d5
3 changed files with 80 additions and 0 deletions

View file

@ -30,5 +30,9 @@
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#personInPosition"> <rdf:Description rdf:about="http://vivoweb.org/ontology/core#personInPosition">
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-personInPosition.xml</display:listViewConfigFile> <display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-personInPosition.xml</display:listViewConfigFile>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#organizationForPosition">
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-organizationForPosition.xml</display:listViewConfigFile>
</rdf:Description>
</rdf:RDF> </rdf:RDF>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
SELECT DISTINCT ?position (afn:localname(?position) AS ?positionName)
?positionTitle ?person ?personName ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
GRAPH ?g1 { ?subject ?property ?position }
OPTIONAL { GRAPH ?g2 { ?position core:positionForPerson ?person }
GRAPH ?g3 { ?person rdfs:label ?personName }
}
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) ?personName
</query>
<template>propStatement-organizationForPosition.ftl</template>
</list-view-config>

View file

@ -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#organizationForPosition -->
<#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.person??>
<a href="${url(statement.person)}">${statement.personName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.position)}">${statement.positionName}</a> (no linked person)
</#if>
</#local>
<#local dateTimeInterval>
<#if statement.dateTimeStart??>
<#local startYear = dt.xsdDateTimeToYear(statement.dateTimeStart)>
</#if>
<#if statement.dateTimeEnd??>
<#local endYear = dt.xsdDateTimeToYear(statement.dateTimeEnd)>
</#if>
<#if startYear?? && endYear??>
${startYear} - ${endYear}
<#elseif startYear??>
${startYear} -
<#elseif endYear ??>
- ${endYear}
</#if>
</#local>
<#local dateInPosition>
<#if dateTimeInterval?has_content>
<span class="listDateTime">${dateTimeInterval}</span>
</#if>
</#local>
<@s.join [ linkedIndividual, statement.positionTitle! ] /> ${dateInPosition!}
</#macro>