Strange behaviour with subquery

sparql

#1

Hello,

I have a problem with a nested SPARQL query that seems like it does not perform the aggregation inside the subquery. When I convert the nested query to a flat query it returns the correct results. The two queries are:

Q1:

SPARQL SELECT ?tweet ?num_tags WHERE {?tweet ns:has_creater . <http://twitter.com/xxxxxx/> . {SELECT ?tweet (count(?tag) AS ?num_tags) WHERE {?tweet ns:hashashtag ?tag} GROUP BY ?tweet}};

Q2:
SPARQL SELECT ?tweet (count(?tag) AS ?num_tags) WHERE {?tweet ns:has_creater <http://twitter.com/xxxxxx/> . ?tweet ns:hashashtag ?tag} GROUP BY ?tweet;

The flat query Q2 returns 32 rows from which only 4 tweets have 2 hashtags. The rest have only 1 hashtag. However, query Q1 returns 36 rows with all tweets having 1 hashtag.
IMO, the two queries are equivalent and should return the same results.

Could you please explain me why virtuoso returns different results and does not perform the groupby+count in the subquery?

Thank you!