NIHVIVO-1341, NIHVIVO-1336 Implement strategies for handling missing linked individual in custom list views.

This commit is contained in:
rjy7 2010-12-21 20:30:15 +00:00
parent 9b158001da
commit 44c4dc9f5b
4 changed files with 53 additions and 33 deletions

View file

@ -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.
-->
<list-view-config>
<!--
<query>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
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 ?subClass ?authorship ?infoResource ?infoResourceName ?dateTime WHERE {
?subject ?property ?authorship .
?authorship core:linkedInformationResource ?infoResource .
?infoResource rdfs:label ?infoResourceName .
?subClass rdfs:subClassOf core:InformationResource .
OPTIONAL { ?infoResource core:hasDateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime . }
} ORDER BY ?subClass DESC(?dateTime) ?infoResourceName
</query>
-->
<template>propStatement-authorInAuthorship.ftl</template>
</list-view-config>

View file

@ -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.
-->
<list-view-config>
<query>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
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)
</query>
<template>propStatement-educationalTraining.ftl</template>

View file

@ -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>

View file

@ -11,10 +11,17 @@
</#if>
</#assign>
<#assign org><a href="${url(statement.org)}">${statement.orgName}</a></#assign>
<#assign linkedIndividual>
<#if statement.org??>
<a href="${url(statement.org)}">${statement.orgName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.edTraining)}">educational training ${statement.edTrainingName}</a>
</#if>
</#assign>
<#if statement.dateTime??>
<#assign dateTime = dt.xsdDateTimeToYear(statement.dateTime)>
</#if>
<@s.join [ degree, org, statement.deptOrSchool!, statement.info!, dateTime! ] />
<@s.join [ degree, linkedIndividual, statement.deptOrSchool!, statement.info!, dateTime! ] />