The clients might need to get a valid uid in order to create new entities in the Dgraph DB. So, we have to expose some way in which the client can request the server for a UID (Which the server would generate, store and return)
We need a query format which could help doing this. One way is:
mutation {
get
}
which would generate a uid, store it in posting-list and return
{
uid: 0x12
}
This uid can be used by the client to associate other atributes to this entity by further mutations.
We could also extend this to
mutation {
get 10
}
To get 10 uids
{
uid: [12, 2334, 453, ...]
}
This would help reduce the number of calls made to the server in cases when we want to create a given number of entities at a time.
What do you think of this approach? Any suggestions/comments are welcome. @minions,
And then we internally automatically generate the UIDs, assign them to the RDFs and store them. We can also return the value of x and y back to the client in the response. This means each call to the server has a good chunk of mutations, avoiding back and forth to generate ids.