<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Mapping OCL constraints into CTL-like logic and SML for UML validation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Miloud BENNAMA</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ageria m_bennama@esi.dz</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>t_tebibel@esi.dz</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>UML; OCL; CP-nets; CPN-ML; ASKCTL; CPNtools;</institution>
          <addr-line>Mapping; model-checking</addr-line>
        </aff>
      </contrib-group>
      <fpage>102</fpage>
      <lpage>112</lpage>
      <abstract>
        <p>The UML (Unified Modeling Language) graphical models miss providing some pertinent elements of specification as constraints over objects and operations. To fill this lack, OCL (Object Constraint Language) has been developed by IBM and integrated to UML as a modern and formal modeling language, which is easy to learn and efficient to use. On the other hand, many works emerged providing a formal semantics to UML dynamic diagrams by using CP-nets (High-level Petri Nets). The latter are verified based on system properties written in temporal logic. The purpose of this paper is to assist the UML modeler, not necessarily familiar with temporal logics, by letting him expressing the properties in OCL language and proposing an automatic mapping of OCL invariants and pre/post-conditions into CTL-like logic (Computational Tree Logic) coupled with the functional programming language Standard ML. The obtained temporal logic formulas are verified over the state space of the CP-net models derived from UML diagrams by model-checking.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>
        UML [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] is the de facto standard for specifying
both of the structural and behavioral aspects of
systems. OCL (Object Constraint Language [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]),
an integral part of UML, allows for specifying
additional constraints on UML models in a more
precise and concise manner. OCL has a
mathematical definition based on set theory with a
notion of object model and system states. UML
and OCL are easy and familiar to users, but they
do not support validation tasks and their semantics
is defined in a semi-formal way.
      </p>
      <p>
        To provide a rigorous semantics for UML models,
CPN-nets [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] have been used by many studies
[
        <xref ref-type="bibr" rid="ref1 ref20 ref3 ref9">1,3,9,20</xref>
        ] as an expressive semantics domain.
Also, OMG (Object Management Group) has
inspired many UML concepts from Petri Nets,
particularly, in activity diagrams. CP-nets are
widely-used for specifying and analysing behaviour
of concurrent systems. They consist in a transition
system that supports model-checking validation
method.
      </p>
      <p>
        Model-checking technique shows that a system
satisfies its specification. It requires a formal
representation (as CP-nets) of the system and a
specification that is often expressed in terms of a
temporal logic formula [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        A formal tool, called CPNtools, has emerged for
analyzing CP-nets. It uses the functional
programming language Standard ML [
        <xref ref-type="bibr" rid="ref14 ref21">14,21</xref>
        ] and
CTL-like temporal logic, called ASKCTL [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], for
model description, data manipulation and
properties specification.
      </p>
      <p>
        We proposed in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] an approach to translate the
Interaction Overview Diagram (IOD) to CP-nets for
simulation and state space analysis using
CPNtools. To specify and check system properties,
the modeler is not familiar with temporal logic and
ML language that require many skills.
      </p>
      <p>
        To assist the modeler in this phase of specification,
we propose to allow him to express system
properties in his usual language of specification,
namely OCL, and to automate the translation of
OCL properties to ASKCTL and ML. The resulting
formulas are evaluated over the state space of the
CP-net model derived from the IOD diagram.
Various works [
        <xref ref-type="bibr" rid="ref12 ref15 ref2 ref23 ref4 ref7">2,4,7,12,15,23</xref>
        ] have been
undertaken to transform OCL into other formal
languages. Our approach differs from works that
use temporal logics to formalize OCL constraints in
that it achieves a detailed mapping of basic and
complex expressions of OCL into Standard ML.
This extends our previous works on the IOD
diagrams mapping into CP-net models. Unlike
other works, our approach translates the class
diagram, IOD diagram, and OCL specifications into
the input languages of CPNtools model-checker.
The remainder of this paper is organized as
follows. Section 2 presents OCL language and its
constraints whereas section 3 presents the
CPNtools and its input formal languages. Section 4
describes our approach of mapping of OCL
expressions into ML functions and OCL constraints
into ASKCTL formulas. Section 5 illustrates the
application of our approach over an ATM system.
Section 6 recalls the related works. Finally, Section
7 concludes and presents future works.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. OBJECT CONSTRAINT LANGAGE</title>
      <p>The UML has been widely accepted as a standard
for object-oriented modeling language and is
supported by a great number of CASE tools. The
Object Constraint Language (OCL) is an integral
part of UML, and was introduced to express
subtleties and nuances of meaning that diagrams
cannot convey by themselves.</p>
      <p>
        OCL has been introduced by IBM for business
