On 01.09.2015 09:56, Stas Malyshev wrote:
Hi!
Also, I don't see a reason why the JSON encoding should use an IRI
It probably doesn't have to, just Q-id would be enough. "1" is OK too, but a bit confusing - if the rest would be Q-ids, then it makes sense to make all of the Q-ids. Other option would be to make it just null or something special like that.
My reasoning is that people who are using JSON now already are coping with "1" in some way. So any negative effects that it might have are already there ;-).
I am not concerned with uniformity, since it is not clear anyway which strings are considered valid "unit IRIs" by Wikibase now. On the JSON level, this is a"string"; there is no "IRI" datatype there. It's different in RDF, where we must use a valid IRI as a value because RDF knows this "datatype".
string does not seem to help anyone. I would suggest keeping the "1" as a marker for "no unit". Of course, this "1" would never be shown in the
It is possible, but "1" the looks like "magic value", which is usually bad design since one needs to check for it all the time. It would be nicer if there could be a way to avoid it.
Indeed, but any value will be "magic" in this sense. Using the IRI of Q199 will just be a superficial cure to this -- code would still have to check for equality with this IRI explicitly in many places, making it a "special value" again. The cleanest solution would be to omit the "unit" key if there is no unit, but this would break some existing implementations that do not check if "unit" is present or not, and which may therefore get errors when trying to access it blindly. Maybe using "null" would be a compromise.
Wikibase and elsewhere. If we create a special IRI for denoting this situation, it will be better distinguished from other (regular) units, and there will be no dependency on the current content of Wikidata's Q199.
We already have such dependencies - e.g. in calendars and globes - so it won't be anything new. But let's see what the Wikidata team thinks about it :)
I agree for calendars. For globes, I don't think that Wikibase treats them as "special values". They are just "some IRI" with no code depending on what exactly they are. It will be different for our "1", which will be treated different on the software level. For calendars, it still had some advantage to use items (we needed the labels), but I don't see any advantage for the case of "1". I think your concern about "special values" is exactly what I had in mind, but it was not as clear yet :-).
Markus