query-51e833afb5fde75b901502971539d138

rq turtle/ttl

Non-human citizensI am trying to get a list of all non-humans having some citizenship. I can do this for any particular country but query for all countries timeout:

Use at

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 ?stateLabel (COUNT(?item) AS ?cnt) WHERE {
  ?item wdt:P27 ?state.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

MINUS { ?item wdt:P31 wd:Q5. }
MINUS { ?item wdt:P31/wdt:P279* wd:Q95074.}
MINUS { ?item wdt:P31/wdt:P279* wd:Q8436.}
}
GROUP BY ?state ?stateLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?cnt") v1("?item"):::projected v2("?state") a1((" ")) a2((" ")) c3(["bd:serviceParam"]):::iri c7(["wd:Q5"]):::iri c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal c10(["wd:Q8436"]):::iri c9(["wd:Q95074"]):::iri v1 --"wdt:P27"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c3 --"wikibase:language"--> c5 end subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P31"--> c7 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c9 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c10 end bind4[/"count(?item)"/] v1 --o bind4 bind4 --as--o v3