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:
rjy7 2011-03-02 22:33:01 +00:00
parent 451ddd9461
commit 2a3b6615f7
9 changed files with 56 additions and 227 deletions

View file

@ -4,45 +4,29 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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 ?authorship
?infoResource ?infoResourceName
?dateTime WHERE {
?subject ?property ?authorship
OPTIONAL { ?authorship core:linkedInformationResource ?infoResource .
?infoResource rdfs:label ?infoResourceName
OPTIONAL { ?infoResource core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
}
}
} ORDER BY DESC(?dateTime) ?infoResourceName
</query-base>
<query-collated>
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 ?subclass
SELECT DISTINCT <collation-fragment> ?subclass </collation-fragment>
?authorship
?infoResource ?infoResourceName
?dateTime WHERE {
?subject ?property ?authorship
OPTIONAL { ?authorship core:linkedInformationResource ?infoResource .
?infoResource rdfs:label ?infoResourceName
<collation-fragment>
OPTIONAL { ?subclass rdfs:subClassOf core:InformationResource .
?infoResource a ?subclass
}
}
</collation-fragment>
OPTIONAL { ?infoResource core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
}
}
} ORDER BY ?subclass DESC(?dateTime) ?infoResourceName
</query-collated>
}
}
} ORDER BY <collation-fragment> ?subclass </collation-fragment> ?infoResourceName
</query-select>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;

View file

@ -4,7 +4,7 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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;
@ -33,7 +33,7 @@
}
}
}
</query-base>
</query-select>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;

View file

@ -4,7 +4,7 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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;
@ -16,7 +16,7 @@
OPTIONAL { ?dateTimeValue core:dateTime ?dateTime }
OPTIONAL { ?dateTimeValue core:dateTimePrecision ?dateTimePrecision }
}
</query-base>
</query-select>
<query-construct>
CONSTRUCT {

View file

@ -4,46 +4,13 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
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
?dateTimeStart ?dateTimeEnd
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:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
} ORDER BY DESC(?dateTimeEnd) DESC(?dateTimeStart)
</query-base>
<query-collated>
<query-select>
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;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
SELECT DISTINCT ?subclass
SELECT DISTINCT <collation-fragment> ?subclass </collation-fragment>
?edTraining
?org ?orgName
?degreeName ?degreeAbbr
@ -53,10 +20,12 @@
?subject ?property ?edTraining
OPTIONAL { ?edTraining core:trainingAtOrganization ?org .
?org rdfs:label ?orgName
<collation-fragment>
OPTIONAL { ?subclass rdfs:subClassOf foaf:Organization .
?org a ?subclass
}
}
}
</collation-fragment>
}
OPTIONAL { ?edTraining core:degreeEarned ?degree
OPTIONAL { ?degree rdfs:label ?degreeName }
OPTIONAL { ?degree core:abbreviation ?degreeAbbr }
@ -73,7 +42,7 @@
}
}
} ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart)
</query-collated>
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;

View file

@ -4,37 +4,12 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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 ?role
?roleLabel
?activity ?activityName
?dateTimeStart ?dateTimeEnd WHERE {
?subject ?property ?role
OPTIONAL { ?role core:roleIn ?activity .
?activity rdfs:label ?activityName
}
OPTIONAL { ?role rdfs:label ?roleLabel }
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
} ORDER BY DESC(?dateTimeEnd) DESC(?dateTimeStart) ?personName
</query-base>
<query-collated>
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 ?subclass
SELECT DISTINCT <collation-fragment>?subclass</collation-fragment>
?role
?roleLabel
?activity ?activityName
@ -43,9 +18,11 @@
OPTIONAL { ?role core:roleIn ?activity .
?activity rdfs:label ?activityName
}
<collation-fragment>
OPTIONAL { ?role a ?subclass .
?subclass rdfs:subClassOf core:Role
}
</collation-fragment>
OPTIONAL { ?role rdfs:label ?roleLabel }
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
@ -55,8 +32,8 @@
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
} ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart) ?personName
</query-collated>
} ORDER BY <collation-fragment>?subclass</collation-fragment> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?personName
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;

View file

