query-563f749ca5e4c8d5d05caa10ebbcd397
Obtaining the output type when convertingThe UI shows which units the various conversion factors correspond to. Where does that data come from? It isn't clear from querying the value of the property. The datatype of the conversion factors are simply xsd:decimal. : The following query retrieves both magnitude and unit for the example of {{Q:79738}}:Drrngrvy@
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
select * where {
# gigabyte
wd:Q79738 p:P2442 / psv:P2442 [
wikibase:quantityAmount ?amount ;
wikibase:quantityUnit ?unit ;
] .
?unit rdfs:label ?unitLabel .
filter (lang(?unitLabel) = "en")
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?amount"):::projected
v3("?unit"):::projected
v1("?unitLabel"):::projected
a2((" "))
a1((" "))
c4(["wd:Q79738"]):::iri
f0[["?unitLabel = 'en'"]]
f0 --> v1
a1 --"wikibase:quantityAmount"--> v2
a1 --"wikibase:quantityUnit"--> v3
c4 --"p:P2442"--> a2
a2 --"p:statement/value/P2442"--> a1
v3 --"rdfs:label"--> v1