0

I am running cosmosdb with the Gremlin API, giving me a graph database. Most of my gremlin traversals are basic stuff, but I have one that I can't figure out the query for. Take this model

enter image description here

I want to start at Service B. I want to walk outE("MAKES_CONNECTION") edges to only ServiceConnections that have an inE("CONNECTION_ENVIRONMENT") where the properties of the environment are stage=dev and env=dev. Then step down the ServiceConnection.outE("MAKES_CONNECTION") and print off the ServiceName value, in this case, the printed value would be Service C

To explain whats going on here in plain text. Service B makes an HTTP connection to Service C in the Dev environment. But in the QA environment, it makes a connection to Service D

scphantm
  • 4,293
  • 8
  • 43
  • 77

1 Answers1

0

Untested, but I think this is right (pictures are nice, but if you want a tested traversal it's always best to include some sample data):

g.V().has('ServiceMap','ServiceName','B').
  out('MAKES_CONNECTION').has('type','ServiceConnection').
  filter(__.in('CONNECTION_ENVIRONMENT').has('stage','dev').has('env','dev')).
  values('ServiceName')
stephen mallette
  • 45,298
  • 5
  • 67
  • 135