Import single json creating unique nodes and edges

The correct JSON syntax for Dgraph would be

[ 
 { 
    "uid": "_:30", 
    "ToNodeId": [ { "uid": "_:1412" } ] 
 },
 ...
]

Note that you have to add the prefix _: in order to make them “unique” via blank node. Remember that Blank Nodes guarantees the uniqueness only in the procedure context(or transaction context) you can’t use it for future insertions/mutations.

It may possible to use numbers or hex, but you have to lease several uids from zero before doing it.

1 Like