There should be at least basic support for aggregation in queries (i.e. count).
Currently the number of results of a query are available from the NodeIterator
returned by QueryResult#getNodes(). However since implementations are free to
return -1 if the number of elements is not available this method is not reliable.
IMO the current approach mixes two concerns: querying for nodes and querying for
the number of nodes satisfying the query condition. This is particularly
problematic since users might not be interested in both but still encounter any
performance impediment from calculating the other.