query-964858b7a97547b53b4b434da776c3e3
The question did not specify “metropolitan France” so I chose not to limit the results to that, which means the map is very zoomed out by default.
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#>
#defaultView:Map{"hide": ["?layer", "?coordinates]}
SELECT ?river ?riverLabel ?layer (SAMPLE(?coordinates_) AS ?coordinates) WHERE {
?river wdt:P17 wd:Q142;
# /wdt:P279* wd:Q355304; # too expensive – instead:
wdt:P31 wd:Q4022; # after all, the question was “rivers” not “watercourses” ;)
wdt:P625 ?coordinates_. # this misses rivers that have no coordinate location, but even if we made this optional they wouldn’t be shown on the map
BIND(IF(EXISTS { ?river wdt:P403 wd:Q4918. }, # change P403 to P403+ to also highlight tributaries (rivers that *eventually* end in the Mediterranean)
"ends in the Mediterranean"@en,
"does not end in the Mediterranean"@en)
AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}
GROUP BY ?river ?riverLabel ?layer
ORDER BY ASC(?layer) # try to make the map draw the “ends in…” dots above the “does not end in…” ones, so they’re more visible
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?coordinates")
v3("?coordinates_"):::projected
v4("?layer"):::projected
v2("?river"):::projected
c7(["bd:serviceParam"]):::iri
c4(["wd:Q4022"]):::iri
c9(["fr,en"]):::literal
c2(["wd:Q142"]):::iri
v2 --"wdt:P17"--> c2
v2 --"wdt:P31"--> c4
v2 --"wdt:P625"--> v3
v2 --"wdt:P403"--> null
bind0[/"if( ,sends in the Mediterranean^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>',sdoes not end in the Mediterranean^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>')"/]
subgraph bind0e0["Exists Clause"]
e0v1 --"wdt:P403"--> e0c2
e0v1("?river"):::projected
e0c2(["wd:Q4918"]):::iri
end
bind0--EXISTS--> bind0e0
v2 --o bind0
null --o bind0
null --o bind0
bind0 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind2[/"sample(?coordinates_)"/]
v3 --o bind2
bind2 --as--o v4