Transformations

General Information

ShapeChange can apply a number of transformations to an input model, before generating target representations for it. Transformations are applied on a given base model. This can be the input model (e.g. from an Enterprise Architect project file) or the result of another transformation. It is thus possible to create a chain or tree of model transformations.

Java Implementation Details

Within the ShapeChange Java framework, each transformation is implemented as a Java class.  In keeping with the modularity of ShapeChange, each such transformer implements the de.interactive-instruments.ShapeChange.Transformation.Transformer interface, which contains a method “hook” for processing a given model.  The fully-qualified name of this class must be provided in the configuration file.

Configuration

Each individual transformer is defined in the configuration file as its own <Transformer> element.  All <Transformer> definitions are nested under the <transformers> element.

All <Transformer> definitions, no matter the actual transformer type, are configured via XML attributes and parameters.  <ProcessMapEntry> definitions may also be used to customize mappings that are applied during a transformation.

Transformer Attributes

Each <Transformer> element has four attributes, two required and two optional.  These attributes are as follows:

Attribute Name Required / Optional Default Value Explanation
 class  Required  –

A string representing the fully-qualified transformer “handler” class (that implements the Transformer interface).

 mode  Optional  enabled Whether or not this particular transformer is “turned on”.  This allows for transformers to be turned on/off at will.  The possible values are:

  • enabled: The transformer is processed.
  • disabled: The transformer is ignored.
  • diagnostics-only: The transformation is processed, but no output is created. However, not all transformers support this mode yet and some will treat this mode identical to “enabled”.
 id  Required  – Unique identifier of the transformer within the configuration file. This identifier is used by other transformers and/or targets to reference the output of the transformer as input for their processing tasks.
 input  Optional  – (defaults to input model) References the id of the input model or another transformer. The according model will be processed by the transformer. If the attribute is omitted or no value is provided, the input model defined in the configuration file is used.

Transformer Parameters

In addition to the required attributes, each <Transformer> may have additional parameters defined via <ProcessParameter> elements which are nested under the <parameters> element.

Each transformer type may define its own expected or required parameters; the transformer-specific subheadings of the subpages will describe these for each transformer type.

Rules

A <Transformer> can have a number of <ProcessRuleSet> elements (nested under the <rules> element). They are used to configure the optional processing steps to be executed by the transformer. Each rule set has a required and an optional attribute. These attributes are as follows:

Attribute Name Required / Optional Explanation
name Required Identifier of the rule set.
extends Optional Can be used to add specific rules to a standard process rule set.

A <ProcessRuleSet> can contain a number of <rule> elements. Each of them identifies (via the value of the required “name” attribute) a specific type of processing to be applied by the transformer.

Each transformer type can define its own rule sets and rules; the transformer-specific subheadings of the subpages will describe these for each transformer type.

Process Map Entries

The <mapEntries> section of the <Transformer> element may contain a series of <ProcessMapEntry> definitions.

Map entries allow for customized mapping and processing of UML classes. Each transformer type defines which map entries apply to which of its rules; the transformer-specific subheadings of the subpages will describe these for each transformer type.

The attributes of a <ProcessMapEntry> are as follows:

Attribute Name Required/Optional Explanation
type Required The UML type/class name to be mapped.
rule Required

The transformation “rule” where this mapping is applicable.

targetType Optional

The type to which the type will be mapped. The interpretation of its value is left to the code implementing the transformer.

param Optional

A parameter for the mapping. The interpretation of its value is left to the code implementing the transformer.

Common Transformer Functionality

Specific functionality (e.g. setting tagged values) can be executed for all transformers.

More Information

Supported Transformer Types

Identity Transform

The Identity transformation is used to create a GenericModel representation from a given input model. This can result in a performance gain, if multiple targets and/or transformations are applied on the input model.

More information

Profiler

The Profiler creates a subset of a given model.

Model elements (classes and properties) can contain information (in tagged values) about which profile the elements belong to. A parameter in the configuration of the Profiler defines which profile the model elements have to belong to. If an element does not belong to that profile, the Profiler removes it from the model.

More information

Flattener

The Flattener can be used to simplify a complex Application Schema model, up to the point where all complex data structures have been resolved to feature type properties whose type is either a simple type (like Integer, Boolean or CharacterString), a code list, or an enumeration.

This can be useful for exchanging application schema data via or for converting that data into formats that do not support complex data structures (for example Shapefiles).

More information

Top