How to choose edges where vertices have a common property?

I would like to filter the edges by comparing one property of each vertex of the edge. This is the Gremlin code, which, as I hoped, will return all edges where the vertices are the same GROUP_NAMEas each other:

g.E.filter{it.outV.GROUP_NAME == it.inV.GROUP_NAME}

It does not return any results. What did I miss? Thank.

UPDATE:

This is one solution that handles direct comparisons, but I would like to be able to do different comparisons in addition to equality.

g.E.filter{it.bothV.GROUP_NAME.dedup().count() == 1}.count()
+3
source share
1 answer

I think your problem is that you need to snatch values ​​from the pipes. There are couple methods for this , but I would use next().

g.E.filter{it.outV.name.next() == it.inV.name.next()}

Obviously, you could use other comparisons there.

NTN!

+3

All Articles