Hey,
In the current JSON, statements are grouped by property ("statement groups") and the statements in each group are in a list (ordered). The statement groups, however, are in a map (unordered) and no extra order information is given [1].
Should we consider this the official definition? When we defined the original datamodel, we used to have statements ordered (and there were no groups by properties), but now we have the groups and abandoning statement-group order makes sense with Reasonator-style UIs that find a good order automatically. However, this should then also match the internal datamodel implementation as used, e.g., for diffs (if a bot edits an item, and statement order is not part of the data, then it might randomly reorder statement groups).
Tools that work on the JSON as it is now cannot guarantee any order of statement groups. In Java the order you get can really be different from run to run. So we should change our interfaces in WDTK from List to Set (otherwise our tests fail as soon as we read more than one statement). But before doing this, I would like to know if this is really the future or if there are plans to keep the order of statement groups and to extend the JSON instead.
Cheers,
Markus
[1] The current JSON has the following ordered elements:
* statements in one statement group (the collection of all statements with the same property) are stored as a list (ordered) * statement qualifiers are a map (no order) but extra order information is given ("qualifier-order") * the "list of references" of a statement is indeed a list (ordered) * the snaks of each reference are a map (no order) but extra order information is given ("snak-order") * aliases of each language are stored in a list (ordered)
What is not ordered:
* statement groups are stored in a map (from property ids to lists of statements with this property); no order is expressed between statements with different main properties. * labels, descriptions, alias lists (map from language to content)