Defining tags

You can use tags to add information to model elements to reflect characteristics of a specific domain or platform. The Features window for the various model element types contains a tab that lists the tags that were defined. You can define tags for a stereotype, for a specific metaclass, or for an individual model element.

Defining tags for a stereotype

If you define a tag for a stereotype, the tag will be available for any model element that has that stereotype applied to it.

Procedure

  1. Open the Features window for the stereotype that you want to define a tag for.
  2. On the Tags tab, use the Quick Add section to specify a name for the tag and optionally a default value, and then click Add.
    The new tag is now visible in the list of tags on the Tags tab, and beneath the stereotype in the model browser.
    Browser showing addition of tags
  3. Once the tag has been created, open the Features window for the new tag by clicking the Invoke Feature Dialog button Invoke Feature Dialog button.
  4. Use the Description tab to provide a description of the tag.
  5. On the General tab, use the Type field to specify the type of information that the tag will contain.
    Note: You can also set the type of the tag to be a type of model element. For example, you can set the type to Operation. Then, when you go to assign a value to a specific instance of the tag, you will be presented with a tree that allows you to select any element of type Operation.

Defining a tag for a metaclass

You can define a tag for a metaclass, and then that tag will be available for any model element of that type. For example, you can define a tag that will be available for any class in the model. To define a tag for a metaclass, you must add the tag to a profile.

Procedure

  1. Add an editable profile to your model. This can be a profile that you already created, or a new profile that you are creating as part of the project.
  2. Right-click the profile in the browser, and select Add New > Tag.
  3. Double-click the new tag to open its Features window.
  4. On the General tab, use the Applicable to field to specify the type of element that the tag should be available for, and optionally use the Value field to specify a default value for the tag.
  5. Use the Type field to specify the type of information that the tag will contain.
    Note: You can also set the type of the tag to be a type of model element. For example, you can set the type to Operation. Then, when you go to assign a value to a specific instance of the tag, you will be presented with a tree that allows you to select any element of type Operation.
  6. Use the Description tab to provide a description for the new tag.
  7. Click OK.

Defining a tag for an individual element

In some situations, you may want to define a tag to specify information for only a single element in the model.

Procedure

  1. Open the Features window for the specific model element.
  2. On the Tags tab, use the Quick Add section to specify a name for the tag and optionally a default value, and then click Add.
    On the Tags tab, the new tag is displayed under a category called Local. This makes it possible to distinguish tags that were defined for a single element from those that were defined for a stereotype or for an element type. Tags defined for stereotypes are displayed under a category with the name of the package that contains the stereotype. Tags defined for an element type are displayed under a category with the name of the profile that contains the tag.
  3. Once the tag has been created, open the Features window for the new tag by clicking the Invoke Feature Dialog button Invoke Feature Dialog button
  4. Use the Description tab to provide a description of the tag.
  5. On the General tab, use the Type field to specify the type of information that the tag will contain.
    Note: You can also set the type of the tag to be a type of model element. For example, you can set the type to Operation. Then, when you go to assign a value to a specific instance of the tag, you will be presented with a tree that allows you to select any element of type Operation.
  6. Click OK.

Defining a tag with multiple values

About this task

The General tab of the Features window for tags includes a Multiplicity field, which allows you to define a tag that can take more than one value. This can be especially useful when you set the type of a tag to be a type of model element. You can then set the value of a specific instance of the tag to point to a number of different model elements.

When you go to assign a value for a tag with multiplicity greater than one, you will see multiple lines for entering values.
Tag values dialog with multiple rows
Note: Keep in mind that if the multiplicity is greater than 1 and you then change the multiplicity to 1, all the previously entered values are cleared when you click OK in the Features window.

Using strings from AUTOSAR standard for tag values

About this task

When modeling with the AUTOSAR profiles, some tags have a list of strings (from the AUTOSAR standard) that you may want to use as the value of the tag. The strings that are provided depend upon the tag and the specific AUTOSAR element to which the tag is being applied. For example, WIRED and WIRELESS are provided for the tag category for the element EthernetPhysicalChannel. You can use one of the provided values, or enter a different value. When you click in the value field for a tag, an arrow is displayed if the tag has predefined options from the AUTOSAR standard.
Tag with predefined values from AUTOSAR standard

Modifying tag order in browser and Features window

By default, tags are displayed alphabetically in the model browser. You also have the option of modifying the display order that is used for tags in the browser. In the Features window, you can choose to have tags display alphabetically or in the order you specified in the browser.

Procedure

  1. From the main menu, select View > Browser Display Options > Enable Ordering.
  2. In the browser, select a tag that you want to reorder.
    The up/down arrows in the browser are enabled.
  3. Use the up/down arrows to move the tag up or down in the list of tags.
  4. If you want the order in the Features window to match the order that you specified in the browser, go to the Tags tab of the Features window and clear the Use default order check box. If you clear the Use default order check box, but have not specified an order in the browser, the tags are displayed in the order in which they were created.
    Note: The Use default order check box on the Tags tab corresponds to the property Dialog::ModelElement::TagsAutoArrange.