<
From version < 21.1 >
edited by Alexander Schulz-Rosengarten
on 2018/11/22 14:53
To version < 6.1 >
edited by Alexander Schulz-Rosengarten
on 2013/12/18 16:12
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,282 +1,113 @@
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 8  
9 -\\
10 10  
11 -=== Topics ===
7 +{{toc maxLevel="2" minLevel="2"/}}
12 12  
9 +----
13 13  
11 +== Overview ==
14 14  
15 -{{toc maxLevel="2" minLevel="2"/}}
13 +
16 16  
17 17  This subproject provides a tracing mechanism for arbitary model-elements across multiple model transformations, based on EMF.
18 18  
19 -The main propose of KTM is to allow bidirectional information transfer between abstract models and their resultant transformed models.
17 +The main propose of KTM is to allow information transfer between abstract models and their resultant transformed models.
20 20  
21 21  ----
22 22  
23 23  == Transformation Tree Model ==
24 24  
25 -\\
23 +
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  
29 29  It is based on an EMF-Metamodel.
30 30  
31 -[[image:attach:als-ktmt-metamodel.png]]
29 +
32 32  
33 -The structure of the model can be separated into two parts.
31 +<metamodel>
34 34  
35 -**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.
33 +
36 36  
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.
35 +The structure of the model can be separated into two parts.
38 38  
39 -\\
37 +First part is a tree of transformations.
40 40  
41 -An abstract example of an instance of this model:
39 +Each Model-Class is a representation of a concrete model which is transformed. So models are nodes and ModelTransformations are edges.
42 42  
43 -[[image:attach:abstract_example_tree.png]]
41 +Thus the Model representing the root-model of a tree is also the root of a concrete TransformationTree-Model.
44 44  
45 -----
43 +Second part is object mapping.
46 46  
47 -== Extensions ==
45 +Concrete models contain EObjects as their elements, which are representend by Element-Class in TransformationTree metamodel.
48 48  
49 -Two classes are provided by this project to extend functionality of the core model.
47 +The Elements of two models are connected with ElementTransformations-Class to model their
50 50  
51 -=== TransformationMapping ([[JavaDoc>>attach:TransformationMapping.html]]) ===
49 +origination relationship in corresponding model transformation.
52 52  
53 -The main propose of this class is generation of a object-mapping during transformation process.
51 +
54 54  
55 -Therefor it provides different functions for incremental registering of single parent-child-relations between EObjects.
53 +An abstract example of an instance of this model:
56 56  
57 -Furthermore, the extension allows to extract the mapping and check completeness of mapped elements against content of transformed models.
55 +
58 58  
59 -=== TransformationTreeExtensions ([[JavaDoc>>attach:TransformationTreeExtensions.html]]) ===
57 +<exmaple_tree>
60 60  
61 -This class provides all functionalities to easily traverse and search in a TransformationTree.
62 -
63 -Furthermore, it allows to modify trees by creating, deleting or appending new transformations and transformed models.
64 -
65 -Additionally this extension provides functionality to extract a concrete mapping between two arbitary model intances from a TransformationTree.
66 -
67 67  ----
68 68  
69 -== Implementation Details ==
61 +== Extensions ==
70 70  
71 -* 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.
72 -* 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.
73 -* 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.
63 +
74 74  
75 -----
65 +Two classes are provided by this project to extend functionality of the core model.
76 76  
77 -== Example ==
67 +
78 78  
79 -In this example we will perform some transformations on SCCharts.
69 +TransformationMapping (JavaDoc)
80 80  
81 -The source chart is a ABO, the "Hello World" of SCCharts.
71 +
82 82  
83 -ABO is already a CoreSCChart, so we will perform normalization and a transformation to SCG.
73 +The main propose of this class is generation of a Object mapping during transformation process.
84 84  
85 -=== Creating Mapping during Transformation ===
75 +Therefor it provides different functions for incremental registering of single parent child relations beween EObjects.
86 86  
87 -In order to note every single element transformation of a model transformation, we use the TransformationMapping extension.
77 +Furthermore, the extension allows to extract the mapping and check completeness of mapped elements against content of transformed models.
88 88  
89 -After each creation of new Objects for transformed model the mapping must be updated with it's origin information.
79 +
90 90  
91 -The codeblock blow show a snipped of SCChartCoreTransformation with additional mapping registration.
81 +TransformationTreeExtensions (JavaDoc)
92 92  
93 -\\
83 +
94 94  
95 -{{code language="java" theme="Eclipse" firstline="1" title="transformTriggerEffect CodeSnipped" linenumbers="true" collapse="true"}}
96 -...
97 -  @Inject
98 - extension TransformationMapping
85 +This class proived all functionalities to easily traverse and search in a TransformationTree.
99 99  
100 -...
87 +Furthermore, it allows to modify trees by creating, deleting or appending new transformations and transformed models.
101 101  
102 - // NEW - Mapping access delegation
103 - def extractMapping() {
104 - extractMappingData;
105 - }
89 +
106 106  
107 -...
91 +----
108 108  
109 - //-------------------------------------------------------------------------
110 - //-- S P L I T T R A N S I T I O N --
111 - //-------------------------------------------------------------------------
112 - // For every transition T that has both, a trigger and an effect do the following:
113 - // For every effect:
114 - // Create a conditional C and add it to the parent of T's source state S_src.
115 - // create a new true triggered immediate effect transition T_eff and move all effects of T to T_eff.
116 - // Set the T_eff to have T's target state. Set T to have the target C.
117 - // Add T_eff to C's outgoing transitions.
118 - def Region transformTriggerEffect(Region rootRegion) {
119 - clearMapping; //NEW - clear previous mapping information to assure a single consistent mapping
120 - // Clone the complete SCCharts region
121 - var targetRootRegion = rootRegion.mappedCopy; //NEW - mapping information (changed copy to mappedCopy)
122 - // Traverse all transitions
123 - for (targetTransition : targetRootRegion.getAllContainedTransitions) {
124 - targetTransition.transformTriggerEffect(targetRootRegion);
125 - }
126 - val completeness = checkMappingCompleteness(rootRegion, targetRootRegion); //NEW - DEBUG
127 - targetRootRegion;
128 - }
129 - def void transformTriggerEffect(Transition transition, Region targetRootRegion) {
130 - // Only apply this to transition that have both, a trigger (or is a termination) and one or more effects
131 - if (((transition.trigger != null || !transition.immediate || transition.typeTermination) && !transition.effects.nullOrEmpty) ||
132 - transition.effects.size > 1) {
133 - val targetState = transition.targetState
134 - val parentRegion = targetState.parentRegion
135 - val transitionOriginalTarget = transition.targetState
136 - var Transition lastTransition = transition
137 - val firstEffect = transition.effects.head
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 - }
153 - }
154 - lastTransition.setTargetState(transitionOriginalTarget)
155 - }
156 - }
157 -{{/code}}
93 +
158 158  
159 -=== Create TransformationTree ===
95 +== Implementation Details ==
160 160  
161 -The following code will now perform each transformation stepwise and updates a transformation tree each step.
97 +
162 162  
163 -\\
99 +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 funtions and matching functionality.
164 164  
165 -{{code language="java" theme="Eclipse" firstline="1" title="Transform and create TranformationTree" linenumbers="true" collapse="true"}}
166 -aboSplitTE = SCCtransformation.transformTriggerEffect(abo);
101 +
167 167  
168 -ModelWrapper aboSplitTEModel =
169 - transformationTree.initializeTransformationTree(SCCtransformation.extractMapping(), "TriggerEffect", abo, "coreSCChart", aboSplitTE, "coreSCChart-splitTriggerEffect");
103 +Models in TransformationTrees may be transient.
170 170  
171 -aboNormalized = SCCtransformation.transformSurfaceDepth(aboSplitTE);
105 +This indicates that all references to EObjects in all Elements of the transient model are removed.
172 172  
173 -ModelWrapper aboNormalizedModel =
174 - transformationTree.addTransformationToTree(SCCtransformation.extractMapping(), aboSplitTEModel, "SurfaceDepth", aboSplitTE, aboNormalized, "normalizedCoreSCChart");
107 +Thus these models can't be source of a new appended tranformation and can not be associated with it's orginal model.
175 175  
176 -aboSCG = SCGtransformation.transformSCG(aboNormalized);
109 +The main propose of this feature is to improve scalability of TransformationTrees by removing unneccessary references to internal model, but preserve traversing funtionality of the ObjectMapping.
177 177  
178 -ModelWrapper aboSCGModel =
179 - transformationTree.addTransformationToTree(SCGtransformation.extractMapping(), aboNormalizedModel, "SCC2SCG", aboNormalized, aboSCG,"SCG");
111 +== Example ==
180 180  
181 -tree = transformationTree.root(aboSCGModel);
182 -{{/code}}
183 -
184 -\\
185 -
186 -The resulting TransformationTree has following structure and representing each step and model of the transformation.
187 -
188 -\\
189 -
190 -(% class="wrapped" %)
191 -|=(% style="text-align: center;" colspan="4" %)(% style="text-align: center;" colspan="4" %)
192 -(((
193 -(% class="content-wrapper" %)
194 -(((
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 -
224 -\\
225 -
226 -Furthermore the TransformationTree now contains mapping information for the whole transformation chain.
227 -
228 -Now we can use an additional feature of KTM, the resolving of mappings between arbitary models.
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 -\\
113 +coming soon
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -50823277
1 +8651475
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/8651475/Transformation Mapping (KTM)