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:
parent
21c03c35f0
commit
20e94ea813
5 changed files with 28 additions and 21 deletions
|
@ -14,11 +14,10 @@
|
|||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
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
|
||||
?property
|
||||
?role
|
||||
?roleLabel
|
||||
?activity ?activityName
|
||||
?activityLabel
|
||||
?infoResource ?infoResourceName
|
||||
|
@ -36,17 +35,21 @@
|
|||
LET (?infoResourceName := afn:localname(?infoResource))
|
||||
OPTIONAL { ?infoResource rdfs:label ?infoResourceLabel }
|
||||
|
||||
<collated>
|
||||
# NB Currently we can only retrieve subclass for either the
|
||||
# infoResource or the activity, but not both. Later, we could have
|
||||
# the query retrieve both and write a custom preprocessor to merge
|
||||
# the results into a single subclass column.
|
||||
?infoResource vitro:mostSpecificType ?subclass .
|
||||
?subclass rdfs:subClassOf bibo:Collection
|
||||
</collated>
|
||||
|
||||
?subclass rdfs:subClassOf ?superclass
|
||||
FILTER ( ( ?property = core:hasEditorRole && ?superclass = bibo:Collection ) ||
|
||||
( ?property = core:hasReviewerRole && ?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 { ?dateTimeInterval core:start ?dateTimeStartValue .
|
||||
?dateTimeStartValue core:dateTime ?dateTimeStart
|
||||
|
@ -71,12 +74,15 @@
|
|||
?subject ?property ?role .
|
||||
?role core:forInformationResource ?infoResource .
|
||||
?infoResource vitro:mostSpecificType ?subclass .
|
||||
?subclass rdfs:subClassOf bibo:Collection
|
||||
?subclass rdfs:subClassOf ?superclass .
|
||||
?subclass rdfs:label ?subclassLabel
|
||||
} WHERE {
|
||||
?subject ?property ?role .
|
||||
?role core:forInformationResource ?infoResource .
|
||||
?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>
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
|
||||
|
||||
SELECT DISTINCT <collated>?subclass</collated>
|
||||
# send the property to the template, since this view supports multiple role properties
|
||||
?property
|
||||
?role
|
||||
?roleLabel ?roleTypeLabel
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
<#import "lib-sequence.ftl" as s>
|
||||
<#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
|
||||
next statement -->
|
||||
<#macro showRole statement>
|
||||
<#macro showRole statement property>
|
||||
<#local linkedIndividual>
|
||||
<#if statement.infoResource??>
|
||||
<#if statement.activity??>
|
||||
|
@ -23,16 +23,14 @@
|
|||
</#if>
|
||||
<#elseif statement.activity??>
|
||||
<a href="${profileUrl(statement.activity)}">${statement.activityLabel!statement.activityName}</a>
|
||||
<#else>
|
||||
<a href="${profileUrl(statement.role)}">${statement.roleLabel!}</a>
|
||||
</#if>
|
||||
</#local>
|
||||
|
||||
<#local core = "http://vivoweb.org/ontology/core#">
|
||||
<#local dateTime>
|
||||
<@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" />
|
||||
</#local>
|
||||
|
||||
${linkedIndividual} ${statement.roleLabel!} ${dateTime!}
|
||||
<#-- If property is collated, then subclass label is redundant information -->
|
||||
${linkedIndividual} <#if ! property.collatedBySubclass>${statement.subclassLabel!}</#if> ${dateTime!}
|
||||
|
||||
</#macro>
|
|
@ -26,6 +26,6 @@
|
|||
<@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" />
|
||||
</#local>
|
||||
|
||||
${linkedIndividual} ${statement.roleLabel!} ${dateTime!}
|
||||
${linkedIndividual} ${statement.roleLabel!} ${dateTime!} property: ${statement.property!}
|
||||
|
||||
</#macro>
|
|
@ -10,11 +10,11 @@
|
|||
<#import "lib-sequence.ftl" as s>
|
||||
<#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
|
||||
next statement -->
|
||||
<#macro showRole statement>
|
||||
<#macro showRole statement property>
|
||||
|
||||
<#local linkedIndividual>
|
||||
<#if statement.indivInRole??>
|
||||
|
@ -29,8 +29,10 @@
|
|||
so use the type label instead. -->
|
||||
<#local roleLabel>
|
||||
<#if statement.roleLabel?has_content>${statement.roleLabel}
|
||||
<#-- Display, e.g., "Principal Investigator" for "Principal Investigator Role" -->
|
||||
<#elseif statement.roleTypeLabel?has_content>${statement.roleTypeLabel?replace(" Role", "")}
|
||||
<#-- Display, e.g., "Principal Investigator" for "Principal Investigator 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>
|
||||
</#local>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue