query-70acd3df931e5ec89ce16ad3ed75318a
Capital cities with GPS location for a defined set of countries: (P36)capital Hi, friends! Based on my highly limited skills I've been able to create the following query to list
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 ?country ?countryLabel ?capitalLabel
WHERE {
VALUES ?country { wd:Q965 wd:Q115 wd:Q117 wd:Q114 wd:Q1037 wd:Q924 wd:Q945 wd:Q1036 wd:Q902 wd:Q252 wd:Q928 wd:Q854 wd:Q869 wd:Q786 wd:Q792 wd:Q774 wd:Q790 wd:Q783 wd:Q96 wd:Q811 wd:Q750 wd:Q155 wd:Q739 wd:Q736 wd:Q419 wd:Q424 wd:Q1020 wd:Q836 wd:Q953 }
OPTIONAL { ?country wdt:P36 ?capital. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ASC(?countryLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?capital")
v2("?country"):::projected
v1("?countryLabel"):::projected
c3(["bd:serviceParam"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?country/]
bind0-->v2
bind00(["wd:Q965"])
bind00 --> bind0
bind01(["wd:Q115"])
bind01 --> bind0
bind02(["wd:Q117"])
bind02 --> bind0
bind03(["wd:Q114"])
bind03 --> bind0
bind04(["wd:Q1037"])
bind04 --> bind0
bind05(["wd:Q924"])
bind05 --> bind0
bind06(["wd:Q945"])
bind06 --> bind0
bind07(["wd:Q1036"])
bind07 --> bind0
bind08(["wd:Q902"])
bind08 --> bind0
bind09(["wd:Q252"])
bind09 --> bind0
bind010(["wd:Q928"])
bind010 --> bind0
bind011(["wd:Q854"])
bind011 --> bind0
bind012(["wd:Q869"])
bind012 --> bind0
bind013(["wd:Q786"])
bind013 --> bind0
bind014(["wd:Q792"])
bind014 --> bind0
bind015(["wd:Q774"])
bind015 --> bind0
bind016(["wd:Q790"])
bind016 --> bind0
bind017(["wd:Q783"])
bind017 --> bind0
bind018(["wd:Q96"])
bind018 --> bind0
bind019(["wd:Q811"])
bind019 --> bind0
bind020(["wd:Q750"])
bind020 --> bind0
bind021(["wd:Q155"])
bind021 --> bind0
bind022(["wd:Q739"])
bind022 --> bind0
bind023(["wd:Q736"])
bind023 --> bind0
bind024(["wd:Q419"])
bind024 --> bind0
bind025(["wd:Q424"])
bind025 --> bind0
bind026(["wd:Q1020"])
bind026 --> bind0
bind027(["wd:Q836"])
bind027 --> bind0
bind028(["wd:Q953"])
bind028 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P36".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end