To retrieve the Server Project Version in a Diagram


  1. Right-click the empty space on the diagram pane and open the Specification window.
  2. On the left side of the dialog, select TraceabilityCreate. Expression dialog opens.
  3. Select Create operation > Script.

  4. Specify the Name for the derived property.
  5. Set the Type as String.
  6. Specify the Operation Name.
  7. From the Language drop-down list, select JavaScript Rhino.
  8. Insert the following script as the Body

    JavaScript Rhino
    var prj = com.nomagic.magicdraw.core.Application.getInstance().getProject().getPrimaryProject();
    var ver = com.nomagic.magicdraw.core.ProjectUtilities.getVersion(prj);
    ver.getName();

  9. Click OK.


To display the Server Project Version in a Diagram


  1. Create the Note symbol in the diagram and anchor it to the diagram.
  2. Right-click the Note symbol and deselect Represent Diagram Context (Package).
  3. (Optional) Right-click the Note symbol and deselect Apply SysML Callout Style.
  4. Right-click the Note symbol and select Edit Compartments.
  5. In the Element Properties tab of the Compartment Edit dialog, select the name of the property you created.

  6. Click OK. You can see the property name and the server project version in the Note symbol.

Sample model

The model used in these examples is the Case Studies for Querying the Model sample model. To open this model, you need to download case studies for querying the model.mdzip