1
votes

When I attempt to UPDATE/UPSERT an Edge using the syntax:

update relationship set in = #123, out = #456 upsert where in = #123 and out = #456

The Edge is created, but the Vertex in and out properties aren't populated, meaning the graph isn't traversible (and is just a collection of floating vertices in the browser).

This is in contrast to a basic CREATE command, which works as expected:

create edge relationship from #123 to #456

How can I make the UPDATE/UPSERT version populate the Vertex properties correctly?

2

2 Answers

0
votes

UPDATE EDGE doesn't support UPSERT, see issue #4436

0
votes

You can use “upsert” for edges since version 3.0.1 and it will work properly – but you need to do the following:

Create unique index on edge_class (out, in) and – it's strange – The order is important! To do this, you need to create in and out properties first, otherwise db can't create index and there will be an exception when you will try to run command “Create index”. Then, use command CREATE EDGE UPSERT FROM TO .

In this case edge will be created only if it is not exists, and it will create in and out properties for vertex classes.

But it still doesn't work for UPDATE command 'cos, as authors said, “The UPDATE/UPSERT works at document level, so it doesn't create the connections from the vertices. Using it, you will have a broken graph” and it still the same.