Jump to Menu

How to Use Stereotypes and Tagged Values?

Compatible edition(s): Enterprise, Professional, Standard, Modeler

  • March 19, 2012
  • Views: 43,413
  • PDF

What are stereotypes and tagged values

UML is designed to be a general-purpose language for diverse usage. Therefore, at times, it may not be able to serve some of the specific needs in describing your model elements. After all, one cannot be both general and specific at the same time. In such cases, you can make use of stereotypes, a UML extension mechanism, to characterize model elements. For example, you can create a stereotype and name it "External User" for users outside the system and add your own custom properties for domain-specific attributes by adding tag definitions. When applying a stereotype to your model element, you will specify the tag values to describe its characteristics.

Graphically, a stereotype is represented by a name enclosed by guillemets << >>. As shown in the example below, the stereotype External User is applied to a model element (i.e. actor) called Customer.


Stereotyped actor

What this tutorial is about

In this tutorial, we will show you how to apply stereotypes to the actors (i.e. Customer, Cinema Manager) and add tag definitions, in the use case diagram below.


Sample use case diagram

Steps to create stereotypes and add tag definitions

  1. Download Use-Case-Stereotype.vpp. You can also find this file at the bottom of this tutorial.
  2. Open the downloaded .vpp file in Visual Paradigm. To open a project, select Project > Open from the application toolbar.
  3. Open the only use case diagram in the project
  4. Right-click on Customer. Select Stereotypes > Edit Stereotypes... from the popup menu.
    edit actor stereotype
  5. In the window opened, click Edit Stereotypes... under the Stereotypes tab.
    Edit stereotypes
  6. In the Configure Stereotypes window, click Add...
    Add stereotype
  7. In the Stereotype Specification window, select the General tab. Enter External User as the name of stereotype.
    Configure stereotype
  8. Now let's just say that we want to have a way to describe whether an external user is using the ticketing system as a guest or a login user. So we are going to add a tag definition for actors that will apply this stereotype to specify the tagged value then Select the Tagged Value Definitions tab. Then click Add and select Boolean Tag.
    Add boolean tag
  9. A new row will be inserted into the table for the new tag. Name it login user under the Name column. The type should be automatically filled in for you (i.e. Boolean). Click OK to close the Stereotype Specification window.
    Confirm add tag
  10. In the Configure Stereotypes window, click OK. A window will open to ask you to confirm applying the changes. Click Yes to proceed.
  11. We are now finished with the stereotype definition. Click OK to close the Actor Specification window.

Apply stereotypes to model elements

Next we will apply the stereotype to a model element. Right-click Customer and select Stereotypes > External User from the popup menu.
Assign stereotype to actor

Graphically, the actor Customer will now appear with the text <<External User>> above its name.
Stereotyped actor

Steps to set tagged values

We will now look at how to set the tagged values after we apply a stereotype (External User) to a model element (Customer).

  1. Right-click on Customer and select Stereotypes > Edit Stereotypes... from the popup menu.
  2. In the Actor Specification window, select the Tagged Values tab.
    OPen tagged value tab
  3. Click the cell under the Value column. Select the appropriate value for your need.
    Note: After clicking a value cell, you may or may not get a list of values to choose from. It all depends on the type of the tag. For example, if the tag is of integer type, you would need to manually enter a number yourself.
    Select boolean value
  4. Click OK to accept the changes and close the window.

Create another stereotype

Follow the previous steps to create a stereotype off from Cinema Manager (actor) and name it Internal User.

As for the tag definitions, (instead of a boolean tag called "login user") let's add one of integer type to store the access level.
Adding integer tag

Then apply Internal User (stereotype) to Cinema Manager (actor). Simply right click on Cinema Manager and select Stereotypes > Internal User from the popup menu.

The text <<Internal User>> should now appear above the actor's name, Cinema Manager.
Actors stereotyped




Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK