orientjs icon indicating copy to clipboard operation
orientjs copied to clipboard

Updated Edge returned with non-associated Node

Open creisle opened this issue 6 years ago • 6 comments

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?

creisle avatar Aug 02 '18 18:08 creisle

Hi @creisle

how do you update the edge?

wolf4ood avatar Aug 02 '18 18:08 wolf4ood

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

creisle avatar Aug 02 '18 19:08 creisle

The same thing happens when I delete an edge within a transaction

creisle avatar Aug 02 '18 19:08 creisle

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

wolf4ood avatar Aug 02 '18 19:08 wolf4ood

@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

creisle avatar Aug 02 '18 20:08 creisle

Hi @creisle

do you have a sample script to replicate this?

Thanks

wolf4ood avatar Aug 03 '18 08:08 wolf4ood