Exercise : Integrating existing data

We’ve added a new schema and loaded some company data, but what about integrating our previous friends dataset with this company one.

Trying to use the blank nodes from previous mutations won’t work. The blank nodes aren’t persisted in the store, so when referring to nodes created in a previous mutation, it’s the UID that’s needed. So instead of

_:sarah <works_for> _:company1 .

it’s

uid-for-sarah <works_for> uid-for-company1 .

Because the uid picked by Dgraph is unique, we can’t help you this time. Use the uid’s picked by your instance of Dgraph to write a mutation that links the company and friendship data. Hint: previous queries will tell you the uid.

The process you’ve just done here would normally done programmatically - query the data to get the uid’s, formulate the mutations, then batch the updates.

Endpoint: /mutate
Response