Graphql type system support in DQL

I am not able to query types defined inside graphql schema in DQL

schema:

type Person {
  pid: String! @id
  email: String
}

DQL query:

{
  Person (func: type(Person)) {
      pid
      email
   }
}

Above DQL queries returns an empty list.

Try this:

{
  Person (func: type(Person)) {
      Person.pid
      Person.email
  }
}

The GraphQL fields get mapped to a type dotted DQL field name.

Still not working

Wondering what your actual data looks like. How did you add your data? (Live/bulk load, graphql mutations, dql mutations)

You might be missing the correct data types on the data and maybe even the correct predicates.

First I added my schema as mentioned above,
Then added data using graphql mutation. Graphql query gives data correctly.

Try going to the schema browser in Ratel, and see the Samples and Statistics for Person.email. Are their any? You can also click the query button next to the sample data (if there is any) to generate you a suitable DQL query.

1 Like

Try doing this:

{
  Person (func: type(Person)) {
      uid
      expand(_all_)
  }
}

This should at least show the uid if nodes exist and then it should show any other fields that are part of the type for those nodes.

This is working now, thanks. Genrated query from Ratel UI.

curious, what did it generate vs what you had and I had above?

the same query worked, I just went ahead and checked Samples and Statistics for Person.email, noticing node present