query-90756cc08db270a749f9c619ed7f02a6
Related properties shows, that there are only 50,000 items with P31=Q5. Is it using very, vey old data; there is too big dataset or something else is wrong? If somebody could write SPARQL equivalent that doesn't get to timeout error, I would be thankful (I'm still learning SPARQL). related properties toolCurrently,
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#>
SELECT ?prop ?propLabel ?count WHERE {
{
SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) WHERE {
?item wdt:P31 wd:Q5 .
?item ?p ?id .
?prop wikibase:directClaim ?p .
} GROUP BY ?prop
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY DESC (?count)
limit 1000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count"):::projected
v4("?id")
v2("?item")
v3("?p")
v5("?prop"):::projected
c5(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
c7(["en"]):::literal
v2 --"wdt:P31"--> c2
v2 -->v3--> v4
v5 --"wikibase:directClaim"--> v3
bind1[/"count(?item)"/]
v2 --o bind1
bind1 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end