AT
Join ServerApache TinkerPop
questions
addV with existing ID doesn't throw error
Kkyano2/1/2023
I noticed when I call
This is verrrry undesirable behavior, I would need to it throw a constrain violation.
Any thoughts?
addV(newLabel)
with an existing ID but a different label, it will add the newLabel
and the new properties defined to the existing vertex.This is verrrry undesirable behavior, I would need to it throw a constrain violation.
Any thoughts?
Sspmallette2/1/2023
what graph system are you finding this happening with?
Sspmallette2/1/2023
i would expect the following on any graph:
gremlin> g.addV('new').property(id, 1).property('name','stephen')
Vertex with id already exists: 1
Type ':help' or ':h' for help.
Display stack trace? [yN]
Sspmallette2/1/2023
i think i recall you were using Neptune - is that right?
Solution
Ttriggan2/1/2023
This works on Neptune b/c of the support for multiple labels. :/
Sspmallette2/1/2023
interesting. i knew Neptune had multi-labels but wouldn't have expected
addV()
to trigger the multiple labelsSspmallette2/1/2023
no workarounds? i guess you'd just have to always validate with
fold()/coalesce()/unfold()
?Ttriggan2/1/2023
Yes, or use
mergeV()
once it is supported.Eedolivares2/1/2023
Yea this was my problem the other day haha. I wrote a bunch of code that consolidates messy gremlin, locally against the gremlin-server @ 3.6.0 only to realize it’ll have to get stashed until Neptune supports that version
Sspmallette2/1/2023
so you were trying out the new
mergeV()
and mergeE()
steps?Kkyano2/2/2023
Hmmm
Kkyano2/2/2023
ok
Kkyano2/2/2023
Thanks
Eedolivares2/8/2023
Yes, I was trying it out locally against docker gremlin-server but, I’ll come back to it once gremlin 3.6.0 is supported by Neptune
Sspmallette2/8/2023
do you happen to have any feedback/thoughts on the API that those new steps offer?
Eedolivares2/15/2023
I think they’re great you all are amazing! I’d need to look at the internals I wasn’t sure if it is actually calling coalesce or if there is some more complicated conditional logic in there under the hood but, the abstraction is nice and intuitive and it does what I would expect.
Sspmallette2/15/2023
it is not calling
coalesce()
it is a brand new natively executed step