wikibase-sdk icon indicating copy to clipboard operation
wikibase-sdk copied to clipboard

Optionally reduce simplified data

Open nichtich opened this issue 6 years ago • 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 https://github.com/maxlath/wikidata-cli/issues/63).

nichtich avatar Dec 23 '18 07:12 nichtich

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

maxlath avatar Jan 02 '19 10:01 maxlath