diff --git a/productMods/config/listViewConfig-relatedRole.xml b/productMods/config/listViewConfig-relatedRole.xml index 8d6fd1bc..dca9ffad 100644 --- a/productMods/config/listViewConfig-relatedRole.xml +++ b/productMods/config/listViewConfig-relatedRole.xml @@ -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 ?subclass + ?vSubclass # send the property to the template, since this view supports multiple role properties ?property ?role @@ -36,7 +38,23 @@ OPTIONAL { ?role <http://purl.obolibrary.org/obo/RO_0000052> ?indivInRole . ?indivInRole rdfs:label ?indivLabel } - + OPTIONAL { ?role <http://purl.obolibrary.org/obo/RO_0000052> ?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 <http://purl.obolibrary.org/obo/RO_0000052> ?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 @@ } } + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role rdfs:label ?roleLabel . + ?role vitro:mostSpecificType ?subclass . + ?subclass rdfs:label ?roleTypeLabel . + ?role <http://purl.obolibrary.org/obo/RO_0000052> ?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 <http://purl.obolibrary.org/obo/RO_0000052> ?indivInRole . + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://purl.obolibrary.org/obo/RO_0000052> ?indivInRole . + ?indivInRole a vcard:Kind . + ?indivInRole vcard:hasName ?vName . + ?vName vcard:familyName ?lastName . + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://purl.obolibrary.org/obo/RO_0000052> ?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 <http://purl.obolibrary.org/obo/RO_0000052> ?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 <http://purl.obolibrary.org/obo/RO_0000052> ?indivInRole . + ?indivInRole a vcard:Kind . + ?indivInRole vitro:mostSpecificType ?vSubclass . + ?vSubclass rdfs:subClassOf vcard:Kind + } + } + PREFIX core: <http://vivoweb.org/ontology/core#> diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl index 16126c97..1907a90b 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-relatedRole.ftl @@ -16,7 +16,15 @@ <#local linkedIndividual> <#if statement.indivInRole??> - ${statement.indivLabel!statement.indivName} + <#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} + + <#else> + ${statement.indivLabel!statement.indivName} + <#else> <#-- This shouldn't happen, but we must provide for it --> ${i18n().missing_person_in_role}