VIVO-1038. Updated grant contributor property so that it will display name parts of vcard individuals but without making them links.

This commit is contained in:
Tim Worrall 2015-08-24 11:54:21 -04:00
parent 0eba1cbdbd
commit 583aa3791a
2 changed files with 103 additions and 2 deletions

View file

@ -10,8 +10,10 @@
PREFIX core: <http://vivoweb.org/ontology/core#>
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
SELECT DISTINCT <collated>?subclass</collated>
?vSubclass
# send the property to the template, since this view supports multiple role properties
?property
?role
@ -36,7 +38,23 @@
OPTIONAL { ?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole rdfs:label ?indivLabel
}
OPTIONAL { ?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vcard:hasName ?vName .
?vName vcard:familyName ?lastName .
OPTIONAL { ?vName vcard:givenName ?firstName . }
OPTIONAL { ?vName core:middleName ?middleName . }
bind ( COALESCE(?firstName, "") As ?firstName1) .
bind ( COALESCE(?middleName, "") As ?middleName1) .
bind ( COALESCE(?lastName, "") As ?lastName1) .
bind (concat(str(?lastName1 + ", "),str(?firstName1 + " "),str(?middleName1)) as ?indivLabel) .
OPTIONAL { ?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vitro:mostSpecificType ?vSubclass .
?vSubclass rdfs:subClassOf vcard:Kind
}
}
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
@ -92,6 +110,81 @@
}
}
</query-construct>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?role .
?role a ?objectType .
?role rdfs:label ?roleLabel .
?role vitro:mostSpecificType ?subclass .
?subclass rdfs:label ?roleTypeLabel .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vcard:hasName ?vName .
?vName vcard:familyName ?lastName .
?vName vcard:givenName ?firstName .
?vName core:middleName ?middleName .
?indivInRole vitro:mostSpecificType ?vSubclass .
?vSubclass rdfs:subClassOf vcard:Kind
} WHERE {
{
?subject ?property ?role .
?role a ?objectType
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role rdfs:label ?roleLabel
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role vitro:mostSpecificType ?subclass
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role vitro:mostSpecificType ?subclass .
?subclass rdfs:label ?roleTypeLabel
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vcard:hasName ?vName .
?vName vcard:familyName ?lastName .
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vcard:hasName ?vName .
?vName vcard:familyName ?lastName .
?vName vcard:givenName ?firstName .
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vcard:hasName ?vName .
?vName vcard:familyName ?lastName .
?vName vcard:givenName ?firstName .
?vName core:middleName ?middleName .
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://purl.obolibrary.org/obo/RO_0000052&gt; ?indivInRole .
?indivInRole a vcard:Kind .
?indivInRole vitro:mostSpecificType ?vSubclass .
?vSubclass rdfs:subClassOf vcard:Kind
}
}
</query-construct>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;

View file

@ -16,7 +16,15 @@
<#local linkedIndividual>
<#if statement.indivInRole??>
<a href="${profileUrl(statement.uri("indivInRole"))}" title="${i18n().name}">${statement.indivLabel!statement.indivName}</a>
<#if statement.vSubclass?? && statement.vSubclass?contains("vcard")>
<#if statement.indivLabel?replace(" ","")?length == statement.indivLabel?replace(" ","")?last_index_of(",") + 1 >
${statement.indivLabel?replace(",","")}
<#else>
${statement.indivLabel}
</#if>
<#else>
<a href="${profileUrl(statement.uri("indivInRole"))}" title="${i18n().name}">${statement.indivLabel!statement.indivName}</a>
</#if>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${profileUrl(statement.uri("role"))}" title="${i18n().missing_person_in_role}">${i18n().missing_person_in_role}</a>