Open and Closed Pattern Restrictions
Note: There is a newer version of this specification see VEC 2.1.0
The concept of open enumerations mentioned before is useful in cases where a restriction to a limited amount of well-known values is necessary. However, the continuous evolution of the VEC has shown, that this approach is not feasible in all situations.
Therefore, the concept of pattern restrictions has been introduced. A pattern restriction is a regular expression that defines valid attribute values. Those restrictions can be used when a valid pattern is known, but the explicit enumeration of the values is not possible. For example, it is known that valid values for the coding of a connector are only strings with two digits of alphanumerical characters. To represent this as an enumeration would require 1296 enumeration literals.
In the UML model attributes that shall be restricted with a pattern are defined like regular class attributes with a custom Primitive Type as datatype (e.g. +coding: CodingName). The Primitive Type is stereotyped either with ClosedPatternRestriction or OpenPatternRestriction. The semantic for open and closed is the same as for enumerations. ClosedPatternRestrictions are included in all schema versions, OpenPatternRestrictions only in the strict schema versions. The actual pattern of the restriction is defined as "class constraint" on the Primitive Type.
In the XML Schema the Primitive Types are translated as <xs:simpleType> based on xs:string with a xs:pattern restriction.