Hi guys,
sorry could you help me with this query?
Model:
https://i.imgur.com/3n8MEzZ.png
I need to read all information about all the humans alive and for any human the
beers he loves, which car drives and in which house he lives.
With one query, my difficulty is to maintain a hierarchical relationship
between the human and the other nodes.
I found this solution but I don't know if it's the best one:
g.V().hasLabel("HUMAN").has("isLive",true).where(__.and(__.out("have").hasLabel("CAR"),__.out("have").hasLabel("HOUSE"))).both().hasLabel("BEER","CAR","HOUSE").valueMap().tree();
my expect result is like this:
[
{ Jon loves beer: Firestone, Bud , car: Mustang house: NYC},
{ Homer: beer:Duff, car: Plymouth house: SpringField},
{Sasha beer: Bud,Firestone, Bud, car: Ford, house: Chicago}
]
is it possible to do it with just one query? Could you help me?
Thanks