maxlath/wikibase-sdk

Optionally reduce simplified data

nichtich opened this issue · 1 comments

Add an option to further reduce data on simplifiation by

  • removal of empty arrays and objects such as "references": [], "qualifiers": {}"
  • making single-element arrays simple values (e.g. "P31": "Q5" instead of "P31": ["Q5"])

This reduced format is better suitable for human inspection and reuse in edit-entity (see maxlath/wikibase-cli#63).

I don't think this kind of simplification is a good thing, we should be tolerant on the input, but consistent on the output: having variable claims values depending on the number of values means that you don't know what you get. For instance, before being able to do something like entity.claims.P31.map(someFunction) you need to first check that entity.claims.P31 is an array