query-b248fae95cd615426c4844767e949616
Counting instances and classesI have got a timeout. Could you improve it for me please?
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?dummyLabel (COUNT(distinct ?item) as ?count)
WHERE {
?wiki0 <http://schema.org/about> ?item .
?wiki0 <http://schema.org/isPartOf> <https://lv.wikipedia.org/> .
{ ?item wdt:P31 ?dummy . } UNION { ?item wdt:P279 ?dummy . } .
?dummy rdfs:label ?dummyLabel .
FILTER (lang(?dummyLabel) = "lv")
}
GROUP BY ?dummyLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count")
v5("?dummy")
v2("?dummyLabel"):::projected
v4("?item"):::projected
v3("?wiki0")
c4([https://lv.wikipedia.org/]):::iri
f0[["?dummyLabel = 'lv'"]]
f0 --> v2
v3 --http://schema.org/about--> v4
v3 --http://schema.org/isPartOf--> c4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P279"--> v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P31"--> v5
end
union0r <== or ==> union0l
end
v5 --"rdfs:label"--> v2
bind2[/"count(?item)"/]
v4 --o bind2
bind2 --as--o v6