Partial graph query construction for count etc.