Une image contenant texte, signe

Description générée automatiquement

Populate Diagram from Query

 

Overview

This helper allows automatic population of a diagram from a connected query/table layout.

 

Applicable To

Query, Table Layout

Menu Entry

Power Pack Diagram Tools Create / Populate Diagram from Query

Applicable To

Use Case Diagram, Object Model Diagram, Structure Diagram

Menu Entry

Power Pack Diagram Tools Populate Diagram from Query

Demonstration

Watch the Video

Operation

The helper may be launched from a query / table layout to generate new diagrams or modify existing ones.

The helper may be launched from a diagram to modify that diagram by query.

 

Getting Data to Add to the Diagram

The helper first obtains the set of model elements with which to populate the diagram by running the query.

If launched from a diagram then the helper looks for a dependency from the diagram to a query, stereotyped <<populatedFromQuery>>. If no such query is found, then an error is reported. The dependency is automatically added for diagrams generated from a query or may be added manually.

 

A screenshot of a computer

Description automatically generated

When the query has executed, its results are presented in a UI (note that if the helper is launched from a diagram, then the diagram selector combo box is omitted)

A screenshot of a computer

Description automatically generated

Filtering

The Filter box uses a regular expression so (for example) it is possible to distinguish between Constraint Blocks and Blocks by typing ^Block (that is ‘starts with Block’)

Navigation

Double-clicking any result in the table will navigate to it in the Rhapsody browser.

Selecting a diagram to edit in the diagram picker will automatically open the diagram in the Rhapsody editing area.

Adding Elements to the Selected Diagram

The multi-function populate button has the following options:

A screenshot of a computer

Description automatically generated

Add Selected to Diagram

Adds any element to the diagram that has its Select checkbox selected, whether it is currently visible (i.e. not filtered) or not.

 

Add Visible to Diagram

Adds any currently visible element (i.e. it is not filtered out) to the diagram regardless of its Select checkbox state.

 

Add Entire Table to Diagram          

Adds every element in the table to the diagram, ignoring filters and Select checkbox state.

 

When clicked the elements will be added to the current diagram – or a new diagram (see Diagram Selector below)

Adding Relations

To add relations between the elements that get added to the diagram, select any of the relation options before clicking the multi-function populate button:

A screenshot of a computer

Description automatically generated

 

Notes for Adding Elements to the Diagram:

The helper uses Rhapsody’s own Populate feature (like the one you get from the Rhapsody UI Populate option) which means:

·       The helper does not know / care what is already on the diagram.

·       Rhapsody decides on the layout.

·       Behaviour is restricted to what Rhapsody allows from that feature (for example you cannot add ports to the diagram using this helper – Rhapsody displays ports based on diagram properties and cannot be added later using Populate).

·       Part relations in SysML are added using ‘Association’ (Composition is analogous to the ‘Instance’ option in the UI which ‘instance’ is reserved by Rhapsody for software models where there is an Object inside a class)

Removing Elements from the Selected Diagram

The remove multi-function button has the same options as the populate button:

A screenshot of a diagram

Description automatically generated

In addition, the Clear Diagram button will remove all graphical elements from the selected diagram (independent of the results returned by the query)

A screenshot of a diagram

Description automatically generated

These operations are performed graphically (so for example whilst you cannot add ports to the diagram using the helper – you can remove them)

Undo

All populate / remove / clear actions are added to the Rhapsody Undo buffer and may be undone using Rhapsody’s own Undo / Redo

Diagram Selector

When launched from a query/table layout, the UI presents a diagram selector that is pre-populated with all diagrams connected to the query as well as the options to create new diagrams (see Populating the <New> List below):

A screenshot of a computer

Description automatically generated

Selecting a diagram will set it as the current diagram for population and automatically open that diagram in the editing area in Rhapsody. Selecting any of the <<New>> options will set the current diagram to ‘none’ – clicking the populate multi-function button will create a new diagram of the selected type, set it as the current diagram and open it for editing in Rhapsody.     

