Sharing attributes between data structures

When multiple data structures share the same set of attributes, use this technique to eliminate copy&paste and maintain the shared attributes in one place.

  1. Create a new data structure to hold the shared attributes.
  2. Set the expand attribute of the new structure to "true".
  3. Add a placeholder attribute referring to this new data structure to all structures that should share the attributes.

For example, assume all code tables should have Label, Valid from and Valid until attributes. To facilitate this, create a Code table data structure to hold these attributes, set it to expand its attributes and refer to it from each data structure that represents a code table:

<data-structure name="Code table" code="CodeTable" expand="true">
        <description>A base entity for all code tables.</description>
        <attribute name="Label" />
        <attribute name="Valid from" />
        <attribute name="Valid until" />
</data-structure>
<data-structure name="Code table Country" code="Country">
        <attribute name="Code" code="code" status="mandatory" type="string" length="2"
                description="The ISO standard country code." />
        <attribute name="Shared attributes of all code tables" type="CodeTable" />
</data-structure>
<data-structure name="Code table Currency" code="Currency">
        <attribute name="Code" code="code" status="mandatory" type="string" length="3"
                description="The ISO standard currency code." />
        <attribute name="Shared attributes of all code tables" type="CodeTable" />
</data-structure>
<data-structure name="Code table Gender" code="Gender">
        <attribute name="Code" code="code" status="mandatory" type="string" length="1" />
        <attribute name="Shared attributes of all code tables" type="CodeTable" />
</data-structure>

Now the Label, Valid from and Valid until attributes are propagated to the Country, Currency and Gender data structures.

Next >>