I'll describe in Cypher (as best I can) because it's easiest to write up the graph that I have.
I have a graph thus:
RootNode-[:hosts]->Container-[:contains]->Container-[:contains]->Container-[:contains]->Item
-[:contains]->Item
The first container "hierarchy" here describes vehicles containing cages containing boxes containing items. As such there are two Items in my graph, Item1 is in a box in a cage in a vehicle while Item2 is loose and floating around in the vehicle not in a box or cage at all.
The following Gremlin query "compiles" for me (this is a huge milestone for me):
g.V.out('hosts').as('contained').out('contains').loop('contained'){true}
Unfortunately it returns no items. If I change the loop condition to "it.loops<4" then I only get one result - for Item1.
My ultimate goal is to find all "leaves" i.e. Items. I'm trying to build the query one step at a time but I'm no longer confident again about how "loop" actually works with respect to maintaining the objects passed-in to it.