AND and OR statement

Hi. I can not find the documents of AND and OR statement in DQL. They are already on GraphQL but I can not use GraphQL because go dgo does not support it

Here
https://dgraph.io/docs/query-language/connecting-filters/#and-or-and-not

2 Likes

Hi @MichelDiz . Thank you for the answering. Can I do something like this?

curl -H "Content-Type: application/dql" localhost:8080/query -XPOST -d '
{
  me(func: eq(name@en, "Steven Spielberg"))  @filter(eq(dgraph.type, "Character")) OR (uid(0x33996b)) {
    uid
    expand(_all_)
    name@en
    dgraph.type
    director.film @filter(allofterms(name@en, "jones indiana") OR allofterms(name@en, "jurassic park"))  {
      uid
      name@en
    }
  }
}' | python -m json.tool | less

I got this error:

{
  "errors": [
    {
      "message": "line 2 column 87: Got invalid keyword: uid at root",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ],
  "data": null
}

Change this to
@filter(eq(dgraph.type, "Character") OR uid(0x33996b) )

1 Like

It works. Thank you very much!