• In every version of the UML, the authors have applied a four-layer metamodel architecture.
    • When you show the relationship between the metamodel and the model, you get two layers, the metamodel, and the model.
  • The metamodel layer defines what a Class is.
    • It tells us that a class may contain attributes and operations and that it may participate in associations.
    • The Class in the metamodel is a meta-class, a concept that describes what a class is and how to use it.
    • An instance of the Class metaclass is a class that you can see on a diagram.
    • It contains attributes about a type of object, operations that the type of object can support, and information about the associations that the type of object participates in.
    • Different instances of the metaclass Class describe different types of objects.
  • In this figure, Person and Car are both model-level classes that are instances of the metaclass Class.

  • The metamodel also defines an association and how to represent it; that is, structures and relationships that describe any association.
    • The Association in the metamodel is a metaclass just like Class.
  • The instance of the metaclass Association is an association on a class diagram, modeled as the arrow between Person and Car.
    • In this two-layer example, the metamodel layer defines the symbols-such as classes and associations-that can be used to create a model.
    • The model layer describes information such as people and cars and their relationships, using the symbols defined in the metamodel.
    • The model layer is where all UML diagrams drawn by developers exist.
    • The UML (metamodel) defines the rules that govern how modelers draw the diagrams and define the elements of the diagram.

  • To instantiate a metamodel means to create a model, like creating a Person class from the Class metaclass.
    • Instantiating a model class means creating an object of that type.
  • In the previous figure, the object Mike is an instance of the class Person.
    • But in order to model the object Mike we need a definition for modeling an object.
    • It is valid and useful to define a metamodel for instances, in this case, a metaclass called InstanceSpecification.
    • InstanceSpecification defines the needed modeling elements for describing an instance.
    • To instantiate the InstanceSpecification, model an object like Mike:Person, that is, an instance called Mike of type Person.
    • Note that Mike:Person is still a model element, not the actual object Mike.
      • That would be yet a third layer.
  • Using the layering concepts similar to those illustrated in the previous examples, the UML authors set out to employ a multi-layered architecture like this Table:

  • Layer M3 (meta-metamodel) is a model that describes the artifacts of and rules for a metamodel.
    • The M3 layer defines the rules for defining a metaclass.
    • This level of abstraction supports the creation of many different models from the same set of basic concepts.
  • Layer M2 (metamodel) is a model that describes the artifacts of and rules for a model.
    • It is UML that defines the model for elements like attributes, classes, and instances.
    • The UML definition of a class extends the core definition of the Class metaclass found in the M3 layer.
    • The UML definition for an attribute also extends the MOF Class definition.
    • It is valid, and useful, to allow a class at one level to inherit from multiple classes in the level above.
      • This encourages a model in which the higher layers are extremely cohesive and loosely coupled to support the widest range of application.
  • Layer M1 (model) is the model that describes the artifacts and rules for the problem domain.
    • This is the level at which we draw Class diagrams, Sequence diagrams, and so forth.
    • Classes and objects, associations, attributes, and all other elements of the model layer depend on the M2 layer definitions.
  • Layer MO consists of the runtime elements created by executing the model.
    • Layer M0 represents the actual artifacts of the problem domain, consisting of the elements created and used at runtime.
    • Layer M1 is a model of layer M0, layer M2 is a model of layer M1, and finally, layer M3 is a model of M2.
  • This layered approach to defining concepts leads to the possibility that the same concept (class name) may appear at multiple levels.
    • Each lower level inherits the concept from the layer above and adds to or overrides the definition.
    • For example, Classifier appears in both M3 and M2.
    • The definition in M2 adds new features not defined in M3.