sparql-view-unfold
    Preparing search index...

    Function derivedVarNamer

    • Creates the namer a pass writing triple terms into patterns coins its variables with: the position p of the value ?x names becomes ?x_p, and a name already taken in the query takes the first free numeric suffix (?x_p0, ?x_p1, ...).

      The name has to be a function of what it names, which is the whole reason this exists beside freshVarGenerator. Two places writing out the same position must write the same variable, or the two operands of a join stop joining on it once both have been rewritten - where a sequentially numbered generator names by call order instead. Sound because the position is functionally determined by the value the two already agree on: equal triple terms have equal subjects.

      Parameters

      • existing: Iterable<string>

        Every variable name occurring in the query, collected once before the pass runs (collectVariableNames), a name coined half way through otherwise colliding with one further down the tree that has not been visited yet

      Returns DerivedVarNamer

      the namer, which is stateful: it remembers what it has already coined, so that a second reading of one position hands back the variable the first one coined