Help - "predicate xxx of type uid is scalar"

Hi,
I’m using dgraph4j to persist a collection of entities that are interrelated… as per the JSON Mutations, I’m trying to use uid’s - which I’m setting to be of the format: “_:something”, where something is generally a UUID.

What am I doing wrong?

First offending line is this JSON object - failing on isRecipientOf.

Schema for isRecipientOf is specified as: “isRecipientOf uid @reverse .”

{
	"uid": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2 ",
	"firstName": "FIRST_NAME001w000001Jqbe5AAB",
	"lastName": "LAST_NAME001w000001Jqbe5AAB",
	"middleName": "MIDDLE_NAME001w000001Jqbe5AAB",
	"isCareRecipient": true,
	"account": {
		"uid": "_:a001w000001Jqbe5AAB ",
		"type": "sfdc",
		"idVal": "001w000001Jqbe5AAB"
	},
	"isAdminFor": {
		"uid": "_:cc2bb499ae-f001-469d-a51b-5b201295781c ",
		"name": "2bb499ae-f001-469d-a51b-5b201295781c",
		"isRecipientOf": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2 "
	},
	"belongsTo": {
		"uid": "_:cc2bb499ae-f001-469d-a51b-5b201295781c ",
		"name": "2bb499ae-f001-469d-a51b-5b201295781c",
		"isRecipientOf": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2 "
	}
}

Thank you.
S-

I don’t understand RDF too well… but it seemed that this error is saying, “hey you told me isRecipientOf was a scalar one time, and now you are saying it is a uid” - Some of the JSON objects before this offending JSON object had isAdminFor and belongsTo with value null. I fixed it so that nulls are not serialized to JSON…
Still get this scalar error.

What you want is something like


{
    "uid": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2",
	"firstName": "FIRST_NAME001w000001Jqbe5AAB",
	"lastName": "LAST_NAME001w000001Jqbe5AAB",
	"middleName": "MIDDLE_NAME001w000001Jqbe5AAB",
	"isCareRecipient": true,
	"account": {
		"uid": "_:a001w000001Jqbe5AAB ",
		"type": "sfdc",
		"idVal": "001w000001Jqbe5AAB"
	},
	"isAdminFor": {
		"uid": "_:cc2bb499ae-f001-469d-a51b-5b201295781c",
		"name": "2bb499ae-f001-469d-a51b-5b201295781c",
		"isRecipientOf": {
            "uid": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2"
		}
	},
    
	"belongsTo": {
		"uid": "_:cc2bb499ae-f001-469d-a51b-5b201295781c",
		"name": "2bb499ae-f001-469d-a51b-5b201295781c",
		"isRecipientOf": {
            "uid": "_:u5d143b28-53ec-4a9a-a985-4befac313bb2"
		}
	}
}

This is a common mistake and is also mentioned as a Note at https://docs.dgraph.io/mutations/#edges-between-nodes.

Ah - Yup it was mentioned… but didn’t have a place to hang that mention. Now I’ll never forget :slight_smile:

Thank you.

I fixed it and am not seeing the circular references in the graph. What I mean is I can navigate from FirstName to belongsTo fine. But from that belongsTo I can’t navigate back to the FirstName node… 'cause there isn’t a “isRecipeintOf” edge coming out of that node. I tried the following in ratel

{
  users(func: eq(firstName, "FIRST_NAME001w000001JqdJ0AAJ")) {
    uid, firstName, middleName, lastName, 
    accounts {expand(_all_)},
	belongsTo{name, isRecipientOf}
  }
  cc(func: eq(name, "91b9650d-5f9e-4706-8596-bdf97ea01171")) {
    name, isRecipientOf, isAdminFor
  }
}

What am I missing now?

Duh - I wasn’t doing expand on the isRecipientOf edge! NM
Thanks