Changes for page Transformation Mapping (KTM)
Last modified by Richard Kreissig on 2023/09/14 11:14
<
>
edited by Alexander Schulz-Rosengarten
on 2013/12/18 16:12
on 2013/12/18 16:12
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
-
... ... @@ -2,19 +2,15 @@ 2 2 3 3 4 4 5 +=== Topics === 5 5 6 6 8 + 7 7 {{toc maxLevel="2" minLevel="2"/}} 8 8 9 ----- 10 - 11 -== Overview == 12 - 13 - 14 - 15 15 This subproject provides a tracing mechanism for arbitary model-elements across multiple model transformations, based on EMF. 16 16 17 -The main propose of KTM is to allow information transfer between abstract models and their resultant transformed models. 13 +The main propose of KTM is to allow bidirectional information transfer between abstract models and their resultant transformed models. 18 18 19 19 ---- 20 20 ... ... @@ -26,88 +26,158 @@ 26 26 27 27 It is based on an EMF-Metamodel. 28 28 29 - 25 +[[image:attach:als-ktmt-metamodel.png]] 30 30 31 -<metamodel> 32 - 33 - 34 - 35 35 The structure of the model can be separated into two parts. 36 36 37 -First part is a tree of transformations. 29 +**First part** (upper half) is a tree of transformations. Each ModelWrapper-class is a representation of a model which is transformed. So ModelWrapper are nodes and ModelTransformations are edges. Thus the ModelWrapper representing the initial-source-model of all transformation is also the root of a TransformationTree-model. 38 38 39 - Each Model-Classisa representation ofaconcretemodel whichis transformed.So models arenodes andModelTransformations are edges.31 +**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. 40 40 41 - Thusthe Model representing the root-model of a tree is also the root of a concrete TransformationTree-Model.33 + 42 42 43 - Secondpart is object mapping.35 +An abstract example of an instance of this model: 44 44 45 - Concretemodels contain EObjectsastheir elements, whichre representendby Element-Class in TransformationTreemetamodel.37 +[[image:attach:abstract_example_tree.png]] 46 46 47 - The Elements of two models are connected with ElementTransformations-Class to model their39 +---- 48 48 49 - originationrelationship in corresponding model transformation.41 +== Extensions == 50 50 51 - 43 +Two classes are provided by this project to extend functionality of the core model. 52 52 53 - Anabstractexampleofan instance of thisdel:45 +=== TransformationMapping ([[JavaDoc>>attach:TransformationMapping.html]]) === 54 54 55 - 47 +The main propose of this class is generation of a object-mapping during transformation process. 56 56 57 - <exmaple_tree>49 +Therefor it provides different functions for incremental registering of single parent-child-relations between EObjects. 58 58 59 - ----51 +Furthermore, the extension allows to extract the mapping and check completeness of mapped elements against content of transformed models. 60 60 61 -== Extensions == 53 +=== TransformationTreeExtensions ([[JavaDoc>>attach:TransformationTreeExtensions.html]]) === 62 62 63 - 55 +This class provides all functionalities to easily traverse and search in a TransformationTree. 64 64 65 - Twoclassesareprovidedby thisprojectto extendfunctionalityofthecore model.57 +Furthermore, it allows to modify trees by creating, deleting or appending new transformations and transformed models. 66 66 67 - 59 +Additionally this extension provides functionality to extract a concrete mapping between two arbitary model intances from a TransformationTree. 68 68 69 - TransformationMapping (JavaDoc)61 +---- 70 70 71 - 63 +== Implementation Details == 72 72 73 -The main propose of this class is generation of a Object mapping during transformation process. 65 +* All references to EObjects in EObjectWrapper 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 object-mapping. 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. 74 74 75 - Therefor it provides different functions for incremental registering of single parent child relations beween EObjects.69 +---- 76 76 77 - Furthermore,the extensionallows to extract themapping and check completenessof mapped elements against content of transformed models.71 +== Example == 78 78 79 - 73 +=== Creating Mapping during Transformation === 80 80 81 -Tran sformationTreeExtensions(JavaDoc)75 +The following code is a modifcation of the tranformation "Spilt Trigger and Effects" of SCCharts. 82 82 83 - 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}} 84 84 85 - Thisclass proivedall functionalitiesto easily traverse and search in aTransformationTree.145 +=== Create TransformationTree with Mapping === 86 86 87 - Furthermore,itallows tomodifytreesby creating,deletingorappendingnew transformationsand transformed models.147 +To test the transformation and mapping we will transform th following ABO-SCChart. 88 88 89 - 149 +[[image:attach:example_abo.jpeg]] 90 90 91 -- ---151 +The following code snipped performs the transformation on our ABO-example, extracts the mapping and creates a transformation tree. 92 92 93 - 153 +{{code title="Transform and create TranformationTree" theme="Eclipse" linenumbers="true" language="java" firstline="1" collapse="true"}} 154 +aboSplitTE = transformation.transformTriggerEffect(abo); 94 94 95 -== Implementation Details == 156 +Model aboSplitTEModel = transformationTreeExtensions.initializeTransformationTree( 157 + transformation.extractMapping(), 158 + "splitTriggerEffect", 159 + abo, "coreSCChart", 160 + aboSplitTE, "coreSCChart-splitTriggerEffect"); 96 96 97 - 162 +tranformationTree = transformationTreeExtensions.root(aboSplitTEModel); 163 +{{/code}} 98 98 99 - AllreferencesEObjects are referencestocopyofthe originalEObject. This allows to representimmutable mapping.Toreidentifycorresponding EObjectsTransformationTreeExtensions provides searchfuntions and matchingfunctionality.165 +The result of transformation is the following SCChart. ABO-splitTriggerEffect. 100 100 101 - 167 +[[image:attach:example_abo_splitTE.jpeg]] 102 102 103 - Modelssmaybetransient.169 +Resulting TransformationTree has following structure. 104 104 105 - This indicates thatall referencesto EObjects inall Elements of thetransientmodelaremoved.171 +[[image:attach:example_tree.jpeg]] 106 106 107 - Thusthesemodelscan'tbesource ofaew appended tranformationandcan notbeassociatedwithit's orginalmodel.173 +Furthermore the TransformationTree now contains the following mapping information. 108 108 109 - Themain proposeofthis feature is to improve scalability of TransformationTrees byremoving unneccessary referencestointernalmodel, but preserve traversing funtionality of the ObjectMapping.175 +[[image:attach:example_tree_transformation.jpeg]] 110 110 111 - ==Example==177 +Here you can see the effect of the transformation causing the transformation to split up. 112 112 113 -c omingsoon179 +[[image:attach:als-ktm-splitTriggerEffect-detail.jpg]]
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -8651 4751 +8651594 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651 475/Transformation Mapping (KTM)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651594/Transformation Mapping (KTM)