Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Add Stereotypes and Metaclasses using Profile Helpers

You can define Stereotypes in a Profile to either extend:

  • Core UML objects (Metaclasses pre-defined in Enterprise Architect), or
  • Objects (Stereotypes) defined by other Profiles and technologies (for instance objects defined in ArchiMate or SysML)

Stereotypes can extend Metaclasses in several ways:

  • One Stereotype extending one Metaclass, for a specific definition of one object type
  • One Stereotype extending more than one Metaclass, where the definition applies to more than one object type - such as modifying both a Class and an Object in the same way
  • Several Stereotypes extending one Metaclass, where you are creating several variations of the same base object type; for example, to define types of Association connector, representing Parent, Sibling, Grandparent, Uncle/Aunt and Cousin relationships

Add Metaclasses and Stereotypes to a Profile

Step

Description

See also

1

If you are extending a non-UML type defined by an existing Profile or technology, follow the process described in the Create Stereotypes Extending non-UML Objects Help topic.

Create Stereotypes Extending non-UML Objects

2

In the Project Browser, locate the Package with the <<profile>> Stereotype and open its child diagram.

Create UML Profiles using Profile Helpers

3

Drag the 'Add Stereotype' icon from the 'Profile Helpers' page of the Diagram Toolbox onto the diagram.

The 'Add Stereotype' dialog displays.

4

In the 'Name' field, type the Stereotype name (which will also be the name of the new modeling object).

5

Select one of these object groups by clicking on the 'Type' drop-down arrow:

  • Element Extension - to create a Stereotype that extends an element
  • Connector Extension - to create a Stereotype that extends a connector
  • Abstract Metaclass - to create a Stereotype that extends a structural or behavioral modifier
  • Metaclass Extension - to create a Stereotype that extends a Metaclass that already exists within your model (and most likely within the diagram you are currently working in)

6

Click on the Add Metaclass button.

The 'Extend Metaclass' dialog displays, showing a list of object types associated with the object group selected in step 5.

Select the Metaclass to be extended from the list and click on the OK button.

If you selected 'Metaclass Extension' in step 5, the 'Select a Profile Element browser/search' dialog displays; search for and select the existing Metaclass element to extend with this Stereotype.

The Metaclass name is added to the 'Extensions' field.

7

If you want to extend more than one Metaclass with the Stereotype, click on the Add Metaclass button again and select the next object type to extend. You can repeat this for as many Metaclasses as you want to extend with this Stereotype.

To delete a selected Metaclass from the 'Extensions' list click on the Remove button.

8

Review the available properties in the 'Stereotype' panel. These properties modify the behavior of the Stereotype.

To apply a property, click in the 'Value' field and type or select the appropriate value.

When you select a property field, a description of the property's effect is displayed at the bottom of the 'Stereotype' panel.

Only provide values for properties that you want to apply to this Stereotype.

9

Click on the name of a Metaclass in the 'Extensions' field and review the available properties in the 'Metaclass' panel. These properties further modify the behavior of the stereotype based on options specific to the Metaclass being extended.

To apply a property, click in the 'Value' field and type or select the appropriate value.

When you select a property field, a description of the property's effect is displayed at the bottom of the 'Metaclass' panel.

Do not provide values for any properties that you do not want to apply to this Stereotype.

If you are extending more than one Metaclass, click on the next Metaclass name in the 'Extensions' field and review the properties for that object type.

10

Click on the Next button. The 'Define Tagged Values' page displays.

11

In the 'Property' panel right-click to display a context menu with options for creating and grouping Tagged Values of different types. These options include:

  • 'Add Tagged Value': Create a simple Tagged Value - a prompt displays for the Tagged Value name. Add a name and click on the OK button to display the name in the 'Property' column; to set a default value, type it in to the 'Default Value' field
  • 'Add Specialized Tagged Value':
         -  Enumeration: create an enumeration Tagged Value, based on an existing Enumeration element
         -  Predefined: select a Predefined Tagged Value Type from a list and, in the 'Default Value' field,
            type or select an initial value if necessary
         -  Structured: create a Structured Tagged Value composed of several other simple Tagged Values,
            typed by an existing Class element
         -  Reference: create a Tagged Value with which the user can locate and reference an element created
            with a specified Stereotype (a form of RefGUID Tagged Value); in creating this, you must select the
            existing Stereotype element that defines the stereotype
         -  Reference List: create a Tagged Value with which the user can  locate and reference a list of
            elements created with a specified Stereotype (a form of RefGUIDList Tagged Value); in creating this,
            you must select an existing Stereotype element that defines the stereotype
  • 'Edit Tagged Value Name': displays a simple prompt in which you overtype the current name to correct or change it
  • 'Create Tag Group': create Tag Groups in the Metaclass element, through which to organize the Tagged Values you have created in the Stereotype element
  • 'Move Tag to Group' (displayed when you right-click on an existing Tagged Value): displays the 'Move Tag to Group' dialog, on which you can select an existing Tag Group to contain the selected Tagged Value
  • 'Remove Grouping': remove the selected Tag Group, leaving its member Tagged Values listed at the end of the 'Property' column
  • 'Delete': Remove the selected Tagged Value from the list and from the Stereotype

Add a Structured Tagged Value to a Stereotype Create Tagged Value Type from Predefined Types Add an Enumeration to a Stereotype RefGUID Tagged Value RefGUIDList Tagged Value Define Tag Groupings

12

Click on the Next button. The 'Define a Shape Script' page displays.

A Shape Script can be used to define the appearance of the Stereotype. To include a Shape Script, click on the Edit button.

The Shape Editor window displays. Create your Shape Script using this editor.

When you have finished creating the Script, click on the OK button. The image defined by the Shape Script is shown in the 'Preview' panel.

Note: For the Shape Script to take effect, you must select the 'Alternate Image' option when you save the Profile.

Alternatively, you can define a simple default appearance (background color, line color) for the model object, after you have created the Stereotype element.

Shape Scripts Export a Profile Shape Editor

13

Click on the Finish button. The Stereotype element and Metaclass element(s) are now displayed on the Profile diagram.

14

You can now:

  • Repeat steps 2 to 13 for each of the other Stereotype elements you want to create
  • Edit the Stereotype (and through it, the Metaclass) element properties you defined above, using the Profile Helper
  • Add Constraints to your Stereotype element
  • If a shape has not been set then you can now define the object's default appearance (background color, line color)
  • Set up the Quick Linker definitions for the stereotyped elements and connectors in the Profile

Quick Linker Set Default Appearance Define Stereotype Constraints Edit a Stereotype Element

Notes

  • If you intend to extend a large number of model elements, rather than putting all of them on one diagram you can create additional child Class diagrams under the <<profile>> Package and add different types of Metaclass elements to different diagrams; in this case you save the Package as the Profile, not the individual diagrams
  • Stereotype elements must have unique names, but Metaclass elements can have the same name (for example, there can be several Action Metaclasses, each with a different ActionKind attribute)
  • If you have a number of Tagged Values in the Stereotype element, and you have assigned them to groups, you can define which of those groups default to expanded (open) in the Tagged Values window, and which default to closed; open the 'Features' dialog for the Metaclass, at the 'Attributes' page, and add the attribute _tagGroupStates with the initial value <groupname>=closed;<groupname>=closed;<groupname>=open; ...

Learn more