NIHVIVO-2723 Fix collated queries on listViewConfig-hasRole and listViewConfig-hasEditReviewRole.

This commit is contained in:
ryounes 2011-06-20 15:29:07 +00:00
parent 22d103590b
commit 2418a41c1e
2 changed files with 49 additions and 23 deletions

View file

@ -8,15 +8,16 @@
<list-view-config>
<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 bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
SELECT DISTINCT <collated>?subclass</collated>
# send the property to the template, since this view supports multiple role properties
?property
?role
?startDateOnly
?roleLabel
?activity ?activityName
?activityLabel
@ -34,12 +35,17 @@
OPTIONAL { ?role core:forInformationResource ?infoResource
LET (?infoResourceName := afn:localname(?infoResource))
OPTIONAL { ?infoResource rdfs:label ?infoResourceLabel }
}
<collated>
OPTIONAL { ?role a ?subclass .
?subclass rdfs:subClassOf core:Role
# NB Currently we can only retrieve subclass for either the
# infoResource or the activity, but not both. Later, we could have
# the query retrieve both and write a custom preprocessor to merge
# the results into a single subclass column.
OPTIONAL { ?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection
}
</collated>
}
OPTIONAL { ?role rdfs:label ?roleLabel }
OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval
OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue .
@ -52,16 +58,27 @@
<critical-data-required>
FILTER ( bound(?infoResource) )
</critical-data-required>
} ORDER BY <collated>?subclass</collated> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?infoResourceName
} ORDER BY <collated>?subclass</collated> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?infoResourceLabel ?infoResourceName
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
CONSTRUCT {
?subclass rdfs:subClassOf core:Role
?subject ?property ?role .
?role core:forInformationResource ?infoResource .
# ?infoResource a ?subclass .
?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection
} WHERE {
?subclass rdfs:subClassOf core:Role
?subject ?property ?role .
?role core:forInformationResource ?infoResource .
# ?infoResource a ?subclass .
?infoResource vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf bibo:Collection
}
</query-construct>

View file

@ -5,15 +5,15 @@
<list-view-config>
<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 core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
SELECT DISTINCT <collated>?subclass</collated>
# send the property to the template, since this view supports multiple role properties
?property
?role
?startDateOnly
?roleLabel
?activity ?activityName
?activityLabel
@ -26,8 +26,9 @@
OPTIONAL { ?activity rdfs:label ?activityLabel }
}
<collated>
OPTIONAL { ?role a ?subclass .
?subclass rdfs:subClassOf core:Role
OPTIONAL {
# ?activity a ?subclass
?activity vitro:mostSpecificType ?subclass
}
</collated>
OPTIONAL { ?role rdfs:label ?roleLabel }
@ -42,16 +43,24 @@
<critical-data-required>
FILTER ( bound(?activity) )
</critical-data-required>
} ORDER BY <collated>?subclass</collated> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?activityName
} ORDER BY <collated>?subclass</collated> DESC(?dateTimeEnd) DESC(?dateTimeStart) ?activityLabel ?activityName
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
CONSTRUCT {
?subclass rdfs:subClassOf core:Role
?subject ?property ?role .
?role core:roleIn ?activity .
# ?activity a ?subclass .
?activity vitro:mostSpecificType ?subclass .
} WHERE {
?subclass rdfs:subClassOf core:Role
?subject ?property ?role .
?role core:roleIn ?activity .
# ?activity a ?subclass .
?activity vitro:mostSpecificType ?subclass
}
</query-construct>