8.1 Introduction to Metamodeling

In Chapter 2 we defined a model as a description of (part of) a system written in a well-defined language . A well-defined language was defined as a language which is suitable for automated interpretation by a computer. The question we will answer in this chapter is: "How do we define such a well-defined language?"

In the past, languages were often defined using a grammar in Backus Naur Form (BNF), which describes what series of tokens is a correct expression in a language. This method is suitable and heavily used for text-based languages, like programming languages. We could use a BNF grammar to define modeling languages. It does fulfill the requirement that it is suitable for automated interpretation. However, BNF restricts us to languages that are purely text based. Because modeling languages do not have to be text based, and often aren't (they can, for example, have a graphical syntax, like UML), we will need a different mechanism for defining languages in the MDA context. This mechanism is called metamodeling.

A model defines what elements can exist in a system. If we define the class Cat in a model, we can have instances of Cat , (like "our neighbor's cat") in the system. A language also defines what elements can exist. It defines the elements that can be used in a model. For example, the UML language defines that we can use the concepts "Class," "State," "package," and so on, in a UML model. Looking at this similarity, we can describe a language by a model: the model of the language describes the elements that can be used in the language.

Every kind of element that a modeler can use in his or her model is defined by the metamodel of the language the modeler uses. In UML you can use classes, attributes, associations, states, actions, and so on, because in the metamodel of UML there are elements that define what is a class, attribute, association, and so on. If the metaclass Interface was not included in the UML metamodel, a modeler could not define an interface in a UML model.

Because a metamodel is also a model, a metamodel itself must be written in a well-defined language. This language is called a metalanguage. So, BNF is a metalanguage . Figure 8-1 shows this approach. But there are few comments that must be made.

Figure 8-1. Models, languages, metamodels, and metalanguages


First, a metalanguage plays a different role than a modeling language in the MDA framework, because it is a specialized language to describe modeling languages. We therefore use a different symbol for a metalanguage in the MDA framework. Secondly, the metamodel completely defines the language. Therefore, it is not necessary or useful to make the distinction between the language and the metamodel that defines the language; for all practical purposes they are equivalent. Figure 8-2 shows the relationship between a model, its language, and the metalanguage.

Figure 8-2. Models, languages, and metalanguages


Because a metalanguage is a language itself, it can be defined by a metamodel written in another metalanguage. In theory there is an infinite number of layers of model “language “metalanguage relationships. The standards defined by the OMG use four layers , as explained in the next section.

MDA Explained. The Model Driven Architecture(c) Practice and Promise 2003
Project Leadership (The Project Management Essential Library)
EAN: 2147483647
Year: 2004
Pages: 118

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net