Exercise 20.3 - Digital Thread Queries for Teamwork Cloud
Objectives
The objective of this exercise is to help new users formulate digital thread graph queries for Teamwork Cloud (TWC) to analyze inter-model relations from/to artifacts in Teamwork Cloud to artifacts in other digital engineering repositories. The specific learning objectives of this exercise are to:
create a new Teamwork Cloud query collection for a Digital Thread Project.
create graph queries (using Gremlin language) to analyze relations from/to Teamwork Cloud artifacts.
run the queries to display the graph view of Teamwork Cloud relations.
Preparation
This exercise assumes the student has:
Syndeia Cloud 3.7 installed with a valid user account.
User has reviewed and successfully performed all the steps in the previous tutorials:
An existing digital thread project containing relations from/to TWC artifacts (e.g. SysML element) to/from artifacts in other repositories.
Because the content of your digital thread project 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.
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, Artifacts, or their types 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 TWC data model maps to the Syndeia Cloud data model is discussed in the next section.
Background – Teamwork Cloud (TWC) and Queries
For TWC basics, refer to the Background section in the previous tutorial Exercise 20.2 - Exploring the Search/Details/Relations Tab and Graph View of TWC Artifacts.
For Gremlin query basics, refer to https://intercax.atlassian.net/wiki/x/q40C-/ .
Exercise
Select a Digital Thread project that has existing relations to and from TWC artifacts. In this example, we are using the project Autonomous Vehicle (AV01). Go to the Explore → Queries interface as shown in Figure 3.
Create a new query collection by clicking the folder icon button as shown in Figure 4. Name the collection ‘Teamwork Cloud Queries’, give it a description and click the Create button.
We will add our first query. Click the three dots next to the collection and select Create Query as shown in Figure 5. In the Create Query window, name it ‘Get All TWC Artifact Relations’ and give a description. Copy and paste the below query in the Gremlin Query field.
g.E().has('Relation', 'container', 'AV01') .has('_isLatest', 'TRUE') .where(bothV().repeat(out('ownedBy')) .until(hasLabel('Repository') .has('name', 'Teamwork Cloud 2024x @ Intercax')))In the query, make the following changes specific to your digital thread project and TWC repository:
Specify the Key of your digital thread project (e.g. AV01) in the first
hasstep of the query -has('Relation', 'container', 'AV01')Specify the Name of the TWC repository you are using (e.g. Teamwork Cloud 2024x @ Intercax) in the last has step of the query -
has('name', 'Teamwork Cloud 2024x @ Intercax').This will be the name that was given to the repository when adding it, as shown in Figure 6.
Click Create to finish.
The first newly created query will now show up in the Teamwork Cloud Queries Collection shown below in Figure 7. Run the first query by clicking the Play button .
This will execute the query and fetch both outgoing and incoming relations to elements in the given Teamwork Cloud repository, and display them in the query results area shown in Figure 8. The color keys on the RHS indicate artifacts by repository type (e.g. Jama, Jira).
Click on Settings (gear button shown below in Figure 9) and set Select edge display label as Relation Type to show the relation types for inter-model relations (i.e. Refines) in the graph view shown below.
Add a 2nd query by cloning the first query. To do this, hover over the first query, click the More Options menu (three vertical dots), and select the Clone option, as shown below. In the Clone Query window shown in Figure 10, name it ‘Get All Incoming Relations to TWC Artifacts’ and give a description. In the Gremlin Query field, we will update the bothV() to inV() so that the raw query is:
g.E().has('Relation', 'container', 'AV01') .has('_isLatest', 'TRUE') .where(inV().repeat(out('ownedBy')) .until(hasLabel('Repository') .has('name', 'Teamwork Cloud 2024x @ Intercax')))Click the Clone button to finish.
Clone the 2nd query above by repeating step 7. But in this case, name it ‘Get All Outgoing Relations to TWC Artifacts’. In the Gremlin Query field, we update the inV() to outV() so that the raw query is:
g.E().has('Relation', 'container', 'AV01') .has('_isLatest', 'TRUE') .where(outV().repeat(out('ownedBy')) .until(hasLabel('Repository') .has('name', 'Teamwork Cloud 2024x @ Intercax')))
For the 4th and final query, we will see all relations between TWC and Jama (or any two repositories). Create a new query in the Teamwork Cloud queries collection (see step 3) and use the following Gremlin query:
g.E().has('Relation', 'container', 'AV01') .has('_isLatest', 'TRUE') .where(outV().repeat(out('ownedBy')) .until(hasLabel('Repository') .has('name', 'Teamwork Cloud 2024x @ Intercax'))).where(inV().repeat(out('ownedBy')) .until(hasLabel('Repository') .has('name', 'Jama @ Intercax')))The 1st where step above filters relations where the source vertex outV() belongs to the Teamwork Cloud repository with the given name.
The 2nd where step above filters relations where the target vertex inV() belongs to the Jama repository with the given name.
Run the query by clicking the Play button . Repeat the Relation Type display setting in step 4 and the result should look like Figure 11 below. You can repeat steps 8-9 for any pair of repositories.
There should now be 4 queries in the Teamwork Cloud Queries Collection. You can run the entire collection of queries (all 4) by clicking the Play button next to the query collection, as shown in Figure 12 below.
Congratulations! You have now learned how to create and run digital thread queries (using Gremlin) for Teamwork Cloud artifacts.