Visualizing OCL Constraint Patterns with VOCL
Ali Hamie
Computing Division, Brighton University, Brighton and Hove, U.K.
Keywords:
Constraint Pattern, Template Package, OCL, Visualization.
Abstract:
A specification pattern is a generic constraint expression that can be instantiated to solve a class of specification
problems. It captures and generalizes frequently used logical expressions in models. Specification patterns
have been defined and represented in the Object Constraint Language OCL for UML/OCL modelling. The
notation of visual OCL (VOCL) is a visualization of OCL and can be considered as an alternative solution
to the textual OCL. This paper provides the visualization of some OCL constraint patterns in VOCL. For this
purpose, we introduce constraint pattern templates in VOCL to represent constraint patterns in a diagrammatic
form. The benefits of the visualization is that some patterns will be available in a intuitive diagrammatic
notation that follows the UML notation.
1 INTRODUCTION
Constraint patterns (Ackermann and Turowski, 2006;
Costal et al., 2006; Wahler et al., 2006; Wahler et al.,
2010) are essential to developing constraint specifi-
cations for UML class models (OMG, 2006). Using
constraint patterns accelerates the development and
maintenance of constraint specifications. This is be-
cause a pattern abstracts from concrete textual syn-
tax and thus reduces typical syntactic and semantic
errors by providing predefined constraint templates.
Patterns also overcome the difficulty of writing con-
straints because class models can express complicated
relations between classes, including subtyping, re-
flexive relations, or potentially dealing with infinitely
large instances, and specifying such facts requires ad-
dressing this complexity. A pattern captures and gen-
eralizes frequently used logical expressions. It is a
parameterizable constraint expression that can be in-
stantiated to solve a class of specification problems.
In the context of UML modelling, the Object
Constraint Language OCL (Warmer and Kleppe,
2003) has been used to define and represent constraint
patterns. OCL is a formal specification language
that was developed as an extension to the Unified
Modelling Language UML . The main purpose is to
describe additional constraints on UML models that
are difficult to describe using the diagrammatic no-
tation of UML. OCL is based on textual syntax and
provides basic data types and a library of collection
types such as sets, bags and sequences. The type of
constraints that can be described in OCL include in-
variants on classes and types, preconditions and post-
conditions of operations or methods. However, mod-
eling with UML and OCL may lead to some difficulty
in that the user has to learn two different languages
to represent common modelling elements such as ob-
jects and links.
The Visual OCL (VOCL) (Winkelmann, 2005;
Bottoni et al., 2001) is a graphical representation of
OCL capable of visualizing the textual constraints of
UML models. It was developed to overcome the prob-
lem stated above. Based on the OCL meta model,
VOCL follows the UML notation and its graphical
representation as far as possible. This makes a direct
integration of OCL in UML diagrams easier. Like
OCL, VOCL is a formal, typed and object-oriented
language. Since the user does not need to learn an-
other textual language, it is claimed to be an advan-
tage over the textual OCL. The language uses sim-
ple diagrams to represent new data types such as col-
lections, and operations such as forall, select, union,
etc. Logical expressions are represented as Peircian
graphs using different kinds of box to express con-
junctions and disjunctions.
In this paper we provide a visualization of OCL
specification patterns using VOCL. The basic tool for
representing and combining constraint patterns is a
generic form of package, called a pattern or template
package. In the package, a generic constraint frame-
work can be defined which acts as a macro-like tem-
plate that can be applied in many places. A tem-
plate can contain modeling constructs in the form of
both diagrams and text. In addition, any name can
129
Hamie A..
Visualizing OCL Constraint Patterns with VOCL.
DOI: 10.5220/0004317801290134
In Proceedings of the 1st International Conference on Model-Driven Engineering and Software Development (MODELSWARD-2013), pages 129-134
ISBN: 978-989-8565-42-6
Copyright
c
2013 SCITEPRESS (Science and Technology Publications, Lda.)