query-2498aab241d2a732a75e4ade7524cf9e

rq turtle/ttl

Count item labels

Use at

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#>
SELECT ?item ?itemLabel (COUNT(?value) AS ?values)
WHERE
{
  ?item wdt:P31 wd:Q6256.
  OPTIONAL{?item rdfs:label ?value}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?item ?itemLabel
ORDER BY DESC(?values)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v3("?value"):::projected v4("?values") c5(["bd:serviceParam"]):::iri c7(["en"]):::literal c2(["wd:Q6256"]):::iri v2 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."rdfs:label".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind1[/"count(?value)"/] v3 --o bind1 bind1 --as--o v4