Match Model#

The Match Model feature is used to Match a UML/SysML model to the code implementation. It features semi-automated model matching capability for Model Based Systems Engineering (MBSE).

Creating a Project#

  • Create a project as described in the section Multi-Module Projects or Create a Compound Project

  • The project should contain both the model and the code datasources.

  • Once the project is created, open the DSM: $root View.

  • Tag the elements by selecting the menu “Match Model->Tag Code/Model”.


This will create a green “model” tag and a red “code” tag. The “model” tag contains the model’s “Block/Operation” elements and the “code” tag contains the code’s “Class/Interface/Method” elements. after-tag-elements

View the Percent Mapped and Percent Validated by selecting the menu “Match Model->Manage Matches…”

manage-matches-init This is the baseline with no mapped or validated elements.

Currently Lattix supports matching from a Magicdraw model to code implemented in Java or C/C++ Clang.

Matching and Validating Elements#

Match model elements to code by selecting the menu “Match Model->Match” (this can take some time on large projects). A prompt will ask you to confirm as it will remove any existing non-verified model2code dependencies. Note: this is expected at this stage. do-match

Matches are visible in the DSM view as dependencies (with dependency kind “model2code”) of each model element on a code element (dependencies are read down the column). In this example, the RCUpdate::Run()_sys block has one operation, UpdateManualSwitches, which is matched (“uses”) to the method UpdateManualSwitches in the RCUpdate class: after-match

In the “Possible matches” section, in the bottom right of the dialog, you can see the match in the DSM by clicking [DSM] of a selected match. If that match is preferred, it can be selected by clicking on [Change To]. It is also possible to view the source code of that matched class or method by clicking on [View source], but it will require configuring an external editor/viewer (see How Do I Configure An External Source Editor Viewer Into Lattix view-source

The menu “Match Model->Manage Matches” opens a dialog that lets you see each individual match. Each match can then be manually validated by checking the box in the Validated column of the Manage Matches dialog box. The Percent Validated will increase as matches are validated. manage-validate

The Possible Matches are weighted with the highest weighted match at the top of the list.

Component Mapping Algorithm: To consider the dependencies as a criteria in the match, the component_mapping algorithm can be selected in the Manage Matches dialog. To make this selection available, you should press the “Create Component Mapping” button component-mapping

If you wish to see how Lattix defines the “Components” in the “Component Mapping”, you can click the “Show Component Partitioning” button. A view will be displayed for visual inspection, with the Model partitions on the left and Code partitions on the right. Typically there will be more partitions, elements, and dependencies in the Code than in the Model. show-partitioning

If you select the “component_mapping” algorithm, the matches are then suggested as Possible Matches between elements in similar partitions. Note that the Possible Matches for the selection of WeaponInventory are different than the ones presented with the “model2code” algorithm.