query-d189c1c5960f188647596a52dbff1004

rq turtle/ttl

title: Mountains by height SELECT ?item ?itemLabel ?height_in_m ?globeLabel ?height ?unitLabel ?lowerbound ?upperbound ?precision ?height2 ?conversion WHERE { ?item wdt:P31/wdt:P279* wd:Q8502. # berg ?item wdt:P17 wd:Q142. ?item p:P2044 ?stmnode. # elevation optional {?item wdt:P376 ?globe.} ?stmnode psv:P2044 ?valuenode. ?valuenode wikibase:quantityAmount ?height. ?valuenode wikibase:quantityUnit ?unit. #optional {?valuenode wikibase:quantityLowerBound ?lowerbound. #?valuenode wikibase:quantityUpperBound ?upperbound. #BIND((?upperbound-?lowerbound)/2 AS ?precision). #BIND(IF(?precision=0, ?height, (CONCAT(str(?height), "±", str(?precision)))) AS ?height2). }

# conversion to SI unit ?unit p:P2370 ?unitstmnode. # conversion to SI unit ?unitstmnode psv:P2370 ?unitvaluenode. ?unitvaluenode wikibase:quantityAmount ?conversion. ?unitvaluenode wikibase:quantityUnit wd:Q11573. # meter BIND(?height* ?conversion AS ?height_in_m).

SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". } } ORDER BY DESC(?height_in_m) LIMIT 10000

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Mountains by height
SELECT ?item ?itemLabel  ?height_in_m ?globeLabel ?height ?unitLabel ?lowerbound ?upperbound ?precision ?height2 ?conversion
WHERE
{
  ?item          wdt:P31/wdt:P279*           wd:Q8502.    # berg
  ?item          wdt:P17                     wd:Q142.
  ?item          p:P2044                     ?stmnode.    # elevation
  optional {?item          wdt:P376                     ?globe.}
  ?stmnode       psv:P2044                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?height.
  ?valuenode     wikibase:quantityUnit       ?unit.
  #optional {?valuenode     wikibase:quantityLowerBound ?lowerbound.
  #?valuenode     wikibase:quantityUpperBound ?upperbound.
  #BIND((?upperbound-?lowerbound)/2 AS ?precision).
  #BIND(IF(?precision=0, ?height, (CONCAT(str(?height), "±", str(?precision)))) AS ?height2). }

  # conversion to SI unit
  ?unit          p:P2370                 ?unitstmnode.   # conversion to SI unit
  ?unitstmnode   psv:P2370               ?unitvaluenode. 
  ?unitvaluenode wikibase:quantityAmount ?conversion.
  ?unitvaluenode wikibase:quantityUnit   wd:Q11573.      # meter
  BIND(?height* ?conversion AS ?height_in_m).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
} 
ORDER BY DESC(?height_in_m)
LIMIT 10000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?conversion"):::projected v4("?globe") v6("?height"):::projected v11("?height_in_m"):::projected v2("?item"):::projected v3("?stmnode") v7("?unit") v8("?unitstmnode") v9("?unitvaluenode") v5("?valuenode") a1((" ")) c13(["wd:Q11573"]):::iri c15(["bd:serviceParam"]):::iri c17(["de,en"]):::literal c3(["wd:Q8502"]):::iri c5(["wd:Q142"]):::iri v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v2 --"p:direct/P17"--> c5 v2 --"p:P2044"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P376".-> v4 end v3 --"p:statement/value/P2044"--> v5 v5 --"wikibase:quantityAmount"--> v6 v5 --"wikibase:quantityUnit"--> v7 v7 --"p:P2370"--> v8 v8 --"p:statement/value/P2370"--> v9 v9 --"wikibase:quantityAmount"--> v10 v9 --"wikibase:quantityUnit"--> c13 bind0[/"?height * ?conversion"/] v6 --o bind0 v10 --o bind0 bind0 --as--o v11 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end