NIHVIVO-1727 Corrections to core:relatedRole list view to get related individual that has no label
This commit is contained in:
parent
0493637b3a
commit
18ade9a1dd
2 changed files with 50 additions and 50 deletions
|
@ -9,42 +9,43 @@
|
|||
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
|
||||
|
||||
SELECT DISTINCT ?role (afn:localname(?role) AS ?roleName)
|
||||
?roleLabel ?roleTypeLabel
|
||||
?indivInRole ?indivName
|
||||
SELECT DISTINCT ?role (afn:localname(?role) AS ?roleName)
|
||||
?indivInRole (afn:localname(?indivInRole) AS ?indivName)
|
||||
?indivLabel
|
||||
?roleLabel ?roleTypeLabel
|
||||
?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
|
||||
GRAPH ?g1 { ?subject ?property ?role }
|
||||
|
||||
GRAPH ?g1 { ?subject ?property ?role }
|
||||
|
||||
# ?role is either a core:Role or one of its subclasses
|
||||
{
|
||||
{ GRAPH ?g2 { ?role a ?subclass } }
|
||||
{ GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } }
|
||||
UNION
|
||||
{ GRAPH ?g4 { ?role a core:Role } }
|
||||
}
|
||||
|
||||
# Works because we don't do inferencing on subproperties, so the only ?roleProp
|
||||
# returned will be the asserted one.
|
||||
# We need ?subclass in query-base to get the roleTypeLabel for roles that
|
||||
# have no label (e.g., InvestigatorRole and its subclasses)
|
||||
OPTIONAL { GRAPH ?g2 { ?role a ?subclass }
|
||||
GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role }
|
||||
OPTIONAL { GRAPH ?g4 { ?subclass rdfs:label ?roleTypeLabel } }
|
||||
}
|
||||
|
||||
OPTIONAL { GRAPH ?g5 { ?roleProp rdfs:subPropertyOf core:roleOf }
|
||||
GRAPH ?g6 { ?role ?roleProp ?indivInRole }
|
||||
GRAPH ?g7 { ?indivInRole rdfs:label ?indivName }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
|
||||
OPTIONAL { GRAPH ?g9 { ?subclass rdfs:label ?roleTypeLabel } }
|
||||
OPTIONAL { GRAPH ?g10 { ?role core:dateTimeInterval ?dateTimeInterval }
|
||||
OPTIONAL { GRAPH ?g11 { ?dateTimeInterval core:start ?dateTimeStartValue }
|
||||
GRAPH ?g12 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
|
||||
OPTIONAL { GRAPH ?g7 { ?indivInRole rdfs:label ?indivLabel } }
|
||||
}
|
||||
|
||||
OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
|
||||
|
||||
OPTIONAL { GRAPH ?g9 { ?role core:dateTimeInterval ?dateTimeInterval }
|
||||
OPTIONAL { GRAPH ?g10 { ?dateTimeInterval core:start ?dateTimeStartValue }
|
||||
GRAPH ?g11 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g13 { ?dateTimeInterval core:end ?dateTimeEndValue }
|
||||
GRAPH ?g14 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
|
||||
}
|
||||
}
|
||||
OPTIONAL { GRAPH ?g12 { ?dateTimeInterval core:end ?dateTimeEndValue }
|
||||
GRAPH ?g13 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
|
||||
}
|
||||
}
|
||||
# Make sure we get the role that goes with the role property
|
||||
FILTER (
|
||||
( ?roleProp != core:investigatorRoleOf || ?subclass = core:InvestigatorRole ) &&
|
||||
( ?roleProp != core:principalInvestigatorRoleOf || ?subclass = core:PrincipalInvestigatorRole ) &&
|
||||
( ?roleProp != core:co-PrincipalInvestigatorRoleOf || ?subclass = core:CoPrincipalInvestigatorRole )
|
||||
)
|
||||
} ORDER BY ?indivName ?roleLabel ?roleTypeLabel
|
||||
} ORDER BY ?indivName ?indivLabel ?roleLabel ?roleTypeLabel
|
||||
</query-base>
|
||||
|
||||
<query-collated>
|
||||
|
@ -54,41 +55,40 @@
|
|||
|
||||
SELECT DISTINCT ?subclass
|
||||
?role (afn:localname(?role) AS ?roleName)
|
||||
?roleLabel ?roleTypeLabel
|
||||
?indivInRole ?indivName
|
||||
?indivInRole (afn:localname(?indivInRole) AS ?indivName)
|
||||
?indivLabel
|
||||
?roleLabel ?roleTypeLabel
|
||||
?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
|
||||
|
||||
GRAPH ?g1 { ?subject ?property ?role }
|
||||
|
||||
# ?role is either a core:Role or one of its subclasses
|
||||
{
|
||||
{ GRAPH ?g2 { ?role a ?subclass } }
|
||||
{ GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } }
|
||||
UNION
|
||||
{ GRAPH ?g4 { ?role a core:Role } }
|
||||
OPTIONAL { GRAPH ?g2 { ?role a ?subclass }
|
||||
GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role }
|
||||
OPTIONAL { GRAPH ?g4 { ?subclass rdfs:label ?roleTypeLabel } }
|
||||
}
|
||||
|
||||
# Works because we don't do inferencing on subproperties, so the only ?roleProp
|
||||
# returned will be the asserted one.
|
||||
|
||||
OPTIONAL { GRAPH ?g5 { ?roleProp rdfs:subPropertyOf core:roleOf }
|
||||
GRAPH ?g6 { ?role ?roleProp ?indivInRole }
|
||||
GRAPH ?g7 { ?indivInRole rdfs:label ?indivName }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
|
||||
OPTIONAL { GRAPH ?g9 { ?subclass rdfs:label ?roleTypeLabel } }
|
||||
OPTIONAL { GRAPH ?g10 { ?role core:dateTimeInterval ?dateTimeInterval }
|
||||
OPTIONAL { GRAPH ?g11 { ?dateTimeInterval core:start ?dateTimeStartValue }
|
||||
GRAPH ?g12 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g13 { ?dateTimeInterval core:end ?dateTimeEndValue }
|
||||
GRAPH ?g14 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g7 { ?indivInRole rdfs:label ?indivLabel } }
|
||||
}
|
||||
|
||||
OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
|
||||
|
||||
OPTIONAL { GRAPH ?9 { ?role core:dateTimeInterval ?dateTimeInterval }
|
||||
OPTIONAL { GRAPH ?g10 { ?dateTimeInterval core:start ?dateTimeStartValue }
|
||||
GRAPH ?g11 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
|
||||
}
|
||||
OPTIONAL { GRAPH ?g12 { ?dateTimeInterval core:end ?dateTimeEndValue }
|
||||
GRAPH ?g13 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
|
||||
}
|
||||
}
|
||||
# Make sure we get the role that goes with the role property
|
||||
FILTER (
|
||||
( ?roleProp != core:investigatorRoleOf || ?subclass = core:InvestigatorRole ) &&
|
||||
( ?roleProp != core:principalInvestigatorRoleOf || ?subclass = core:PrincipalInvestigatorRole ) &&
|
||||
( ?roleProp != core:co-PrincipalInvestigatorRoleOf || ?subclass = core:CoPrincipalInvestigatorRole )
|
||||
)
|
||||
} ORDER BY ?subclass ?indivName ?roleLabel ?roleTypeLabel
|
||||
} ORDER BY ?subclass ?indivName ?indivLabel ?roleLabel ?roleTypeLabel
|
||||
</query-collated>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<#local linkedIndividual>
|
||||
<#if statement.indivInRole??>
|
||||
<a href="${profileUrl(statement.indivInRole)}">${statement.indivName}</a>
|
||||
<a href="${profileUrl(statement.indivInRole)}">${statement.indivLabel!statement.indivName}</a>
|
||||
<#else>
|
||||
<#-- This shouldn't happen, but we must provide for it -->
|
||||
<a href="${profileUrl(statement.role)}">${statement.roleName}</a> (no linked individual in this role)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue