query-b8aa70921e2442205853a03452ae2f9a
title:Number of albums by language in descending order
credit:CamelCaseNick on Telegram
SELECT (count(?album) as ?albums) ?P407Label ?P407 WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?album wdt:P31 wd:Q482994. OPTIONAL { ?album wdt:P407 ?P407. } } GROUP BY ?P407 ?P407Label ORDER BY DESC(?albums) ASC(?P407)
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 bd: <http://www.bigdata.com/rdf#>
#title:Number of albums by language in descending order
#credit:CamelCaseNick on Telegram
SELECT (count(?album) as ?albums) ?P407Label ?P407 WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?album wdt:P31 wd:Q482994.
OPTIONAL { ?album wdt:P407 ?P407. }
}
GROUP BY ?P407 ?P407Label
ORDER BY DESC(?albums) ASC(?P407)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?P407"):::projected
v3("?album"):::projected
v4("?albums")
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c6(["wd:Q482994"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v3 --"wdt:P31"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P407".-> v2
end
bind1[/"count(?album)"/]
v3 --o bind1
bind1 --as--o v4