5.2 Metamodels


The metamodel of a language, also known as the abstract syntax , is a description of all the concepts that can be used in that language. For instance, the concept attribute is part of the UML language; the concepts constructor, method , and field are part of the Java language; and the concepts table, column , and foreign key are part of the SQL language. These concepts are sometimes called metaclasses or metatypes . The set of all metaclasses of a language and the relationships between them constitute the metamodel of that language.

Every element of an ordinary model is an instance of a concept in the modeling language used; in other words, every model element is an instance of a metaclass. For instance, in a UML model, a class called Car is an instance of the metaclass Class from the UML metamodel. An attribute of class Car , called isValuable of type Boolean , is an instance of the metaclass Attribute from the UML metamodel. In the model, there is a relation between Car and isValuable . In the metamodel, this is reflected by the relationship between the metaclass Class and the metaclass Attribute . Actually, all modelers are familiar with this instance-of relationship: an object named The Object Constraint Language is an instance of the class called Book . In a metamodel, this relationship is brought one level higher: the class called Book is an instance of the metaclass called Class . Figure 5-2 shows both instance-of relationships.

Figure 5-2. Relation between system, model, and metamodel

graphics/05fig02.gif

As a class defines its objects, a metaclass defines its instances: the model elements. The metaclass Attribute from the UML metamodel specifies that an attribute should have a name and a type, e.g., Boolean . The metaclass Class specifies that each class should have a name, and that it could have attributes, operations, and so on. Each of these related elements must itself be defined within the metamodel; that is, the metaclasses Attribute and Operation should exist.

A modeler can use in his or her model only elements that are defined by the metamodel of the language the modeler uses. In UML, you can use classes, attributes, associations, states, actions, and so on, because the metamodel of UML contains elements that define what these items are. If the metaclass Interface were not included in the UML metamodel, a modeler could not define an interface in a UML model.



Object Constraint Language, The. Getting Your Models Ready for MDA
The Object Constraint Language: Getting Your Models Ready for MDA (2nd Edition)
ISBN: 0321179366
EAN: 2147483647
Year: 2003
Pages: 137

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