On 30/08/12 00:51, Rob Vesse wrote:
Is there a particular class responsible for this renaming?

The constants are in ARQConstants.

The rename engine is in com.hp.hpl.jena.sparql.engine.Rename

Our developers would like to know exactly what forms Jena will use for
variable names in the generated algebra as they've seen some other strange
ones like ?*x as well as the ?/x

IIRC ?*gNNN get allocated for some quad conversion. Can't remember what exactly (non-simplified property paths in GRAPHs?)

Is there a specific reason? (This is internal stuff that the systems may change without notice.)

If the execution strategy is not the constant-memory one the released OpExecutor uses (and TDB[released]), then renaming isn't necessary as it "just happens" as a result of bottom up evaluation. Converting to global variables has some convenience though, such as debugging and not needing to do internal projection.

        Andy


Rob

On 8/29/12 10:24 AM, "Andy Seaborne" <[email protected]> wrote:

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




Reply via email to