Exercise 5.2 - Gremlin Queries for DOORS NG Requirements

Exercise 5.2 - Gremlin Queries for DOORS NG Requirements

Objectives

The objective of this exercise is to help new users of Syndeia graph analysis to formulate Gremlin queries to analyze their graph with the Syndeia Web Dashboard. The specific learning objectives of this exercise are to create lists of

  • DOORS NG artifacts in a specific Container

  • DOORS NG artifacts of a specific artifact type

  • DOORS NG artifacts connected as part of a specific Syndeia Project

Preparation

This exercise assumes the student has

  • Syndeia Cloud 3.3 or 3.4 installed with a valid user account, and

  • An existing Syndeia graph containing DOORS NG (DNG) requirements connected to elements in other repositories.

Because the content of your Syndeia graph will be different, the specific examples in the following exercise instructions are only a guide and example for your actions. It is generally advisable to carry out these exercises in a non-production repository, a “sandbox”, set up for training and practice purposes.

See the tutorials under Syndeia Cloud Web-Dashboard/Part 19 – Syndeia Cloud Graph Analysis for an overview of this feature.

Update for Syndeia Cloud 3.6 – This exercise assumes that the user has been assigned Global Graph Query permission by the Syndeia Cloud administrator in order to access the Graph Queries page. Screenshots in this tutorial were taken from an earlier release; the icons on the left margin of the figures and the graphical display format of query results have been modified but the instructions are otherwise unchanged.

Background – Syndeia Cloud Data Model

Figure 1 provides a simplified schema for elements in the Syndeia Cloud graph. All graph nodes are either Repositories, Containers, or Artifacts, where each Artifact is owned by a Container and Each Container is owned by a Repository. Each has a Type; the set of ContainerTypes and ArtifactTypes are owned by the Repository. How the DNG data model maps to the Syndeia Cloud data model is discussed in the next section.

Figure 1 Syndeia Cloud Schema (simplified)

Background – DOORS NG

As of Syndeia release 3.6, the Syndeia Web Dashboard can extract and display some model information from a DOORS NG (DNG) repository. Figure 1 shows a tree view of this information, with labels identifying the DNG element types. Note the different icons. The label color coding indicates how the DNG element type is mapped to the Syndeia Cloud element types: Repository (green), Container (red), and Artifact (blue). The Syndeia DNG integration supports a large number of standard DNG requirement types, including Requirement, Modules, and Collections, as well as Component-enabled objects such as Streams and Baselines. A more complete diagram of the DNG data model as it is understood by Syndeia is available through the web dashboard help menu on the left.

It is also important to understand the limitations of graph queries with respect to the DNG repositories. As of Syndeia 3.6, graph queries cannot extract the internal structure of a DNG repository, i.e. they cannot be used to obtain the full structure of the DNG repository or internal (intra-model) relations between DNG artifacts. In this way, graph queries are different than the Tree View or Graph View (Digital Thread Explorer) capabilities of the Repositories page in the Syndeia Web Dashboard. Graph queries are most useful in viewing inter-model connections from DNG elements to other repositories.

Figure 2 Tree view of DNG repository

