sition class). This allows code in TStateMachine to gen-
erate Transition objects with the additional property,
given that the context in which this code is executed
is an object of TWeightedStateMachine. For an in-depth
discussion on this topic, see (Berg et al., 2011). Vir-
tual classes also allows existing tools like editors to
instantiate redefined classes in subtypes.
3.7 Metamodel Customisation
In its simplest form, an enclosing class does not
contain other elements than the nested metamodel
classes. The enclosing class may also contain at-
tributes and operations. This adds a new dimension
to metamodels. Specifically, the state of a meta-
model type object can be used to customise the be-
havioural semantics of its encapsulated metamodel.
As an example, the behavioural semantics of a meta-
model (as defined in operations) may use different
algorithms depending on context. These algorithms
may share basic properties (attributes) whose values
can be changed with the intention of tuning the be-
havioural semantics for a specific usage or context.
Being able to adjust these properties simultaneously
for all the algorithms allows customising the seman-
tics easily without changing the actual models. The
properties with their values are in the object of the en-
closing class. Hence, this object’s state captures an
(execution) configuration for models of a given meta-
model/language. Changing such values for a meta-
model/language would change the meaning for all
conformant models/programs. It would also be possi-
ble to maintain several objects of the enclosing class
and thereby facilitate execution profiles (serialised to
files). However, this will give rise to an additional
level of polymorphism as different object states give
different execution results.
4 RELATED WORK
There are several mechanisms that address model
composition and variability. Some of these are dis-
cussed in (Berg and Mller-Pedersen, 2013). Common
to these mechanisms is their external definition from
the language used to define the models and/or meta-
models. Moreover, most mechanisms use some kind
of merging techniques to combine the metamodels
which compromises the principle of encapsulation.
We have used Kermeta to illustrate metamodel
types. Kermeta features a mechanism known as static
introduction. This mechanism allows specifying par-
tial class definitions using aspects. Several aspect def-
initions are combined (or woven) at runtime to form
the definition of a class. The mechanism allows defin-
ing new aspects that are combined with an existing
class definition. Aspects allow creating metamodel
variants. However, they can not be used to type a
metamodel - the resulting classes are contained in a
regular package.
Model types, as described in (Steel and Jzquel,
2007) resembles the work of this paper. There are
some differences and similarities that we will discuss.
First, a model type can be seen as a type-safe set
of an arbitrary number of model object types. The
model type mechanism defines a conformance rela-
tion between model types, which allows reusing code
or transformations. Specifically, code for manipulat-
ing or executing models (interpretation) can be de-
fined according to a reference model type. All models
that are typed with a model type conformant to the ref-
erence model type can be manipulated or executed by
the same code. A model type is created by referring to
classes of an arbitrary number of existing metamod-
els. This is a powerful ability, since classes defined in
different packages can be ”extracted” to constitute a
model type.
A metamodel type, as discussed in this paper, al-
lows typing metamodels as holistic MDE structures.
We have used the notion metamodel type instead of
model type because of a significant difference be-
tween the approaches. An instance of a metamodel
type (object of the enclosing class) represents one par-
ticular metamodel. The object can be used to access
the metamodels’ classes and thereby create model ob-
jects. The object of the enclosing class also refer-
ences one model whose semantics is e.g. intended
to be executed at runtime. Conversely, in the work
of (Steel and Jzquel, 2007), an instance of a model
type can not be used to instantiate the classes of the
model type. Instances of these classes are instead
added to the model type instance. The model type in-
stance acts as a filter where only objects of the model
type’s classes can be added to the model type instance
successfully. The similarity in this respect between
the approaches is that both a metamodel type instance
and a model type instance can be used to reference a
conformant model. The capabilities of the two model
typing approaches differ. Model types are designed to
simplify reuse of code from an external perspective,
e.g. from the perspective of an interpreter or transfor-
mation. Conversely, metamodel types allow creating
metamodel variants. By design, metamodel types are
functional types. Reuse of code is achieved by cre-
ating type variants in the form of subtypes. Model
types, on the other hand, are structural. They can not
be combined, or be related to create variations.
The inability to use substitution in model typing
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
116