query-d44baada11756539be1c0a1c122e1243
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 psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?river ?riverLabel ?lengthInKilometres 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:P403 wd:Q4918; # change P403 to P403+ to include tributaries (rivers that *eventually* end in the Mediterranean)
p:P2043 [
a wikibase:BestRank;
psn:P2043 [ # normalized quantities, in case anyone is specifying river lengths in THE BIRTHPLACE OF THE SI as miles or somesuch nonsense ;)
wikibase:quantityAmount ?lengthInMetres;
wikibase:quantityUnit wd:Q11573
]
].
BIND(?lengthInMetres / 1000 AS ?lengthInKilometres)
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}
ORDER BY DESC(?lengthInKilometres)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?lengthInKilometres"):::projected
v3("?lengthInMetres")
v2("?river"):::projected
a1((" "))
a2((" "))
c6(["wd:Q4918"]):::iri
c8(["wikibase:BestRank"]):::iri
c11(["wd:Q11573"]):::iri
c15(["bd:serviceParam"]):::iri
c4(["wd:Q4022"]):::iri
c17(["fr,en"]):::literal
c2(["wd:Q142"]):::iri
v2 --"p:direct/P17"--> c2
v2 --"p:direct/P31"--> c4
v2 --"p:direct/P403"--> c6
a1 --"a"--> c8
a2 --"wikibase:quantityAmount"--> v3
a2 --"wikibase:quantityUnit"--> c11
a1 --"p:statement/value-normalized/P2043"--> a2
v2 --"p:P2043"--> a1
bind0[/"?lengthInMetres / '1000^^xsd:integer'"/]
v3 --o bind0
bind0 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end