Changes for page Transformation Mapping (KTM)
Last modified by Richard Kreissig on 2023/09/14 11:14
<
>
edited by Alexander Schulz-Rosengarten
on 2014/01/10 11:28
on 2014/01/10 11:28
edited by Alexander Schulz-Rosengarten
on 2014/01/02 11:18
on 2014/01/02 11:18
Change comment:
added datails to incomplete mappings
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -26,9 +26,9 @@ 26 26 27 27 The structure of the model can be separated into two parts. 28 28 29 -**First part** (upper half) is a tree of transformations. Each Model Wrapper-class is a representation of a model which is transformed. SoModelWrapperare nodes and ModelTransformations are edges. Thus theWrapperrepresenting theinitial-source-model of alltransformationis also the root of a TransformationTree-model.29 +**First part** (upper half) is a tree of transformations. Each Model-class is a representation of a concrete model which is transformed. So models are nodes and ModelTransformations are edges. Thus the Model representing the root-model of a tree is also the root of a concrete TransformationTree-model. 30 30 31 -**Second part** (lower half) is object-mapping. Instances of models contain EObjects as their elements, which are represented by E ObjectWrapper-class in thismetamodel. TheObjectWrapperof two models are connected with EObjectTransformations-class to expresstheir origination relationship in corresponding model transformation.31 +**Second part** (lower half) is object-mapping. Instances of models contain EObjects as their elements, which are represented by Element-class in TransformationTree metamodel. The Elements of two models are connected with ElementTransformations-class to model their origination relationship in corresponding model transformation. 32 32 33 33 34 34 ... ... @@ -62,8 +62,8 @@ 62 62 63 63 == Implementation Details == 64 64 65 -* All references to EObjects in EObjectWrapperare references to a copy of the original EObject. This allows to represent immutable mapping. To reidentify corresponding EObjects TransformationTreeExtensions provides search functions which will check for structural matching models.66 -* Models in TransformationTrees may be transient. This indicates that all references to EObjects in all Elements of the transient model are removed. Thus these models can't be source of a new appended transformation and can not be associated with it's original model. The main propose of this feature is to improve scalability of TransformationTrees by removing unnecessary references to internal model, but preserve traversing functionality of the object-mapping.65 +* All references to EObjects are references to a copy of the original EObject. This allows to represent immutable mapping. To reidentify corresponding EObjects TransformationTreeExtensions provides search functions which will check for structural matching models. 66 +* Models in TransformationTrees may be transient. This indicates that all references to EObjects in all Elements of the transient model are removed. Thus these models can't be source of a new appended transformation and can not be associated with it's original model. The main propose of this feature is to improve scalability of TransformationTrees by removing unnecessary references to internal model, but preserve traversing functionality of the ObjectMapping. 67 67 * Mappings can be incomplete causing resulting transfromation tree to be incomplete. A incomplete tree does not represent every object in a model with a corresponding Element. This may break some paths of element transformations, but allows to omit model-immanent objects like annotations from mapping. TranformationMapping extension provies a function to check completeness of mapping against its models. 68 68 69 69 ---- ... ... @@ -70,110 +70,4 @@ 70 70 71 71 == Example == 72 72 73 -=== Creating Mapping during Transformation === 74 - 75 -The following code is a modifcation of the tranformation "Spilt Trigger and Effects" of SCCharts. 76 - 77 -{{code title="Modified SCChart Transformation" theme="Eclipse" linenumbers="true" language="java" firstline="1" collapse="true"}} 78 -package de.cau.cs.kieler.ktm.test.transformations 79 -import com.google.inject.Inject 80 -import de.cau.cs.kieler.ktm.extensions.TransformationMapping 81 -import de.cau.cs.kieler.sccharts.Region 82 -import de.cau.cs.kieler.sccharts.Transition 83 -import de.cau.cs.kieler.sccharts.extensions.SCChartsExtension 84 -/** 85 - * @author als 86 - */ 87 -class SCChartTestTransformation { 88 - @Inject 89 - extension TransformationMapping 90 - @Inject 91 - extension SCChartsExtension 92 - // NEW - Mapping access delegation 93 - def extractMapping() { 94 - extractMappingData; 95 - } 96 - //------------------------------------------------------------------------- 97 - //-- S P L I T T R A N S I T I O N -- 98 - //------------------------------------------------------------------------- 99 - // For every transition T that has both, a trigger and an effect do the following: 100 - // For every effect: 101 - // Create a conditional C and add it to the parent of T's source state S_src. 102 - // create a new true triggered immediate effect transition T_eff and move all effects of T to T_eff. 103 - // Set the T_eff to have T's target state. Set T to have the target C. 104 - // Add T_eff to C's outgoing transitions. 105 - def Region transformTriggerEffect(Region rootRegion) { 106 - clearMapping; //NEW - clear previous mapping information to assure a single consistent mapping 107 - // Clone the complete SCCharts region 108 - var targetRootRegion = rootRegion.mappedCopy; //NEW - mapping information (changed copy to mappedCopy) 109 - // Traverse all transitions 110 - for (targetTransition : targetRootRegion.getAllContainedTransitions) { 111 - targetTransition.transformTriggerEffect(targetRootRegion); 112 - } 113 - //check if mapping is complete (only for test proposes) 114 - val diff = rootRegion.checkMappingCompleteness(targetRootRegion); 115 - if (diff.key.empty && diff.value.empty) { 116 - targetRootRegion; 117 - } else { 118 - null 119 - } 120 - } 121 - def void transformTriggerEffect(Transition transition, Region targetRootRegion) { 122 - // Only apply this to transition that have both, a trigger and one or more effects 123 - if (((transition.trigger != null || !transition.immediate) && !transition.effects.nullOrEmpty) || 124 - transition.effects.size > 1) { 125 - val targetState = transition.targetState 126 - val parentRegion = targetState.parentRegion 127 - val transitionOriginalTarget = transition.targetState 128 - var Transition lastTransition = transition 129 - for (effect : transition.effects.immutableCopy) { 130 - val effectState = parentRegion.createState(targetState.id + effect.id) 131 - effectState.mapParents(transition.mappedParents); //NEW - mapping information 132 - effectState.setTypeConnector 133 - val effectTransition = createImmediateTransition.addEffect(effect) 134 - effectTransition.mapParents(transition.mappedParents); //NEW - mapping information 135 - effectTransition.setSourceState(effectState) 136 - lastTransition.setTargetState(effectState) 137 - lastTransition = effectTransition 138 - } 139 - lastTransition.setTargetState(transitionOriginalTarget) 140 - } 141 - } 142 -} 143 -{{/code}} 144 - 145 -=== Create TransformationTree with Mapping === 146 - 147 -To test the transformation and mapping we will transform th following ABO-SCChart. 148 - 149 -[[image:attach:example_abo.jpeg]] 150 - 151 -The following code snipped performs the transformation on our ABO-example, extracts the mapping and creates a transformation tree. 152 - 153 -{{code title="Transform and create TranformationTree" theme="Eclipse" linenumbers="true" language="java" firstline="1" collapse="true"}} 154 -aboSplitTE = transformation.transformTriggerEffect(abo); 155 - 156 -Model aboSplitTEModel = transformationTreeExtensions.initializeTransformationTree( 157 - transformation.extractMapping(), 158 - "splitTriggerEffect", 159 - abo, "coreSCChart", 160 - aboSplitTE, "coreSCChart-splitTriggerEffect"); 161 - 162 -tranformationTree = transformationTreeExtensions.root(aboSplitTEModel); 163 -{{/code}} 164 - 165 -The result of transformation is the following SCChart. ABO-splitTriggerEffect. 166 - 167 -[[image:attach:example_abo_splitTE.jpeg]] 168 - 169 -Resulting TransformationTree has following structure. 170 - 171 -[[image:attach:example_tree.jpeg]] 172 - 173 -Furthermore the TransformationTree now contains the following mapping information. 174 - 175 -[[image:attach:example_tree_transformation.jpeg]] 176 - 177 -Here you can see the effect of the transformation causing the transformation to split up. 178 - 179 -[[image:attach:als-ktm-splitTriggerEffect-detail.jpg]] 73 +coming soon
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -86515 941 +8651535 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/86515 94/Transformation Mapping (KTM)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651535/Transformation Mapping (KTM)