Add a method for counting the number of tuples a query returns.

Sparql in particular doesn't have a built-in counting construct; therefore,
a helper method is desirable to facilitate paging and the like.