sdmx-json icon indicating copy to clipboard operation
sdmx-json copied to clipboard

Are `minOccurs != 1`, `maxOccurs != 1` measures and attributes always arrays?

Open hoehrmann opened this issue 11 months ago • 2 comments

I understand observations are encoded as arrays of the measures, attributes, and annotations. But measures and attributes can occur more (or perhaps even less) than once. My best guess is that they then always are encoded as arrays, as otherwise the observations cannot be properly linked back to the structures, but this does not seem to be discussed in the specification at all.

(In doubt, please handle this as a public review comment on SDMX 3.1 once the comment period begins.)

hoehrmann avatar Mar 24 '24 01:03 hoehrmann

Could you please provide more details for your question?
Note that the documentation says for observations:

The value in the JSON name/value pair is an array containing:

• first: the corresponding values of all measures (as presented in the structure.measures.observation array) or the indexes of these values, depending on the presence of the values array in the component definition, • followed by: the corresponding values of all attributes presented in the structure.attributes.observation array or the indexes of these values, depending on the presence of the values array in the component definition, • and last: the indexes of the values of all annotations of that observation.

dosse avatar Mar 25 '24 16:03 dosse

Consider this example:

data:
  structures:
    - name: Example
      measures:
        observation:
          - id: OBS_VALUE
            format:
              minOccurs: 1
              maxOccurs: unbounded
  # ...
  dataSets:
    - action: Information
      series:
        0:0:0:0:0:
          observations:
            "0":
              - xxx

If this had maxOccurs: 1 then xxx would be an actual value or an index. But since maxOccurs: unbounded is set, it could be more than one value or more than one index. I could not find anything in the specification that says, if I have three actual values or three indices, then xxx has to be an array [1,2,3] (similarily, if more than one value is allowed, but I have only a single value, it also has to be encoded as array). An alternative interpretation (as this does not seem to be specified) could also be that three values would be encoded like this:

  dataSets:
    - action: Information
      series:
        0:0:0:0:0:
          observations:
            "0":
              - 1
              - 2
              - 3

but then it would not be clear if 2 is a value for OBS_VALUE or something else entirely.

hoehrmann avatar Mar 25 '24 17:03 hoehrmann