Looking for a count aggregator on DQL

As far as I know, the count within the same return block would honor the first and offset parameters. However, you could use a separate block to do total counts with DQL.

Something like:

query {
  anythingHere(func: type(YourType), first: 25, offset: 75)  {
    expand(_all_)
  }
  anyNameHere(func: type(YourType)) {
    total: count(uid)
  }
}

On a side note, I am quite confused for the purpose of layering a REST API on top of a GraphDB? GraphQL is a replacement for REST APIs. Do you have clients that require a REST API? This reverses many of the optimizations of having a graph database: underfetching, overfetching, and single endpoint to name a few. Not saying there may not be a use case, I just personally feel like it is taking a step backwards.

3 Likes