Updating the Table Selection

When launched (if there is a connected diagram) or when an existing diagram is selected in the Diagram Selector, the table automatically updates, selecting any elements already on the diagram (if they were returned by the Query). This option may be disabled using the Options menu.

 

Diagram display

Connected diagrams are displayed in the selector using the format [type] [name]

The [type] displays either the full model element type or the shortened version if it has one. The shortened version is taken from the following property on the new term diagram stereotype:

[BaseDiagramTypeSubject].General.SysMLDiagramKindTitle

For example, the SysML Block Definition Diagram stereotype (which is based on an Object Model Diagram):

 

A screenshot of a computer

Description automatically generated

New Diagram Location

The location for any new diagrams is decided by the following (in order of precedence):

1.     By Dependency

If the query has an incoming dependency (from a package) stereotyped <<queryForDiagramPopulation>> and that package is not read only then new diagrams are created in that package (each query should have only one such dependency). The direction of these (and other) dependencies allows the queries to be read-only which is typical of those found in profiles.

 

A screenshot of a diagram

Description automatically generated

 

2.     By Owner

If the owning package of the query is not read only then new diagrams are created there.

 

3.     At Project Level

If the project is not read only then new diagrams are created there.

 

If all three fail then an error is displayed.

Populating the <<New>> List

The helper decides which <<New>> options to display using the following mechanisms (in the order of precedence)

 

1.     By Explicit List

The helper checks the new diagram location package/project for the following property:

RhapsodyPowerPackExtension.PopulateDiagramFromQuery.ListOfStereotypes

This property does not exist by default and is intended for profile designers to add their own ‘whitelist’ property (see below)

 

2.     By User Defined List

The helper checks the new diagram location package/project for the following property:

RhapsodyPowerPack.PopulateDiagramFromQuery.ListOfStereotypes

This property is part of the power pack and is intended for users to define a local whitelist property.

 

If either of the above properties have content, then that is used to populate the <<New>> list. The whitelist should be a comma separated list of full paths to new term stereotypes and/or the following base terms:

·       UseCaseDiagram

·       ObjectModelDiagram

·       StructureDiagram

For example:

A screenshot of a computer

Description automatically generated

A screen shot of a computer

Description automatically generated

 

3.     By Explicit List of Packages / Profiles

This option is especially useful for larger profiles such as UAF where there are many possible diagram types, but it is expected that each part of the model only contains a subset of those types. The helper checks the new diagram location package/project for the following property:

RhapsodyPowerPackExtension.PopulateDiagramFromQuery.ListOfPackagesOrProfiles

This property does not exist by default and is intended for profile designers to add their own ‘whitelist’ property for specific parts of their models. This is a comma separated list of Packages or Profiles that may contain stereotypes. The specified locations are checked (recursively) for available diagram stereotypes.

 

4.     By User Defined List of Packages / Profiles

This is the user-defined version of the above property that is it does exist and may be populated by a user to constrain the list)

RhapsodyPowerPack.PopulateDiagramFromQuery.ListOfPackagesOrProfiles

 

5.     Use All Profiles

If this property is set to true, then no further checks are made. Any applicable stereotype found in any currently loaded profile is made available.

 

6.     By Project Type

If the project has a new term stereotype applied, then the helper locates that profile and automatically populates the <<New>> list with all available new term stereotypes based on any of the three base terms mentioned above. For larger profiles such as UPDM this may result in a long list of <<New>> options and in such cases the whitelists above are recommended.

 

7.     UML

If none of the above apply, then the three base terms mentioned above are used:

A screenshot of a computer

Description automatically generated

Since these properties are checked on the target diagram location it is possible for each package that contains generated diagrams to have a different <<New>> list by adding the <<queryForDiagramPopulation>> dependency:

A screenshot of a computer

Description automatically generated