Subsequent mutations, in ratel and with pydgraph

Hi all
I guess this should be very basic, but I can’t find a suitable resource for the following question. This mutation describes two sample transactions, where Alice sends 50 to Bob and 100 to Charlie:

{
  set
  {
    _:alice <name> "Alice" .
    _:bob <name> "Bob" .
    _:charlie <name> "Charlie" .
    _:alice <to> _:bob (value="10") .
    _:alice <to> _:charlie (value="50") .
  }
}

The code works fine when executed in the ratel mutation UI. Now, if I want to add another transaction,

{
  set
  {
    _:bob <to> _:charlie (value="20") .
  }
}

and query with

{
  debug(func: has(name)) {
     uid
     expand(_all_)
  }
}

I don’t see the anticipated Bob → Charlie transaction.
Same for pydgraph: I could set the first scene with

txn = client.txn()
    try:
        p = {
            'name': 'Alice',
            'to': [
                {
                    'name': 'Bob',
                    'value': '10'
                },
                {
                    'name': 'Charlie',
                    'value': '50'
                }
            ]
        }
        assigned = txn.mutate(set_obj=p)
        txn.commit()

but adding something like

txn = client.txn()
    try:
        p = {
            'name': 'Bob',
            'to': [
                {
                    'name': 'Charlie',
                    'value': '30'
                }
            ]
        }
        assigned = txn.mutate(set_obj=p)
        txn.commit()

or even using the assigned UIDs as

txn = client.txn()
    try:
        p = {
            'name': 0x22,
            'to': [
                {
                    'name': 0x21,
                    'value': '30'
                }
            ]
        }
        assigned = txn.mutate(set_obj=p)
        txn.commit()

does not do the job. In the first example, two new nodes “Bob” and “Charlie” are generated, in the second example the UID is translated into an integer and integer-nodes are generated.
So I am clearly missing out on the correct syntax, could anybody help?
Many thanks!

Blank_nodes are used only in the context of the transaction. Dgraph will create a new Node if you use the same Blank_node again. You should then use the UID instead of blank_node on the second mutation:

e.g:

{
  set
  {
    <0x13883> <to> <0x13882> (value="20") .
  }
}

As for the other examples, they are all wrong in the concept.

For example 'name': 0x22, is not actually assigning anything. You are modifying the predicate “name”. Correct is 'UID': 0x22. And if you do not use ‘’ 'UID': $someuid" you will actually create a new Node always. Check this section for more details. Get started with Dgraph

Cheers.

Thank you, this is helpful.