Previous Table of Contents Next


5.8.1 TypeMapping Classes


   5.8.1.1 TypeMapping

   TypeMapping instances permit the creation of mappings between data types defined within different environments and are used to indicate data type compatibilities that permit direct assignment of values from one environment (the “source? type) into equivalent values in another environment (the “target? type). For example, an integer field data type in a record-oriented DBMS (the source type) might be mapped to a compatible integer data type in a relational DBMS (the target type).

   Whereas the actual transfer of data values between environments is accomplished using the CWM’s Transformation package, TypeMapping instances can be used to identify both the permissible and preferred mappings between data types. Value interchange between a pair of data types is considered permissible if a TypeMapping instance is defined for the pair. A TypeMapping instance is considered the preferred mapping if the instance’s isBestMatch attribute has the value true.

   Typically, there will be one TypeMapping Instance between a pair of data types that is considered the preferred mapping. To promote flexible use of this feature, there is no requirement that a preferred TypeMapping instance must be identified between a pair of data types nor are multiple preferred instances prohibited. In these latter cases, however, the precise semantics are usage-defined.

   Interchange between data types defined by non-preferred mappings may often function as intended. However, the isLossy boolean may be set to indicate that such interchanges may be subject to validity restrictions in certain circumstances. For example, it may be valid to move data values from a 32-bit integer data type to a 16-bit integer data type as long as the actual values in the 32-bit underlying data type do not exceed the range permitted for 16-bit integers. The CWM Foundation leaves the understanding and handling of such differences to individual tools. If such differences must be modeled, consider using the CWM Transformation package to filter data values during interchange.

   TypeMapping instances are unidirectional, so two instances are required to show that a data type pair can be mutually interchanged between environments.

   Superclasses

   ModelElement

   Attributes

   isBestMatch

True if this TypeMapping instance represents the best available mapping between a pair of data types in different software systems.

type:

multiplicity:

Boolean
exactly one

   isLossy

True if this TypeMapping instance may result in a data conversion error if the source data is within certain ranges. For example, storing a 32-bit unsigned integer value into a 16-bit unsigned integer container will result in a data conversion error only when the source data has a value greater than 65535.

type:

multiplicity:

Boolean
exactly one

   References

   sourceType

Identifies the Classifier instance that is the source of information exchange.

class:

defined by:

multiplicity:

Classifier
MappingSource::sourceType
exactly one

   targetType

Identifies the Classifier instance that is the target of information exchange.

class:

defined by:

multiplicity:

Classifier
MappingTarget::targetType
exactly one

   Constraints

   The targetType and sourceType references may not refer to the same Classifier instance. [C-8-1]

   5.8.1.2 TypeSystem

   Instances of the TypeSystem class collect together the data types (subclasses of Classifier) defined by a software system and the TypeMapping instances defining how they are mapped to data types in otherTypeSystems.TypeMapping instances collected by a TypeSystem instance include both those in which the software system’s data types act as sources and as targets of mappings. Classifiers and TapeMappings are maintained in a single collection via the ElementOwnership association but can be distinguished by their respective types.

   Because it is a Package, a TypeSystem can also serve to collect together the Classifier instances for a particular software system.

   Superclasses

   Package

   Contained Elements

   TypeMapping

   Attributes

   version

A string describing the version of the TypeSystem represented.

type:

multiplicity:

String
exactly one

   Constraints

   A TypeSystem may own only Classifiers and TypeMappings. [C-8-2]