Page MenuHomePhabricator

Normalized quantities with uncertainty are rounded strangely
Open, Needs TriagePublic

Description

I tried to find the shortest rivers on Wikidata with this query (because of this video) and noticed something strange: this item, with a length of 0.6±1 km.

The non-normalized quantity looks fine:

v:d0fe3cbb763bf8122165d4518e81a3b9 a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0.600"^^xsd:decimal ;
        wikibase:quantityUpperBound "+1.600"^^xsd:decimal ;
        wikibase:quantityLowerBound "-0.400"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q828224> .

The lower bound doesn’t make much sense – the river can’t very well have a negative length – but that’s not the RDF output’s fault: 0.6±1 km is just not an especially sensible length. Something strange happens in the normalized quantity, though:

v:2faaf9c571f69e68f960c7fe0861a7cd a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0"^^xsd:decimal ;
        wikibase:quantityUpperBound "+2000"^^xsd:decimal ;
        wikibase:quantityLowerBound "+0"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q11573> .

For some reason, 0.6±1 km has been normalized into 0 m, with 0 m as the lower bound and 2000 m as the upper bound. The amount is no longer in the middle between the lower and upper bound, and all three have somehow become rounded, but not very reasonably (in my opinion).

Some more experiments on the sandbox item (in each snippet, the first value is the non-normalized one:

v:5ce3d09e8e7eba9deafb3011aebe3ef7 a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0.1"^^xsd:decimal ;
        wikibase:quantityUpperBound "+1.1"^^xsd:decimal ;
        wikibase:quantityLowerBound "-0.9"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q828224> .

v:ce5e974a091c1129b4963329f10f3506 a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0"^^xsd:decimal ;
        wikibase:quantityUpperBound "+1000"^^xsd:decimal ;
        wikibase:quantityLowerBound "+0"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q11573> .
v:916f03bc72105a5a33b9bbb7c0b5c33b a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0.9"^^xsd:decimal ;
        wikibase:quantityUpperBound "+1.9"^^xsd:decimal ;
        wikibase:quantityLowerBound "-0.1"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q828224> .

v:2faaf9c571f69e68f960c7fe0861a7cd a wikibase:QuantityValue ;
        wikibase:quantityAmount "+0"^^xsd:decimal ;
        wikibase:quantityUpperBound "+2000"^^xsd:decimal ;
        wikibase:quantityLowerBound "+0"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q11573> .
v:e7ab9a2622b2cf048baa32406d548189 a wikibase:QuantityValue ;
        wikibase:quantityAmount "+1.9"^^xsd:decimal ;
        wikibase:quantityUpperBound "+2.9"^^xsd:decimal ;
        wikibase:quantityLowerBound "+0.9"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q828224> .

v:0c87644a59a22600b6af4b823c4c9306 a wikibase:QuantityValue ;
        wikibase:quantityAmount "+2000"^^xsd:decimal ;
        wikibase:quantityUpperBound "+3000"^^xsd:decimal ;
        wikibase:quantityLowerBound "+0"^^xsd:decimal ;
        wikibase:quantityUnit <http://www.wikidata.org/entity/Q11573> .

See also T68580#1258899 for some remarks by @daniel on how precision should affect unit conversion; it’s not clear to me if what he describes there was already implemented at the time, but I don’t think the behavior found here matches that description anyways.