|
|
Populate Diagram from Query |
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 |
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.
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.

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)

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’)
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.
The multi-function populate button has the following options:

Adds any element to the diagram that has its Select checkbox selected, whether it is currently visible (i.e. not filtered) or not.
Adds any currently visible element (i.e. it is not filtered out) to the diagram regardless of its Select checkbox state.
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)
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:

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)
The remove multi-function button has the same options as the populate button:

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

These operations are performed graphically (so for example whilst you cannot add ports to the diagram using the helper – you can remove them)
All populate / remove / clear actions are added to the Rhapsody Undo buffer and may be undone using Rhapsody’s own Undo / Redo
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):

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.
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.
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):

The location for any new diagrams is decided by the following (in order of precedence):
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.

If the owning package of the query is not read only then new diagrams are created there.
If the project is not read only then new diagrams are created there.
If all three fail then an error is displayed.
The helper decides which <<New>> options to display using the following mechanisms (in the order of precedence)
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)
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:



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.
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
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.
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.
If none of the above apply, then the three base terms mentioned above are used:

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:
