query-489e79c9c6976f1d0c93ddb456f18f00
Get osm id for mandal(sub district) and its admin_centre PREFIX osmt: https://wiki.openstreetmap.org/wiki/Key: PREFIX osmm: https://www.openstreetmap.org/meta/ SELECT DISTINCT ?item ?itemLabel ?capitalLabel ?osmid ?osmadm WHERE { ?item (wdt:P131) wd:Q15390; (wdt:P31/(wdt:P279)) wd:Q817477; wdt:P36 ?capital. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } SERVICE https://sophox.org/sparql {
?osmid osmt:wikidata ?item; osmm:has ?osmadm; ?osmadm "admin_centre". }
} ORDER BY ?item
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#>
#Get osm id for mandal(sub district) and its admin_centre
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT DISTINCT ?item ?itemLabel ?capitalLabel ?osmid ?osmadm WHERE {
?item (wdt:P131*) wd:Q15390;
(wdt:P31/(wdt:P279*)) wd:Q817477;
wdt:P36 ?capital.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
SERVICE <https://sophox.org/sparql> {
?osmid osmt:wikidata ?item;
osmm:has ?osmadm;
?osmadm "admin_centre".
}
}
ORDER BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?capital")
v1("?item"):::projected
v4("?osmadm"):::projected
v3("?osmid"):::projected
a1((" "))
c2(["wd:Q15390"]):::iri
c10(["en"]):::literal
c14(["admin_centre"]):::literal
c5(["wd:Q817477"]):::iri
c8(["bd:serviceParam"]):::iri
v1 --"wdt:P131"--> c2
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
v1 --"wdt:P36"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
subgraph s2["https://sophox.org/sparql"]
style s2 stroke-width:4px;
v3 --https://wiki.openstreetmap.org/wiki/Key:wikidata--> v1
v3 --https://www.openstreetmap.org/meta/has--> v4
v3 -->v4--> c14
end