On 29/08/12 17:51, Rob Vesse wrote:
Andy
Just got a question from one of our devs about algebra ARQ is generating. The
original query is sq-08.rq from the subquery tests of the 1.1 test suite, the
following is the fragment of the algebra he was asking about:
(extend ((?max ?/.0))
(group () ((?/.0 (max ?/y)))
(quadpattern (quad <urn:x-arq:DefaultGraphNode> ?/x
<http://www.example.org/schema#p> ?/y)
Under what circumstances will ARQ insert slashes into variable names?
When it needs to rename them to make then different from another use of
the same name in a different scope. It renames all variables that do
not show in the projection of subqueries if it detemines any renaming is
needed.
The GROUP BY isn't the trigger: this query is simpler and uses renaming:
PREFIX : <http://example/>
SELECT *
{
{ SELECT ?x { ?x :p ?y } }
?y :q ?r
}
There are two separate uses of ?y in that query.
{ SELECT ?x { ?x :p ?y } }
does not expose ?y so the use of ?y there is independent of the
" ?y :q ?r".
If ARQ determines some renaming is necessary, it systematically renames
everything hidden by project scoping - it renames to only leave
variables that exposed. Hence the ?/.0 from the group aggregate.
Andy
Thanks,
Rob