Metamodeling is one of the most important aspects of Model-Driven Software Development. Metamodeling knowledge is needed for dealing with the following MDSD challenges:
- Construction of domain-specific modeling languages (DSLs): the metamodel describes the abstract syntax of such a language (see Chapter 4).
- Model validation: models are validated against the constraints defined in the metamodel.
- Model-to-model transformations: such transformations are defined as mapping rules between two metamodels.
- Code generation: the generation templates refer to the metamodel of the DSL.
- Tool integration: based on the metamodel, modeling tools can be adapted to the respective domain.
This list helps to justify why we dedicate an entire chapter to this subject.
6.1 What Is Metamodeling?
Metamodels are models that make statements about modeling. More precisely, a metamodel describes the possible structure of models – in an abstract way, it defines the constructs of a modeling language and their relationships, as well as constraints and modeling rules – but not the concrete syntax of the language. We say that a metamodel defines the abstract syntax and the static semantics of a modeling language (see Chapter 4). Vice versa, each formal language, such as Java or UML, possesses a metamodel.
Metamodels and models have a class-instance relationship: each model is an instance of a metamodel. To define a metamodel, a metamodeling language is therefore required that in turn is ...