0

I'm using DSE graph. I have a model like this:

AccountGroup "consists of" Account (AccountGroup -> Account). Profile "accesses_to" Account (Profile -> Account).

Now given an account_id, I need to return all the vertices and edges related to that Account.

My gremlin code looks like this:

g.V().has('Account', 'account_id', '123456').in().hasLabel('AccountGroup')

That only returns one AccountGroup for Account. How to write the query for getting all Account, AccountGroup and Profile?

TrongBang
  • 923
  • 1
  • 12
  • 23
  • Could you please provide a Gremlin script that creates some sample data - here is an example https://stackoverflow.com/questions/51388315/gremlin-choose-one-item-at-random – stephen mallette Nov 13 '18 at 11:08

1 Answers1

0

I think you want to the paths to all related vertices or just a tree. So it's either:

g.V().has('Account', 'account_id', '123456').
  inE('consists of','accesses_to').outV().
  path()

... or this:

g.V().has('Account', 'account_id', '123456').
  inE('consists of','accesses_to').outV().
  tree()

The latter is a more compact format but might be a bit harder to process on the client side.

Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34