I'm experimenting with dgraph and so far my biggest struggle is to create an edge between two objects without prior knowledge of their uids (for bulk loading). Example - let's have two types - parent and child, the only difference is that child is always a leaf node, so the schema may be something like
<name>: string .
<age>: int .
<children>: [uid] .
type Parent {
name
age
children
}
type Child {
name
age
}
Now I would like to insert three nodes - two parents and one child - and create an edge between them, all that using one query, without prior querying uid. I imagine something like this:
{
"set": [
{
"name": "Kunhuta",
"age": 38,
"dgraph.type": "Parent"
},
{
"name": "Vendelin",
"age": 41,
"dgraph.type": "Parent"
},
{
"name": "Ferko",
"age": 14,
"dgraph.type": "Child",
"Parent": [
{
"name": "Kunhuta"
},
{
"name": "Vendelin"
}
]
}
]
}
(Suppose names are unique type identifiers)
Is it possible to somehow do so in dgraph?