I'm developing a web application using OrientDB and the Java API. I have discovered that it is creating (ie. saving) duplicate Edges with the same Vertices.
How do I query whether an Edge exist (for the same pair of Vertices). (And if they do not exist, I'll then create a new Edge with the pair of Vertices.)
The Edge has been successfully created in the OrientDB with a class name, using:
openGraphNoTx.createEdgeType("Friendship");
The Edge has been successfully added like this:
openGraphTx.addEdge(null, fanV, influencerV, "Friendship");
So, I'd like to query/search with the fanV and influencerV vertices to retrieve any existing Edge if it already exist. How do I do this?
I tried using:
fanV.query() ... and build the query and then fanV.edges()... but can't figure out how to set the query parameters.
fanV.getEdges(Direction.IN, friend.getId().toString()); ... ??? can't fiture out how to set the query parameters.
... but can't figure it out.
Any help on how to search/query/retrieve an Edge in Java would be appreciated. Thanks!
I found the answer myself:
... will retrieve any existing Friendship edge.