Previous | Table of Contents | Next |
When metamodeling, we primarily distinguish between metamodels and models. As already stated, a model that is instantiated
from a metamodel can in turn be used as a metamodel of another model in a recursive manner. A model typically contains model
elements. These are created by instantiating model elements from a metamodel, i.e., metamodel elements.
The typical role of a metamodel is to define the semantics for how model elements in a model get instantiated. As an example,
consider
Figure 7.6, where the metaclasses Association and Class are both defined as part of the UML
metamodel. These are instantiated in a user model in such a way that the classes Person and Car are both instances of the
metaclass Class, and the association Person.car between the classes is an instance of the metaclass Association. The semantics
of UML defines what happens when the user defined model elements are instantiated at M0, and we get an instance of Person,
an instance of Car, and a link (i.e., an instance of the association) between them.
The instances, which are sometimes referred to as “run-time? instances, that are created at M0 from for example Person should
not be confused with instances of the metaclass InstanceSpecification that are also defined as part of the UML metamodel.
An instance of an InstanceSpecification is defined in a model at the same level as the model elements that it illustrates,
as is depicted in
Figure 7.7, where the instance specification Mike is an illustration (or a snapshot) of an
instance of class Person.