• Keine Ergebnisse gefunden

UML AND M ETAMODELING

Im Dokument UML Profile for Communicating Systems (Seite 54-58)

The UML is defined by means of the metamodeling concept. Metamodels serve as models for other models [KK02]. Many model elements in the UML represent a type/instance dichotomy. A type represents the essence of an abstraction and the instance forms a concrete sample. In addition, there is a type/class dichotomy in which classes and primitive types implement types.

A type specifies a domain of values and a set of operations applicable to those values. A class implements a type and it provides the representation of attributes and the implementation of operations (methods). This distinction is propagated with subclasses, so that the specification given for a type is valid for all subclasses and a subclass may implement several types.

In other words, modeling describes an information domain by means of a model. This model is described using a specific language – the modeling language. This language contains a set of language constructs with a defined syntax and semantics. Metamodeling describes a modeling language for a model. Hence, to achieve this in a consistent manner a metamodeling language is used for this. It itself contains modeling elements with a defined syntax and semantics.

In essence, metamodeling describes (meta-)models whose domain is another modeling language. For this purpose, the OMG has defined four levels of metamodels shown in Figure 23.

Control Flow Activity Final Initial

Node

Object Flow Fork Node

4.3 UML and Metamodeling

LAYER DESCRIPTION EXAMPLE

meta-metamodel (M3) The infrastructure for metamodeling architecture.

Defines the language for specifying metamodels.

MetaClass, MetaAttribute, MetaOperation

metamodel (M2) An instance of a meta-metamodel. Defines the language for specifying a model.

Class, Attribute, Operation

model (M1) An instance of a metamodel.

Describes the language to describe an information domain.

person, name, say

information (M0) An instance of a model.

Describes the specific information domain.

<person_33111>, “john”, say()

Figure 23: Four Layer Metamodeling Architecture

The concrete instantiations of the model elements from the meta-meta model layer down to the concrete information layer is pictorially depicted in the following Figure 24.

Figure 24: Instance Creation in UML Metamodeling Layers

«instanceOf» «instanceOf»

«instanceOf»

«instanceOf»

«instanceOf»

«instanceOf»

«instanceOf»

«instanceOf»

«instanceOf» «instanceOf»

«snapshot»

«snapshot»

MOF

UML

UML Model

Information

The information (or runtime) layer M0 is the lowest layer in the hierarchy. This layer represents the reality and describes the real basis of models. Abstracted from this layer, models are created. This uniformly represents objects and behaviors which are available or will occur at runtime.

The runtime layer is the foundation for the layered design of the metamodeling approach. This real world is not intended to be modeled with all and every aspects. Instead, it is intended to create an abstracted model from this, as models are much easier to cope with than as real-world models.

Additionally, many aspects of the real-world objects are irrelevant and the focus lies on essential parts.

Consequently, objects of the M0 layer are instances of the modeling layer M1. A model defined in M1 can be instantiated to a real world object. The metamodel M2 is the model of a model. For instance, the UML 2 metamodel defines that a class may own one or more attributes and operations. It also defines how many outbound lines may be attached to an activity and so on. It defines the abstract syntax of the UML model elements. Figure 25 gives an overview of the UML 2 metamodel.

The meta-metamodeling layer M3 is the topmost layer in the four-layer-model of the UML. It is the foundation of all metamodeling layers. In most cases, this layer is only of concern for tool developers, metamodeling and code generator engineers. This layer describes what is allowed to be used to build a metamodel, e.g. class, property, generalization, association et cetera. However, it does not define a composite structure diagram, state machine diagram or use case diagram. The meta-metamodel defines a simple class model with exact definitions for multiplicity and is itself defined by an object-oriented class model described in the UML.

The meta-metamodel of UML defined in the M3 layer is the Meta-Object Facility (MOF). The MOF is also an own, independently defined standard by the OMG in [OMG03a].

To summarize, the differences between MOF, MOF-based metamodel, UML metamodel and UML model are that MOF is a language for creating metamodels. Any metamodel created by using MOF constructs is a MOF-based metamodel. The UML metamodel is a metamodel created by using the MOF language, while the UML metamodel itself is a language for creating UML models. The UML metamodel is MOF-based. A UML model is created by using UML metamodel and therefore, it is not MOF-based directly.

4.3 UML and Metamodeling

Figure 25: Overview of UML 2 Metamodel Class Hierarchy

The class diagram of the UML metamodel in Figure 25 depicts the basic structure. There can be a few core classes identified. The first one is the Element metaclass. Almost all classes in the UML metamodel hierarchy are specializations of this base class. The NamedElement metaclass – being a specialization of Element – adds an identifier to each instance of a metaclass element. This enables unique addressing of all instance types. The TypedElement metaclasses introduces the type concept to its specialized metaclasses. It constrains values to a specific range of values. The RedefinableElement metaclass provides the basis for object-orientation concepts like overloading and overwriting. Instance definitions of a RedefinableElement can be refined by means of further instances. Another important metaclass is the Classifier. A Classifier is a more general description and is an abstraction of a generic class that is known from object-oriented concepts. In UML, there are 23 different specializations defined from the Classifier metaclass.

Im Dokument UML Profile for Communicating Systems (Seite 54-58)