Reputation: 87
My vertices have one of two labels 'User' and 'Group', and edges are labeled 'contains'. A 'Group' vertex may point to 'User' vertices or other 'Group' vertices. I use the following query to find 'User' vertices starting from a Group vertex. If a 'Group' vertex points to another 'Group' vertex, it traverses to that sub 'Group' vertex to find 'User' vertices.
g.V().hasLabel('Group').has('AccountName','oem').repeat(out('contains')).until(hasLabel('User'))
Now I need to traverse out to 'Group' vertices that do not point to any other vertices. After reading some other postings I tried the following, but I got "Gremlin Query Compilation Error: Ambiguity between 'P.not' and '__.not'" What's the correct way to express something like that?
g.V().hasLabel('Group').has('AccountName','oem').repeat(out('contains')).until(not(outE())) <<== Error
Upvotes: 1
Views: 233
Reputation: 2759
Instead of using not(outE())
you could use outE().count().is(0)
as another means to express this query. That would remove the required ambiguity of explicitly using the P class or the anonymous traversal (double underbar, __
) with not()
.
Upvotes: 1