How to get any data having space in between?

I have loaded below schema >>
name: string @index(term) .

Now I am loading below data >>
{
set {
_:avi “Avi” .
}
}

Now I am trying to get the data >>
{node (func: uid(0x4e)) { uid first name } }

“0x4e” is the uid of data loaded.

Actual result >> {
“data”: {
“node”: [
{
“uid”: “0x4e”,
“name”: “Avi”
}
]
}
Desired result >> {
“data”: {
“node”: [
{
“uid”: “0x4e”,
“first name”: “Avi”
}
]
}

Importing answer from https://github.com/dgraph-io/dgraph/issues/2530

Just to be sure, your mutation correctly is like this?

{
set {
_:avi <first name> "Avi" .
_:avi <last name> "Jain" .
}
}

I strongly recommend you to use like this

{
set {
  _:avi <first_name> "Avi" .
  _:avi <last_name> "Jain" .
  }
}

Spacing on predicates are not allowed. You will receive an error like this:

while lexing _:avi “Avi” .: Unexpected character ’ ’ while parsing IRI

Cheers

1 Like

Thank you!
I have managed to do so on my client, however it’s allowing spaces in between if i mutate using java client.