Page MenuHomePhabricator

No unit is not consistently represented in JSON
Open, MediumPublic

Description

As I reported in https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team/Archive/2016/05#Representation_of_no_unit, no unit is not consistently represented and no explanation was given as to why the JSON format should have multiple ways to represent the same thing, so I can only assume it's a bug.

If you leave the field blank, it will store the unit as "1". If you enter Q199 as the unit, it will store the unit as "http://www.wikidata.org/entity/Q199". It will display both as not having a unit even though the underlying data is different. Storing the same thing in two ways for the same format seems like a bad idea to me because everyone using the JSON data will need to check for two different values to find out whether something has no unit or not. I haven't tested it, but I imagine it could also create "duplicate" statements when merging since the units are technically different, even though people using the website have no way of knowing that the statements are different.

I would expect that either leaving the field blank and entering Q199 are both considered ways to say that a value has no unit and it saves it using whichever value it prefers (in the same way that "1" and "01" and "000001" for a quantity are all normalised to "1"), or I would expect that Q199 is not considered a way to say that a value has no unit and the website stops displaying it as if it is.

You can see an example on https://www.wikidata.org/w/index.php?title=Q4115189&oldid=325555359 (last two statements).