query-f7a0ce85c4809438f119558e92047aa8
12:31, 2 February 2019 (UTC)) talk (Bouzinac was able to clean white-not very white-spaces ? }}SPARQL{{Besides, if the template Ok, i've found out this query (raising same Saarland problem :) ) it shows the current neighbours of Germany 12:52, 2 February 2019 (UTC)) talk (Tagishsimon: There's nothing much wrong. Items are included in the query if they have a wdt:P47 wd:Q183 property/value, which Saarland does. You need to add further conditions if you want to eliminate non-countries. --Bouzinac@
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 ?border ?borderLabel ?country1Label ?country2Label ?isLandBorder ?isMaritimeBorder ?constraint {
VALUES (?country1) {(wd:Q183)}
?border wdt:P31 wd:Q12413618 ;
wdt:P17 ?country1 , ?country2 .
FILTER (?country1 != ?country2)
BIND (EXISTS {?border wdt:P31 wd:Q15104814} AS ?isLandBorder)
BIND (EXISTS {?border wdt:P31 wd:Q3089219} AS ?isMaritimeBorder)
BIND ((?isLandBorder|| ?isMaritimeBorder) AS ?constraint)
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
} ORDER BY ?country1Label
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?border"):::projected
v7("?constraint"):::projected
v4("?country1")
v1("?country1Label"):::projected
v3("?country2")
v5("?isLandBorder"):::projected
v6("?isMaritimeBorder"):::projected
c5(["bd:serviceParam"]):::iri
c2(["wd:Q12413618"]):::iri
c7(["fr"]):::literal
f0[["?country1 != ?country2"]]
f0 --> v4
f0 --> v3
bind1[/VALUES ?country1/]
bind1-->v4
bind10(["wd:Q183"])
bind10 --> bind1
v4 --"wdt:P31"--> c2
v4 --"wdt:P17"--> v4
v4 --"wdt:P17"--> v3
v4 --"wdt:P31"--> null
bind2[/" "/]
subgraph bind2e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?border"):::projected
e0c2(["wd:Q15104814"]):::iri
end
bind2--EXISTS--> bind2e0
v4 --o bind2
c1 --o bind2
null --o bind2
bind2 --as--o v5
v4 --"wdt:P31"--> null
bind3[/" "/]
subgraph bind3e1["Exists Clause"]
e1v1 --"wdt:P31"--> e1c2
e1v1("?border"):::projected
e1c2(["wd:Q3089219"]):::iri
end
bind3--EXISTS--> bind3e1
v4 --o bind3
c1 --o bind3
null --o bind3
bind3 --as--o v6
bind4[/"(?isLandBorder || ?isMaritimeBorder)"/]
v5 --o bind4
v6 --o bind4
bind4 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end