NIHVIVO-1339 core:relatedRole custom list view is a work in progress. To review potential implementation options with Rebecca

This commit is contained in:
nac26 2011-01-06 14:44:04 +00:00
parent bbd51fca82
commit 9ab78ca9cf
3 changed files with 87 additions and 0 deletions

View file

@ -99,4 +99,8 @@
end roles (from person) config
******************************************************************
-->
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#relatedRole">
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-relatedRole.xml</display:listViewConfigFile>
</rdf:Description>
</rdf:RDF>

View file

@ -0,0 +1,36 @@
<?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 ?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 != &lt;http://vitro.mannlib.cornell.edu/default/inferred-tbox&gt; &amp;&amp;
?g5 != &lt;http://vitro.mannlib.cornell.edu/default/vitro-kb-inf&gt; )
}
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
</query>
<template>propStatement-relatedRole.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#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??>
<a href="${profileUrl(statement.person)}">${statement.personName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${profileUrl(statement.role)}">${statement.roleName}</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 dateInRole>
<#if dateTimeInterval?has_content>
<span class="listDateTime">${dateTimeInterval}</span>
</#if>
</#local>
${linkedIndividual} ${statement.specificRole} ${dateInRole!}
</#macro>