I am referencing the example used in this blog post to base my question :
http://discuss.dgraph.io/t/dgraph-tutorials-series-2-uid-operations-updating-nodes-and-traversals-dgraph-blog/5251
Assuming that currently we have :
Michael < follows > Pawan
Pawan < follows > Leyla
Leyla < follows > Micheal
Imagine I have a dataset of two columns in excel that I want to add to this graph
column1 : person name : (eg. Ryan)
Column 2 : follows ( either Michael /pawan/ Leyla)
now if there was a single row I could go with the query :
{
"set":[
{
"uid": "RYANS_UID",
"follows": {
"uid": "MICHAELS_UID"
}
}
]
}
However instead of manually looking up RYAN and MICHEAL’s UID is there an upsert block that can do it programmatically ?
I tried :
upsert {
query {
v as var(func: eq(name, "Michael"))
}
mutation {
set {
"name" : "RYAN",
"age" : "26",
"follows" : { uid(v)}
}
}
}
I get the following error
Error: t: while lexing upsert { query { v as var(func: eq(name, “Michael”)) } mutation { set { “name” : “RYAN”, “age” : “26”, “follows” : { uid(v)} } } } at line 7 column 9: Invalid character ‘{’ inside mutation text
The context for this question is I have modeled master data as nodes and I would like to add events linking to existing nodes using Ratel UI