Since EA 14, it is possible to define so-called metamodel constraints for UML profiles. In the EA help we find a description of the currently supported rules.
Here I would like to describe the possibilities of the metaconstraint rule, which limits classifying of Model-Elements.
When a model element may get a type, we speak of the model element gets a classifier.
Therefore, the rule umlRole=classifier is what we use to restrict the classifier of Model-Elements.
Important: assure that the name classifier is witten propperly and has no leading or following space in its name!
The following example shows a UML profile with metaconstraints umlRole=classifier for stereotypes which are derived from the metamodel types: InstanceSpecification, Object, Property (Part) and Port:
This rule has two effects:
- In the type selection dialog only model elements with the given stereotype or the model element type (see YourPort and Activity) can be selected.
- During model validation, incorrectly typed (classified) model elements are listed.
At least until build 1526, the restriction to the UML metaclass type, such as B. Activity in the example above is not taken into account in the model validation.
- Is the model element which can be used as a classifier – e.g. a model element with stereotype <<AUsedAsClassifier>> – drag&dropped from the Project Browser into the diagram, the Drop as dialog shows the possibility to create a port (MyPort), a property (MyPart), an instance specification (MyInstanceSPecification) or an object (MyObject) and classify the new created Model-Element with the dropped Model-Element from the Project Browser (the model element with stereotype <<AUsedAsClassifier>>).
Validation of the example above gives the following result in EA Build 1526:
Here is the result when a model element with stereotype <<AUsedAsClassifier>> is dragged from the Project Browser into the diagram: