From 44c4dc9f5b081decd0fd018dc34f7f8c36b1d347 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 21 Dec 2010 20:30:15 +0000 Subject: [PATCH] NIHVIVO-1341, NIHVIVO-1336 Implement strategies for handling missing linked individual in custom list views. --- .../listViewConfig-authorInAuthorship.xml | 31 ++++++++-------- .../listViewConfig-educationalTraining.xml | 37 +++++++++++-------- .../propStatement-authorInAuthorship.ftl | 7 ++++ .../propStatement-educationalTraining.ftl | 11 +++++- 4 files changed, 53 insertions(+), 33 deletions(-) create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-authorInAuthorship.ftl diff --git a/productMods/config/listViewConfig-authorInAuthorship.xml b/productMods/config/listViewConfig-authorInAuthorship.xml index 96da0684..43b356e0 100644 --- a/productMods/config/listViewConfig-authorInAuthorship.xml +++ b/productMods/config/listViewConfig-authorInAuthorship.xml @@ -11,31 +11,30 @@ sending it to the template Query requirements: - - WHERE clause must contain a statement ?subject ?property ?objectvariable, with the variables - ?subject and ?property named as such. The objectvariable can be given any name, but it must be + - WHERE clause must contain a statement ?subject ?property ?object, with the variables + ?subject and ?property named as such. The object can be given any name, but it must be included in the SELECT terms retrieved by the query. This is the statement that will be edited from the edit links. + - If the linked individual may be missing, the query should select the object's localname using + the ARQ localname function, so that the template can display the local name in the absence of + the linked individual. --> + \ No newline at end of file diff --git a/productMods/config/listViewConfig-educationalTraining.xml b/productMods/config/listViewConfig-educationalTraining.xml index c7c958ad..9972e376 100644 --- a/productMods/config/listViewConfig-educationalTraining.xml +++ b/productMods/config/listViewConfig-educationalTraining.xml @@ -11,30 +11,37 @@ sending it to the template Query requirements: - - WHERE clause must contain a statement ?subject ?property ?objectvariable, with the variables - ?subject and ?property named as such. The objectvariable can be given any name, but it must be + - WHERE clause must contain a statement ?subject ?property ?object, with the variables + ?subject and ?property named as such. The object can be given any name, but it must be included in the SELECT terms retrieved by the query. This is the statement that will be edited from the edit links. + - If the linked individual may be missing, the query should select the object's localname using + the ARQ localname function, so that the template can display the local name in the absence of + the linked individual. An alternative is to use the localName() method provided to the template + instead. --> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - SELECT DISTINCT ?edTraining ?org ?orgName ?degreeName ?degreeAbbr ?majorField ?deptOrSchool ?info ?dateTime WHERE { - ?subject ?property ?edTraining . - ?edTraining core:trainingAtOrganization ?org . - ?org rdfs:label ?orgName . - OPTIONAL { ?edTraining core:degreeEarned ?degree . } - OPTIONAL { ?degree rdfs:label ?degreeName . } - OPTIONAL { ?degree core:abbreviation ?degreeAbbr . } - OPTIONAL { ?edTraining core:majorField ?majorField . } - OPTIONAL { ?edTraining core:departmentOrSchool ?deptOrSchool . } - OPTIONAL { ?edTraining core:supplementalInformation ?info . } - OPTIONAL { ?edTraining core:hasDateTimeValue ?dateTimeValue . - ?dateTimeValue core:dateTime ?dateTime . } - } ORDER BY DESC(?dateTime) + SELECT DISTINCT ?edTraining (afn:localname(?edTraining) AS ?edTrainingName) ?org ?orgName + ?degreeName ?degreeAbbr ?majorField ?deptOrSchool ?info ?dateTime + WHERE { + ?subject ?property ?edTraining . + OPTIONAL { ?edTraining core:trainingAtOrganization ?org . + ?org rdfs:label ?orgName . } + OPTIONAL { ?edTraining core:degreeEarned ?degree . } + OPTIONAL { ?degree rdfs:label ?degreeName . } + OPTIONAL { ?degree core:abbreviation ?degreeAbbr . } + OPTIONAL { ?edTraining core:majorField ?majorField . } + OPTIONAL { ?edTraining core:departmentOrSchool ?deptOrSchool . } + OPTIONAL { ?edTraining core:supplementalInformation ?info . } + OPTIONAL { ?edTraining core:hasDateTimeValue ?dateTimeValue . + ?dateTimeValue core:dateTime ?dateTime . } + } ORDER BY DESC(?dateTime) diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-authorInAuthorship.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-authorInAuthorship.ftl new file mode 100644 index 00000000..7ba33325 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-authorInAuthorship.ftl @@ -0,0 +1,7 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Custom object property statement view for http://vivoweb.org/ontology/core#educationalTraining --> + +<#import "lib-sequence.ftl" as s> +<#import "lib-datetime.ftl" as dt> + diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-educationalTraining.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-educationalTraining.ftl index 98f4fd40..3281bb24 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-educationalTraining.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-educationalTraining.ftl @@ -11,10 +11,17 @@ -<#assign org>${statement.orgName} +<#assign linkedIndividual> + <#if statement.org??> + ${statement.orgName} + <#else> + <#-- This shouldn't happen, but we must provide for it --> + educational training ${statement.edTrainingName} + + <#if statement.dateTime??> <#assign dateTime = dt.xsdDateTimeToYear(statement.dateTime)> -<@s.join [ degree, org, statement.deptOrSchool!, statement.info!, dateTime! ] /> +<@s.join [ degree, linkedIndividual, statement.deptOrSchool!, statement.info!, dateTime! ] />