Running an aggregate like `COUNT` over multiple columns in SPARQL 1.1

SPARQL 1.1 added aggregates, but it only permits them to be run over a single column, or over all columns in the result set.

For instance, this query gets a large number of rows, and you might want to know how many without running the full query --

```SELECT
DISTINCT  ?s ?p ?o
WHERE
{
VALUES ?s { <http://dbpedia.org/resource/Treaty_of_Bern> }
?s ?p ?o
OPTIONAL { ?s a ?type } .
FILTER ( BOUND ( ?type ) ) .
}
```

A simple `COUNT(DISTINCT *)` includes all variables bound in the WHERE clause -- which here means a Cartesian result set, multiplying the count of `DISTINCT ?s ?p ?o` by the count of `DISTINCT ?type`.

A workaround is to wrap the aggregate around a sub-query. The query below returns an accurate count of `DISTINCT ?s ?p ?o` rows.

```SELECT
( COUNT( DISTINCT * ) AS ?HowManyTriples )
WHERE
{
{
SELECT
DISTINCT ?s ?p ?o
WHERE
{
VALUES ?s { <http://dbpedia.org/resource/Treaty_of_Bern> }
?s ?p ?o
OPTIONAL { ?s a ?type } .
FILTER ( BOUND ( ?type ) ) .
}
}
}
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.68847746,"math_prob":0.68531257,"size":992,"snap":"2019-26-2019-30","text_gpt3_token_len":275,"char_repetition_ratio":0.13157895,"word_repetition_ratio":0.3152174,"special_character_ratio":0.29334676,"punctuation_ratio":0.22274882,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9841922,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-06-25T01:34:09Z\",\"WARC-Record-ID\":\"<urn:uuid:d46317bb-e969-400d-a879-c2139fc6bedc>\",\"Content-Length\":\"3691\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:171bb7f0-637f-48e8-806d-8c2f25f0fea8>\",\"WARC-Concurrent-To\":\"<urn:uuid:ea313b43-3d43-40bf-a498-6331404efd9a>\",\"WARC-IP-Address\":\"10.38.31.216\",\"WARC-Target-URI\":\"http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtAggregateOverMultipleColumnsInSparql?command=plain-html\",\"WARC-Payload-Digest\":\"sha1:VP3ZJQ3OR3IVHYVW7QXXZAVBCVADEEMA\",\"WARC-Block-Digest\":\"sha1:HIFPER5NXGJDSDYS7OCJVI3HVMX5IEBW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-26/CC-MAIN-2019-26_segments_1560627999783.49_warc_CC-MAIN-20190625011649-20190625033649-00000.warc.gz\"}"}