I am currenlty using Azure Cosmos DB[Gremlin API] to store Hierarichal Information. I am maintaining ParentChild Relationship amongst my vertices using edges of type 'ParentOf'.
Requirement: Given an known Parent vertex fetch all the child vertices[recursively derived] from the vertex.
Issue: I am using the below queries to fetch the required edges and vertices.
Fetch all the Vertices under vertexX Hierarchy: g.V().hasLabel('company').has('CompanyName', 'vertexX').emit().repeat(out('ParentOf')).until(__.outE().count().is(0))
Fetch all the Edges under vertexX Hierarchy.We are only fetching edges of defined by relation ‘ParentOf’: g.V().hasLabel('company').has('CompanyName','vertexX').emit().repeat(out('ParentOf')).until(__.outE().count().is(0)).outE('ParentOf')
Issue: Given an hierarchy where the grand child distance is greater than 32 the above query fails with below error: g.V().hasLabel('company').has('CompanyName','SR101').emit().repeat(out('ParentOf')).until(__.outE().count().is(0)).values('CompanyName'): Script eval error: ActivityId : b1f1fc11-f616-4ea4-8301-8e2eb32711d1 ExceptionType : GraphRuntimeException ExceptionMessage : Gremlin Query Execution Error: Exceeded maximum number of loops on a repeat() step. Cannot exceed 32 loops. Recommend limiting the number of loops using times(n) step or with a loops() condition. For example: ...until(hasId(targetId).or().loops().is(n)) Source : Microsoft.Azure.Graphs GremlinRequestId : b1f1fc11-f616-4ea4-8301-8e2eb32711d1 Context : graphcompute Scope : graphcomp-execquery GraphInterOpStatusCode : GraphRuntimeError HResult : 0x80131500
I have tried if subgraph() step can be useful,but in vain as cosmosdb has limited gremlin steps that can be used
It so appears this is an limitation. Are there any known best practices or workaround for this scenario.