Changes for page Transformation Mapping (KTM)
Last modified by Richard Kreissig on 2023/09/14 11:14
<
>
edited by Alexander Schulz-Rosengarten
on 2018/11/22 14:53
on 2018/11/22 14:53
edited by Alexander Schulz-Rosengarten
on 2014/01/10 11:28
on 2014/01/10 11:28
Change comment:
update according to metamodel changes
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,13 +1,7 @@ 1 1 = KTM - KIELER Transformation Mapping = 2 2 3 -{{panel bgColor="orange" title="Deprecated since 0.11"}} 4 -This article is deprecated. The described features are no longer available in current releases. 3 + 5 5 6 -KTM was redesigned is now available as KiTT included in KiCool. 7 -{{/panel}} 8 - 9 -\\ 10 - 11 11 === Topics === 12 12 13 13 ... ... @@ -22,7 +22,7 @@ 22 22 23 23 == Transformation Tree Model == 24 24 25 - \\19 + 26 26 27 27 To offer a mapping between model-elements during multiple transformations KTM introduces a model called TransformationTree to represent these relations. 28 28 ... ... @@ -36,7 +36,7 @@ 36 36 37 37 **Second part** (lower half) is object-mapping. Instances of models contain EObjects as their elements, which are represented by EObjectWrapper-class in this metamodel. The EObjectWrapper of two models are connected with EObjectTransformations-class to express their origination relationship in corresponding model transformation. 38 38 39 - \\33 + 40 40 41 41 An abstract example of an instance of this model: 42 42 ... ... @@ -76,36 +76,29 @@ 76 76 77 77 == Example == 78 78 79 -In this example we will perform some transformations on SCCharts. 80 - 81 -The source chart is a ABO, the "Hello World" of SCCharts. 82 - 83 -ABO is already a CoreSCChart, so we will perform normalization and a transformation to SCG. 84 - 85 85 === Creating Mapping during Transformation === 86 86 87 - In ordertonote every singleelementtransformationofa model transformation,weusetheTransformationMapping extension.75 +The following code is a modifcation of the tranformation "Spilt Trigger and Effects" of SCCharts. 88 88 89 -After each creation of new Objects for transformed model the mapping must be updated with it's origin information. 90 - 91 -The codeblock blow show a snipped of SCChartCoreTransformation with additional mapping registration. 92 - 93 -\\ 94 - 95 -{{code language="java" theme="Eclipse" firstline="1" title="transformTriggerEffect CodeSnipped" linenumbers="true" collapse="true"}} 96 -... 97 - @Inject 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 98 98 extension TransformationMapping 99 - 100 -... 101 - 90 + @Inject 91 + extension SCChartsExtension 102 102 // NEW - Mapping access delegation 103 103 def extractMapping() { 104 104 extractMappingData; 105 105 } 106 - 107 -... 108 - 109 109 //------------------------------------------------------------------------- 110 110 //-- S P L I T T R A N S I T I O N -- 111 111 //------------------------------------------------------------------------- ... ... @@ -123,160 +123,70 @@ 123 123 for (targetTransition : targetRootRegion.getAllContainedTransitions) { 124 124 targetTransition.transformTriggerEffect(targetRootRegion); 125 125 } 126 - val completeness = checkMappingCompleteness(rootRegion, targetRootRegion); //NEW - DEBUG 127 - targetRootRegion; 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 + } 128 128 } 129 129 def void transformTriggerEffect(Transition transition, Region targetRootRegion) { 130 - // Only apply this to transition that have both, a trigger (or isatermination) and one or more effects131 - if (((transition.trigger != null || !transition.immediate || transition.typeTermination) && !transition.effects.nullOrEmpty) ||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) || 132 132 transition.effects.size > 1) { 133 133 val targetState = transition.targetState 134 134 val parentRegion = targetState.parentRegion 135 135 val transitionOriginalTarget = transition.targetState 136 136 var Transition lastTransition = transition 137 - val firstEffect = transition.effects.head 138 138 for (effect : transition.effects.immutableCopy) { 139 - // Optimization: Prevent transitions without a trigger 140 - if(transition.immediate && transition.trigger == null && firstEffect == effect) { 141 - // skip 142 - } else { 143 - val effectState = parentRegion.createState(GENERATED_PREFIX + "S") 144 - effectState.mapParents(transition.mappedParents); //NEW - mapping information 145 - effectState.uniqueName 146 - val effectTransition = createImmediateTransition.addEffect(effect) 147 - effectTransition.mapParents(transition.mappedParents); //NEW - mapping information 148 - 149 - effectTransition.setSourceState(effectState) 150 - lastTransition.setTargetState(effectState) 151 - lastTransition = effectTransition 152 - } 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 153 153 } 154 154 lastTransition.setTargetState(transitionOriginalTarget) 155 155 } 156 156 } 142 +} 157 157 {{/code}} 158 158 159 -=== Create TransformationTree === 145 +=== Create TransformationTree with Mapping === 160 160 161 -T he followingcodewill now performeachtransformationstepwiseandupdatesatransformationtree eachstep.147 +To test the transformation and mapping we will transform th following ABO-SCChart. 162 162 163 - \\149 +[[image:attach:example_abo.jpeg]] 164 164 165 -{{code language="java" theme="Eclipse" firstline="1" title="Transform and create TranformationTree" linenumbers="true" collapse="true"}} 166 -aboSplitTE = SCCtransformation.transformTriggerEffect(abo); 151 +The following code snipped performs the transformation on our ABO-example, extracts the mapping and creates a transformation tree. 167 167 168 - ModelWrapper aboSplitTEModel =169 - transformationTree.initializeTransformationTree(SCCtransformation.extractMapping(), "TriggerEffect",abo, "coreSCChart", aboSplitTE, "coreSCChart-splitTriggerEffect");153 +{{code title="Transform and create TranformationTree" theme="Eclipse" linenumbers="true" language="java" firstline="1" collapse="true"}} 154 +aboSplitTE = transformation.transformTriggerEffect(abo); 170 170 171 -aboNormalized = SCCtransformation.transformSurfaceDepth(aboSplitTE); 156 +Model aboSplitTEModel = transformationTreeExtensions.initializeTransformationTree( 157 + transformation.extractMapping(), 158 + "splitTriggerEffect", 159 + abo, "coreSCChart", 160 + aboSplitTE, "coreSCChart-splitTriggerEffect"); 172 172 173 -ModelWrapper aboNormalizedModel = 174 - transformationTree.addTransformationToTree(SCCtransformation.extractMapping(), aboSplitTEModel, "SurfaceDepth", aboSplitTE, aboNormalized, "normalizedCoreSCChart"); 175 - 176 -aboSCG = SCGtransformation.transformSCG(aboNormalized); 177 - 178 -ModelWrapper aboSCGModel = 179 - transformationTree.addTransformationToTree(SCGtransformation.extractMapping(), aboNormalizedModel, "SCC2SCG", aboNormalized, aboSCG,"SCG"); 180 - 181 -tree = transformationTree.root(aboSCGModel); 162 +tranformationTree = transformationTreeExtensions.root(aboSplitTEModel); 182 182 {{/code}} 183 183 184 - \\165 +The result of transformation is the following SCChart. ABO-splitTriggerEffect. 185 185 186 - The resulting TransformationTree has following structureand representing eachstepandmodelof thetransformation.167 +[[image:attach:example_abo_splitTE.jpeg]] 187 187 188 - \\169 +Resulting TransformationTree has following structure. 189 189 190 -(% class="wrapped" %) 191 -|=(% style="text-align: center;" colspan="4" %)(% style="text-align: center;" colspan="4" %) 192 -((( 193 -(% class="content-wrapper" %) 194 -((( 195 195 [[image:attach:example_tree.jpeg]] 196 -))) 197 -))) 198 -|(% style="text-align: center;" colspan="1" %)(% style="text-align: center;" colspan="1" %) 199 -((( 200 -(% class="content-wrapper" %) 201 -((( 202 -[[image:attach:example_abo.jpeg]] 203 -))) 204 -)))|(% style="text-align: center;" colspan="1" %)(% style="text-align: center;" colspan="1" %) 205 -((( 206 -(% class="content-wrapper" %) 207 -((( 208 -[[image:attach:example_abo_splitTE.jpeg]] 209 -))) 210 -)))|(% style="text-align: center;" colspan="1" %)(% style="text-align: center;" colspan="1" %) 211 -((( 212 -(% class="content-wrapper" %) 213 -((( 214 -[[image:attach:example_abo_norm.jpeg]] 215 -))) 216 -)))|(% style="text-align: center;" colspan="1" %)(% style="text-align: center;" colspan="1" %) 217 -((( 218 -(% class="content-wrapper" %) 219 -((( 220 -[[image:attach:example_abo_scg.jpeg]] 221 -))) 222 -))) 223 223 224 - \\173 +Furthermore the TransformationTree now contains the following mapping information. 225 225 226 - FurthermoreTransformationTree now contains mapping information for thewholechain.175 +[[image:attach:example_tree_transformation.jpeg]] 227 227 228 - Now we canusean additionalfeatureofKTM,the resolvingof mappingsbetweenarbitarymodels.177 +Here you can see the effect of the transformation causing the transformation to split up. 229 229 230 -The following code has starts with an instance of the initial ABO SCChart and SCG, along with the TranformationTree above. 231 - 232 -\\ 233 - 234 -{{code language="java" theme="Eclipse" firstline="1" title="resolveMapping" linenumbers="true" collapse="true"}} 235 -@Inject 236 -extension TransformationTreeExtensions 237 - 238 -//Find nodes of model instances in tree 239 -val aboSCCModelWrapper = transformationTree.findModel(aboSCC,"coreSCChart"); 240 -val aboSCGModelWrapper = transformationTree.findModel(aboSCG,"SCG"); 241 - 242 -//resolve 243 -val mapping = resolvemapping(aboSCCModelWrapper, aboSCC, aboSCGModelWrapper, aboSCG); 244 -{{/code}} 245 - 246 -\\ 247 - 248 -The returned mapping is a multi mapping between all object in aboSCC and their resulting objects in aboSCG. 249 - 250 -This mapping can now displayed in models or used for various information propagation between elements of the models. 251 - 252 -[[image:attach:example_abo_resolved.jpeg]] 253 - 254 -\\ 255 - 256 -Also a more detailed view is available, showing all EObjects relation. 257 - 258 -\\ 259 - 260 -[[image:attach:example_abo_resolved_elements.jpeg]] 261 - 262 -== Visualisation == 263 - 264 -If you have a TransformationTree file (.ktmt) you can open a KLighD visualisation by right-clicking on file in project-tree and selecting //'Open Transformation Tree//'. 265 - 266 -=== Diagram Options === 267 - 268 -//Model Visualisation//: If enabled tries to visaulize selected models with KLighD else a EObject-represenation is created. 269 - 270 -//EObject Attributes//: If enabled shows Attributes of EObject in EObject-represenation. 271 - 272 -//Selective mapping edges//: If enabled shows only selected mapping edges. 273 - 274 -=== Interaction === 275 - 276 -//CTRL+CLICK//: Selects a Node in TransformationTree as source and displays its represented model. 277 - 278 -//SHIFT+CLICK//: Selects a Node in TransformationTree as target, displays both models and the resolved mapping as edges (currenly only between States/Regions). 279 - 280 -If Selective selective mapping edge is enabled no mapping edges are displayed. If you select (//CLICK//) an element in one of the two model its relation to corresponding element is displayed. You can multi-select with //CTRL+CLICK// or deselect by clicking on an edge. 281 - 282 -\\ 179 +[[image:attach:als-ktm-splitTriggerEffect-detail.jpg]]
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 - 508232771 +8651594 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/ 50823277/Transformation Mapping (KTM)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651594/Transformation Mapping (KTM)