One can count the number of different values for a variable in a result. A count operator, combined with a group allows the counting of the (different) documents retrieved. For instance, to mention the number of documents written on each subject, count is applied to the document variable and group to the subject one.
Example counting documents on a subject :
select group ?topic count ?doc where ?doc c:subject ?topic