So try like this:
{
A as var(...) {} //Already wrote this query.
B as var(...) {} //Already wrote this query.
allResults(func: uid(A, B) ) {
uid
expand(_all_)
}
}
For the Dgraph there is no problem of performance to have different query blocks.