Ardoq Graph Search uses the Gremlin graph traversal language. For more non-Ardoq specific reference guides to Gremlin, we recommend the two sources below. Please keep in mind that they are linking to external resources.
Gremlin is an effective graph query language that facilitates complex data exploration and analysis. It powers reporting capabilities in Ardoq, allowing for advanced filtering, relationship analysis, and detailed queries tailored to users' needs.
Table of Contents:
Ardoq Graph Search Examples
Below you will find some Ardoq specific Gremlin queries to get you started with solving business questions with Ardoq Graph Search.
Gremlin queries operate on vertices (entities) and edges (relationships) to traverse graphs, retrieve data, and apply conditions. Its syntax supports operations like filtering by properties, handling exclusions, and querying relationships.
Gremlin query: What is the overall cost of our application portfolio?
g.V().hasLabel('Application').
values('cost').
sum()
Gremlin query: What is the overall target cost of our application portfolio?
g.V().hasLabel('Application').
values('target_cost').
sum()
Gremlin query: Find all applications with no direct connection to capabilities
g.V().hasLabel('Application').
not(
both().
hasLabel('Capability'))
Gremlin query: What is the overall cost of all applications whose current lifecycle status is sunsetting?
g.V().hasLabel('Application').
values('lifecycle_status', 'Planned Sunset').
values('cost').
sum()
Gremlin query: Show all capabilities which are realized by multiple applications
g.V().hasLabel('Capability').
filter(__.in('Realized By').
count().
is(gt(1)))
Gremlin query: What is the average criticality score for the applications that are realized by the Product Portfolio Management capability?
g.V().has('name', 'Product Portfolio Management').
both('Realized by').
hasLabel('Application').
values('criticality_number').
mean()
Gremlin query: Show the name of the task with the highest time spent
g.V().hasLabel('Task').
order().
by('minutes', decr).
limit(1).
values('name')
Gremlin query: How many highly critical capabilities are dependent on high-risk applications?
g.V().hasLabel('Application').
has('risk', 'High').
in('Depends on').
hasLabel('Capability').
has('criticality', 'High').
count()
Gremlin query: Which high-risk capabilities are realized by high-risk applications?
/* Here, we consider a model where a capability might have different type names, like 'Capability level 1', 'Capability level 2'... We want to consider all components whose component type include 'Capability'
*/
def isCapability = {
((String) it.get().label()).contains('Capability')
}
g.V().hasLabel('Application').
has('risk', 'High').
in('Realized by').
filter(isCapability).
has('criticality', 'High')
Gremlin query: Which business process is impacted if Mongo-DB1 goes down?
g.V().hasLabel('Business Process').
filter(
repeat(
timeLimit(20).
both().
simplePath()).
until(
has('name', 'Mongo-DB1 ')))
Gremlin query: Which business processes are affected by Salesforce sunsetting?
g.V().hasLabel('Business Process').
filter(
repeat(
timeLimit(20).
both().
simplePath()).
until(
has('name', 'Salesforce')))
Gremlin query: Find all applications which has no connection (direct or indirect) to capabilities.
g.V().hasLabel('Application').
not(
filter(
repeat(
timeLimit(20).
both().
simplePath()).
until(
hasLabel('Capability'))))
Gremlin query: How to find all Applications that contain a tag called 'Fix'
g.V().hasLabel('Application').has('tags', 'Fix')
/* You could replace 'Application' for a different component type or you can remove this entirely and look for all Vertice tags in the graph using the following query */
g.V().has('tags', 'Fix')
Tips and tricks
Tips and tricks: Working with relative dates
/* Define relative date variables - have in mind that only SECONDS and DAYS are supported ChronoUnits in the Groovy runtime environment */
today = new Date().toInstant()
fiveDaysAgo= today.minus(5,java.time.temporal.ChronoUnit.DAYS).toString()
/* Filter on dates with steps such as has() and where() */
g.V().hasLabel('Application').
has('last-updated', lte(fiveDaysAgo))
Tips and tricks: Only consider components within a specific root workspace
/* Simply add the following filter */
.has('rootWorkspace', '<rootWorkspaceId>')
/* All applications */
g.V().hasLabel('Application')
/* All applications within the root workspace with id 59e884b41fa32c6dc6786176 */
g.V().hasLabel('Application').
has('rootWorkspace', '59e884b41fa32c6dc6786176')
Tips and tricks: Show the traversed path
/* Simply add .path() to the end of the query. This requires that the original query ends on a component or a reference */
g.V().hasLabel('Application').
outE('Runs on').
inV().
path()
Tips and tricks: Identifying Duplicate Data (Case-Insensitive Name Matching)
/* This query helps identify components with similar or duplicate names, treating "Apple" and "apple" as the same. This is incredibly useful for maintaining data quality and identifying inconsistencies within your model. */
duplicateNames = g.V().
group().by(values('name').map{ it.get().toLowerCase() }.fold()).
unfold().
filter(select(values).count(local).is(gt(1))).
select(keys).
map{ it.get()[0] }.
toList()
g.V().values('name').map{ it.get().toLowerCase() }.is(within(*duplicateNames)).order()
Tips and tricks: Access all the components in a traversal, and not just the “last” one
/* Simply add the following to the end of the query (this requires that the path does not include any explicit references (you should use .out() instead of .outE().inV()) Otherwise, you will end up with a collection which consists of both references and components, and then any operation which only works for only components or only references will fail) */
.path().unfold()
/* All components reached by outgoing references from the application called Excel */
g.V().hasLabel('Application').
has('name', 'Excel').
out()
/* Excel and all components reached by outgoing references from the application called Excel */
g.V().hasLabel('Application').
has('name', 'Excel').
out().
path().
unfold()
