query-0ac704f343a2962d2a8905a6b41797df

rq turtle/ttl

Quantities and Units Listed in the SI Brochure

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
select
  ?quantity (sample(?quantityLabel) as ?quantityLabel) (sample(?quantityDesc) as ?quantityDesc)
  ?unit (sample(?unitLabel) as ?unitLabel) (sample(?unitDesc) as ?unitDesc)
  (group_concat(?unitSymbol; separator = "; ") as ?unitSymbols)
  (sample(?unitStatus) as ?unitStatus)
where {
  values ?source { wd:Q68977959 }

  ?quantity wdt:P279+ wd:Q71550118 .
  optional { ?quantity rdfs:label ?quantityLabel . filter (lang(?quantityLabel) = "en") }
  optional { ?quantity schema:description ?quantityDesc . filter (lang(?quantityDesc) = "en") }

  ?quantity p:P8111 ?quantityStatement .
  ?quantityStatement prov:wasDerivedFrom [ pr:P248 ?source ] ; ps:P8111 ?unit .
  optional { ?unit rdfs:label ?unitLabel . filter (lang(?unitLabel) = "en") }
  optional { ?unit schema:description ?unitDesc . filter (lang(?unitDesc) = "en") }
  optional {
    ?unit p:P5061 [ prov:wasDerivedFrom [ pr:P248 ?source ] ; ps:P5061 ?unitSymbol ] .
    filter (lang(?unitSymbol) = "en")
  }

  optional { ?quantityStatement a ?bestRank . }
  bind (if(bound(?bestRank) && ?bestRank = wikibase:BestRank, "<recommended>", "<accepted>") as ?unitStatus)
} group by ?quantity ?unit

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?bestRank") v7("?quantity"):::projected v12("?quantityDesc"):::projected v12("?quantityLabel"):::projected v8("?quantityStatement") v6("?source") v9("?unit"):::projected v12("?unitDesc"):::projected v12("?unitLabel"):::projected v13("?unitStatus"):::projected v1("?unitSymbol"):::projected v12("?unitSymbols") a1((" ")) a3((" ")) a2((" ")) c3(["wd:Q71550118"]):::iri bind0[/VALUES ?source/] bind0-->v6 bind00(["wd:Q68977959"]) bind00 --> bind0 v7 --"p:direct/P279"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."rdfs:label".-> v12 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."schema:description".-> v12 end v7 --"p:P8111"--> v8 a1 --"p:reference/P248"--> v6 v8 --"prov:wasDerivedFrom"--> a1 v8 --"p:statement/P8111"--> v9 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v9 -."rdfs:label".-> v12 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v9 -."schema:description".-> v12 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; a2 -."p:reference/P248".-> v6 a3 --"prov:wasDerivedFrom"--> a2 a3 --"p:statement/P5061"--> v1 v9 --"p:P5061"--> a3 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v8 -."a".-> v10 end bind1[/"if(bound(?bestRank)?bestRank = 'wikibase:BestRank','<recommended>','<accepted>')"/] v10 --o bind1 bind1 --as--o v13 bind8[/"sample(?quantityLabel)"/] v12 --o bind8 bind8 --as--o v12 bind9[/"sample(?quantityDesc)"/] v12 --o bind9 bind9 --as--o v12 bind10[/"sample(?unitLabel)"/] v12 --o bind10 bind10 --as--o v12 bind11[/"sample(?unitDesc)"/] v12 --o bind11 bind11 --as--o v12 bind12[/"?unitSymbol"/] v1 --o bind12 bind12 --as--o v12 bind13[/"sample(?unitStatus)"/] v13 --o bind13 bind13 --as--o v13