Open and Closed Enumerations
Note: There is a newer version of this specification see VEC 2.0.2
In the VEC model we distinguish between two kinds of enumerations:
- Closed lists
- Open lists
For a closed list the enumeration values are fixed. At the time of the UML model generation it is known, which values an attribute can take. There is no possibility to use other values later without changing the XML schema definition. Normally these are values which are defined inherently by the Model. An example would be the PartVersion.primaryPartType. As it is defined that there must exist a corresponding Specification, extending a literal would mean at the same time to create new Specification-class. Another example would be the referenceNode for Locations on TopologySegments. Since one TopologySegment only has one StartNode and one EndNode this is a typical ClosedEnumeration.
For an open list the allowed values for an attribute are not completely known at the point of the UML model generation or might change in future due to new technical developments. There may be a pre-defined set of values. But it must be possible to add further values in a later stage. An example might be the Gender of a Terminal which is currently restricted to Male and Female. In future new technologies might emerge, where the existing values are not sufficient. Motivation for this open list concept is, that for known values, standardized literals shall be used, but reading systems must be able to handle additional literals, since they can emerge quite quickly due to technology improvements.
The diagram shows the representation of open and closed enumeration lists as stereotypes.
During the UML to XML transformation, closed enumerations are transformed into XML “xs:enumeration”. Open enumerations will be translated into XML „xs:string“.
The VEC model defines for open enumerations a pre-defined list of commonly agreed values. The idea behind is that these pre-defined values are used if applicable, and further values should be used only, if the pre-defined ones do not fit. However, this cannot be enforced by the XML schema. If an open enumeration is translated into “xs:string”, it is not possible to check if the predefined values are used.
Therefore, in addition to the standard VEC XML schema, a further XML schema, called the “Strict VEC XML schema” is defined. In this schema, an open enumeration is transformed into XML “xs:enumeration”, too. The enumeration values are restricted to the pre-defined once. With this schema it is possible to check if a VEC used pre-defined values, only.