Action Language - Computing

grassquantityAI and Robotics

Nov 15, 2013 (4 years and 6 months ago)


Action Languages

Executable UML

, broadly, is some computation, such as
executing a function, sending a signal, reading or
writing data, and iterating over a set. Until recently,
the actions defined for the UML are little more
than placeholders (un
interpreted strings and
graphical symbols). The modeller can indicate a
few critical properties, such as sending a signal and
invoking a function, but then must resort to writing
code, because only a few special
purpose actions
are defined. To be useful as more than a tool for
sketching software structure, the UML repertoire of
actions should be extended to be able to specify
computation, making UML an executable
specification language.

Executable UML

The UML, as extended by action semantics,
however, should not be taken to be a new
programming language, or as a graphical
programming language. There are already many
programming languages that can be used with
UML, or could be formally integrated with it, and
the world doesn’t need yet another programming
language. Rather, the action semantics provides for
specification of systems in sufficient detail that
they can be executed
, and the action semantics
should provide
just enough
semantics to enable the
specification of computation.

Executable UML

A standard action semantics enables interchange of
complete specifications in UML. Because the
semantics are independent from the syntax, users
can develop models using their own favourite
syntax or language. Moreover, the definition of a
standard syntax, being a matter of taste, is likely to
be a lengthy and contentious process. Defining the
semantics first also allows multiple conforming
syntaxes to be developed onto a solid base. The
action semantics defines primitive, simple

Executable UML

The action semantics defines primitive,
simple constructs. A particular action
language could implement each semantic
construct one
one, or it could define
level, composite constructs to offer
the modeller both power and convenience.
These higher
level constructs do not need to
be defined as a part of the semantics,
because they already exist as composites of

Executable UML

The semantic primitives are defined to
enable the construction of multiple execution
engines, each with potentially different
organizations. Hence, a model compiler
builder can optimize the structure of the
software to meet specific performance
requirements, so long as the semantic
behaviour of the specification and the
implementation remain the same. This then
requires a mapping from the structure of the
specification to the structure of the

Executable UML

Recent additions to the UML

action semantics,

which facilitate the
development of

Action Languages

AL animates UML models. In particular
statecharts and interaction diagrams can


1) creating objects with the keyword

2) sending messages with the keyword

Executable UML

The action language is executable and allow
us to describe the actions an object performs
when receiving a stimulus. AL incluide the
following functions:

Sequential Logic

Access to the data described by the Class

Access to the data supplied by signals initiating

The ability to generate signals

Access to timers

Access to synchronous operations provided by
classes and objects

Access to operations provided by other domains

Tests and Transformations

Action Semantics for UML

from OMG

Action Semantics are mapped to a syntax,
and are combined with the UML. The aim is
that the UML shall constitute a
computationally complete language. This
language is targeted at system analysis and
behaviour description, and is not envisioned
to be language suitable for system

Executable UML

Action Languages (AL) are like OCL in that
they can be used represent constraints.
However OCL consists of pure expression that
cannot affect the state of an object whereas
AL can create objects and send messages to
objects, hence permitting a greater range of
modelling and testing. OCL is an expression
language. It no side effects,
this means that
the state of the system will never change
because of an OCL expression, even though
an OCL expression can be used to
state change, e.g. in a post

Executable UML Issues

Action languages and OCL may make the
lines between analysis, design, and
implementation more fuzzy. Should UML be
making a shift from a property
language to an executable language, used
mainly for programming?

There may be a need for a non
executable as
well as an executable version in the UML
language. Both may co
exist and be used
where appropriate.

Executable UML Issues

If analyst/designer gets too involved in
low level detail the following problems
can arise:

Efficient specifications
: focus on
efficiency rather than accuracy of

Executable UML Issues

The Problem of Over
: If
level details need to be specified
then Java is a reasonable way to do it. A
common mistake is to include more
details than are necessary, spelling out
unimportant details. This has been
described as
writing Java in picture
This is well
known as the problem surely
become worse if the tools are going to
head towards being high
programming language compilers.

Executable UML Issues

Focus on the target language:

using code generators that map UML to
a target language, the semantics of the
target language as well as its notational
capabilities tend to become visible on
the UML level. For example, missing
multiple inheritance in Java may restrict
executable UML to single inheritance as

Why Not Just Use OCL?.


OCL is intended for expressing
constraints, that is, relationships within a
particular snapshot of a system. While
OCL allows a modeller to specify
conditions on changes to the instance
model, these specifications are not
executable, which is what actions are all
about. OCL is not an action language.

Project Technology xUML

Executable UML is a

of the
Unified Modelling Language with
defined semantics for both the
components and the interactions
between them during execution.

Project Technology xUML


