Query to return empty result

hi,everyone ,i am new learner of dgraph,but i am confused .
dataset:

{
  set {
   _:john <name> "John" .
   _:john <friend> _:joe .
   _:john <friend> _:sara .

   _:joe <name> "Joe" .
   _:joe <friend> _:steve .   
   
   _:steve <name> "Steve" .

   _:sara <name> "Sara" .
   _:sara <friend> _:maria .
   
   _:maria <name> "Maria" .

  }
}

add index:

# curl localhost:8080/alter -XPOST -d $'
> name: string @index(term) @lang .
> friend: string @index(term) .
> ' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   109  100    44  100    65    863   1275 --:--:-- --:--:-- --:--:--  1274
{
    "data": {
        "code": "Success",
        "message": "Done"
    }
}
{
    find_someone(func: eq(name, "John")) {
        name
    }
}

but result is empty,what is the problem ?thanks in advance.

It is running okay on my side.

BTW, “friend” is an edge. You are setting it as friend: string @index(term) . This is wrong. Should be <friend>: [uid] .

Please, do our Tour before anything tour.dgraph.io

Cheers.

thank you very much,i mistaked, did not create the right predicate

1 Like