redisgraph-go icon indicating copy to clipboard operation
redisgraph-go copied to clipboard

Adding Edges to previously created Nodes

Open tom342178 opened this issue 3 years ago • 1 comments

I am updating the graph from a stream of input data. I am updating the Nodes separately from the Edges.

From what I can see, the supported pattern is that I add the nodes and the edges that connect the nodes in the same commit. I did not see a way to create a node then at a later time add an edge to a node that had already been committed without adding the node to the Node map first. If I do that, it appears as though the node would be pushed to redis again.

Am I correct?

tom342178 avatar Jul 22 '22 16:07 tom342178

Let's first create two nodes:

graph.query g "create (x1 {n:1})"
graph.query g "create (x2 {n:2})"

Now, let's find these nodes and connect them with a new relationship:

graph.query g "match (x1 {n:1}), (x2 {n:2}) merge (x1)-[r:R]->(x2) return x1,r,x2"

LiorKogan avatar Jul 22 '22 16:07 LiorKogan