Une image contenant texte, signe

Description générée automatiquement

Model Element Editor

 

Context Pattern Tags

Context Pattern Tags are a special kind of tag. You will find them used in profiles such as AUTOSAR and M2M.

The type of the tag is String, however the tag itself stores model elements by storing the full path(s) to those model elements:

A screenshot of a computer

Description automatically generated

 

 

Rhapsody provides special editors for such tags:

A screenshot of a computer

Description automatically generated

Rhapsody Editor for Context Pattern Tag with No Multiplicity

A screenshot of a computer

Description automatically generated

Rhapsody Editor for Context Pattern Tag with Multiplicity

Defining Context Pattern Tags

A tag becomes a context pattern tag under the following conditions:

1.     It is owned by a stereotype.

2.     The stereotype has a property named [tagName]ContextPattern

 

The context pattern property defines a context pattern that Rhapsody (and the Model Element Editor) uses to filter a picker. The sample model includes an example that has two tags, one with no multiplicity and another with multiplicity:

A screenshot of a computer

Description automatically generated

Note that this is the only time the Model Element Editor does not refer to the in-memory representation of the current model that it creates upon launch. Instead, it uses the Rhapsody search API to run the context pattern defined in the stereotype to obtain the applicable model elements. The Rhapsody API has no facility to perform a context pattern search directly, instead the helper creates a temporary table layout in the same package as the model element being edited (or if the element is at the root, then a new package is created to hold the layout). After the query has been run, these temporary elements are deleted. Note that this may cause issues if your profile has locked the model down and table layouts cannot be created (for example if your profile forbids them). An enhancement request has been submitted to IBM to be able to run such searches directly without the need to create a table layout.