modeling and adopted by UML as a mean to
specify invariants of classes and types in a class
model, to specify type invariant of stereotypes, to
describe pre- and post-conditions on operations
and methods, to describe guards, and also as a
navigation language. OCL is a language of typed
expressions, where an expression can be
universally and existentially quantified [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
    </sec>
    <sec id="sec-3">
      <title>2.1 Invariants</title>
      <p>
        The OCL expression can be part of an Invariant
which is a Constraint stereotyped as an
«invariant». When the invariant is associated with a
Classifier, the latter is referred to as a “type” in this
clause. An OCL expression is an invariant of the
type and must be true for all instances of that type
at any time [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]
context &lt;TypeName&gt; inv &lt;InvName&gt;:
&lt;BooleanExpression&gt;
Optionally, the name of the constraint may be
written after the inv keyword, allowing the
constraint to be referenced by name.
      </p>
      <p>Integrity constraints in OCL are represented as
invariants defined in the context of a specific type,
named the context type of the constraint. Its body,
the Boolean condition to be checked, must be
satisfied by all instances of the context type.</p>
    </sec>
    <sec id="sec-4">
      <title>2.1 Pre/post conditions</title>
      <p>
        The OCL expression can be part of a Precondition
or Postcondition, corresponding to «precondition»
and «postcondition» stereotypes of Constraint
associated with an Operation or other behavioral
feature. The contextual instance self then is an
instance of the type that owns the operation or
method as a feature. The context declaration in
OCL uses the context keyword, followed by the
type and operation declaration. The stereotype of
constraint is shown by putting the labels ‘pre:’ and
‘post:’ before the actual Preconditions and
Postconditions [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
context
&lt;TypeName&gt;::&lt;OperationName&gt;(&lt;param1&gt;:
&lt;Type1&gt;, ... ): &lt;ReturnType&gt;
pre &lt;PreName&gt;: &lt;BooleanExpression&gt;
post &lt;PostName&gt;: &lt;BooleanExpression&gt;
Optionally, the name of the precondition or
postcondition may be written after the pre or post
keyword, allowing the constraint to be referenced
by name.
      </p>
    </sec>
    <sec id="sec-5">
      <title>3. CP-NETS AND TEMPORAL LOGIC</title>
    </sec>
    <sec id="sec-6">
      <title>3.1 CPN-ML language</title>
      <p>
        The CPN-ML [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] programming language is a
variation of functional programming language
Standard ML (SML) used in CP-nets. CPN-ML
embeds the Standard ML and extends it with
constructs for defining colour sets and functions,
declaring variables, and writing inscriptions in
CPnet models. SML provides the user with the
expressiveness required to model data and data
manipulation of complexity found in industrial
systems. SML is also used to implement simulation,
state space analysis, and performance analysis of
CP-net models.
      </p>
      <p>(i)
(ii)
(iii)
(iv)</p>
      <p>Colour sets: The CPN ML language
provides a predefined set of basic types
inherited from Standard ML that can be
used as simple colour sets.</p>
      <p>Expressions and Types: In CP-nets,
relatively simple expressions have been
used as arc expressions, guards, and initial
markings. It is possible to use the complete
set of Standard ML expressions.</p>
      <p>Functions: Functions are similar to the
procedures and methods known from
conventional programming languages.</p>
      <p>Recursion and Lists: Such loop statements
are not available in a functional
programming language, which instead
relies on recursive functions to express
iteration.</p>
    </sec>
    <sec id="sec-7">
      <title>3.2 ASKCTL logic</title>
      <p>
        The ASKCTL [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] is a CTL-like logic which is
interpreted over the state spaces of CP-nets. The
logic has been designed to express properties of
both state and transition information over the
CPnet state space. The logic is powerful enough to
express many of the standard CP-net properties.
Using ASKCTL logic implies that we get a well
understood and easy to use framework for
expressing a much wider range of properties. The
models over which we interpret ASKCTL are state
spaces of CP-nets. These graphs carry information
on both nodes and edges.
      </p>
      <p>
        ASKCTL is a branching-time modal logic and an
extension of Computational Tree Logic (CTL [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]).
An ASKCTL statement is defined to be a state or a
transition formula. For more details about ASKCTL
syntax see [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] and [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ].
      </p>
    </sec>
    <sec id="sec-8">
      <title>3.3 CP-nets</title>
      <p>
        CP-nets [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] are high-level Petri nets widely-used
formal method for system specification, design,
simulation and verification. They provide a
graphical oriented modeling language capable of
expressing concurrency, synchronization,
resources sharing and non-determinism at different
levels of abstraction. They combine the mathematic
primitives of Petri Nets [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] and the expressive
power of SML. They support a variety of verification
techniques such as state space analysis and model
simulation.
      </p>
    </sec>
    <sec id="sec-9">
      <title>3.4 CPNtools</title>
      <p>
        CPNtools [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] is a tool for editing, simulating, and
analyzing CP-nets. The tool features incremental
syntax checking and code generation, which take
place while a net is being constructed. A fast
simulator efficiently handles untimed and timed
nets. Full and partial state spaces can be
generated and analyzed, and a standard state
space report contains information, such as
boundedness properties and liveness properties.
CPNtools supports state space analysis and
model-checking of ASKCTL logic.
      </p>
    </sec>
    <sec id="sec-10">
      <title>4. MAPPING OF OCL</title>
    </sec>
    <sec id="sec-11">
      <title>4.1. Mapping of OCL expressions to ML</title>
      <p>In OCL language, a number of basic types are
predefined to the UML modeler. These predefined
types, such as Boolean, UnlimitedNatural, Integer,
Real, Enumeration and String, are independent of
any object model. In ML language, the same basic
types are available with some difference in the
syntax.</p>
    </sec>
    <sec id="sec-12">
      <title>4.1.1 Numbers and arithmetical operations</title>
      <p>There are three types to express numbers in OCL:
Real, Integer and UnlimitedNatural, where
UnlimitedNatural is a subtype of Integer and
Integer is a subtype of Real. The basic arithmetical
(+, -, *, =, abs(), min(), max()) and comparison
operations (&gt;, &lt;, &gt;=, &lt;=) are defined for numbers.
Two types of conversion from Real to Integer are
provided (floor(), round()) and additionally, a
conversion to string was introduced (toString()).
There are two operations defined for the Integer
and UnlimitedNatural types only: division quotient
(div()) and remainder (mod()). Table 1 shows the
mapping of OCL numeral operations into ML.
The OCL UnlimitedNatural type represents the set
of non-negative integers. Its OCL declaration a :
UnlimitedNatural is expressed in ML by var a:INT
with 0..maxINT;. All integer operations are applied
in the UnlimitedNatural subtype except the
negation operation.</p>
      <p>The OCL Real type represents numerals with a
decimal point. All integer operations are applied in
the Real supertype except the div and mod
operations. Additionally, the floor and around
operations are supported in Real type.</p>
    </sec>
    <sec id="sec-13">
      <title>4.1.2 Boolean type mapping</title>
      <p>Basically OCL users work with the Boolean values
true and false that are the instances of the Boolean
type. OCL provides the basic logical operations
and, or, not as well as the derived operations xor,
implies. The OCL declaration syntax of a Boolean
a: Boolean is expressed in ML syntax by var a:
BOOL;
In ML, the OCL Boolean conjunction ‘a and b’
becomes ‘a andalso b’, disjunction ‘a or b’ becomes
‘a orelse b’, implication ‘a implies b’ becomes ‘not a
orelse b’ and negation ‘not a’ is the same. The
table 2 shows the mapping of OCL Boolean
operations into ML.</p>
      <p>OCL
A:Integer</p>
      <p>ML</p>
      <p>Description
var a: INT;
integer type declaration
A: var a:INT with natural type declaration
UnlimitedNatural 0..maxINT ;
A:Real</p>
      <p>A:Real;
real type declaration
Strings are specified by sequences of printable
ASCII characters surrounded with double quotes.
The OCL declaration syntax of a string a: String is
expressed in ML syntax by var a: String;. In both
OCL and ML, the length of a string (size) can be
determined, a string can be projected to a
substring, and two strings can be concatenated (^).
Also, it is possible to access single or all characters
of a given string and to applied case conversion.
chars to
chars to</p>
    </sec>
    <sec id="sec-14">
      <title>4.1.4 Enumeration type</title>
      <p>OCL enumeration types are user-defined types. An
enumeration type is defined by specifying a name
and a set of literals. An enumeration value is one of
the literals used for its type definition. In ML,
enumerated values are explicitly named as
identifiers in the declaration. These values must be
alphanumeric identifiers. Table 4 shows the
mapping of OCL enumeration operations into ML.
OCL
A :
Enum{v0,v1,..,vn}
A = #vi , A &lt;&gt; #vi</p>
      <p>ML Description
Var Enum = with enumeration type
v0| v1|...|vn; declaration</p>
      <p>equality and
A = #vi , A &lt;&gt; #vi inequality with an
enumeration value
Values of this color set have the form: {id1=v1,...,
idn=vn} where vi are values of type typei for
1&lt;=i&lt;=n.</p>
      <p>To extract the ith element of a product the following
operation is used: #idi tuple
In ML, each component in the record color set may
be a different type and each is identified by a
unique label so that each field is
positionindependent.</p>
    </sec>
    <sec id="sec-15">
      <title>4.1.5 CollectionType</title>
      <p>It describes a list of elements of a particular given
type. It is a concrete metaclass whose instances
are the subclasses SetType, OrderedSetType,
SequenceType, and BagType.</p>
      <p>(v)
(vi)
(vii)
(viii)</p>
      <p>BagType is a collection type that describes
a multiset of elements where each element
may occur multiple times in the bag. The
elements are unordered.</p>
      <p>SequenceType is a collection type that
describes a list of elements where each
element may occur multiple times in the
sequence. The elements are ordered by
their position in the sequence.</p>
      <p>SetType is a collection type that describes
a set of elements where each distinct
element occurs only once in the set. The
elements are not ordered.</p>
      <p>OrderedSetType is a collection type that
describes a set of elements where each
distinct element occurs only once in the set.
The elements are ordered by their position
in the sequence.</p>
      <p>The OCL CollectionType declaration
Collection(Type) is expressed in ML by:
colset collection= list Type;
var A : collection;
A:
In ML, the values of a list color set are a sequence
whose color set must be the same type. Values of
this color set have form [v1, v2, ..., vn] where vi has
type Type for i=1..n.</p>
      <p>The four kind of collection in OCL have the same
declaration in ML as a list color set but the
difference is shown in the treatment of their
operations. Table 5 shows the mapping of standard
operations while table 6 presents the mapping of
iteration operations and table 7 describes the
mapping of the collection operations.</p>
      <p>BCo-&gt;oelexacnludes(e): not (mem C e) C exclude the element e
BCo-&gt;oilnlecalundes(e): mem C e C include the element e
C1- ((intersect C1 C2) no element of C2 is in C1
&gt;excludesAll(C2) = nil)
C1- contains_all C1
&gt;includesAll(C2) C2
BCo-&gt;oilseEamnpty: C=nil
BCo-&gt;onleoatEnmpty: C&lt;&gt;nil
All elements of C2 are in
C1
Same as (c-&gt;size = 0)</p>
      <p>Same as (not c-&gt;isEmpty)
var class_name : class_type;
The attribute value class_name.atti is expressed in
ML by #atti class_name;.</p>
    </sec>
    <sec id="sec-16">
      <title>4.2 Mapping of OCL Constraints to ASKCTL</title>
      <p>OCL constraints consist of an OCL expression of
type Boolean and some declaration connecting the
OCL expression to an item in the class diagram. In
the case of pre and post-conditions, the constraint
is bound to an operation; invariants are bound to a
class.</p>
      <p>An OCL invariant is an OCL expression associated
with a class. It must be true for all instances of that
class type at any time. Its structure is:</p>
      <p>context ClassType inv: ExpOcl.</p>
      <p>An invariant is translated by the ASKCTL formula:</p>
      <p>INV(NF("",ML(ExpOcl)))
where:

</p>
      <p>ML() is a mapping function that gets an
equivalent expression in ML code.</p>
      <p>NF() is the node function used as a state
subformula. Its arguments are a string and a
ML function which takes a state space node
and returns a Boolean.
 INV(A) is a state formula witch is true if the
argument A is true for all reachable states
from the current state.
diagram. The class type class_name (att1:type1,
….,attn:typen) is declared in ML as an record type :
Colset class_type = record att1:type1* ….*attn:typen
A pre/post condition OCL is associated with an
operation of a class. The pre condition must be true
before the operation call and the post condition
must be true after the operation execution. Its
structure is:
A pre/post condition is translated by an ASKCTL
formula:</p>
      <p>INV(AND(OR(NOT(NF("",Fir(t1))),NF("",
ML(ExpOcl1))),OR(OR(NOT(NF("",Fir(t1))),</p>
      <p>NOT(NF("",ML(ExpOcl1)))),</p>
      <p>FORALL_NEXT(AND( NF("",Fir(t2)),</p>
      <p>FORALL_NEXT( NF("",ML(ExpOcl2))))))));
where:
 t1 and t2 are the derived transitions from the
sending and receiving events of the message
“operation call”.

</p>
      <p>Fir(t) indicates the firing of a transition t.</p>
      <p>FORALL_NEXT(A): used as a state formula,
looks at immediate successors, is true if the
argument, A, is hold for all immediate
successors.</p>
      <p>Figure 2 shows the verification of an OCL
pre/postcondition on the CP-net state space where the ML
Boolean pre-expression (MLExpPre =
ML(ExpOCL1)) must be true just prior the operation
execution (state i) and the ML Boolean
postexpression (MLExpPost = ML(ExpOCL2)) must be
true just after the operation execution (state i+2).</p>
    </sec>
    <sec id="sec-17">
      <title>5. CASE STUDY</title>
      <p>Our approach of mapping and analysis is applied to
an ATM system. To start the application, the client
inserts his card in the dispenser. He then enters his
personal identification number (PIN). In the
absence of error, he chooses to withdraw money or
view his balance. Otherwise, he starts again the
identification phase. To withdraw money, he
introduces the amount and recovers his money if
the balance is sufficient. For account inquiry, only
the balance is displayed. In all cases, the client
gets his card at the operation end.</p>
      <p>Thus, the static view of the ATM system is modeled
by a class diagram (see figure 3), and an object
diagram, see figure 4. The object diagram is used
to initialize the model for a possible execution.
*
1</p>
      <p>ATM</p>
      <p>ID: string
cash: integer
state: integer
tax: integer
ejected_money: integer
insert_card()
enter_PIN()
PIN_ok()
PIN_error()
select_withdrawal()
enter_amount()
amount_ok()
amount_error()
balance()
select_balance()
req_balance()
Bank</p>
      <p>ID : string
PINs : set{integer}
check_PIN()
check_amount()
update_account()
Client
1
*
ID: string
PIN: integer
max_amount: integer
asked_amount: integer
old_balance: integer
new_balance: integer
req_PIN()
display_option()
eject_card()
req_amount()
eject_money()
print_balance()
display_insufficient()
1
*
To illustrate the behaviour view of the ATM system,
we present in figure 5 the Interaction Overview
Diagram (IOD) of the ATM. The ATM IOD consists
of three sequence diagrams: client identification,
balance and withdrawal transaction; each of which
models a part of the system interactions.</p>
      <p>
        We limit ourselves to only show the identification
SD. We use a TranslatorTool that implements the
mapping rules developed in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] for automatically
generating a CP-net model from the ATM IOD in
accordance with the ATM Class Diagram.
The obtained CP-net model (see figure 4) is
initialized by the multi-set of tokens derived from
the ATM Object Diagram, see figure 4. The initial
multi-set of tokens is given as follows:
{("client", "c1", (100,5000,4000,9000,8000)),
("client", "c2", (200,4000,3000,8000,9000)),
("atm", "a1", [
        <xref ref-type="bibr" rid="ref1">100000,1,50,0</xref>
        ]),
("bank", "b1", (100,200,300,400))}
The resulting CP-net model is executed in
CPNtools for simulation, state space analysis and
system properties verification.
insPocmker1
tidentsub
pdec1
outsock
te1
sident
      </p>
      <p>tfork
sbalance</p>
      <p>pinit
tbalancesub
pmer2</p>
      <p>outsock
tjoint
tidentin</p>
      <p>pos2
tos7
pos7
patm
tos2
tos3
pos3
salt1
salt2
pcheck
Using the simulation tool, we can examine different
scenarios and explore the behaviour of the system.
Simulation provides a partial validation of the
model. It is often used to debug its dynamics. The
simulation of a HCPN can be either interactive or
automatic with graphical feedback showing visually
the tokens movement, enabled transitions and
places marking. The simulation feedback can be
interpreted by a helpful sequence diagram for user
facilities and errors detection.</p>
      <p>superpage siod_atm</p>
      <p>te2
swithdrawal</p>
      <p>insopcdkec2
twithdrawalsub
pfinal
subpage sident
pinsert
preq
apin
pclient
tos1
pos1
tos4
pos4
pein3sock</p>
      <p>shelp
thelpsub</p>
      <p>peo4utsock
pidentinport
pbank
tos8
pos8
pidentoutport
paltinsock
{ok}
talt1sub</p>
      <p>paltoutsock
{error} talt2sub</p>
      <p>tidentout
As for the state space analysis, it is one of the main
formal analysis methods of Petri Net. It has proven
successful in the verification of systems. Once the
state space is generated for the resulting CP-net
model, we obtain a text file which contains a
standard report providing information about generic
properties such as state space statistics,
boundedness properties, home properties and
liveness properties.</p>
      <p>ML standard queries available in CPNtools may
also be evaluated. In the case of negative answers,
the user is helped to investigate why an expected
property does not hold. If an unexpected dead state
is found a shortest path from the initial state to the
dead state is helpful information, as a
counterexample. This situation may be interpreted
to UML user with both a sequence diagram
describing the error trace (events sequence), and
an object diagram describing the dead marking
(object values).</p>
      <p>However, as UML users are not necessary familiar
with input languages of CPNtools (CP-nets,
ASKCTL and CPN-ML). The specification of
system properties, to check the model consistency
with the expected properties of the real system, will
be difficult for users to understand. So, we allow
UML user to express system properties in OCL
language, as invariants and pre/post conditions, on
the class diagram, then we automatically map
these constraints into ASKCTL formulas based on
CPN-ML functions. Finally, we check OCL
properties on CP-net state space trough ASKCTL
formulas. Positive responses are shown to UML
user and negative responses are interpreted by a
counterexample through a sequence diagram and
an object diagram.</p>
      <p>We express in what follows four OCL properties
checked over the state space of the resulting
CPnet model in CPNtools environment.</p>
      <p>Property 1: ATM machine does not eject money if
the client asks for an amount higher than its
balance.</p>
    </sec>
    <sec id="sec-18">
      <title>OCL invariant:</title>
      <p>
        Context c:Client
inv: (c.asked_amount &gt; c.balance) implies
(c.ATM.eject_money = 0)
ASKCTL formula (without detail for invariant
condition):
use (ogpath^"/ASKCTL/ASKCTLloader.sml");
val CTLFormula1 = INV( NF("",MLInv));
eval_node CTLFormula1 1
where INV() is a state formula which is true if its
argument is true for all reachable states.
Eval_node() is a function that allows to evaluate a
state formula from a specified state node (initial
state node = 1). It returns true or false, and in the
case of false, it also prints out a diagnostic report.
Thus, the first code line allows loading the ASKCTL
library. The ASKCTL library has two parts: one
which implements the language of the logic, and
one which implements the model checker [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
MLInv is a ML function which allows verifying the
OCL invariant condition.
      </p>
      <p>Property 2: after an “insufficient balance” message
is returned by the machine, the client balance must
be decreased by the tax value.</p>
    </sec>
    <sec id="sec-19">
      <title>OCL pre/post-condition:</title>
      <p>Context Client::insufficient()
let c:Client
POST: (a.new_balance = a.old_balance
a.ATM.cach)</p>
    </sec>
    <sec id="sec-20">
      <title>ASKCTL formula (without detail for postcondition):</title>
      <p>use (ogpath^"/ASKCTL/ASKCTLloader.sml");
Val CTLformula2= INV(or(not NF(“”, fire(t1)),
FORALL_NEXT( and( NF( “”, fire(t2)),
FORALL_NEXT( NF(“”, MLpost))))));
eval_node CTLformula2 1
where FORALL_NEXT() is used as a state formula.
It is true if its argument is true for all immediate
state successors. t1 and t2 are derived transitions
from the sending and receiving events of the call
operation message. Fire(t) indicates that the
transition t is enabled. MLpost is a ML function
which allows verifying the OCL post-condition.
Propriety 3: The machine does not eject money if
the requested sum is greater than the cash
machine or greater than the maximum or exceeds
the client's balance amount.</p>
    </sec>
    <sec id="sec-21">
      <title>OCL invariant:</title>
      <p>Context c: Client
INV: (c.asked_amount+c.ATM.tax &gt; c.balance) or
(c.asked_amount+ c.ATM.tax &gt; c.max_amount) or
(c.asked_amount+a.ATM.tax &gt; c.ATM.cash)
implies c.ATM.eject_money=0
ASKCTL formula 3:
use (ogpath^"/ASKCTL/ASKCTLloader.sml");
val CTLFormula3 = INV(NF("",MLInv)) ;
eval_node CTLFormula3 1;
fun MLInv3 n =
if (Mark.SubPageAmountError'P11 1 n) &lt;&gt; empty
then CheckEjctedMoney n
else true
fun CheckEjectedMoney n =
let
val atm= List.nth(Mark.SubPageAmountError 'P11
1 n,0) :TOBJ;
val class=(#1 atm): STRING;
val ID=(#2 atm) : STRING;
val list=(#3 atm): INTlist;
in
(class="atm") andalso (ID="a1") andalso
(List.nth(list,3)=0)
end
Property 4: The machine rejects the user PIN if it
does not appear in the bank data. The machine is
thus in a state of reject.</p>
    </sec>
    <sec id="sec-22">
      <title>OCL pre/post condition:</title>
      <p>Context Bank :: pin_error()
Let b :bank
PRE : b.PINs excludes(b.client.PIN)
POST : atm.state =0
ASKCTL formula 4:
use (ogpath^"/ASKCTL/ASKCTLloader.sml");
val CTLFormula4 = INV( AND( OR( NOT( NF("",
firt1)),
NF("",MLpre)),OR(OR(NOT(NF("",firt1)),NOT(NF(""
, MLpre))), EXIST_NEXT( AND( NF( "", firt2),
EXIST_NEXT( NF( "", MLpost)))))));
eval_node</p>
      <p>CTLFormula4 1
fun firt1 n = ((Mark.SubPagePinError'P20 1 n) &lt;&gt;
empty)
fun firt2 n = ((Mark.SubPagePinError'P_msg1 1 n)
&lt;&gt; empty)andalso((Mark.SubPagePinError'P10 1
n) &lt;&gt; empty)
fun MLpre n =
let
val bank= List.nth(Mark.SubPagePinError'P20 1
n,0) :TOBJ;
val list2=(#3 bank): INTlist;
val client= List.nth(Mark.SubPagePinError'P00 1
n,0) :TOBJ;
val list0=(#3 client): INTlist;
in (not(checkpin list0 list2)) end
fun MLpost n =
let val atm= List.nth(Mark.SubPagePinError'P11 1
n,0) :TOBJ;
val list1=(#3 atm): INTlist; in (List.nth(list1,1)=0)
end
where MLpre is a ML function which allows
verifying the OCL pre-condition.</p>
    </sec>
    <sec id="sec-23">
      <title>6. RELATED WORKS</title>
      <p>
        OCL has been formalized by various formal
languages such as B, Z, CSP, PVS, mu-calculs
and temporal logic. Many temporal extensions of
OCL exist. Ziemann and Gogolla aim in [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ] to
expand the semantics of the language with a
LTLbased extension. Bill et al. present in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] an OCL
extension with CTL-based temporal operators.
Kanso and Taha propose in [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] a pattern-based
extension of the OCL language to express temporal
constraints on object-oriented systems. Distefano
et al. provide in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] a formal semantics to OCL by
using OBTL (Object-Based Temporal Logic), which
facilitates the specification of dynamic and static
properties of object-based systems. They do not
expand OCL with temporal operators, but provide a
theoretical precise mapping of a part of OCL into
OBTL. Cengarle and Knapp propose in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] an
extension of OCL, called OCL/RT, for modeling
real-time and reactive systems. OCL/RT introduces
a general notion of time and event to describe the
temporal behavior of UML models. Mullins and
Oarga provide in [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] an OCL extension, called
EOCL, with CTL temporal operators. This
extension is strongly inspired by BOTL, and allows
model checking EOCL properties on UML models
expressed as abstract state machines.
      </p>
      <p>
        Theoretically, our approach of OCL formalization
can be compared to [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] when translating invariants
and pre/post conditions to a variant of CTL logic.
But, practically, our work uses a specific logic
strongly based on a functional programming
language SML in CP-nets context. This allows
detailed mapping of basic and complex types and
operations of OCL language. Our approach is
implemented and integrated in a validation
framework of UML models by using CPNtools
environment.
      </p>
    </sec>
    <sec id="sec-24">
      <title>7. CONCLUSION</title>
      <p>To help and assist UML modelers verifying their
specification, we proposed to automatically
translate OCL properties, specified on the class
diagram, to CTL-like logic based on SML. We also
present in details the translation of basic and
complex expressions of OCL by exploiting the
expressiveness of the functional programming
language CPN-ML. We relied on the class diagram
for the static view of the system and the IOD
diagram for the behaviour view of the system. The
CP-net model derived from the UML description is
analysed by model-checking based on OCL
constraints derived to ASKCTL logic. To the best of
our knowledge, it is the first work that uses
Standard ML to formulate OCL expressions in a
CP-net context. The resulting formulas are succinct
and of reduced execution time as ASKCTL logic is
based on the functional and recursive aspect of ML
as well as the Strongly Connected Component
graph (SCC). ASKCTL formulas have been
evaluated over the generated state space of
CPnet model within CPNtools environment. In case of
negative answers, we propose to help the user
investigating why an expected property does not
hold. For this purpose, a sequence diagram is
returned to the user relating the property error
trace.</p>
      <p>For future works, we plan to improve our
implementation with regard to efficiency and
usability. We also plan to integrate the proposed
approach of mapping in a CASE tool
(ComputerAided Software Engineering) of UML2 in order to
generalize its application to other dynamic
diagrams.</p>
    </sec>
    <sec id="sec-25">
      <title>8. REFERENCES</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Alhroob</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dahal</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Hossain</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2010</year>
          ,
          <article-title>October)</article-title>
          .
          <article-title>Transforming UML sequence diagram to high level Petri Net</article-title>
          .
          <source>In Software Technology and Engineering (ICSTE)</source>
          ,
          <year>2010</year>
          2nd International Conference on (Vol.
          <volume>1</volume>
          , pp.
          <fpage>V1</fpage>
          -
          <lpage>260</lpage>
          ). IEEE.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bill</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gabmeyer</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , Kaufmann,
          <string-name>
            <given-names>P.</given-names>
            , &amp;
            <surname>Seidl</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>OCL meets CTL: Towards CTLExtended OCL Model Checking</article-title>
          .
          <source>In Proceedings of the MODELS 2013 OCL Workshop}</source>
          (Vol.
          <volume>1092</volume>
          , pp.
          <fpage>13</fpage>
          -
          <lpage>22</lpage>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bennama</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Bouabana-Tebibel</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>Validation environment of UML2 IOD based on hierarchical coloured Petri nets</article-title>
          .
          <source>International Journal of Computer</source>
          Applications in Technology,
          <volume>47</volume>
          (
          <issue>2</issue>
          ),
          <fpage>227</fpage>
          -
          <lpage>240</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cengarle</surname>
            ,
            <given-names>M. V.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Knapp</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2002</year>
          ).
          <article-title>Towards ocl/rt</article-title>
          . In FME 2002:
          <string-name>
            <given-names>Formal</given-names>
            <surname>Methods-Getting</surname>
          </string-name>
          <string-name>
            <surname>IT</surname>
          </string-name>
          Right (pp.
          <fpage>390</fpage>
          -
          <lpage>409</lpage>
          ). Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5. Cheng, A.,
          <string-name>
            <surname>Christensen</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Mortensen</surname>
            ,
            <given-names>K. H.</given-names>
          </string-name>
          (
          <year>1997</year>
          ).
          <article-title>Model checking Coloured Petri Netsexploiting strongly connected components</article-title>
          .
          <source>DAIMI Report Series</source>
          ,
          <volume>26</volume>
          (
          <issue>519</issue>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Christensen</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Mortensen</surname>
            ,
            <given-names>H.K.</given-names>
          </string-name>
          (
          <year>1996</year>
          )
          <article-title>'Design/CPN ASKCTL Manual Version 0</article-title>
          .9', University of Aarhus.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Distefano</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Katoen</surname>
            ,
            <given-names>J. P.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Rensink</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2000</year>
          ).
          <article-title>On a temporal logic for object-based systems</article-title>
          (pp.
          <fpage>305</fpage>
          -
          <lpage>325</lpage>
          ). Springer US.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Edmund</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Clarke</surname>
            ,
            <given-names>E. A.</given-names>
          </string-name>
          <string-name>
            <surname>Emerson</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. P.</given-names>
            <surname>Sistla</surname>
          </string-name>
          , “
          <article-title>Automatic Verification of Finite State Concurrent System Using Temporal Logic”</article-title>
          ,
          <source>ACM Transactions on Programming Languages and Systems</source>
          , vol.
          <volume>8</volume>
          (
          <issue>2</issue>
          ),
          <year>1986</year>
          , pp.
          <fpage>244</fpage>
          -
          <lpage>263</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Fernandes</surname>
            ,
            <given-names>J. M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tjell</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baek</surname>
            <given-names>Jorgensen</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            , &amp;
            <surname>Ribeiro</surname>
          </string-name>
          ,
          <string-name>
            <surname>Ó.</surname>
          </string-name>
          (
          <year>2007</year>
          , May).
          <article-title>Designing tool support for translating use cases and UML 2.0 sequence diagrams into a coloured Petri net</article-title>
          .
          <source>SCESM'07: ICSE Workshops</source>
          <year>2007</year>
          . Sixth International Workshop on (pp.
          <fpage>2</fpage>
          -
          <lpage>2</lpage>
          ). IEEE.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Jensen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          (
          <year>1998</year>
          )
          <article-title>An Introduction to the Practical Use of Coloured Petri Nets</article-title>
          .
          <source>Lectures on Petri Nets II: Applications, Lecture Notes in Computer Science</source>
          ,
          <volume>1492</volume>
          ,
          <fpage>237</fpage>
          -
          <lpage>292</lpage>
          ,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Jensen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Kristensen</surname>
            ,
            <given-names>L. M.</given-names>
          </string-name>
          (
          <year>2009</year>
          ).
          <article-title>Coloured Petri nets: modelling and validation of concurrent systems</article-title>
          . Springer.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Kanso</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Taha</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>Temporal Constraint Support for OCL</article-title>
          .
          <source>In Software Language Engineering</source>
          (pp.
          <fpage>83</fpage>
          -
          <lpage>103</lpage>
          ). Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Mandel</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Cengarle</surname>
            ,
            <given-names>M. V.</given-names>
          </string-name>
          (
          <year>1999</year>
          ).
          <article-title>On the expressive power of the Object Constraint Language OCL</article-title>
          . Available on the World Wide Web: http://www. fast. de/projeckte/forsoft/ocl.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Milner</surname>
            ,
            <given-names>R</given-names>
          </string-name>
          . (Ed.). (
          <year>1997</year>
          ).
          <article-title>The definition of standard ML: revised</article-title>
          . The MIT press.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Mullins</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Oarga</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2007</year>
          ).
          <article-title>Model checking of extended OCL constraints on UML models in SOCLe. In Formal Methods for Open ObjectBased Distributed Systems</article-title>
          (pp.
          <fpage>59</fpage>
          -
          <lpage>75</lpage>
          ). Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16. OMG,
          <source>Object Constraint Language 2.3</source>
          .1,
          <string-name>
            <surname>Doc</surname>
            <given-names>Number</given-names>
          </string-name>
          <source>: formal/2012-01-01</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17. OMG,
          <source>UML Superstructure Specification 2.4</source>
          .1,
          <string-name>
            <surname>Doc</surname>
            <given-names>Number</given-names>
          </string-name>
          <source>: formal/2011-08-06</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Petri</surname>
            ,
            <given-names>C. A.</given-names>
          </string-name>
          (
          <year>1962</year>
          ). Kommunikation mit Automaten. Bonn:
          <article-title>Institut f¨ur Instrumentelle Mathematik</article-title>
          ,
          <source>Schriften des IIM Nr. 2</source>
          ,
          <year>1962</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Ratzer</surname>
            ,
            <given-names>A. V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wells</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lassen</surname>
            ,
            <given-names>H. M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Laursen</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Qvortrup</surname>
            ,
            <given-names>J. F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stissing</surname>
            ,
            <given-names>M. S.</given-names>
          </string-name>
          , ... &amp;
          <string-name>
            <surname>Jensen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          (
          <year>2003</year>
          ).
          <article-title>CPN tools for editing, simulating, and analysing coloured Petri nets</article-title>
          .
          <source>In Applications and Theory of Petri Nets</source>
          <year>2003</year>
          (pp.
          <fpage>450</fpage>
          -
          <lpage>462</lpage>
          ). Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Staines</surname>
            ,
            <given-names>T. S.</given-names>
          </string-name>
          (
          <year>2008</year>
          , March).
          <article-title>Intuitive mapping of UML 2 activity diagrams into fundamental modeling concept Petri net diagrams and colored Petri nets</article-title>
          .
          <source>ECBS</source>
          <year>2008</year>
          .
          <article-title>15th Annual IEEE International Conference</article-title>
          and Workshop on the (pp.
          <fpage>191</fpage>
          -
          <lpage>200</lpage>
          ). IEEE.
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Ullman</surname>
            ,
            <given-names>J. D.</given-names>
          </string-name>
          (
          <year>1998</year>
          ).
          <article-title>Elements of ML programming</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <surname>Zaidi</surname>
            ,
            <given-names>A. K.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Levis</surname>
            ,
            <given-names>A. H.</given-names>
          </string-name>
          (
          <year>2006</year>
          ).
          <article-title>Verification of System Architectures Using Modal Logics and Formal Model Checking Techniques</article-title>
          .
          <source>In Conference on Systems Engineering Research (CSER).</source>
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <surname>Ziemann</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2003</year>
          , January).
          <article-title>Ocl extended with temporal logic</article-title>
          .
          <source>In Perspectives of System Informatics</source>
          (pp.
          <fpage>351</fpage>
          -
          <lpage>357</lpage>
          ). Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>