How to union query blocks

I thought about it, but I need a way to divide queries between each other. Because in this way I got a bunch of entities without any way to mark them with a correct alias in the result JSON.
I would like to do it as:

{
  group1: group1 {
    expand(_all_)
  }
  group2: group2 {
    expand(_all_)
  }
}

And then filter and paginate result of the query.
I tried to use query variables but idk why it doesn’t work.

variable as var(func: condition1)
data(func: uid(variable)) {
   uid(variable) {
      expand(_all_)
  }
}

It says, I can’t using uid with a variable, though documentation says it’s possible to use uid() with a variable :expressionless: