NIHVIVO-1879 Combine collated and uncollated list view queries into a single query, with preprocessing to get the right version.
This commit is contained in:
parent
451ddd9461
commit
2a3b6615f7
9 changed files with 56 additions and 227 deletions
|
@ -4,40 +4,12 @@
|
|||
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
|
||||
|
||||
<list-view-config>
|
||||
<query-base>
|
||||
<query-select>
|
||||
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 ?position
|
||||
?positionTitle
|
||||
?person ?personName
|
||||
?dateTimeStart ?dateTimeEnd WHERE {
|
||||
?subject ?property ?position
|
||||
OPTIONAL { ?position core:positionForPerson ?person .
|
||||
?person rdfs:label ?personName
|
||||
}
|
||||
OPTIONAL { ?position rdfs:label ?positionTitle }
|
||||
OPTIONAL { ?position core:dateTimeInterval ?dateTimeInterval
|
||||
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
|
||||
?dateTimeStartValue core:dateTime ?dateTimeStart
|
||||
}
|
||||
OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue .
|
||||
?dateTimeEndValue core:dateTime ?dateTimeEnd
|
||||
|
||||
}
|
||||
# Current positions only: end date is either null or not in the past
|
||||
} FILTER ( !bound(?dateTimeEnd) ||
|
||||
afn:substring(str(?dateTimeEnd), 0, 4) >= afn:substring(str(afn:now()), 0, 4) )
|
||||
} ORDER BY ?personName
|
||||
</query-base>
|
||||
|
||||
<query-collated>
|
||||
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 ?subclass
|
||||
SELECT DISTINCT <collation-fragment> ?subclass </collation-fragment>
|
||||
?position
|
||||
?positionTitle
|
||||
?person ?personName
|
||||
|
@ -45,10 +17,12 @@
|
|||
?subject ?property ?position
|
||||
OPTIONAL { ?position core:positionForPerson ?person .
|
||||
?person rdfs:label ?personName
|
||||
}
|
||||
}
|
||||
<collation-fragment>
|
||||
OPTIONAL { ?position a ?subclass .
|
||||
?subclass rdfs:subClassOf core:Position
|
||||
}
|
||||
}
|
||||
</collation-fragment>
|
||||
OPTIONAL { ?position rdfs:label ?positionTitle }
|
||||
OPTIONAL { ?position core:dateTimeInterval ?dateTimeInterval
|
||||
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
|
||||
|
@ -60,8 +34,8 @@
|
|||
# Current positions only: end date is either null or not in the past
|
||||
} FILTER ( !bound(?dateTimeEnd) ||
|
||||
afn:substring(str(?dateTimeEnd), 0, 4) >= afn:substring(str(afn:now()), 0, 4) )
|
||||
} ORDER BY ?subclass ?personName
|
||||
</query-collated>
|
||||
} ORDER BY <collation-fragment> ?subclass </collation-fragment> ?personName
|
||||
</query-select>
|
||||
|
||||
<query-construct>
|
||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue