Meta-Model Pruning: Abstract. Large and Complex Meta-Models Such As Those of U
Meta-Model Pruning: Abstract. Large and Complex Meta-Models Such As Those of U
1 Introduction
In this paper, we present a meta-model pruning algorithm that takes as input a large
meta-model and a set of required classes and properties, to generate a target effective
meta-model. The effective meta-model contains the required set of classes and proper-
ties. The term pruning refers to removal of unnecessary classes and properties. From
a graph-theoretic point of view, given a large input graph (large input meta-model) the
algorithm removes or prunes unnecessary nodes (classes and properties) to produce a
smaller graph (effective meta-model). The algorithm determines if a class or property is
unnecessary based on a set of rules and options. One such rule is removal of properties
with lower bound multiplicity 0 and who’s type is not a required type. We demonstrate
using the notion of model typing that the generated effective meta-model, a subset of
the large meta-model from a set-theoretic point of view, is a super-type, from a type-
theoretic point of view, of the large input meta-model. This means that all programs
written using the effective meta-model can also be executed for models of the origi-
nal large meta-model. The pruning process preserves the meta-class names and meta-
property names from the large input meta-model in the effective meta-model. This also
implies that all instances (models) of the effective meta-model are also instances of the
initial large input meta-model. All models of the effective meta-model are exchangeable
across tools that use the large input meta-model as a standard. The extracted effective
meta-model is very much like a transient DSML with necessary concepts for a problem
domain at a given time. For example, we present an application of our algorithm to gen-
erate an effective meta-model to specify test models for a model transformation. The
model transformation is developed by the French Spatial Agency (CNES) to transform
U ML models to code for embedded systems.
The paper is organized as follows. In Section 2 we present the motivation for our
work. We present related work in Section 3 that attempt to solve problems discussed in
motivation. In Section 4 we present the meta-model pruning algorithm. We introduce
model typing in Section 5 to show that the effective meta-model is indeed a super-type
of the large meta-model. In Section 6 we present the application of meta-model pruning
to obtain an effective meta-model for develop test models for a model transformation.
We conclude and present future work in Section 7.
2 Motivation
The motivation for us to develop a meta-model pruning algorithm comes from observa-
tions made by us and others in various phases of the MDE process. We categorize our
observations in the form of scenarios:
Scenario 1: Input Domain of Model Transformations A large meta-model such as
that of U ML is the de facto input meta-model for a large number of model transforma-
tions or model processing programs/tools. However, many of these model transforma-
tions manipulate only a subset of the concepts defined in the input meta-model. There is
a sparse usage of concepts in the input meta-model. For instance, code generators from
U ML state machines [6] normally use only the U ML class diagram and U ML state ma-
chine modelling elements. Therefore, often the large meta-model is not the real input
meta-model of a model transformation. We illustrate this scenario in Figure 1 (a) where
meta-model MMlarge specifies a large set of models but a model transformation MT is
developed to process only a subset of this large set.
Scenario 2: Chain of Model Transformations A consequence of not defining the real
input domain of a model transformation is the non-compatibility/mis-match of outputs
and inputs between transformations in chain. Consider a sequence of model transfor-
mations as shown in Figure 1 (b). The output meta-model MMoa of model transforma-
tion MTa is also the input meta-model MMib for the next model transformation MTb .
However, we do not know if all models generated by MTa can be processed by the
model transformation MTb as the concepts manipulated by the model transformations
may be different. In [7], we identify this issue as one of the barriers to validate model
transformations. Not identifying and dealing with this mismatch between the real input
meta-model and real output meta-model can lead to serious software faults.
Scenario 3: Testing Model Transformations Creating a model that conforms to a large
meta-model does not always require all the concepts in the meta-model. For instance, if
you want to create a model to test a model transformation of the large meta-model you
may need to use only a small number of concepts. The entire large meta-model does not
serve the purpose of creating test models for a certain sub-domain of the input meta-
model. The large meta-model could pose a problem for a test model developer as she/he
can be confused by the large number of concepts in the meta-model. In the context of
automated testing, if you want to generate test models (such as using the tool Cartier
[8] [9]) then you would want to transform the smallest possible input meta-model to
a formal language for constraint satisfaction. Transforming the entire meta-model to a
formal language will lead to a enormous constraint satisfaction problem. These large
constraint satisfaction problems are often intractable. Solving smaller constraint satis-
faction problems obtained from a small set of concepts and subsequently with fewer
variables is relatively feasible.
Scenario 4: Software Process Modelling: Software process models contain several
workflows. However, each workflow in a software process uses different sub-domains
of a single shared meta-model such as the the U ML. These workflows are often realized
by different people and at different times. There are several software process method-
ologies that use the U ML as the shared modelling language. The most popular of them
Fig. 1. Effective Meta-model Scenarios in Model Transformation Development
is the Rational Unified Process (RUP) [10]. Figure 2(a) shows the different workflows
of RUP and the use of different subsets of U ML for each workflow. Dedicated software
processes such as ACCORD [11] use U ML extended with domain-specific constructs
to develop real-time systems. In Figure 2(b), we show the use of subsets U ML in the
ACCORD process. People involved in a certain workflow of a software process are
exposed to concepts in the entire shared meta-model such as the U ML instead of a sub-
set of U ML that represents their real work area. The access to unnecessary modelling
elements to an engineer of a workflow could lead to errors in the software process.
Fig. 2. (a) Workflows in RUP and its usage of U ML (b) Workflow of ACCORD and its use of
U ML
The above scenarios are only some of the many possible scenarios where a large
meta-model defines the modelling domain while only a sub-domain is in use.
3 Related Work
There has always been a need to define the effective modelling domain for a given
objective in MDE. This is true especially in the case of using large GPMLs such as
U ML. In this section we present related work that deal with the problem of obtaining
and using the effective modelling domain. We also pinpoint our contributions in this
work.
Consider a fundamental task in MDE: Creating a model in a model editor such as in
the Eclipse [12] environment. A popular editor for U ML models is TOPCASED [13].
The tool can be used to create U ML models such as class diagrams, state machines, ac-
tivity diagrams, and use-case diagrams. If a modeller chooses to create class diagrams
the tool presents the user with modelling elements for class diagrams such as classes
and associations but not U ML state machine modelling elements such as states and tran-
sitions. Therefore, the tool inherently prevents the modeller from using an unnecessary
part of the U ML meta-model. The hard-coded user interface in TOPCASED in fact
presents the modeller with an effective modelling domain.
Model transformations on GPMLs such as U ML are built for specific tasks and can
process only a sub-domain of its huge input domain. To filter the input to a model
transformation pre-conditions [14] are specified in a constraint language such as Object
Constraint Language (OCL) [15] [16]. Graph transformation based model transforma-
tion languages specify pre-conditions to apply a graph rewriting rule on a left-hand side
model pattern [17]. Both pre-condition contracts and patterns are specified on the entire
input meta-model while they refer to only a sub-domain.
In the paper [5] Solberg et al. present the issue of navigating the meta-muddle no-
tably the U ML meta-model. They propose the development of Query/Extraction tools
that allow developers to query the metamodel and to extract specified views from the
metamodel. These tools should be capable of extracting simple derived relationships
between concepts and more complex views that consist of derived relationships among
many concepts. They mention the need to extract such views for different applications
such as to define the domain of a model transformation and extracting a smaller meta-
model from the concepts used in a model. Meta-modelling tools such as those developed
by Xactium [18] and Adaptive Software [19] possess some of these abilities. The au-
thors of [5] propose the use of aspects to extract such views. However, the authors do
not elaborate on the objectives behind generating such views.
In this paper, we present the following contributions emerging from our observa-
tions in MDE and survey of previous work:
– Contribution 1: We present a meta-model pruning algorithm to extract an effective
meta-model from a large meta-model.
– Contribution 2: We present an application of model typing to verify that an effec-
tive meta-model is indeed a super-type of the large input meta-model. All programs
written using the effective meta-model are valid also for the original large meta-
model. Our approach preserves meta-concept names in the effective meta-model
from the large meta-model and hence all instances of the effective meta-model are
instances of the large input meta-model.
We present some general definitions we use for describing the meta-model pruning
algorithm:
Definition 1: A primitive type b is an element in the set of primitives: b ∈ {String,
Integer, Boolean}.
Definition 2: An enumeration type e is a 2-tuple e := (name, L), where name is a String
identifier, L is a finite set of enumerated literals.
Definition 3: A class type c is a 4-tuple c := (name, Pc , Super, isAbstract), where name
is a String identifier, Pc is a finite set of properties of class c, class c inherits properties
of classes in the finite of classes Super and isAbstract is a Boolean that determines if c
is abstract.
Definition 4: A meta-model MM is a 2-tuple MM := (T, P, Inv), where T is a finite set
of class, primitive, and enumeration types, P is a set of properties, Inv is a finite set of
invariants.
Type Operations: The operations on types used in this paper are: (a) t.isInstanceO f (X)
that returns true if t is of type X or inherits from X. (b) t.allSuperClasses(), if
t.isInstanceO f (Class), returns the set of all its super classes t.Super including the super
classes of its super classes and so on (multi-level).
Definition 5: A property p is a 7-tuple p := (name, oC,type, lower, upper, opposite,
isComposite), where name is a String identifier, oC is a reference to the owning class
type, type is a reference to the property type, lower is a positive integer for the lower
bound of the multiplicity, upper is the a positive integer for the upper bound of the
multiplicity, opposite is a reference to an opposite property if any, and isComposite
determines if the objects referenced by p are composite (No other properties can contain
these objects).
Property Operations: The operations on properties in this paper is p.isConstrained()
which returns true if constrained by any invariant i such that p ∈ i.PI . This is checked
for all invariants i ∈ MM.Inv.
Definition 6: An invariant I is a 3-tuple c := (TI , PI , Expression), where TI is the set of
types used in the invariant I and PI is the set of properties used in I. An Expression is
a function of TI and PI that has a boolean value. The Expression is often specified in a
constraint language such as OCL [15].
Note: Throughout the section, we use the relational dot-operator to identify an element
of a tuple. For example, we want to refer to the set of all types in a meta-model we use
the expression MM.T ,or MM.P to refer to the set of all properties. Also, we do not con-
sider user-defined meta-model operations or its argument signatures in our approach.
4.4 Implementation
The meta-model pruning algorithm has been implemented in Kermeta [21]. Kermeta
is a language for specifying metamodels, models, and model transformations that are
compliant to the Meta Object Facility(MOF) standard [22]. The tool supports input
meta-models in the Eclipse Modelling Framework’s (EMF) [12] Ecore meta-modelling
standard. The tool with usage instructions is available for download [23].
5 Model Typing
In the section we describe the notion of model typing. We use model typing to verify that
meta-model pruning algorithm indeed generates a super-type of the input meta-model.
Model typing corresponds to a simple extension to object-oriented typing in a model-
oriented context [24]. A model typing is a strategy for typing models as collections
of interconnected objects while preserving type conformance, used as a criterion of
substitutability.
The notion of model type conformance (or substitutability) has been adapted and ex-
tended to model types based on Bruce’s notion of type groups and type group matching
[25]. The matching relation, denoted <#, between two metamodels defines a function
of the set of classes they contain according to the following definition:
Metamodel M’ matches another metamodel M (denoted M’ <# M) iff for each
class C in M, there is one and only one corresponding class C’ in M’ such that
every property p and operation op in M.C matches in M’.C’ respectively with
a property p’ and an operation op’ with parameters of the same type as in M.C.
This definition is adapted from [24] and improved here by relaxing the constraint
related of the name-dependent conformance on properties and operations.
Let’s illustrate model typing with two metamodels M and M’ given in Figures 4 and
5. These two metamodels have properties and references that have different names. The
metamodel M’ has additional elements compared to the metamodel M.
C1 <# COne because for each property COne.p of type D (namely, COne.name
and COne.aCTwo), there is a matching property C1.q of type D’ (namely, C1.id
and C1.aC2), such that D’ <# D.
Thus, matching between classes may depend on the matching of their related de-
pendent classes. As a consequence, the dependencies involved when evaluating model
type matching are heavily cyclical [26]. The interested reader can find the details of
matching rules used for model types in [26].
In Section 6, we illustrate the use of model typing integrated in the model trans-
formation language Kermeta. We show that transformations written using the effective
meta-model are also valid for models of the original large meta-model.
6 Application
c l a s s Main {
o p e r a t i o n main ( ) : Void i s do
/ / I n p u t UML Model
v a r i n p u t M o d e l : uml : : Model
model ?= r e s . o n e
v a r t r a n s f o : c n e s P a c k a g e : : T r a n s f o<uml : : UmlMM>
i n i t c n e s P a c k a g e : : T r a n s f o<uml : : UmlMM>.new
t r a n s f o . generateCode ( inputModel )
end
}
−−−−−−−−−−−−−−−−−−−−−−−−−
pa cka g e c n e s P a c k a g e ;
r e q u i r e UMLCNES;
c l a s s T r a n s f o<MT : UMLCNES> {
o p e r a t i o n g e n e r a t e C o d e ( s o u r c e : MT : : Model ) : Void i s do
/ / Code g e n e r a t o r . . .
end
}
The result of executing the algorithm with no options (no parameter specified) is
the bare-minimum effective meta-model shown in Figure 6. A bare minimum effective
meta-model , in our case, is sufficient to specify input models for the transformation.
The meta-model is generated using an initial set of required classes Creq . All elements of
Creq are provided as input the the pruning algorithm in the set Treq such that Creq ∈ Treq .
The classes in Creq are shown within red boxes in Figure 6. The top-level class Ctop =
Model is specified in a green-dashed box. In the pruned meta-model we observe that all
disjoint subgraphs of the U ML meta-model are removed such as U ML State Machines,
U ML Class Diagrams, and U ML Use Case Diagrams preserving only a subset of U ML
Activity diagram.
We call the resulting MMe f f ective of U ML, U ML C NES. We can verify that U ML C-
NES is a super-type of U ML using the notion of model types described in Section 5.
The type checking rules for model types has been integrated into the typing system of
the modelling and model transformation language Kermeta [21]. We can write a trans-
formation using U ML C NES as the input domain as shown in listing 1.1. The package
cnesTransfoMain calls the generateCode operation (in package cnesPackage) with an
U ML input model. However, the transformation is defined for the U ML C NES meta-
model. The transformation will still execute since U ML C NES is a super-type of U ML.
Test models can also be developed as instances of U ML C NES and transformed to U ML
without loss of information.
The pruning algorithm is flexible. We briefly illustrate this by pruning U ML for
the different options presented in the paper. In Table 1 we summarize the number of
classes and properties for the different options of the meta-model pruning algorithm.
The algorithm can be used to generate different effective meta-models with various
applications. For example, another option that is not dealt with in this paper could be
inclusion of all possible containers of a property to the set of required types. Options
Fig. 6. The Effective U ML Activity Diagram Meta-model for the CNES Case Study
Table 1. Meta-model Pruning Results for Options
can be used to relax or tighten the pruning for applications where model transformations
may evolve and use more concepts that initially perceived.
7 Conclusion
Deriving effective modelling domains is an ubiquitous need in MDE. There are several
existing ways such as invariants, pre-conditions and hard-coded knowledge in model
editors such as TOPCASED to obtain some form of an effective modelling domain.
Most of these approaches patch up the modelling domain with constraints or code to
obtain a constrained or effective modelling domain. In this paper, we present an algo-
rithm to extract an effective meta-model from a large meta-model via pruning the large
meta-model. Very much like extracting the meta-model of a transient DSML. The input
to the algorithm includes the large meta-model and a set of required classes and proper-
ties. The algorithm finds all mandatory dependencies between these required concepts.
It then prunes the large meta-model such that only the required concepts and its manda-
tory dependencies are preserved. The flexible algorithm also allows inclusions of non-
mandatory properties. The effective meta-model typically has fewer classes and prop-
erties compared to the input meta-model and is a super-type of the input meta-model.
Therefore, any program written for the effective meta-model will also accept models of
the large meta-model. In the future, we would like to integrate the meta-model pruning
algorithm to dynamically generate an effective meta-model in MDE tool chains such as
editors and transformations. There is also scope for adding more options to control the
generation of an effective meta-model for various objectives.
References