Shallow and deep are distinguished from each
other whether the above mechanism is nested or not.
3.2 Transforming Sequence Models into
CPN
There are two possible implementations of sequence
models by CPN.
One is a structure based implementation, which
assigns a place for each lifeline, and assigns a transi-
tion with an incoming arc to it for each incoming mes-
sage to the lifeline. We can easily transform a given
sequence model into CPN model using these simple
rules, however the resultant CPN model is not com-
patible with state machine models, since no concepts
of states are included.
The other is a state based implementation, which
takes the states of objects into account. As discussed
in Section 2, an injected state is defined for each
incoming message to a lifeline, of which operation
name occurs as an action name in the state machine
model for the object that the life line represents.
Therefore, a CPN model consisting of the places
for these injected states, and of the incoming arc with
a transition to the above each place, reflects this im-
plementation. Such a CPN model can basically be
transformed in the same way as state machines. How-
ever, sequence models could form more complicated
structure than state machine models using combined
fragments. The treatment of these combined frag-
ments is as follows (Shinkawa, 2006).
[Alternative and Option Fragments]
An alternative and option fragments, designated
by alt and opt tag, represent case and if - then struc-
tures respectively, and implemented by CPN using as
many transitions as the number of regions in the frag-
ment. Each transition is assigned a guard equivalent
to the guard of corresponded region.
[Loop Fragment]
A loop fragment, designated by loop tag, repre-
sents an iterative process, and is implemented using
two conflicting transitions for iteration and exit re-
spectively.
[Parallel Fragment]
A parallel fragment, designated by par tag, rep-
resents concurrent message passing between the life-
lines, and is interpreted as concurrent state transitions
in the state based implementation. This fragment is
expressed in CPN using a transition splitting one in-
coming arc into multiple outgoing arcs.
[Break Fragment]
A break fragment, designated by break tag, is used
to terminate the message passing in the outer frag-
ment, to which the break fragment belongs. Since
the fragment is controlled by a guard, it can be im-
plemented as a transition with the equivalent guard,
which puts a token into the place outside the fragment.
[Critical Fragment]
A critical fragment, designated by critical tag,
represents a message passing process that must be
performed exclusively, and usually used within a par-
allel fragment. This fragment is expressed in CPN us-
ing a place with a lock token. The locking mechanism
works as follows.
1. The first transition in the fragment gets the lock
in the above place, and the transition immediately
after the fragment return the lock.
2. Each transition that conflicts with the critical frag-
ment refers to this place, that is, bidirectional arcs
are drawn between the transition and the place.
[Weak Sequencing Fragment]
A weak sequencing fragment, designated by seq
tag, defines the ordering of messages as follows
(OMG, 2010).
1. The ordering of OccurrenceSpecifications within
each of the operands are maintained in the result.
2. OccurrenceSpecifications on different lifelines
from different operands may come in any order.
3. OccurrenceSpecifications on the same lifeline
from different operands are ordered such that
an OccurrenceSpecification of the first operand
comes before that of the second operand.
This fragment reduces to a par fragment if all the
operands include disjunct sets of lifelines interacting
together. Therefore, when tranforming it into CPN,
we first regard it as par fragment, then add the order-
ing restrictions to it. The detailed implementation is
as follows.
1. Build the CPN model for the seq fragment as par
fragment.
2. Derive all the ordering constraints ( ˆm
i, j
≺ ˆm
i+1,k
)
between (i)th and (i + 1)th operands or regions
P
i
and P
i+1
, where ˆm
i, j
and ˆm
i+1,k
represent the
receiving event occurrences for the message m
i, j
and m
i+1,k
in the operand P
i
and P
i+1
respectively.
3. Draw an additional arc between P ( ˆm
i, j
) to
T ( ˆm
i+1,k
), and modify the incoming arc function
of the P ( ˆm
i, j
) so that an extra token for the tran-
sition T ( ˆm
i+1,k
) is provided. In addition, modify
the guard of T ( ˆm
i+1,k
) for this extra token. P ( ˆm)
and T ( ˆm) represent the place and transition asso-
ciated with the receiving event occurrence ˆm.
For example, in Figure 3, the order of the re-
ceiving event occurrences, which are denoted by the
names of messages, must satisfy m
1
≺ m
2
and m
3
≺
INTER-MODEL CONSISTENCY BETWEEN UML STATE MACHINE AND SEQUENCE MODELS
139