Overview

An extension, new feature or object class may require additional data types or codelists to capture the valid values for new attributes added to the class. 

New codelist

To add new data types or codelists create a Data Type sub-package containing any new data types needed.

In the example to the right, a <<codelist>> is defined in an extension package. It is called TestCodeList, it has a generalization to the 'string' class and inherits the basic attributes of an XSD string variable (from the XMLSchemaDatatypes, which is separate package in the AIXM UML model). 
The <<datatype>> TestDataType is created with the nilReason property, of type NilReasonEnumeration (from the ISO 19136 UML package, included in the AIXM UML model). This is the most common configuration for codelists.

Extended codelist

An AIXM Core <<CodeList>> can also be extended in the Data Type sub-package. However, it shall be kept in mind that such an extended codelist can be used only by a new attribute declared in an extension. The core model attribute will keep using the non-extended list of values, as the extension has no impact in the data type of the core model attribute.

Extend a codelist by creating a class with the same name as the codelist and giving it a stereotype <<CodeList>>. Careful analysis must be done to ensure that the extended list of values remains normalised. It shall not duplicate values that already exist in the core codelist, (including the OTHER value), but with other names/abbreviations. 

New data type with pattern

Another example is the creation of a new data type that is constrained by a pattern, as presented in the diagram at the right of the page. 
The pattern and whiteSpace values are declared as "initial values" in Sparx EA and the attributes themselves need to be declared with stereotype <<XSDfacet>>, as shown in the screenshot below:
Patterns are encoded using regular expressions. The Schema Recommendation suggests that an XML validator should implement "Level 1" regular expressions as defined in the[ |http://unicode.org/unicode/reports/tr18/]Unicode Regular Expression Guidelines.

 


XML Schema regular expressions are similar to other well-known regular expressions, such as might be found in UNIX or Perl.

XML Schema Mapping

Use the step 1 - EA export script to generate the data type extension XML Schema. Data Types are generated as a XMLSchema <simpleType> with the appropriate facets, Patterns and/or codelists defined.