Skip to content

NXDL: group cardinality in NXDL vs. in HDF5 #1636

Description

@woutdenolf

In NXDL we have:

<xs:complexType name="groupType">
    <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"/>
    <xs:attribute name="maxOccurs" use="optional" type="nx:nonNegativeUnbounded"/>
    <xs:group ref="nx:groupGroup" minOccurs="0" maxOccurs="unbounded"/>
</xs:complexType>

<xs:group name="groupGroup">
    <xs:sequence>
        <xs:element name="group" type="nx:groupType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:group>

The groupGroup definition just controls how many <group> entries can appear in an NXDL definition file, not how many groups exist in an HDF5 file.

In XML Schema (W3C), minOccurs and maxOccurs default to 1 when not specified
(https://www.w3.org/TR/xmlschema-1/#declare-element). This does not apply however to the maxOccurs attribute in NXDL which has not default. So it is undefined.

So in:

<definition name="NXentry" type="group">
    <group type="NXuser"/>
    <group type="NXsample"/>
    <group type="NXinstrument"/>
    ...
</definition>

these lines define which group types are allowed in an NXentry. We can add as many as we want because

<xs:element name="group" type="nx:groupType" minOccurs="0" maxOccurs="unbounded"/>

But the cardinality in HDF5 is undefined because maxOccurs in NXDL has no XML default value defined in its attribute declaration.

<xs:attribute name="maxOccurs" use="optional" type="nx:nonNegativeUnbounded"/>

That is not at all what we intended right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions