query-50feea9bbb4cc668a19c1a79dad7f5fc
Query
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
(GROUP_CONCAT(DISTINCT ?natureLabel; SEPARATOR = "; ") AS ?nature) ?coords
WHERE {
?border_city wdt:P31 wd:Q902814.
?border_city wdt:P31 ?nature.
OPTIONAL { ?border_city wdt:P17 ?country. }
OPTIONAL { ?border_city wdt:P625 ?coords. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?nature rdfs:label ?natureLabel .
?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;
v3("?border_city"):::projected
v2("?border_cityLabel"):::projected
v6("?coords"):::projected
v5("?country")
v1("?countryLabel"):::projected
v8("?nature")
v7("?natureLabel"):::projected
c6(["bd:serviceParam"]):::iri
c2(["wd:Q902814"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v3 --"wdt:P31"--> c2
v3 --"wdt:P31"--> v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P17".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P625".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v8 --"rdfs:label"--> v7
v3 --"rdfs:label"--> v2
v5 --"rdfs:label"--> v1
end
bind1[/"?natureLabel"/]
v7 --o bind1
bind1 --as--o v8