Exercise

 

  1. Log on to the Syndeia Cloud Web Dashboard (see Video 1.2) and click on the Graph Queries icon on the left border.

  2. The first task is to compile a list of DNG Artifacts in a specific DNG Project. Per Figure 2, Projects in DNG are Containers and are owned by (specific to) a Repository. We will begin by creating a list of Containers available in a DNG Repository.

    1. If we use Query Builder (Figure 3), we select Container from the pull-down menu under Label.

      Figure 3 Graph Queries page (icon outlined in red) – Query Builder

    2. To restrict the list of Containers to our current DNG repository, we click Filters. We will filter by the name of our Repository, so we select Repository from the pull-down menu at the top marked Property of. Under Property Key, we select the Name property and under Property Value, we enter DNG @ Intercax. We then click the Plus (+) button to add the filter in the bottom list and the window should look similar to Figure 4. Click Close.

      Figure 4 Query Builder Filters window

  3. Back on the Graph Queries page, click Run. The results, a list of all Containers in DNG @ Intercax may be displayed in table form as in Figure 5. Key Container properties in the table are Name and Key because we will use these in the next search. Click the Exports icon to export the list as a CSV file for future reference, if desired.

    Caution: The list of DNG Projects listed in Figure 5 does not include all Projects in the DNG repository. Only those Projects that own Artifacts that are connected to other models (or are connected directly themselves) appear on the list. Other DNG Projects that do not involve connections to other repositories are not part of the Syndeia Cloud graph and do not appear in Gremlin graph query results.

    Figure 5  Graph Queries page, Containers results in table format (Export icon highlighted in red)

     

  4. Note at the top of Figure 5, the Query Builder utility has created a Gremlin query. We could have performed the same search with the same results by going to the

    Raw Query mode and entering this query directly.

    g.V().has('sLabel','Container').where(outE().has('sLabel','ownedBy').inV().has('name',’ DNG 6.0.2 @ Intercax (JTS, CCM, "RM", QM, LQE, (R)ELM, GC)'))’)

  5. The final part of the first task is to generate a list of all Artifacts in a specific Container within the DNG repository. Note that Syndeia will return only those DNG Requirements that are connected within the Syndeia Cloud graph, not all Requirements in the repository.

    1. We can search by Container Name (“Unmanned Aerial Vehicle”) or Key (CONT803), which we got from the table in Figure 5. Generally, it is better to search by Key, which is unique within the Syndeia Cloud database, rather than Name, which is not unique.

    2. If we use Query Builder, we select Artifact from the pull-down menu under Label, as in Figure 6.

      Figure 6  Query Builder, Artifact search

    3. To restrict the list of Artifacts to the DNG Project Unmanned Aerial Vehicle, we click Filters. We will filter by the Container Key, so we select Container from the pull-down menu at the top marked Property of. Under Property Key, we select the sKey property and under Property Value, we enter CONT803, which we took from the table in Figure 5.  After we click the Plus (+) icon, the Filters window should look like Figure 7. Click Close.

      Figure 7  Query Builder Filters window, filter by Container sKey

  6. Back on the Graph Queries page, click Run. The results, a list of all Artifacts in Container CONT803 may be displayed in table form as in Figure 8. Note that only DNG requirements that are part of the Syndeia Cloud graph appear; there may be other DNG requirements in this Project without connections to other repositories that do not appear.

    Figure 8  Graph Queries page, Artifacts results in table format, truncated

  7. Note at the top of Figure 8, the Query Builder utility has created a Gremlin query. We could have performed the same search with the same results by going to the Raw Query mode and entering this query directly.
    g.V().has('sLabel','Artifact').where(outE().has('sLabel','ownedBy').inV().has('sKey','CONT803'))

  8. The second task is to compile a list of DNG Artifacts of a specific type. Unlike most other repositories, ArtifactTypes in DNG are owned by (specific to) a Container, not a Repository. However, the Syndeia Cloud graph (Figure 1) requires that all ArtifactTypes belong to a Repository. We can begin by creating a list of Artifact types available in the DOORS repository.

    1. If we use Query Builder (Figure 9), we select ArtifactType from the pull-down menu under Label.

      Figure 9 Graph Queries page (icon outlined in red) – Query Builder

    2. To restrict the list of ArtifactTypes to our current DNG Project, we click Filters. We will filter by the name of our Repository, so we select Repository from the pull-down menu at the top marked Property of. Under Property Key, we select the Name property and under Property Value, we enter DNG 6.0.2 @ Intercax (JTS, CCM, "RM", QM, LQE, (R)ELM, GC) . We then click the Plus (+) button to add the filter in the bottom list and the window should look similar to Figure 10. Click Close.

      Figure 10 Query Builder Filters window

  9. Back on the Graph Queries page, click Run. The results, a list of all ArtifactTypes in this DNG repository may be displayed in table form as in Figure 11. Key ArtifactType properties in the table are Name, Key and ExternalKey because we will use these in the next search. However, some names, such as Requirement, appear multiple times with different keys. These represent the different Requirement types belonging to different DNG Projects.

    Figure 11  Graph Queries page, ArtifactTypes results in table format (Export icon highlighted in red)

  10. In practice, it is usually easier to identify the requirement type for a specific DNG Project using the Repositories page as in Figure 12 . We are browsing the specific DNG repository and Project and have selected a sample requirement of the type we want to search for. We have clicked the Details icon at the upper right. Under type.externalKey, we see the value _Fw7hYYKCEeeIeZmfnPUBsA. This was one of the External Keys listed for Requirement in Figure 11, so we have identified the specific Requirement ArtifactType for the Unmanned Aerial Vehicle DNG project. The corresponding Key value is ART-TYPE18.

    Figure 12 Repositories page, DNG requirement 2077 – Altitude selected, type highlighted in red (some DNG repository information grayed out)

  11. The final part of the second task is to generate a list of all Artifacts of this type Requirement within the DNG 6.0.2 @ Intercax Repository. Note that Syndeia will return only those DNG Requirements that are connected within the Syndeia Cloud graph, not all Requirements in the repository.

    1. In this case, we will filter by Key (ART-TYPE18) or externalKey ( _Fw7hYYKCEeeIeZmfnPUBsA), both of which are unique and specific to the Unmanned Aerial Vehicle project, rather than name (Requirement) which is not.

    2. If we use Query Builder, we select Artifact from the pull-down menu under Label, as in Figure 13.

      Figure 13  Query Builder, Artifact search

    3. To restrict the list of Artifacts to the DNG Requirement type, we click Filters. We will filter by the ArtifactType Key, so we select ArtifactType from the pull-down menu at the top marked Property of. Under Property Key, we select the sKey property and under Property Value, we enter ART-TYPE18, which we took from our analysis of Figure 11 and Figure 12.  After we click the Plus (+) icon, the Filters window should look like Figure 14. Click Close.

      Figure 14  Query Builder Filters window, filter by ArtifactType sKey

  12. Back on the Graph Queries page, click Run. The results, a list of all Artifacts of type ART-TYPE18, which is owned by the repository DNG 6.0.2 @ Intercax, may be displayed in table form as in Figure 15. Click the Exports icon to export the list as a CSV file for future reference, if desired.

    Figure 15  Graph Queries page, Artifacts results in table format, truncated (Export icon outlined in red)

  13. Note at the top of Figure 11, the Query Builder utility has created a Gremlin query. We could have performed the same search with the same results by going to the Raw Query mode and entering this query directly.
    g.V().has('sLabel','Artifact').where(outE().has('sLabel','hasType').inV().has('sKey','ART-TYPE18'))

  14. The third task is to compile a list of DNG Artifacts that are connected as part of a specific Syndeia Project. Syndeia Projects are partitions within the Syndeia Cloud graph database that separate different projects or system models. Syndeia Projects are Containers owned by the Syndeia Repository. Unlike DNG Projects, Syndeia Projects contain only relations, the inter-model relations that define the “macrostructure” of the Digital Thread for that system or project. In this case, we are looking not for the DNG requirements directly; we are looking for inter-model connections where one end is a DNG requirement.

  15. We will begin by creating a list of Containers available in the Syndeia Repository.

    1. If we use Query Builder (Figure 16), we select Container from the pull-down menu under Label.

      Figure 16 Graph Queries page (icon outlined in red) – Query Builder

    2. To restrict the list of Containers to the Syndeia repository, we click Filters. We will filter by the name of our Repository, so we select Repository from the pull-down menu at the top marked Property of. Under Property Key, we select the Name property and under Property Value, we enter Syndeia Repository. We then click the Plus (+) button to add the filter in the bottom list and the window should look similar to Figure 17. Click Close.

      Figure 17 Query Builder Filters window

  16. Back on the Graph Queries page, click Run. The results, a list of all Containers in the Syndeia Repository may be displayed in table form as in Figure 18. Key Container properties in the table are Name and Key because we will use these in the next search. Click the Exports icon to export the list as a CSV file for future reference, if desired.

    Figure 18  Graph Queries page, Containers results in table format, truncated

  17. Note at the top of Figure 18, the Query Builder utility has created a Gremlin query. We could have performed the same search with the same results by going to the Raw Query mode and entering this query directly.

    g.V().has('sLabel','Container').where(outE().has('sLabel','ownedBy').inV().has('name','Syndeia Repository'))

     

  18. The next part of the third task is to generate a list of all Relations within a specific Syndeia Project.

    1. We can search by Container Name (“Dirk Sandbox 02”) or Key (DZSB02), which we got from the results shown partially in Figure 18. Generally, it is better to search by Key, which is unique within the Syndeia Cloud database, rather than Name, which is not unique.

    2. If we use Query Builder, we select Relation from the pull-down menu under Label, as in Figure 19. Remember, the Syndeia Projects contain relations, not artifacts.

      Figure 19  Query Builder, Artifact search

    3. To restrict the list of Relations to a specific Syndeia Project, we click Filters. We will filter by the Container Key, so we select Container from the pull-down menu at the top marked Property of. Under Property Key, we select the sKey property and under Property Value, we enter DZSB02, which we took from the results shown partially in Figure 18.  After we click the Plus (+) icon, the Filters window should look like Figure 20. Click Close.

      Figure 20  Query Builder Filters window, filter by Container sKey

  19. Back on the Graph Queries page, click Run. The results, a list of all Relations in Container DZSB15, which is owned by the Syndeia Repository, may be displayed in table form as in Figure 21. Note that all relations within the project appear, not just those with a DNG artifact at one end.

    Figure 21  Graph Queries page, Relations (Edges) results in table format, truncated

  20. The final step is to identify the DNG requirements that participate in these relations, but this cannot be done in Query Builder alone. Note at the top of Figure 21, the Query Builder utility has created a Gremlin query.

     

    g.E().has('sLabel','Relation').has('container','DZSB02')

    We will use the Gremlin query language to append an additional condition. First, we will add an additional traversal step to go to the vertices at the end of the relations. Since we don’t know whether the DNG requirement will have an incoming or outgoing relation in the Syndeia project, we use the bothV() step to cover both ends.

     

    g.E().has('sLabel','Relation').has('container','DZSB02').bothV()

    Next, we will check all vertices for ArtifactType. Going back to the table in Figure 11, we choose DNG Requirement, ART-TYPE18.

     

    g.E().has('sLabel','Relation').has('container','DZSB15').bothV().has(‘type’,’ART-TYPE18’)

    If we select Raw Query and enter this in the Gremlin Query field, we generate the table in Figure 22, showing all DNG requirements of ART-TYPE18 used in the Syndeia Project DZSB02.  This may include multiple versions of the same requirement if each of those versions has a current inter-model connection.

    Figure 22  Graph Queries page, Artifacts results in table format, truncated

  21. There are alternate ways to approach the problem.  If we wanted to search for DNG artifacts in a specific DNG Project (CONT803) that were used in a Syndeia Project (DZSB02), we could reformulate the query using the first part from Step 20 and the second part from Step 13.

     

    g.E().has('sLabel','Relation').has('container','DZSB02').bothV().where(outE().has('sLabel','ownedBy') .inV().has('sKey','CONT803'))