query-9ae8457178bfbdd6c7c264e6b885f866
I'd go for something like the below, but it gives similar results.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?dummyLabel ?count
{
{
SELECT ?dummy (COUNT(distinct ?item) as ?count)
{
?wiki0 schema:about ?item ; schema:isPartOf <https://lv.wikipedia.org/> .
{ ?item wdt:P31 ?dummy . } UNION { ?item wdt:P279 ?dummy . } .
}
GROUP BY ?dummy
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "lv" .}
}
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?count"):::projected
v4("?dummy")
v3("?item")
v2("?wiki0")
c7(["bd:serviceParam"]):::iri
c3([https://lv.wikipedia.org/]):::iri
c9(["lv"]):::literal
v2 --"schema:about"--> v3
v2 --"schema:isPartOf"--> c3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P279"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> v4
end
union0r <== or ==> union0l
end
bind1[/"count(?item)"/]
v3 --o bind1
bind1 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end