Exercise 11.2 - Gremlin Queries for Teamcenter

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

  • Teamcenter artifact types belonging to a specific Repository

  • Teamcenter artifacts connected in a specific Digital Thread Project

  • Artifacts connected to Teamcenter Items in a specific Digital Thread Project

Preparation

This exercise assumes the student has

  • Syndeia Cloud 3.6 installed with a valid user account, and

  • An existing Syndeia graph containing Teamcenter Items 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 1 for Running Saved Graph Queries and Creating Graph Queries and Part 19 – Syndeia Cloud Graph Analysis for general background.

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 Windchill data model maps to the Syndeia Cloud data model is discussed in the next section.

1.png
Figure 1 Syndeia Cloud Schema (simplified)

Background – Teamcenter

As envisioned by Intercax, the Digital Thread is composed of inter-model connections between models in different repositories, which Syndeia creates and manages, and intra-model connections between elements in the same repository, which the individual tool creates and manages. As of Syndeia release 3.6, the Syndeia Web Dashboard can extract and display some model information from the Teamcenter repository. Figure 1 shows a tree view of this information, with labels identifying the Teamcenter element types. The label color coding indicates how the Windchill element type is mapped to the Syndeia Cloud element types: Repository (green) and Artifact (blue). Teamcenter repositories do not have an element type corresponding to the Syndeia concept of Container, so Syndeia creates a default container for the entire Teamcenter repository for its internal graph.

This information is important in formulating and interpreting Syndeia graph queries. A more complete diagram of the Teamcenter data model as it is understood by Syndeia is available through the web dashboard help menu on the left.

 

1.png
Figure 2 Tree view of Teamcenter repository

Exercise

  1. Log on to the Syndeia Web Dashboard (see introductory videos for the web dashboard), open a Digital Thread Project (in our example, MBSB11 which includes relations to Teamcenter Items) and go to the Explore Queries page. In our example, it contains no saved graph collections or queries and appears similar to Figure 3.

  1. The first task is to create an empty Collection to contain our graph queries.

    1. Click on the Create Collection icon (Figure 3). Enter a name and description for the collection (Figure 4) and click Create.

 

  1. Our first objective is to extract a list of artifact types belonging to our Teamcenter repository (Teamcenter 14.3 @ Intercax). We will use the artifact type keys to build the later queries.

    1. Hover over the Tutorial Queries collection, click on the three-dot icon and select Create Query (see Figure 5).

 

  1. In the Create Query window (Figure 6), enter the name, query and description. In this case, the Gremlin query is g.V().has('sLabel','ArtifactType').where(outE().has('sLabel','ownedBy').inV().has('name','Teamcenter 14.3 @ Intercax')) which translates as “Get all nodes of type Artifact Type that are owned by the repository Teamcenter 14.3 @ Intercax”.

 

 

 

 

 

  1. To execute or “play” the saved query, expand the Tutorial Queries collection, hover over the new query (Figure 7) and click the green arrow. The query will execute in the main window and the results will be displayed initially graphically. Click on the Table View icon to display the artifact types with their Keys (Figure 8). We will be interested in Teamcenter Items with Key ART_TYPE813 in the next new queries.

 

 

  1. The second query asks for all Teamcenter Items connected in the active Digital Thread Project (MBSB11 in our example). As in Step 4, click Create Query next to Tutorial Demos. In the Create Query window, enter a Gremlin query such as g.E().has('Relation','container','MBSB11').bothV().has('type','ART-TYPE813') along with appropriate name and description. This query asks first for all Relations in the Syndeia project MSBS11 and then for all nodes at either end (bothV() includes both outgoing/Source and incoming/Target ends of the relation) with type ART-TYPE813, which we showed in the first query represents Teamcenter Items.

  2. Play the new query similarly to Step 5. The results should appear similar to Figure 9.

 

  1. We will use a slightly different approach to create the third query, show all nearest neighbor connected elements to Teamcenter Items in the active digital thread project (MBSB11 in our example).  Because this query, g.E().has('Relation','container','MBSB11').where(bothV().has('type','ART-TYPE813')) is only slightly different from the previous query (it returns the Relations themselves where one end is a Teamcenter Item), we will clone and edit it. To clone an existing query, hover over it, click the three-dot icon and select Clone (Figure 10).  In the Clone query window (Figure 11), edit name, query and description as needed and click Clone.

 

 

 

 

  1. The new graph query will appear under the Tutorial Demos collection. Execute it and it should appear similar to Figure 12.

  2. The entire set of queries can be executed and displayed by hovering over the Tutorial Demos collection and clicking the green arrow.