Creating instance specifications

You can create instance specifications in your model and add them to diagrams such as object model diagrams or block definition diagrams.

To create an instance specification:

  1. Select a package.
  2. Right-click to open the pop-up menu, and use the Add New... menu to create an instance specification in the browser.
  3. Open the Features window for the new instance specification.
  4. On the General tab, select the classifier for the instance specification.
  5. Click Apply or OK.
  6. You are asked whether you want to create slots for the classifier properties. If you answer No, you can create the slots later on.
Note: In SysML projects, there is no need to use the pop-up menu option; the Drawing toolbar contains a tool for drawing instance specifications on a diagram.

Creating instance specifications from existing classifiers

  • You can also create an instance specification by right-clicking an existing classifier in the model browser, and selecting Make an Instance Specification from the pop-up menu.
  • If you have an existing instance specification on a diagram, you can drag a classifier from the model browser onto the instance specification.

Creating slots for an existing instance specification

  1. Right-click the instance specification in the browser to open the pop-up menu.
  2. Select the Create slots for classifier properties... option. The Property Selection window is displayed.
  3. Select the properties for which you want to create slots.
  4. Indicate whether you want to have nested instance specifications created for non-primitive properties.
  5. Click OK.

Specifying values for instance slots

  1. Open the Features window for the instance specification.
  2. On the Values tab, each attribute has a line that allows you to specify the value. Enter a value for each of the attributes.
    Note: If the multiplicity of the attribute is greater than one, enter a series of values separated by commas.
    Values tab of Features window for instance specifications
  3. Click Apply or OK.

Customizing the display of instance specifications in the browser

There are a number of properties that can be used to customize the display of instance specifications in the browser.

  • Browser::Settings::DisplayHierarchicalInstanceSpecification

    For instance specifications that are based on classifiers that have non-primitive members, a hierarchy of instance specifications will be shown in the browser if the property DisplayHierarchicalInstanceSpecification is set to True.

    If the value of the property is set to False, slots representing non-primitive members are shown as ordinary slots.

  • Browser::Settings::InstanceSlotNameFormat

    Use the InstanceSlotNameFormat property to customize the content of the text that is displayed for instance slots in the model browser.

    The default value of the property uses the following keywords:

    • Name - name of the attribute/part/association that the slot represents
    • Multiplicity - the multiplicity defined for the attribute/part/association that the slot represents
    • Value - the value of the slot
  • Browser::Settings::InstanceSpecificationNameFormat

    Use the InstanceSpecificationNameFormat property to customize the content of the text that is displayed for instance specifications in the model browser.

    The default value of the property uses the following keywords:

    • Name - the name of the instance specification
    • ClassifierName - the name of the classifier on which the instance specification is based
    • IsCyclic - this keyword is used for situations where there is a cyclic relation between instance specifications. In such cases, Rhapsody® adds "..." to the text displayed.