A metamodel is a model that models the concepts of a modeling technique - this refers to its usable model elements and the related interrelationships. A metamodel thus provides a formalized description of models that reflects the structure of a domain. A domain is defined by a certain field of interest or a delimited area of application of software. A metamodel is also the fundamental basis of a modeling language, which consists beside it of an abstract syntax, the static semantics and the concrete syntax. A metamodel is in turn described by a model - the so-called metametamodel.
A well-known example of a metamodel is the Unified Modeling Language( UML), whose metamodel is in turn the Meta Object Facility( MOF). Likewise, a class in the Javaprogramming language is a metamodel, which in turn is defined by the Java programming language as a metametamodel. Metamodels are an important requirement in the context of model-driven software development( MDSD), whereby executable software is generated from formal models using an automated process. In addition to UML as the modeling language for models of applications, the Object Management Group( OMG) has standardized the Common Warehouse Metamodel (CWM) for modeling data. For this purpose, four so-called meta-layers were defined by the OMG.
The term metamodel was derived from the Greek prefix meta, which can be translated as above, beside or behind. A model serves the abstraction of the reality, for whose production and description a language is needed. For this purpose, the rules as well as the grammar of this language must also be defined. Exactly these languages are defined in so-called meta models, which in turn are themselves written in a meta language.
Process of model building
The classical process of model building leads from one problem domain at a time to a model of the model domain. Metamodeling describes the modeling technique used in the model domain in a model. The concept of a modeling technique includes the model elements that can be used and their interrelationships. A metamodel is explicitly not a model of a model, but a model of a model domain, that means of a set of similar models - in particular created according to the same technique.
If a metamodel is to define the elements and constructs of a modeling technique precisely, the elements and constructs of the metamodel must be specified just as precisely. This requires the metamodel of a metamodel - this is sufficiently called a higher metamodel or also meta-metamodel. Provided that one follows this idea, this form of definition leads to an infinite sequence of metamodels. Since this does not make sense, the OMG has standardized the Meta Object Facility (MOF) as a meta language and, as it were, the highest instance of meta modeling.
The figure shows the structure of models and languages from the point of view of the OMG. According to this, the metametamodel does not have a meta-language superordinate to it. The layer model defines the respective lower level as an instance of the higher level. Thus, the M2 layer contains the instances of the constructs defined on the M3 layer. As a rule, a metamodel defines itself, which means an identity with its meta-metamodel. Higher metamodels are generally only needed if several, different model domains, each described separately in a metamodel, are to be represented by a common model.
M3 metamodel This top layer has the highest abstraction and defines the Meta Object Facility (MOF) according to the OMG specifications. The elements of the MOF such as MOF Class, MOF Attributes, MOF Associations are used to define metamodels. Thus, the MOF layer specifies an abstract language to develop other modeling languages. Thus, all other modeling languages such as UML or CWM are instances of MOF.
M2 metamodel Here the metamodels are classified, which are described with the help of the MOF constructs and define in each case again an abstract syntax as well as semantics. At this level, the OMG defines the two languages - UML and CWM - which are then used to model at the M1 level below. Often, however, the elements of the modeling languages, for example UML, are not sufficiently expressive for domain-specific modeling. This is then the approach for so-called UML profiles, which then extend the existing language scope of the UML in order to be able to adapt it to special technical or professional domains.
M1 model This is where models are stored to represent the abstraction of a real system.
As shown in the figure, the models are modeled using the UML - and any necessary profiles - or the CWM - here there is the OLAP profile. Thus, each model - for example, the UML model of a software application - is an instance of the metamodel.
M0 instance This layer represents the running system with its different states and real instance in memory. The objects on this layer represent instances of M1 objects and thus ultimately represent the real entities. The example of a book titled "UML" shown in the figure is an instance of the class Book modeled in the M1 layer. The properties of this book are then defined in the layer M1 above.