NIHVIVO-2733 Add custom list view for core:linkedRole - uses core:relatedRole view, with adaptations to fit both properties. Collation support for core:hasEditReviewRole. Improvements to the custom list queries and templates for core:hasRole, core:relatedRole, core:hasEditReviewRole.

This commit is contained in:
ryounes 2011-07-01 23:29:37 +00:00
parent 21c03c35f0
commit 20e94ea813
5 changed files with 28 additions and 21 deletions

View file

@ -14,11 +14,10 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
SELECT DISTINCT <collated>?subclass</collated> SELECT DISTINCT <collated>?subclass</collated> ?subclassLabel
# send the property to the template, since this view supports multiple role properties # send the property to the template, since this view supports multiple role properties
?property ?property
?role ?role
?roleLabel
?activity ?activityName ?activity ?activityName
?activityLabel ?activityLabel
?infoResource ?infoResourceName ?infoResource ?infoResourceName
@ -35,18 +34,22 @@
OPTIONAL { ?role core:forInformationResource ?infoResource OPTIONAL { ?role core:forInformationResource ?infoResource
LET (?infoResourceName := afn:localname(?infoResource)) LET (?infoResourceName := afn:localname(?infoResource))
OPTIONAL { ?infoResource rdfs:label ?infoResourceLabel } OPTIONAL { ?infoResource rdfs:label ?infoResourceLabel }
<collated>
# NB Currently we can only retrieve subclass for either the # NB Currently we can only retrieve subclass for either the
# infoResource or the activity, but not both. Later, we could have # infoResource or the activity, but not both. Later, we could have
# the query retrieve both and write a custom preprocessor to merge # the query retrieve both and write a custom preprocessor to merge
# the results into a single subclass column. # the results into a single subclass column.
?infoResource vitro:mostSpecificType ?subclass . ?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection
</collated> ?subclass rdfs:subClassOf ?superclass
FILTER ( ( ?property = core:hasEditorRole &amp;&amp; ?superclass = bibo:Collection ) ||
( ?property = core:hasReviewerRole &amp;&amp; ?superclass = core:InformationResource )
)
# Get subclass label for display in uncollated view
?subclass rdfs:label ?subclassLabel
} }
OPTIONAL { ?role rdfs:label ?roleLabel }
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart ?dateTimeStartValue core:dateTime ?dateTimeStart
@ -71,12 +74,15 @@
?subject ?property ?role . ?subject ?property ?role .
?role core:forInformationResource ?infoResource . ?role core:forInformationResource ?infoResource .
?infoResource vitro:mostSpecificType ?subclass . ?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection ?subclass rdfs:subClassOf ?superclass .
?subclass rdfs:label ?subclassLabel
} WHERE { } WHERE {
?subject ?property ?role . ?subject ?property ?role .
?role core:forInformationResource ?infoResource . ?role core:forInformationResource ?infoResource .
?infoResource vitro:mostSpecificType ?subclass . ?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection ?subclass rdfs:subClassOf ?superclass .
?subclass rdfs:label ?subclassLabel
FILTER ( ?superclass = bibo:Collection || ?superclass = core:InformationResource )
} }
</query-construct> </query-construct>

View file

@ -13,6 +13,7 @@
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt; PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
SELECT DISTINCT <collated>?subclass</collated> SELECT DISTINCT <collated>?subclass</collated>
# send the property to the template, since this view supports multiple role properties
?property ?property
?role ?role
?roleLabel ?roleTypeLabel ?roleLabel ?roleTypeLabel

View file

@ -9,11 +9,11 @@
<#import "lib-sequence.ftl" as s> <#import "lib-sequence.ftl" as s>
<#import "lib-datetime.ftl" as dt> <#import "lib-datetime.ftl" as dt>
<@showRole statement /> <@showRole statement property />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the <#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement --> next statement -->
<#macro showRole statement> <#macro showRole statement property>
<#local linkedIndividual> <#local linkedIndividual>
<#if statement.infoResource??> <#if statement.infoResource??>
<#if statement.activity??> <#if statement.activity??>
@ -23,16 +23,14 @@
</#if> </#if>
<#elseif statement.activity??> <#elseif statement.activity??>
<a href="${profileUrl(statement.activity)}">${statement.activityLabel!statement.activityName}</a> <a href="${profileUrl(statement.activity)}">${statement.activityLabel!statement.activityName}</a>
<#else>
<a href="${profileUrl(statement.role)}">${statement.roleLabel!}</a>
</#if> </#if>
</#local> </#local>
<#local core = "http://vivoweb.org/ontology/core#">
<#local dateTime> <#local dateTime>
<@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" /> <@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" />
</#local> </#local>
${linkedIndividual} ${statement.roleLabel!} ${dateTime!} <#-- If property is collated, then subclass label is redundant information -->
${linkedIndividual} <#if ! property.collatedBySubclass>${statement.subclassLabel!}</#if> ${dateTime!}
</#macro> </#macro>

View file

@ -26,6 +26,6 @@
<@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" /> <@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" />
</#local> </#local>
${linkedIndividual} ${statement.roleLabel!} ${dateTime!} ${linkedIndividual} ${statement.roleLabel!} ${dateTime!} property: ${statement.property!}
</#macro> </#macro>

View file

@ -10,11 +10,11 @@
<#import "lib-sequence.ftl" as s> <#import "lib-sequence.ftl" as s>
<#import "lib-datetime.ftl" as dt> <#import "lib-datetime.ftl" as dt>
<@showRole statement /> <@showRole statement property />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the <#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement --> next statement -->
<#macro showRole statement> <#macro showRole statement property>
<#local linkedIndividual> <#local linkedIndividual>
<#if statement.indivInRole??> <#if statement.indivInRole??>
@ -29,8 +29,10 @@
so use the type label instead. --> so use the type label instead. -->
<#local roleLabel> <#local roleLabel>
<#if statement.roleLabel?has_content>${statement.roleLabel} <#if statement.roleLabel?has_content>${statement.roleLabel}
<#-- Display, e.g., "Principal Investigator" for "Principal Investigator Role" --> <#-- Display, e.g., "Principal Investigator" for "Principal Investigator Role",
<#elseif statement.roleTypeLabel?has_content>${statement.roleTypeLabel?replace(" Role", "")} "Editor" for "Editor Role".
This information is redundant if the property is collated, since it appears in the subclass label. -->
<#elseif (! property.collatedBySubclass ) && statement.roleTypeLabel?has_content>${statement.roleTypeLabel?replace(" Role", "")}
</#if> </#if>
</#local> </#local>