JanusGraphVertex added remains in the Graph DB if property already exist
Description
AIM is remove the ghost vertex which is formed which does not consists of all the properties desired since the code error out.
Below snippet calls the function where vertex is added with the properties
Calling function acceptRecord(record) throws an error when Property already exists which is unique and it is trying to add the same Property (key,value).
Eg: Emp1 -> has properties Age: 40, EID: 123, Phone: xxxx
EID is unique property
Emp2 -> Age: 41, EID: 123, Phone: xxyx
Since EID already exists, the below code throws an error but the JanusGraphVertex v = graphTransaction.addVertex(vertexLabel); has already been added which never gets deleted and leaves a ghost vertex.
Will changing the block to try catch work plus using graphTransaction.rollback() or v.remove(), to delete the vertex in the catch block
So this piece of code was throwing an error (attached below).
so adding this piece of code in a try-catch block and removing that particular vertex (v.remove()) works, where vertex is not added if it is duplicate
@SarthakGhosh16 sorry for the late response. would you like to create a pull request and contain your code change above?
@yhwang Sure. I'll create a pull request. Thanks!!
https://github.com/IBM/janusgraph-utils/pull/75 Pull Request