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

This commit is contained in:
nac26 2011-01-06 16:01:40 +00:00
parent 29a628bc02
commit 4739e32b34
2 changed files with 18 additions and 15 deletions

View file

@ -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
</query>
<template>propStatement-relatedRole.ftl</template>

View file

@ -12,11 +12,11 @@
<#macro showRole statement>
<#local linkedIndividual>
<#if statement.person??>
<a href="${profileUrl(statement.person)}">${statement.personName}</a>
<#if statement.indivInRole??>
<a href="${profileUrl(statement.indivInRole)}">${statement.indivName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${profileUrl(statement.role)}">${statement.roleName}</a> (no linked person)
<a href="${profileUrl(statement.role)}">${statement.roleName}</a> (no linked individual in this role)
</#if>
</#local>