diff --git a/productMods/config/listViewConfig-relatedRole.xml b/productMods/config/listViewConfig-relatedRole.xml
index dd9accc6..7a760f92 100644
--- a/productMods/config/listViewConfig-relatedRole.xml
+++ b/productMods/config/listViewConfig-relatedRole.xml
@@ -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
@@ -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
${statement.roleName} (no linked individual in this role)