Model Export

(since v2.4.0)

Introduction

ShapeChange loads a UML model into an internal representation. This internal model can be transformed, and target representations can be derived from it (e.g. XML Schemas).

The ModelExport target exports the internal model to a ShapeChange specific XML format: SCXML. The format can be loaded by ShapeChange and other tools, for example the ShapeChange Profile Management Tool (PMT).

Description

By default, this target exports the full model, with all profiles defined by the schemas selected for processing. Conversion rules and the parameter exportProfilesFromWholeModel can modify that behavior. Likewise, the set of tagged values to export can be controlled via the parameter ignoreTaggedValuesRegex.

Another aspect that requires consideration when exporting a model is the way that profiles are defined in it. ShapeChange supports two profile definition behaviors: explicit and non-explicit (for further details, see the Profiler). Profile definitions in an exported model must be explicit. Consequently, if the profile definitions of a model are not explicit, they need to be converted before exporting the model – unless profiles shall be omitted completely.
By default, the ModelExport target assumes that the profile definitions in the model are explicit. By setting parameter profilesInModelSetExplicitly to false, the target can be configured to convert profile definitions. In that case, the target will gather the names of all profiles defined in the model, and assign this set of profiles to each class without a profile assignment. Alternatively, the profile names can explicitly be configured via the configuration parameter profilesForClassesWithoutExplicitProfileAssignments. Properties without profile assignment receive the profiles of their class.

The XML format supports attributes and elements that are specifically designed to support editing model profiles with the PMT. The PMT differentiates between packages that are editable and those that are not editable. Typically, external schemas like the ISO schemas are not the subject of profiling. In that case, packages with ISO schemas would be set as not editable. By default, the ModelExport target marks all packages that do not belong to schemas selected for processing (primarily via the input parameters appSchemaName, appSchemaNameRegex, and appSchemaNamespaceRegex) as not editable. That can be changed via rule-exp-pkg-allPackagesAreEditable.

The target exports the model into an XML file (the name and location of the export file are defined via the parameters outputFilename and outputDirectory). If the parameter zipOutput is set to true, then the XML file will be put into a ZIP archive. This is useful for large export files that shall be processed with the PMT. When exporting large models, it is advisable to set the parameter.

Configuration

Class

The class for the target implementation is de.interactive_instruments.ShapeChange.Target.ModelExport.ModelExport

Conversion Rules

rule-exp-all-omitExistingProfiles

By default, existing profiles are exported. With this rule, that behavior can be changed to omit existing profiles.

This rule has higher priority than rule-exp-all-restrictExistingProfiles.

Parameter(s): none

rule-exp-all-restrictExistingProfiles

By default, existing profiles are exported. With this rule, that behavior can be changed to restrict the set of profiles that are exported.

The target parameter profilesToExport contains a (comma-separated) list of names of the profiles that shall be exported.

This rule has lower priority than rule-exp-all-omitExistingProfiles.

Parameter(s):

rule-exp-pkg-allPackagesAreEditable

By default, packages that do not belong to the schemas selected for processing are marked as not editable. If this rule is enabled, all packages are exported as editable.

Parameter(s): none

Parameters

exportProfilesFromWholeModel

Required / Optional: optional

Type: Boolean

Default Value: false

Explanation: By default, profiles are exported only for classes (and their properties) from schemas that are selected for processing. If this parameter is set to true, profiles are exported for all model classes (and their properties).

Applies to Rule(s): none – default behavior

ignoreTaggedValuesRegex

Required / Optional: optional

Type: String (with regular expression)

Default Value: (profiles)

Explanation: A tagged value whose name matches the regular expression defined by this parameter will not be exported.

Applies to Rule(s): none – default behavior

outputDirectory

Required / Optional: Required

Type: String

Default Value: the current run directory

Explanation: The path to the folder in which the model export file will be created.

Applies to Rule(s): none – default behavior

outputFilename

Required / Optional: Required

Type: String

Default Value: ModelExport

Explanation: The name of the model export file (without file extension).

Applies to Rule(s): none – default behavior

profilesInModelSetExplicitly

Required / Optional: optional

Type: Boolean

Default Value: true

Explanation: Indicates if profile definitions in the input model are explicitly set (true) or not (false). If they are not, then profile inheritance would apply, which is converted during the export (see parameter profilesForClassesWithoutExplicitProfileAssignments) unless rule-exp-all-omitExistingProfiles is enabled.

Applies to Rule(s): none – default behavior

profilesForClassesWithoutExplicitProfileAssignments

Required / Optional: optional

Type: String (comma separated list of values)

Default Value: all profiles defined in the model

Explanation: Names of profiles that will be set for classes that do not belong to a specific profile. This is relevant in case that the profiles are not set explicitly in the model (parameter profilesInModelSetExplicitly is false) and if rule-exp-all-omitExistingProfiles is not enabled.

Applies to Rule(s): none – default behavior

profilesToExport

Required / Optional: required

Type: String (comma separated list of values)

Default Value: none

Explanation: Names of profiles to export

Applies to Rule(s): rule-exp-all-restrictExistingProfiles

zipOutput

Required / Optional: optional

Type: Boolean

Default Value: false

Explanation: Defines if the output should be compressed in a zip file (true) or not (false).

Applies to Rule(s): none – default behavior

Configuration Example

<Target class="de.interactive_instruments.ShapeChange.Target.ModelExport.ModelExport" mode="enabled">
 <targetParameter name="outputDirectory" value="results/modelexport"/>
 <targetParameter name="outputFilename" value="schema_export"/>
 <targetParameter name="sortedOutput" value="true"/>
 <targetParameter name="defaultEncodingRule" value="export"/>
 <rules>
 <EncodingRule name="export">
 <rule name="rule-exp-all-omitExistingProfiles"/>
 <rule name="rule-exp-pkg-allPackagesAreEditable"/>
 </EncodingRule>
 </rules>
</Target>
Top