I want to find two or more vertices which have one same property. For example, find two different Person vretices with same name. I have tried the following:
graph.traversal().V().hasLabel("Person").as("a").where("a", P.eq("a")).by("name").where("a", P.neq("a")).by("vid").toList()
but the result is null(I am quite sure that there are qualified vertices in the graph.) Any help would be greatly appreciated. Thanks.
You have to scan through the vertices twice. With your current traversal, you only compare each vertex with itself.
g.V().hasLabel("Person").as("a").
V().hasLabel("Person").as("b").
where("a", P.eq("b")).by("name").
where("a", P.neq("b"))