How the query works when meets functions?

In the, I only find a simple example to explain how the query works. However, the actual query is more complex like follows. How query execution works with these functions, is there some resources could explain?

  me(func: eq(name@en, "Steven Spielberg")) @filter(has( {
    name@en @filter(allofterms(name@en, "jones indiana"))  {

I can’t quite tell what you want to know beyond what is already in the documentation. But - Every query is about keys, groups and function execution as requested.

The query you are demonstrating is:

  • First look for keys indexed with “name@en” and apply the function. And keep the keys found.

  • Second, it applies the filter with the “has” function to the keys with its params. And keep the keys found.

  • Third, it advances in the nested block through the requested edge (if it exists). And then apply the filter with the allofterms function.

  • Fourth, displays the result.

That would be the logical view of the thing. Each function can has its own rule or approach to dealing with data. Isn’t complex. Some things like variables can be complex under the hood. But it’s not that much.

Thanks,I would like to know the execution order of the query. As you know, the order in which sql database (mysql as example) execution the different functions such as select,where,join …etc is different. The different order of the functions may lead to different results.

The order I would say is:

First query root (which could be understood as “query header”) and then the filters in query root. And so the other nested edges are solved in the same order.

I think only what differentiates this is root and filters. I can’t imagine another situation that could change the result. Maybe paging functions can have something.

Basically Dgraph is based on the principle of GraphQL. That is “the query structure must match the given result vice-versa”.