query-15b25240a18dd0ae2e03b29c4dd5ebc3
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 ?ppp ?qqq WHERE { VALUES ?item {wd:Q11103722} ?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". ?ppp ?qqq ?osmadm. } } 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 ?ppp ?qqq WHERE {
VALUES ?item {wd:Q11103722}
?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".
?ppp ?qqq ?osmadm.
}
}
ORDER BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?capital")
v2("?item"):::projected
v4("?osmadm"):::projected
v3("?osmid"):::projected
v5("?ppp"):::projected
v6("?qqq"):::projected
a1((" "))
c2(["wd:Q15390"]):::iri
c10(["en"]):::literal
c14(["admin_centre"]):::literal
c5(["wd:Q817477"]):::iri
c8(["bd:serviceParam"]):::iri
bind0[/VALUES ?item/]
bind0-->v2
bind00(["wd:Q11103722"])
bind00 --> bind0
v2 --"wdt:P131"--> c2
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
v2 --"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--> v2
v3 --https://www.openstreetmap.org/meta/has--> v4
v3 -->v4--> c14
v5 -->v6--> v4
end