@ -4,40 +4,26 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
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 ?authorship
?person ?personName WHERE {
?subject ?property ?authorship
OPTIONAL { ?authorship core:authorRank ?rank }
OPTIONAL { ?authorship core:linkedAuthor ?person .
?person rdfs:label ?personName
}
} ORDER BY ?rank ?personName
</query-base>
<query-collated>
<query-select>
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;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
SELECT DISTINCT ?subclass
SELECT DISTINCT <collation-fragment> ?subclass </collation-fragment>
?authorship
?person ?personName WHERE {
?subject ?property ?authorship
OPTIONAL { ?authorship core:authorRank ?rank }
OPTIONAL { ?authorship core:linkedAuthor ?person .
?person rdfs:label ?personName
?person rdfs:label ?personName
<collation-fragment>
OPTIONAL { ?person a ?subclass .
?subclass rdfs:subClassOf foaf:Person
}
}
} ORDER BY ?subclass ?rank ?personName
</query-collated>
}
</collation-fragment>
} ORDER BY <collation-fragment> ?subclass </collation-fragment> ?rank ?personName
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;

View file

@ -4,40 +4,12 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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 ?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) &gt;= afn:substring(str(afn:now()), 0, 4) )
} ORDER BY ?personName
</query-base>
<query-collated>
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 ?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) &gt;= 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: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;

View file

@ -4,39 +4,12 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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 ?position
?positionTitle
?hrJobTitle
?org ?orgName
?dateTimeStart ?dateTimeEnd WHERE {
?subject ?property ?position
OPTIONAL { ?position core:positionInOrganization ?org .
?org rdfs:label ?orgName
}
OPTIONAL { ?position rdfs:label ?positionTitle }
OPTIONAL { ?position core:hrJobTitle ?hrJobTitle }
OPTIONAL { ?position core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
} ORDER BY DESC(?dateTimeEnd) DESC(?dateTimeStart) ?orgName
</query-base>
<query-collated>
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 ?subclass
SELECT DISTINCT <collation-fragment>?subclass</collation-fragment>
?position
?positionTitle
?hrJobTitle
@ -56,11 +29,13 @@
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
<collation-fragment>
OPTIONAL { ?position a ?subclass .
?subclass rdfs:subClassOf core:Position
}
} ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart) ?orgName
</query-collated>
</collation-fragment>
} ORDER BY <collation-fragment>?subclass</collation-fragment> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?orgName
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;

View file

@ -4,12 +4,13 @@
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-base>
<query-select>
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 ?role
SELECT DISTINCT <collation-fragment>?subclass</collation-fragment>
?role
?roleLabel ?roleTypeLabel
?indivInRole (afn:localname(?indivInRole) AS ?indivName)
?indivLabel
@ -18,9 +19,9 @@
?subject ?property ?role
OPTIONAL { ?role rdfs:label ?roleLabel }
# We need ?subclass in query-base to get the roleTypeLabel for roles that
# have no label (e.g., InvestigatorRole and its subclasses)
# We need ?subclass in the uncollated query to get the roleTypeLabel
# for roles that have no label (e.g., InvestigatorRole and its subclasses).
OPTIONAL { ?role a ?subclass .
?subclass rdfs:subClassOf core:Role
OPTIONAL { ?subclass rdfs:label ?roleTypeLabel }
@ -39,45 +40,8 @@
}
}
} ORDER BY ?indivName ?indivLabel ?roleLabel ?roleTypeLabel
</query-base>
<query-collated>
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 ?subclass
?role
?roleLabel ?roleTypeLabel
?indivInRole (afn:localname(?indivInRole) AS ?indivName)
?indivLabel
?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
?subject ?property ?role
OPTIONAL { ?role rdfs:label ?roleLabel }
OPTIONAL { ?role a ?subclass .
?subclass rdfs:subClassOf core:Role
OPTIONAL { ?subclass rdfs:label ?roleTypeLabel }
?roleProp rdfs:subPropertyOf core:roleOf ;
rdfs:domain ?subclass .
?role ?roleProp ?indivInRole
OPTIONAL { ?indivInRole rdfs:label ?indivLabel }
}
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
}
} ORDER BY ?subclass ?indivName ?indivLabel ?roleLabel ?roleTypeLabel
</query-collated>
} ORDER BY <collation-fragment>?subclass</collation-fragment>?indivName ?indivLabel ?roleLabel ?roleTypeLabel
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;