Equivalent to Neo4J MERGE command?

In Neo4J, if you are trying to create a new node(vertex) or relationship(edge) that might already exist, you can use the MERGE command. (The way they describe it, it’s a combination of MATCH and CREATE, e.g. create the vertex if it doesn’t exist and then do something with the vertex, such as add it to a relationship.). I have found this very handy!

(The reason why I want to do this, is I have some messy data that I want to load one item at a time, and depending on various conditions (not yet entirely determined!), I may want to create the vertex, create multiple related vertices if they don’t exist yet, and create a relationship between the original vertex and the related vertices.)

This is a nice Neo4J -> TG bridge for me: https://www.tigergraph.com/blog/gsql-for-cypher-users/

but it doesn’t describe the equivalent MERGE command I want.

I tried looking at the TG documentation, but there is a lot of it and I missed what I was looking for. I couldn’t find anything with Google either.

Thanks in advance.

will the following DML (INSERT/UPDATE/DELETE) statements work for you?

Not quite.

It seems like after the INSERT statement, there’s no variable associated with the newly inserted Vertex.

Also, it seems like an unnecessary overhead to overwrite the existing node.

I’m just starting with TG, but I think I will have to do an IF statement to see if the vertex exists then do the INSERT, and then do a SELECT to get the newly inserted vertex to do the equivalent of the MERGE.

I think for now, I’ll just use the overwrite property of INSERT.