Facet Mutations via the Ratel Mutation Tab

When trying to add facets after an initial predicate creation, I am confused as to why json syntax works and rdf not:

{
  "set": [ 
      {
        "uid": "0x3",
  			"friendship": {
  				"uid": "0x6",
			  	"friendship|close": "true"
				}       
      }
    ]
}

the above works, the below not:

{
  set {
  	_:0x3 <friendship> _:0x6 (close=true) .
	} 
}

The RDF seems to create new uids instead of using the existing edge/predicate:

{
  "data": {
    "code": "Success",
    "message": "Done",
    "queries": null,
    "uids": {
      "0x3": "0xc",
      "0x6": "0xd"
    }
  },

I assume I must have a syntax error in the rdf…
Can someone shed light on the situation?

I am running on:
Built at 2020-07-27T13:14:00.436Z
Commit: 6e6738f
Commit Info: 6e6738f Thu Jul 16 20:56:21 2020 +0530 (HEAD -> master, origin/master, origin/HEAD)

Wow that was fast (to answer my own question):

Had another look at this:
https://dgraph.io/docs/mutations/#edges-between-nodes

_:0x3 <friendship> _:0x6 (close=true) .

needs to be changed to -->

<0x3> <friendship> <0x6> (close=true) .
2 Likes

Hey @gotjoshua, just to add to that when you use _:a you are allowing Dgraph to assign uids and _:a is used to refer to the same node in other parts of the mutation.

On the other hand you can use <0x3> syntax to refer to the nodes which have already been assigned uids and you know those uids (0x3 in this case).

1 Like