1. Introduction

(since v2.3.0)

This transformation converts the types of the model. For example, it can convert enumerations to code lists.

2. Configuration

The following sections specify the configuration options for this transformation.

2.1. Class

The class for this transformer implementation is de.interactive_instruments.ShapeChange.Transformation.TypeConversion.TypeConverter

2.2. Rules

2.2.1. rule-trf-dissolveAssociations

(since v2.4.0)

Dissolves associations that are navigable from types in the schemas selected for processing. Navigable roles of such associations are transformed into attributes. A suffix can be added to the names of these attributes, via parameter attributeNameSuffix.

The type of these attributes is set as follows:

  • If rule-trf-dissolveAssociations-keepType is enabled, then the type of the former association role is kept as is.

  • Otherwise, if the attribute (i.e., the former association role) has tagged value dissolveAssociationAttributeType with a non-empty value, use that value as type.

  • Otherwise, use the type defined by parameter attributeType.

Associations can be excluded from this transformation by:

If an association that is dissolved has an association class, a warning is logged and the class is removed.

By default, the inlineOrByReference setting of an attribute that results from dissolving an association is that of the original association role. If tagged value dissolveAssociationInlineOrByReference (available since v2.9.0; allowed values: inline, byReference, or inlineOrByReference) is set on the association role, then the inlineOrByReference setting of the attribute will be taken from that tagged value.

2.2.2. rule-trf-dissolveAssociations-excludeManyToManyRelationships

(since v2.4.0)

If this rule is included together with rule-trf-dissolveAssociations, an association is not dissolved if it represents a many-to-many relationship between two types (i.e., all navigable roles have max multiplicity greater than 1).

2.2.3. rule-trf-dissolveAssociations-keepType

(since v2.4.0)

If this rule is included together with rule-trf-dissolveAssociations, then the type of resulting attributes is kept as-is.

2.2.4. rule-trf-dissolveAssociations-removeTransformedAttributeIfMultiple

(since v2.4.0)

If this rule is included together with rule-trf-dissolveAssociations, then attributes that result from dissolving an association and have maximum multiplicity greater than 1 are removed.

2.2.5. rule-trf-enumeration-to-codelist

Converts enumerations to code lists. For each converted enumeration, tagged value 'asDictionary' is set to 'false'.

Enumerations can be excluded from this conversion if their name matches the regular expression given via parameter toCodelistExclusionRegex or if they have tagged value "toCodelist"='false'.

Note
Up until ShapeChange v2.13.0, this rule converted all enumerations within the model to code lists. Now, the typical behavior applies, i.e. only enumerations in the schemas selected for processing are changed by the transformation.

Constraints are not updated.

2.2.6. rule-trf-nilReason-property-for-nillable-property

(since v2.10.0)

For each property that is nillable (has stereotype <<voidable>> or tagged value nillable set to 'true'), create a new attribute, as follows: First, the void reason type that applies to the nillable property is identified: The tagged value voidReasonType of the nillable property is checked first. If the tagged value does not exist or does not identify a type, then the type defined by configuration parameter defaultVoidReasonType is used.

Note

The identification of the void reason type by tagged value or by configuration parameter is as follows:

  • definition by tagged value voidReasonType: If the type is defined by the schema that contains the property, then the tagged value simply provides the name of the type. Otherwise, the tagged value shall identify the type by its full package-qualified name, starting with the application schema package. For example: "Some Application Schema::Some Subpackage::Another Subpackage::VoidReasonType".

  • definition by configuration parameter defaultVoidReasonType: If the name of the type is unique within the conceptual model, then simply providing the type name as parameter value is sufficient. Otherwise (or as a general alternative), the void reason type is identified by providing its full name (omitting packages that are outside of the schema the class belongs to - see the example above).

If the configuration parameter also is not set or does not identify a type within the conceptual model, an error message will be logged and the value type of the new attribute will be CharacterString. Otherwise, the identified type will be set as value type of the new attribute. The name of the new attribute is the name of the nillable property plus suffix defined by configuration parameter nilReasonPropertyNameSuffix. Tagged value inlineOrByReference of the new attribute is set to 'inline'. Tagged value sequenceNumber will be set in such a way that it is placed directly after the nillable property.

2.2.7. rule-trf-objectTypesToFeatureTypes

(since v2.4.0)

Convert all object types from schemas selected for processing to feature types. All subtypes of these types are also converted to feature types.

2.2.8. rule-trf-propertyMetadata-stereotype-to-metadata-property

(since v2.10.0)

Converts the <<propertyMetadata>> stereotype (of a UML property) to an additional property, as follows: First, the metadata type that applies to the property with the stereotype is identified: The tagged value metadataType of the property is checked first. If the tagged value does not identify a metadata type, then the type defined by configuration parameter defaultMetadataType is used.

Note

The identification of the metadata type by tagged value or by configuration parameter is as follows:

  • definition by tagged value metadataType: If the type is defined by the schema that contains the property, then the tagged value simply provides the name of the type. Otherwise, the tagged value shall identify the type by its full package-qualified name, starting with the application schema package. For example: "Some Application Schema::Some Subpackage::Another Subpackage::MetadataType".

  • definition by configuration parameter defaultMetadataType: If the name of the type is unique within the conceptual model, then simply providing the type name as parameter value is sufficient. Otherwise (or as a general alternative), the metadata type is identified by providing its full name (omitting packages that are outside of the schema the class belongs to - see the example above).

