orientjs
orientjs copied to clipboard
Updated Edge returned with non-associated Node
orientdb version: 2.2.35 orientjs version: 2.2.7 node version: 8.11.2 os: centos07
I have an edge connecting two nodes A and B. I update the edge so that it connects nodes B and C instead. However when I select node A, the edge still appears as a related edge (even though the out/in of the edge disagree). I expected it to show up as a related edge of B/C after the update and NOT as a related edge of A.
Is there a way around this? why is this happening?
Hi @creisle
how do you update the edge?
I am updating it in a transaction
.let('updated', tx => tx.update(originalEdge['@rid'])
.set('out = $src').set('in = $tgt')
.return('AFTER @rid'))
where src and tgt are nodes I created earlier in the transaction
The same thing happens when I delete an edge within a transaction
Hi @creisle
you should use update edge statement in order to ensure graph consistency
https://orientdb.com/docs/2.2.x/SQL-Update-Edge.html
Which statement did you use for deleting edge?
Thanks
@maggiolo00 I used
tx.delete('EDGE', <RID>)
To use the UPDATE EDGE instead, how do I do so? do I just modify the statement to put EDGE in front of the RID?
.let('updated', tx => tx.update(`EDGE ${originalEdge['@rid']}`)
.set('out = $src').set('in = $tgt')
.return('AFTER @rid'))
I tried following a format similar to that suggested for delete but I get an SQL error because it puts a comma between EDGE and the RID
That said, even when I add it as string 'EDGE <RID>'
for the update I still have the same issue
Hi @creisle
do you have a sample script to replicate this?
Thanks