# Using Profiles and Stereotypes

Contents

1. Using Profiles and Stereotypes
   1. Applying a Profile
   2. Applying a Stereotype
   3. Setting values to stereotype' properties
   4. Display options of a stereotype application

Once a profile has been designed and defined as previously explained, it now times to use it. The first step to process is to apply the profile on your model or a part of the model. This is the purpose of the next section to explain this first step. Then, we will explain how to use the applied profile and mainly how to use its extensions, i.e. its stereotypes.

## Applying a Profile

To apply a profile, first you need to open your model.

The first step consists in selecting the part of the model you want to apply the profile on. Profiles can be applied either on Models or Packages. Then to apply the profile on this part, let’s select the profile tab in the property view, and press the button.

Then, Papyrus will ask you firstly to choose the profile to apply from your workspace, and secondly to choose which part of the selected profile you want to apply. It is indeed possible that your profile may be composed of sub-profiles as explained in the previous chapter. It is then possible to apply partially a profile by applying one or more of its sub-profiles.

Your model should now look like this:

## Applying a Stereotype

Once the profile is applied on your model, its extensions, i.e. stereotypes, are available in the modeling tool and can be used in your model to annotate uml elements.

To annotate a model element, you first need to select it either through the model explorer or in one open diagram. Then, select the tab named “profile” in the properties view, and add your stereotype using the button of the widget named “Applied stereotypes”

A dialog box enables you to select the stereotype(s) you want to apply (left part of the dialog box) and using the button located in the middle of the dialog box enables to define which stereotypes have to be applied. The list located on the right of the dialog box denotes the list of applied stereotype. If you want to unapply stereotypes, you can select those latter from the right list and use the button to unapply them.

At this point, your Papyrus should look like this:

## Setting values to stereotype' properties

As already mentioned, Stereotypes may have properties. Consequently, when applying a stereotype to a model element, it may be necessary to set the values of those properties. For that, you will go to the profile tab of the properties view and then you can unfold the stereotype application as shown in following figure:

Once you have selected the property to edit, its value (if already set, as for example if there is a default value defined in the profile for the property) appear in the right part of the property view. If the property has not yet been valued, you can add a value by using the button located on the top right of the widget named “Properties values”. If there is a value, double-click on the value to edit this latter.

Ps: If you want to delete a value set to property, let’s use the button located on the top right of the widget named “Properties values”.

## Display options of a stereotype application

Stereotype applications may be graphically rendered under different forms, either textually, or using specific icons. Details to specify those icons associated to a stereotype are given in previous chapters (See definingProfilesAndStereotypes#Stereotype display options).

Let’s remind that in UML, you can apply several stereotypes on a same model element. In Papyrus, it is then possible to select the ones you want to show for each diagram. For showing or hiding a stereotype application, you have to select the tab “appearance” in the properties view. As shown in the next figure, there is one widget named “Applied stereotypes” that denotes the list of stereotypes applied on the current selected model element. On the example illustrated within this figure, you can see on the upper corner of the icon placed in front of the stereotype name “Requirement” an overlay denoting that this stereotype application is shown.

Warning: Let’s notice that the appearance tab of the property view is only visible if you select a model element from one of the open diagram. In other case, if you select the model element from the model explorer, the concept of graphical does not make sense because the information specified within this view are only related to graphical information.

Consequently, the values set to the appearance properties of model element are valid only in the context of the diagram where the element is selected. It is then possible to show a stereotype on a diagram and hide it in another diagram depending on the concerns of the view realized by the diagram.

To hide or show stereotype applications, you have to select them from the list of applied stereotypes available within the appearance tab and then either press the button or .

The former is to be used if you want to display the stereotype application with its qualified name, and the latter is to be used if you want to show it without qualified name. Using one of both depends if you may have ambiguities or not on the origin of the stereotype when as for example applying several profiles defining similar stereotypes. As for example, both profiles, MARTE and SysML, define a stereotype named «FlowPort».

In addition, there are three other widgets dedicated to configure the stereotype display options:

- “Stereotype display” is an enumeration which values may be Text, Icon, Text and Icon or Shape. In UML, as explained previously, a stereotype may be denoted either as a string between a pair of French guillemets (e.g., «Requirement»), or as an icon embedded in the figure or as a shape with a label. In case of the shape option, it substitutes the normal graphical figure used to represent the element and its label denotes the name of the element.

- “Text alignment” is an enumeration which values may be Horizontal or Vertical. When several applied stereotypes are shown, it is rendered as a list of string separated by a comma and enclosed between a pair of French guillemets. By default, this string is shown horizontally. But some times for aesthetic reasons, it may be useful to show it vertically, that is to say showing one stereotype per line.

- “Display place” is an enumeration which values may be Compartment, Comment or With brace. This appearance property is used to set where to show the properties values of the applied stereotypes. In UML, those values can be shown either within a pair of braces located just near (above or on top) the name label of the model element (“With brace” option), or into a dedicated compartment, or in a text note associated with the annotated model element.

PS: if you display several stereotype applications, and if you select the options to display them with icon or with icon and text, this is the icon of the first stereotype application in the list which is chosen to be displayed.