The profile concept is a specialization mechanism defined as part of UML. A profile defines a specific way of using UML. For example, the CORBA Profile for UML defines a specific way of using UML to model CORBA interfaces, and the Java Profile for UML defines a way to model Java source code in UML. A profile is defined by a set of stereotypes, a set of related constraints, and a set of tagged values. A stereotype definition has a name and is attached to elements in the UML metamodel. For example, the stereotype <<JavaClass>> is defined for the UML metaclass Class (see Figure 11-4) in the EJB Profile (Sun Microsystems, Enterprise JavaBeans Specification, Version 2.1, 2002). In a UML model one can apply this stereotype to each class in a model. A constraint can be attached to a stereotype definition. This constraint is expressed in OCL in terms of the UML metamodel, and describes the restrictions on instances of the model elements to which the stereotype is applied. For example, for each class in a UML model labeled with the stereotype <<JavaClass>>, the following constraint should hold: "A Java class may have at most one superclass." A tagged value is an additional meta-attribute that is attached to a UML metaclass in the UML metamodel. A tagged value has a name and a type and is attached to a specific stereotype. It can be given a value in a model, but only for elements that have the corresponding stereotype. The effect of a profile is that it defines a specialized variant of UML, for a specific purpose. An alternative is to define a new metamodel instead of using a profile. This would result in separate metamodels for Java, CORBA, and so on. 11.8.1 The Role of Profiles in MDAA profile defines a specialized metamodel, which is by definition a subset of the UML metamodel. In fact, a profile defines a new language by reusing the UML metamodel. Most profiles that are currently used define languages specific for certain platforms, like CORBA, Java, or C++ profiles. A model with such a profile and its applied stereotypes can only be used as a PSM. ![]() |