If the configuration parameter also does not identify a type within the conceptual model, an error message will be logged and the stereotype will simply be removed from the property. Otherwise, if the metadata type is a type with identity (feature or object type) then a directed association to the metadata type is created - else an attribute (with the metadatatype as value type) is created. The name of the new association role or attribute is the property name plus suffix defined by configuration parameter metadataPropertyNameSuffix. If a new association role was created, tagged value inlineOrByReference of the association role is set to the value defined by configuration parameter metadataPropertyInlineOrByReference.

2.2.9. rule-trf-switchValueTypes

(since v2.10.0)

For any property (attribute or association role) with a type for which a process map entry is defined, switch the value type to the target type defined by that process map entry. For an association role, that means that the whole association is "moved" (as if dragging the association end to the new value type).

2.2.10. rule-trf-toFeatureType

(since v2.4.0)

Convert types either identified via parameter toFeatureTypeNameRegex or with tagged value 'toFeatureType=true' to feature types. The name of the tagged value can be configured via parameter toFeatureTypeTaggedValueName. All subtypes of these types are also converted to feature types.

2.3. Parameters

2.3.1. attributeNameSuffix

(since v2.4.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: the empty string

Explanation: Define a suffix to be added to the names of attributes that have been transformed from association roles.

Applies to Rule(s): rule-trf-dissolveAssociations

2.3.2. attributeType

(since v2.4.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: "CharacterString"

Explanation: Define the type to use as fallback when setting the type of attributes that have been transformed from association roles.

Applies to Rule(s): rule-trf-dissolveAssociations

2.3.3. defaultMetadataType

(since v2.10.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: "MD_Metadata"

Explanation: Name of the type from the conceptual model, which shall be used as metadata type for all properties with stereotype <<propertyMetadata>> that do not define a metadata type via tagged value metadataType. The value can be the pure type name, if it is unique within the conceptual model. Otherwise, the correct type is identified by providing its full name (omitting packages that are outside of the schema the class belongs to). The default value for this parameter is 'MD_Metadata' (which typically refers to the type defined by ISO 19115).

2.3.4. defaultVoidReasonType

(since v2.10.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: none

Explanation: Name of the type from the conceptual model, which shall be used as void reason type for all nillable properties that do not define a void reason type via tagged value voidReasonType. The value can be the pure type name, if it is unique within the conceptual model. Otherwise, identify the correct type by providing its full name (omitting packages that are outside of the schema the class belongs to).

2.3.5. metadataPropertyNameSuffix

(since v2.10.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: "_metadata"

Explanation: Defines the suffix that shall be added to the name of a new property created by rule-trf-propertyMetadata-stereotype-to-metadata-property.

2.3.6. metadataPropertyInlineOrByReference

(since v2.10.0)

Alias: none

Required / Optional: optional

Type: Enumeration, one of: 'inlineOrByReference', 'byReference' and 'inline'

Default Value: "inlineOrByReference"

Explanation: Defines the value for tag inlineOrByReference of a new association role created by rule-trf-propertyMetadata-stereotype-to-metadata-property.

2.3.7. nilReasonPropertyNameSuffix

(since v2.10.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: "_nilReason"

Explanation: Defines the suffix that shall be added to the name of a new property created by rule-trf-nilReason-property-for-nillable-property.

2.3.8. toCodelistExclusionRegex

(since v2.4.0)

Alias: none

Required / Optional: optional

Type: string with regular expression (using the syntax supported by Java)

Default Value: none

Explanation: Regular expression to identify enumerations (in the whole model) to NOT convert to code lists under rule-trf-enumeration-to-codelist. Identification is based on a match on the name of the type.

Applies to Rule(s): rule-trf-enumeration-to-codelist

2.3.9. toFeatureTypeNameRegex

(since v2.4.0)

Alias: none

Required / Optional: optional

Type: string with regular expression (using the syntax supported by Java)

Default Value: none

Explanation: Regular expression to identify types from the schemas selected for processing to convert to feature types with rule-trf-toFeatureType. Identification is based on a match on the name of the type. There is no default value.

Applies to Rule(s): rule-trf-toFeatureType

2.3.10. toFeatureTypeTaggedValueName

(since v2.4.0)

Alias: none

Required / Optional: optional

Type: String

Default Value: "toFeatureType"

Explanation: Identify the name of the tagged value that is used to tag types that shall be converted to feature types under rule-trf-toFeatureType.

Applies to Rule(s): rule-trf-toFeatureType

2.4. Map Entries

None at present

2.5. Advanced Process Configuration

None at present

3. Sample Configuration

1
2
3
4
5
6
7
8
9
<Transformer
 class="de.interactive_instruments.ShapeChange.Transformation.TypeConversion.TypeConverter"
 input="INPUT" id="trf" mode="enabled">
 <rules>
  <ProcessRuleSet name="convert">
   <rule name="rule-trf-enumeration-to-codelist"/>
  </ProcessRuleSet>
 </rules>
</Transformer>