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/03 17:00
on 2014/01/03 17:00
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
-
... ... @@ -70,103 +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 - 80 -import com.google.inject.Inject 81 -import de.cau.cs.kieler.ktm.extensions.TransformationMapping 82 -import de.cau.cs.kieler.sccharts.Region 83 -import de.cau.cs.kieler.sccharts.Transition 84 -import de.cau.cs.kieler.sccharts.extensions.SCChartsExtension 85 -/** 86 - * @author als 87 - */ 88 -class SCChartTestTransformation { 89 - @Inject 90 - extension TransformationMapping 91 - @Inject 92 - extension SCChartsExtension 93 - 94 - // -- Mapping Access 95 - def extractMapping() { 96 - extractMappingData; 97 - } 98 - 99 - //------------------------------------------------------------------------- 100 - //-- S P L I T T R A N S I T I O N -- 101 - //------------------------------------------------------------------------- 102 - // For every transition T that has both, a trigger and an effect do the following: 103 - // For every effect: 104 - // Create a conditional C and add it to the parent of T's source state S_src. 105 - // create a new true triggered immediate effect transition T_eff and move all effects of T to T_eff. 106 - // Set the T_eff to have T's target state. Set T to have the target C. 107 - // Add T_eff to C's outgoing transitions. 108 - def Region transformTriggerEffect(Region rootRegion) { 109 - // Clone the complete SCCharts region 110 - var targetRootRegion = rootRegion.mappedCopy; //NEW - mapping information (changed copy to mappedCopy) 111 - // Traverse all transitions 112 - for (targetTransition : targetRootRegion.getAllContainedTransitions) { 113 - targetTransition.transformTriggerEffect(targetRootRegion); 114 - } 115 - targetRootRegion; 116 - } 117 - def void transformTriggerEffect(Transition transition, Region targetRootRegion) { 118 - // Only apply this to transition that have both, a trigger and one or more effects 119 - if (((transition.trigger != null || !transition.immediate) && !transition.effects.nullOrEmpty) || transition.effects.size > 1) { 120 - val targetState = transition.targetState 121 - val parentRegion = targetState.parentRegion 122 - val transitionOriginalTarget = transition.targetState 123 - var Transition lastTransition = transition 124 - for (effect : transition.effects.immutableCopy) { 125 - val effectState = parentRegion.createState(targetState.id + effect.id) 126 - effectState.mapParents(transition.mappedParents); //NEW - mapping information 127 - effectState.setTypeConnector 128 - val effectTransition = createImmediateTransition.addEffect(effect) 129 - effectTransition.mapParents(transition.mappedParents); //NEW - mapping information 130 - effectTransition.setSourceState(effectState) 131 - lastTransition.setTargetState(effectState) 132 - lastTransition = effectTransition 133 - } 134 - lastTransition.setTargetState(transitionOriginalTarget) 135 - } 136 - } 137 -} 138 -{{/code}} 139 - 140 -=== Create TransformationTree with Mapping === 141 - 142 -To test the transformation and mapping we will transform th following ABO-SCChart. 143 - 144 -[[image:attach:example_abo.jpeg]] 145 - 146 -The following code snipped performs the transformation on our ABO-example, extracts the mapping and creates a transformation tree. 147 - 148 -{{code title="Transform and create TranformationTree" theme="Eclipse" linenumbers="true" language="java" firstline="1" collapse="true"}} 149 -aboSplitTE = transformation.transformTriggerEffect(abo); 150 - 151 -Model aboSplitTEModel = transformationTreeExtensions.initializeTransformationTree( 152 - transformation.extractMapping(), 153 - "splitTriggerEffect", 154 - abo, "ABO", 155 - aboSplitTE, "ABO-splitTriEff"); 156 - 157 -tranformationTree = transformationTreeExtensions.root(aboSplitTEModel); 158 -{{/code}} 159 - 160 -The result of transformation is the following SCChart. ABO-splitTriEff. 161 - 162 -[[image:attach:example_abo_splitTE.jpeg]] 163 - 164 -Resulting TransformationTree has following structure. 165 - 166 -[[image:attach:example_tree.jpeg]] 167 - 168 -Furthermore the TransformationTree now contains the following mapping information. 169 - 170 -[[image:attach:example_tree_transformation.jpeg]] 171 - 172 -Here you can see the effect of the transformation causing the transformation to split up. 73 +coming soon
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -86515 631 +8651535 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/86515 63/Transformation Mapping (KTM)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651535/Transformation Mapping (KTM)