Exercise 19.1 - SysML Model Graph Analysis

Objectives

The new learning objective of this exercise is to create and analyze a graph of a SysML model without inter-model connections to engineering models in other repositories.

Preparation

This exercise assumes the student has

  • A SysML modeling tool, either Cameo System Modeler 18.5 - 19.0 or IBM Rhapsody, installed correctly on his or her machine with a valid license for use, and

  • Syndeia 3.3 installed as a plugin for the SysML with a valid license for use

  • Syndeia Cloud and a valid user account. The Syndeia SysML plug-in should be set up so that Syndeia Store Settings point to Syndeia Cloud

We will use the provided MagicDraw project SysML_Graph.mdzip or the Rhapsody project Video_SysML_Graph.rpy. Review the videos 18.1 – 18.4 for more background on graph analysis with Syndeia Cloud. In particular, Video 18.1 on the graph data model and Video 18.3 on Query Builder may be helpful.

Background – SysML Graph Analysis

Figure 1 Starter SysML model (in Cameo)

Some customers have expressed an interest in using graph analysis for analyzing a SysML model, independent of any connections to other models. This exercise will illustrate how Syndeia might be used for this purpose. The starter SysML model provided is shown in Figure 1 and has a set of artifact types, including blocks, activities and requirements, and a set of relationship types, including, abstractions (satisfy and allocate), part properties and containment.

Exercise

  1. The first task is to export the SysML model to Syndeia Cloud. Open the SysML model in Cameo or Rhapsody. Right-click an element (Video Tutorial Demo package in this example) in the browser and select Syndeia → Utils → SysML -> Syndeia Cloud, as shown in Figure 2.


    Figure 2 Pushing SysML model to Syndeia Cloud (example using Cameo System Modeler)

    1. In the Select an Option window, click Yes to push SysML model to Syndeia Cloud.

    2. When the push is complete, a message window reports, “Done pushing SysML model starting with package Video Tutorial Demo to Syndeia Cloud”. This may require more than a minute if the model is large.

      Note: Syndeia does not automatically update Syndeia Cloud with the SysML model internal structure, as it does with inter-model connections. It is necessary to repeat the manual push in order to update the SysML model in Syndeia Cloud.

  2. Login into your instance of Syndeia Cloud in your web browser. The first step is to identify the Container that holds the SysML artifacts from your model.  This may be tricky if there are multiple SysML models in Syndeia Cloud.

    1. One approach is to create a table of all the SysML models in the Syndeia Cloud graph database. A Gremlin query that can do this is
      g.V().hasLabel('Container').where(outE().hasLabel('ownedBy').inV().has('name','SysML Repository'))

    2. Using Query Builder, the same query can be generated by searching the label Container with the filter Repository.name : SysML Repository.

    3. If there are multiple SysML projects/containers, you need to identify the one you just created. If you display the results as a table, you can find the container with the name SysML Graph. Alternatively, sort by the Key column and look for the container with the highest Key number. In my example, this is CONT523. Record the key number of the container.

    4. Determine the key number of the Repository that owns the container CONT523 with the graph query

      g.V().has('sKey','CONT523').out()

      in this case, the Repository key value is REPO28. Record this also.

      Note: Keys are usually more convenient than names in graph queries. They are shorter and they are unique. However, Syndeia assigns keys in the order the objects are created, so the keys in my instance of Syndeia Cloud will be different than in yours.  In the next step, we will use the repository key value to create tables of key values for artifact and relationship types.

  3. Generate a table of artifact type in your SysML repository with the query

    g.V().hasLabel('ArtifactType').where(outE().hasLabel('ownedBy').inV().has('sKey','REPO28'))

    Display the results as a table of vertices, download as a .csv file, and edit the table in Excel to display the name and key values for the different artifact types as in Figure 3.


    Figure 3 Artifact types for REPO28

  4. Repeat the process for SysML relation types with the query

    g.V().hasLabel('ArtifactType').where(outE().hasLabel('ownedBy').inV().has('sKey','REPO28'))

    and generate a table similar to Figure 4.


    Figure 4 Relationship types for REPO28

  5. We will use the key values in these tables to generate some simple analyses of our graph

    1. A query for all requirements (ART-TYPE99) in container CONT523 would look like Figure 5.


      Figure 5 Query: Show all requirements in SysML model

      g.V().hasLabel('Artifact').where(outE().hasLabel('hasType').inV().has('sKey','ART-TYPE99')).where(outE().hasLabel('ownedBy').inV().has('sKey','CONT523'))

      Note: The SysML model contains three requirements, as shown in Figure 1.

    2. A query for all blocks (ART-TYPE103) in container CONT523 would look like Figure 5.


      Figure 6 Query: Show all blocks in SysML model

      g.V().hasLabel('Artifact').where(outE().hasLabel('hasType').inV().has('sKey','ART-TYPE103')).where(outE().hasLabel('ownedBy').inV().has('sKey','CONT523'))

      Note: The SysML model contains many blocks in its many packages and profiles, beyond the Block A, Block A1 and Block A2 of specific interest (Figure 1).

    3. A query for all part property relations (REL-TYPE62) in container CONT523 would look like Figure 7.


      Figure 7 Query: Show all part property relations in SysML model

      g.E().hasLabel('Relation').has('container','CONT523').has('type','REL-TYPE62')

      Note: The only part property relations in our model connect Block A, Block A1 and Block A2 from Figure 1.

    4. A query for all abstraction relations (REL-TYPE57) in container CONT523 would look like Figure 8.

      Figure 8 Query: Show all abstraction relations in SysML model

      g.E().hasLabel('Relation').has('container','CONT523').has('type','REL-TYPE57')

      Note: Syndeia treats both <satisfy> and <allocate> relations as abstractions and cannot currently differentiate between them.

    5. A query for all abstraction (REL-TYPE57), part property (REL-TYPE62) or containment (REL-TYPE56) in container CONT523 would look like Figure 9.


      Figure 9 Query: Show all abstraction, part property and containment (with exceptions) relations in SysML model

      g.E().hasLabel('Relation').has('container','CONT523').or(has('type','REL-TYPE57'),has('type','REL-TYPE62'),has('type','REL-TYPE56').where(and(inV().has('type','ART-TYPE99'),outV().has('type','ART-TYPE99'))))

      Note: This visualization approximates the SysML diagram in Figure 1. It uses both .and and .or steps, where .or allows for abstraction, part property or containment relations, while .and requires any containment relations to both start and end at requirements. There are many containment relations in the SysML model, most of them outside the Video Tutorial package.