query-7b5df019d77b6aac3767db3638f6b3d8
Odia authors and the awards (if any) they received, #233@09JUN2021 SELECT ?item ?itemLabel (COUNT(DISTINCT ?book) AS ?bookn) (GROUP_CONCAT(DISTINCT ?bookLabel; SEPARATOR = ", ") AS ?books) (COUNT(DISTINCT ?award) AS ?awardn) (GROUP_CONCAT(DISTINCT ?awardLabel; SEPARATOR = ", ") AS ?awards) WHERE { ?item wdt:P6886 wd:Q33810 . ?item wdt:P800 ?book. OPTIONAL { ?item wdt:P166 ?award. } # item may have an award SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?item rdfs:label ?itemLabel. ?book rdfs:label ?bookLabel. ?award rdfs:label ?awardLabel. } } GROUP BY ?item ?itemLabel ?genderLabel ?death ORDER BY DESC(?bookn)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Odia authors and the awards (if any) they received, #233@09JUN2021
SELECT ?item ?itemLabel (COUNT(DISTINCT ?book) AS ?bookn) (GROUP_CONCAT(DISTINCT ?bookLabel; SEPARATOR = ", ") AS ?books) (COUNT(DISTINCT ?award) AS ?awardn) (GROUP_CONCAT(DISTINCT ?awardLabel; SEPARATOR = ", ") AS ?awards)
WHERE {
?item wdt:P6886 wd:Q33810 .
?item wdt:P800 ?book.
OPTIONAL { ?item wdt:P166 ?award. } # item may have an award
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?item rdfs:label ?itemLabel.
?book rdfs:label ?bookLabel.
?award rdfs:label ?awardLabel. }
}
GROUP BY ?item ?itemLabel ?genderLabel ?death
ORDER BY DESC(?bookn)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?award"):::projected
v7("?awardLabel"):::projected
v9("?awardn")
v10("?awards")
v3("?book"):::projected
v6("?bookLabel"):::projected
v8("?bookn")
v8("?books")
v2("?item"):::projected
v5("?itemLabel"):::projected
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q33810"]):::iri
v2 --"wdt:P6886"--> c2
v2 --"wdt:P800"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P166".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v2 --"rdfs:label"--> v5
v3 --"rdfs:label"--> v6
v4 --"rdfs:label"--> v7
end
bind4[/"count(?book)"/]
v3 --o bind4
bind4 --as--o v8
bind5[/"?bookLabel"/]
v6 --o bind5
bind5 --as--o v8
bind6[/"count(?award)"/]
v4 --o bind6
bind6 --as--o v9
bind7[/"?awardLabel"/]
v7 --o bind7
bind7 --as--o v10