query-69abbcc366b3d78a7e77148295687032

rq turtle/ttl

sailboat class lengths converted to standard SI unit

see https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Precision,_Units_and_Coordinates#Normalised_units

SELECT ?item ?itemLabel ?length ?unitLabel ?length2 ?conversion ?length_in_m WHERE { ?item wdt:P31/wdt:P279* wd:Q106179098. # sailboat class #?item wdt:P17 wd:Q30. # country USA ?item p:P2043 ?stmnode. # length ?stmnode psv:P2043 ?valuenode. ?valuenode wikibase:quantityAmount ?length. ?valuenode wikibase:quantityUnit ?unit.

# 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(?length * ?conversion AS ?length_in_m).

SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?length_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#>
# sailboat class lengths converted to standard SI unit
# see https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Precision,_Units_and_Coordinates#Normalised_units
SELECT ?item ?itemLabel ?length ?unitLabel ?length2 ?conversion ?length_in_m 
WHERE
{
  ?item          wdt:P31/wdt:P279*           wd:Q106179098.    # sailboat class
  #?item          wdt:P17                     wd:Q30.      # country USA
  ?item          p:P2043                     ?stmnode.    # length
  ?stmnode       psv:P2043                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?length.
  ?valuenode     wikibase:quantityUnit       ?unit.

  # 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(?length * ?conversion AS ?length_in_m).

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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?conversion"):::projected v2("?item"):::projected v5("?length"):::projected v10("?length_in_m"):::projected v3("?stmnode") v6("?unit") v7("?unitstmnode") v8("?unitvaluenode") v4("?valuenode") a1((" ")) c3(["wd:Q106179098"]):::iri c14(["en"]):::literal c10(["wd:Q11573"]):::iri c12(["bd:serviceParam"]):::iri v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v2 --"p:P2043"--> v3 v3 --"p:statement/value/P2043"--> v4 v4 --"wikibase:quantityAmount"--> v5 v4 --"wikibase:quantityUnit"--> v6 v6 --"p:P2370"--> v7 v7 --"p:statement/value/P2370"--> v8 v8 --"wikibase:quantityAmount"--> v9 v8 --"wikibase:quantityUnit"--> c10 bind0[/"?length * ?conversion"/] v5 --o bind0 v9 --o bind0 bind0 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end