query-79ef2d7eb40bc7b2e729c583a16c2394
Class count
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q308915>
SELECT
?count
?class ?classLabel
?classDescription
?example_work ?example_workLabel
(CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WHERE {
{
SELECT
(COUNT(*) AS ?count)
?class
(SAMPLE(?work) AS ?example_work)
WHERE {
?work wdt:P31 ?class ;
wdt:P275 target: .
}
GROUP BY ?class
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?class"):::projected
v4("?count"):::projected
v4("?example_work"):::projected
v5("?example_workUrl")
v2("?work")
c5(["bd:serviceParam"]):::iri
c3([http://www.wikidata.org/entity/Q308915]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P31"--> v3
v2 --"wdt:P275"--> c3
bind2[/"count(*)"/]
bind2 --as--o v4
bind3[/"sample(?work)"/]
v2 --o bind3
bind3 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind4[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/]
v4 --o bind4
bind4 --as--o v5