# Profile Diagram

![Profile Diagram](https://content.gitbook.com/content/aNbtXAm2MUsbrMlAEZb1/blobs/SmQLdJhH7g06nDidSNWJ/UMLStandardProfile!Robustness%20Stereotypes_3.png)

## Create Profile Diagram

To create a Profile Diagram:

1. Select first an element where a new Profile Diagram to be contained as a child.
2. Select **Model | Add Diagram | Profile Diagram** in Menu Bar or select **Add Diagram | Profile Diagram** in Context Menu.

> **See also**
>
> [UML Profile Diagram](http://www.uml-diagrams.org/profile-diagrams.html) - For more information about UML Profile Diagram.

## Profile

To create a Profile (model element only) by Menu:

1. Select an Element where a new Profile to be contained.
2. Select **Model | Add | Profile** in Menu Bar or **Add | Profile** in Context Menu.

## MetaClass

To create a MetaClass:

1. Select **MetaClass** in **Toolbox**.
2. Drag on the diagram as the size of MetaClass.

To create a MetaClass (model element only) by Menu:

1. Select an Element where a new MetaClass to be contained.
2. Select **Model | Add | MetaClass** in Menu Bar or **Add | MetaClass** in Context Menu.

You can use **QuickEdit** for MetaClass by double-click or press `Enter` on a selected MetaClass.

* **Name Expression** : Edit name expression.

  *Syntax of Name Expression*

  ```
  expression ::= [ '<<' stereotype `>>` ] [ visibility ] name
  stereotype ::= (identifier)
  visibility ::= '+' | '#' | '-' | '~'
  name ::= (identifier)
  ```
* **Visibility** : Change visibility property.
* **Add Note** : Add a linked note.
* **Add Constraint** : Add a constraint.
* **Add Stereotype** : Add a stereotype with a connected extension.

## Stereotype

To create a Stereotype:

1. Select **Stereotype** in **Toolbox**.
2. Drag on the diagram as the size of Stereotype.

To create a Stereotype (model element only) by Menu:

1. Select an Element where a new Stereotype to be contained.
2. Select **Model | Add | Stereotype** in Menu Bar or **Add | Stereotype** in Context Menu.

You can use **QuickEdit** for Stereotype by double-click or press `Enter` on a selected Stereotype.

* **Name Expression** : Edit name expression.

  *Syntax of Name Expression*

  ```
  expression ::= [ '<<' stereotype `>>` ] [ visibility ] name
  stereotype ::= (identifier)
  visibility ::= '+' | '#' | '-' | '~'
  name ::= (identifier)
  ```
* **Visibility** : Change visibility property.
* **Add Note** : Add a linked note.
* **Add Constraint** : Add a constraint.
* **Add Attribute** (`Ctrl+Enter`) : Add an attribute.
* **Add Operation** (`Ctrl+Shift+Enter`) : Add an operation.
* **Add Sub-Stereotype** : Add a sub-stereotype.
* **Add Super-Stereotype** : Add a super stereotype.

To suppress Attributes, see [Suppress Attributes](https://docs.staruml.io/user-guide/formatting-diagram#suppress-attributes).

To suppress Operations, see [Suppress Operations](https://docs.staruml.io/user-guide/formatting-diagram#suppress-operations).

To show or hide Operation Signatures, see [Show Operation Signature](https://docs.staruml.io/user-guide/formatting-diagram#show-operation-signature).

### Stereotype Icon

You can assign an icon for stereotype in two ways:

1. Image : Select an image file (PNG, JPEG) to the `image` property in **Property Editor**.
2. Icon Script : Write an icon script in `content` property in **Property Editor**.

Stereotype's `width` property and `height` property represents minimal width and minimal height of the icon respectively.

The assigned icon is shown when you set **Format > Stereotype Display** to **Decoration**, **Decoration with Label**, **Icon**, **Icon with Label** of the view elements.

### Icon Script

You can use very tiny icon script language to represent a stereotype icon as below:

```
!icon 40 40              # header (mandatory) : width height
l 0 0 40 40              # line : x1 y1 x2 y2
r 0 0 40 40              # rectangle : x1 y1 x2 y2
rr 0 0 40 40 5           # round rect : x1 y1 x2 y2 radius
e 0 0 40 40              # ellipse : x1 y1 x2 y2
pl 0 0 10 10 20 20 ...   # polyline : x1 y1 x2 y2 x3 y2 ...
pg 0 0 10 10 20 20 ...   # polygon : x1 y1 x2 y2 x3 y2 ...
a 20 20 15 90 180        # arc : x y radius startAngle endAngle
fr 0 0 40 40             # fill rect : x1 y1 x2 y2
frr 0 0 40 40 5          # fill round rect : x1 y1 x2 y2 radius
fe 0 0 40 40             # fill ellipse : x1 y1 x2 y2
fp 0 0 10 10 20 20 ...   # fill polygon : x1 y1 x2 y2 x3 y2 ...
fa 20 20 15 90 180       # fill arc : x y radius startAngle endAngle
%l #ffff00               # line color : color
%f #ffffff               # fill color : color
%a 0.4                   # alpha : alpha
%w 2                     # line width : width
%p 4 4                   # line pattern : line1 gap1 line2 gap2 ... 
```

The icon script must starts with `!icon` header. The width and height in  `!icon` header doesn't mean the actual icon size but means XY coordinates for the drawing commands. For example, if `!icon 40 40` is given, you can draw shapes in `(0, 0)` \~ `(40, 40)` coordinates.

Please note that the default line color and fill color are the view element's line color and fill color. If you use the command `%l` or `%f` without argument, the line color or the fill color is set to the view element's line color or fill color.

Here is an example of icon script for the entity, boundary, control standard stereotypes in UMLStandardProfile.

![Icons for entity, boundary, control stereotypes](https://content.gitbook.com/content/aNbtXAm2MUsbrMlAEZb1/blobs/0eztoj3wUigU7upypKui/stereotype-icons.png)

{% code title="<<entity>>" %}

```
!icon 40 40
e 3 3 37 37
l 3 37 37 37
```

{% endcode %}

{% code title="<<boundary>>" %}

```
!icon 50 40
e 10 0 50 40
l 0 0 0 40
l 0 20 10 20
```

{% endcode %}

{% code title="<<control>>" %}

```
!icon 40 40
e 5 5 35 35
l 20 5 25 0
l 20 5 25 10
```

{% endcode %}

## Extension

To create a Extension:

1. Select **Extension** in **Toolbox**.
2. Drag from a Stereotype and drop on a MetaClass.

You can use **QuickEdit** for Relationship (See [Relationship](https://docs.staruml.io/class-diagram#relationship)).
