Why does properties().dedup() return duplicates?
When I run the query V().both().properties().dedup() on the TinkerFactory modern graph, I see duplicates for some properties (for instance, vp[NAME->Marko] and vp[LANG->java] appear twice). Looking at the documentation, I do not understand how this is possible.
Any help is appreciated. Thank you!
2 Replies
EDIT: Never mind, that doesn't even make much sense to me anymore.
g.V().both().properties().dedup().by(value)
does seem to work better.
I think dedup() should filter on ID. There should be duplicate IDs, but they're all unique.
g.V().both().properties().dedup().id()
i think @wiebe has the answer right. you get duplicates of the property value because a
VertexProperty
is dedup'd on T.id
because it is a first class graph Element
. In the modern graph there are two vertices with a "java" property and each has its own id
so you see it twice:
if you do an elementMap()
you can see the ids/values more clearly:
using dedup().by(value)
is one way to deal with that, just note that you are filtering unique VertexProperty
objects there which may have some impact on your traversal depending on what you are trying to do.