How to avoid duplicate node

I am creating something like this using the go client

a → b
a → c
b → d
c → d

then I commit my transaction and dgraph will create two nodes for d.

Is there anyway to make b and c point to the same node?

The bulk and live loader has support for that but I can’t figure out how to do this using the go client.

How exactly are you creating these nodes using the Go client. Using JSON or NQuads?

If they are part of the same mutation and you are using blank node identifiers, then it should be ok and only one node should be created for d. If they are part of different mutations in the same transaction, then two nodes would be created.

_:a <edge> _:b .
_:a <edge> _:c .
_:b <edge> _:d .
_:c <edge> _:d .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.