query-2f0f1211d350cf6edd018e6fead2c8ab
Created by User:Gnoeee
Number of wards in each Grama panchayath
SELECT ?gp ?gpLabel (COUNT(DISTINCT ?entity) as ?count) WHERE { ?entity wdt:P31 wd:Q1195098. ?entity wdt:P131/wdt:P131* wd:Q1186. ?entity wdt:P361 ?gp. ?gp wdt:P31 wd:Q2732840. SERVICE wikibase:label {bd:serviceParam wikibase:language "en" .} } GROUP BY ?gp ?gpLabel HAVING (?count >= 0) ORDER BY DESC(?count)
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#>
# Created by User:Gnoeee
# Number of wards in each Grama panchayath
SELECT ?gp ?gpLabel (COUNT(DISTINCT ?entity) as ?count) WHERE {
?entity wdt:P31 wd:Q1195098.
?entity wdt:P131/wdt:P131* wd:Q1186.
?entity wdt:P361 ?gp.
?gp wdt:P31 wd:Q2732840.
SERVICE wikibase:label {bd:serviceParam wikibase:language "en" .}
}
GROUP BY ?gp ?gpLabel HAVING (?count >= 0)
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?count")
v2("?entity"):::projected
v3("?gp"):::projected
a1((" "))
c9(["bd:serviceParam"]):::iri
c3(["wd:Q1195098"]):::iri
c5(["wd:Q1186"]):::iri
c7(["wd:Q2732840"]):::iri
c11(["en"]):::literal
f0[["?count >= '0^^xsd:integer'"]]
f0 --> v4
v2 --"wdt:P31"--> c3
v2 --"wdt:P131"--> a1
a1 --"wdt:P131"--> c5
v2 --"wdt:P361"--> v3
v3 --"wdt:P31"--> c7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind2[/"count(?entity)"/]
v2 --o bind2
bind2 --as--o v4