query-c7716798640435b0ea32763fb7a2a859
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?stationA ?stationALabel ?stationB ?stationBLabel ?slope ?altA ?altB ?coordA ?coordB ?diff ?dist
WHERE
{
?stationA wdt:P197 ?stationB .
FILTER( STR( ?stationA ) < STR( ?stationB ) ) .
?stationA wdt:P2044 ?altA ; wdt:P625 ?coordA .
?stationB wdt:P2044 ?altB ; wdt:P625 ?coordB .
BIND( geof:distance( ?coordA , ?coordB) AS ?dist ) .
BIND( ABS(?altA - ?altB) AS ?diff ) .
BIND( (?diff / ?dist) AS ?slope ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" } .
} ORDER BY DESC(?slope)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?altA"):::projected
v6("?altB"):::projected
v5("?coordA"):::projected
v7("?coordB"):::projected
v9("?diff"):::projected
v8("?dist"):::projected
v10("?slope"):::projected
v2("?stationA"):::projected
v3("?stationB"):::projected
c5(["bd:serviceParam"]):::iri
c7(["fr,en"]):::literal
f0[["str(?stationA) < str(?stationB)"]]
f0 --> v2
f0 --> v3
v2 --"wdt:P197"--> v3
v2 --"wdt:P2044"--> v4
v2 --"wdt:P625"--> v5
v3 --"wdt:P2044"--> v6
v3 --"wdt:P625"--> v7
bind1[/"http://www.opengis.net/def/function/geosparql/distance(?coordA,?coordB)"/]
v5 --o bind1
v7 --o bind1
bind1 --as--o v8
bind2[/"numeric-abs(?altA - ?altB)"/]
v4 --o bind2
v6 --o bind2
bind2 --as--o v9
bind3[/"?diff / ?dist"/]
v9 --o bind3
v8 --o bind3
bind3 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end