The first profile defined for executable
UML is one based on statecharts and
asynchronous, distributed behaviour.
Each object has a state machine that
executes independently of all others. It
is in just one state at a time, possibly
executing many actions. It can invoke
data access methods (that do not
change state) synchronously, and it can
send asynchronous signal events to
communicate and synchronize with
other independently executing state

Why Don't We Just Use A
Programming Language?

A programming language such as Java
provides both too much and too little. It
provides too much because it allows the
modeller access to implementation concepts
(pointers or specifically allowable
implementations of associations), yet it
provides too little because a programming
language does not understand UML concepts
such as state or attribute typing, nor how the
concepts fit together. Programming
languages also over
specify sequencing.

How Does ALs Relate to Activity

Actions can be used in activity graphs in the
same way they are used in state machines.
Each action state in an activity graph has an
entry action specifying what is to be done at
that step.


The create object statements:

create object instance myDog of

The navigation expressions:

select one owner related by

The generate statement sends a message to
an object:

generate D1:bark to myDog;

Bridgepoint (BP) Executable UML


The BP create objects of a

create object instance shipClerk
of ShippingClerk;

The BP compound generalization:

create object instance newBook of

Bridgepoint (BP) Executable UML


BP reclassification by deleting the old subclass and
creating the new one.:

reclassify theClerk as OffDutyClerk;

Use relate link objects:

relate newBook to newAuthor across R2
creating newAuthorship;

Use select to select the link object that relates two
association end objects by selecting with identifier
and referential attribute values.

select theAuthorship that relates
theBook to theAuthor across R2;

Bridgepoint (BP) Executable UML

Action Specification Language (ASL)

The Action Specification Language (ASL) is an
implementation independent language for
specifying processing in the methods and state
actions of object models. The language has been
placed in the public domain and may be freely used
by analysts and developers.

The aim of the language is to provide an
unambiguous, concise and readable definition of
the processing to be carried out by a system.

ASL is used in iUML (from Kennedy Carter) to
specify state actions, operations, initialisation
sequences and test methods.

The Executable UML process (xUML)

xUML is a sub
set of the Unified Modelling
Language incorporating a complete Action
Language that allows system developers to
build executable system models and then use
these models to produce high quality code
for their target systems.

The xUML process is a rigorous object
oriented system development method based
upon experience with executable modelling
that has been applied to many pioneering

Restaurant System

Kennedy Carter Executable UML

reservation1 =
Reservation with table = “Table1”, date = “today”, time = “20:00”

reservation2 =
Reservation with table = “Table2”, date = “today”, time =”20:00”

restaurant =
create unique

Restaurant with booking = {reservation1, reservation2}


restaurant R1 reservation1


restaurant R1 reservation2

aBookingToday = find
one Restaurant where = “20:00”

{bookingsToday} = find Restaurant where = “today”


1)Two Reservations objects are constructed with three attribute values set, all inherited from
Booking (table assumed by association).

2) A single restaurant object is created, there should be only one in the system (It has one
attribute booking (by association with Booking) which is assigned to the set of Reservation

3) Two associations are instantiated between the reservation objects and the restaurant.

These are independent of the attribute assignment.

4) A single booking object is assigned to aBookingToday

5) A set of objects are assigned to a collection variable, by default a Bag.

6) A single setter message is sent to aBookingToday

Two Reservations objects are constructed with three
attribute values set, all inherited from Booking (table by

A single restaurant object is created, there should be only
one in the system (from u. It has one attribute booking
(by association with Booking) which is assigned to the set
of Reservation objects, (through inheritance)

Two associations are instantiated between the reservation
objects and the restaurant.

This is independent of the attribute assignment.

A single message is sent to

Kennedy Carter Executable UML

The statechart on the next slide models bed
availability for the Hospital System. For
each of the states we will write a suitable set
entry actions

using the Action
Specification Language from the iUMLite

Executable UML example

Executable UML example

Executable UML example

ASL syntax

<instance handle>
= find

<source instance handle>
<relationship specification>
<destination instance handle>

<source instance handle>
<relationship specification>
<destination instance handle>

Executable UML example

ALs summary

Unlike conventional languages, there is no concept of a
“main” function or routine where execution starts. Rather,
ASL is executed in the context of a number of interacting
state machines, all of which are considered to be executing
concurrently and in the context of synchronous call stacks
invoked from these state machines or directly from outside
the system. Any state machine, on receipt of a signal (from
another state machine or from outside the system) may
respond by changing state. On entry to the new state, a
block of processing is performed. This processing can, in
principle1 execute at the same time as processing
associated with another state machine.

ALs summary

AL animates UML models. In particular
statecharts and interaction diagrams can be

1) creating objects.

2) sending messages.

The action language is executable and allow
us to describe the actions an object performs
when receiving a stimulus.