Information Technology Reference
In-Depth Information
code, the transformation task is to generate code for every ProctypeDef defined
in the model. Due to its complexity, we present in Fig. 11 a subset of the PRO-
MELA meta-model necessary for understanding the translation process.
5.2 xUML Models to PROMELA Models
Rules in ETL (Epsilon Transformation Language) are defined in order to con-
struct a PROMELA model from the original xUML model. As shown previously,
the PROMELA model (according to its meta-model) has constants, processes
and an initial process. We define rules to translate each one of these elements
and a further rule to put them together inside a complete PROMELA model.
In order to illustrate the use of Epsilon, we present in Fig. 12 the ETL rule
used to transform a class and its associated state machine to a PROMELA
rule UMLClassToPROMELAProctype
1
transform class : UML!Class
2
to proctype : PROMELA!Proctype {
3
4
5
-- Application class defines the scenario: it is a PROMELA init proctype
guard : class.name <> 'Application' and class.name <> 'application'
6
7
8
-- Sets the proctype name
proctype.name := class.name;
9
10
11
-- Transform generalizations
-- Find if it is a generalisation and link the superclasses if they have
12
-- been transformed, otherwise, trigger the transformation superclasses
13
var generalizations := class.generalization;
14
if (generalizations.isDefined()) {
15
for (g in generalizations) {
16
for (c in g.target) {
17
var proc := PROMELA!Proctype.all.select(t|t.name = c.name).first();
18
if (proc.isDefined()) {
19
proctype.generalizations.add(proc);
20
} else {
21
proctype.generalizations.add(c.equivalent());
22
}
23
}
24
}
25
}
26
27
28
-- Associate to the proctype, the messages that it can receive
-- Used in the code transformation to generate inputs from the environment
29
for (s in class.ownedReception) {
30
var msg := PROMELA!MessageSignature.createInstance();
31
msg.name := s.signal.name;
32
proctype.messageSignatures.add(msg);
33
}
34
35
36
-- Generate the attributes and references for this class
GenerateAttributesAndReferences(class, proctype);
37
38
39
-- Generate states and state variables according to the state machine
GenerateStateAndStateVariables(class, proctype);
40
41
42
-- Generate the transition blocks according to the state machine
GenerateTransitionBlocks(class, proctype);
43
}
44
Fig. 12. ETL rule transforming a class and its state machine to a PROMELA process
 
Search WWH ::




Custom Search