The MOF (OMG document number formal/2002-04-03) is an OMG standard that defines the language to define modeling languages. The MOF resides in the M3 layer, as explained in Figure 8-6. As there is no higher layer, the MOF is defined using the MOF itself. It is the language in which the UML and CWM (see section 11.7) definitions, that is, the UML and CWM metamodels, are written. A simplified version of the MOF model is shown in Figure 11-3.
Figure 11-3. The MOF metamodel (simplified)
11.2.1 yMOF Tools
The MOF is not only used to define modeling languages, but also to enable the building of tools for defining modeling languages. The MOF therefore provides some additional functionality.
The MOF Repository Interface
The MOF definition includes a specification of the interface for a MOF repository. This interface allows us to get information about M1 models from a MOF-based repository. This interface is defined using CORBA-IDL and is therefore usable in many environments. Especially for Java, there is a native interface providing the same functionality. This is called the Java Metadata Interface (JMI) and it is described in Sun Microsystems, Java Metadata Interface Specification, Version 1.0 (2002). From Java applications, this interface is easier to use than the CORBA-to-Java mapping.
The MOF is also used to define a stream- or file-based interchange format for M1 models. Whenever a modeling language is defined using a metamodel described in the MOF, the MOF defines a standard way to generate an interchange format for models in that language. This interchange format is based on XML, and it is called XMI (XML Metadata Interchange). Because the MOF is defined using itself, XMI can be used to generate standard interchange formats for metamodels as well.
The main usage of XMI has been as an interchange format of UML models, which has led people to view XMI as the UML interchange format. Although this is undoubtedly true, this is only a limited view of XMI.
11.2.2 The Role of the MOF in MDA
The role of the MOF within MDA is that it gives us the concepts and tools to reason about modeling languages. Using the MOF definition of a modeling language (that is, the metamodel on layer M2) we can define transformations between modeling languages. Because transformations are defined in terms of the metamodels of the involved modeling language, they can be applied to any model (at the M1 layer) written in one of those languages. Without a standard language to describe metamodels, transformations could not be defined properly and the MDA approach would be very difficult to realize. As such, the MOF is the core enabling technology for MDA.