query-cf894f24046d7d1ed303c949b477a927
TODO
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?border_city ?border_cityLabel ?countryLabel ?coords
WHERE {
?border_city wdt:P31 wd:Q902814.
OPTIONAL { ?border_city wdt:P17 ?country. }
OPTIONAL { ?border_city wdt:P625 ?coords. }
# Countries in South America
FILTER (?country IN (wd:Q77, wd:Q414, wd:Q298, wd:Q750, wd:Q419, wd:Q717, wd:Q736, wd:Q739, wd:Q733, wd:Q155))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?border_city rdfs:label ?border_cityLabel.
?country rdfs:label ?countryLabel.}
}
GROUP BY ?border_city ?border_cityLabel ?countryLabel ?coords
order by ?countryLabel ?border_cityLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?border_city"):::projected
v2("?border_cityLabel"):::projected
v5("?coords"):::projected
v3("?country")
v1("?countryLabel"):::projected
c16(["bd:serviceParam"]):::iri
c12(["wd:Q902814"]):::iri
c18(["#91;AUTO_LANGUAGE#93;,en"]):::literal
list0c7(["wd:Q736"]):::iri
list0c2(["wd:Q414"]):::iri
list0c9(["wd:Q733"]):::iri
list0c6(["wd:Q717"]):::iri
list0c8(["wd:Q739"]):::iri
list0c1(["wd:Q77"]):::iri
list0c5(["wd:Q419"]):::iri
list0c4(["wd:Q750"]):::iri
list0c3(["wd:Q298"]):::iri
list0c10(["wd:Q155"]):::iri
list0c1 --o f0
list0c2 --o f0
list0c3 --o f0
list0c4 --o f0
list0c5 --o f0
list0c6 --o f0
list0c7 --o f0
list0c8 --o f0
list0c9 --o f0
list0c10 --o f0
f0[[" in "]]
f0 --> v3
v4 --"wdt:P31"--> c12
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P17".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P625".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
v4 --"rdfs:label"--> v2
v3 --"rdfs:label"--> v1
end