Wikidata/Wikidata-Toolkit

Units in QuantityValues are stored internally as strings

wetneb opened this issue · 0 comments

When constructing a QuantityValue, for instance with Datamodel.makeQuantityValue(new BigDecimal("123"), myUnit), the unit will internally be stored using its IRI. It will then be reconstructed using ItemIdValueImpl.fromIri(unitIRI) when accessed via QuantityValue.getUnitItemId(). If the unit is accessed multiple times, the IRI will be parsed every time into an ItemIdValue, which is perhaps a bit wasteful.

Instead, the unit object should be preserved and stored directly as such.