Stereotypes and Tagged Values

From ArgoUML-Users.net
Jump to: navigation, search

It is assumed that you know what stereotypes and tagged values are for. (TODO: explain it in this wiki and add a link here.)

A first note on UML 2.x and UML 1.x differences

In UML 1.x you could model stereotypes and tagged values whenever and wherever you wanted to. Since UML 2.0 stereotypes and tag definitions are only allowed to appear in a profile, which can be applied by your models (they act as an extension to the UML metamodel). So, you need to create them in a profile, which you then deploy and apply to your model, see here: Profile Configuration. Keep this in mind whenever this article mentions the creation or editing of stereotypes and tagged values!

Stereotypes

A stereotype can be applied to any model element which is specified to be valid for that. This is done by telling the stereotype, which kind of model elements are allowed for it. The "kind" of a model element is the UML meta class (e.g. class, operation, use case, ...). You specify that when you edit the stereotype and add the needed meta classes to the list of base classes of the stereotype.

For example, when you want a stereotype to be applicable to all classes, then go to the property panel of the stereotype, unfold the "Base classes" box, click on the add button, and activate "Class" from the presented list of UML meta classes.

Later in your model, you can then apply the stereotype to a model element using the "Stereotype" tab in the details pane at the bottom. Keep in mind that if the stereotype is in a profile (which is required since UML 2.0), then the profile must be activated in the Profile Configuration.

Tagged Values

You can add a named tag to any model element and set a value. This serves as additional info or for further parameterization. The list of all these "tagged values" can be found in the "Tagged values" tab of a model element, in the details pane at the bottom. The available tags need to be defined somewhere, I'll explain how.

In UML 1.x you can dynamically add a new tag definition to any model element and use it immediately, just try it. Nothing to say to UML 1.x tagged values anymore in this section. The remainder is reserved for UML 2.x!

But in UML 2.x the tags can be defined in a profile only, as this is the only valid place for such extensions. Furthermore a tag definition must belong to a stereotype and will be available only for model elements that apply that stereotype! Belonging to a stereotype means: is a property of a stereotype. For a tag definition (= stereotype property) ArgoUML currently allows the primitive built-in types Boolean, Integer, String and UnlimitedNatural.

Step 1 : Make sure you have a profile that contains a stereotype with at least one property. (Create a profile, add a stereotype, add a property to it, choose its type, deploy the profile, make sure it is available in the profile configuration.)

Step 2 : In your model, apply the profile that contains your desired tag. Then apply the owning stereotype to a model element. Now go to the "Tagged values" tab and verify that your tag (property's name) appears in the dropdown menu of the left table cells. Set some valid value and hit enter.

Voila, you just created a tagged value! It now belongs to that model element unless you remove it. Have fun!!!