sparql-view-unfold
    Preparing search index...
    • Transformation that removes all PROJECT operations from an algebra tree.

      A projection restricts which variables are visible outside its subtree. Simply dropping it would leak the previously hidden variables, letting them accidentally join with identically named variables in the surrounding query. To preserve semantics, every variable that is not projected is first anonymized: it is renamed to a fresh, guaranteed-unique variable (see freshVarGenerator). Afterwards the PROJECT node is replaced by its input.

      Projections are processed bottom-up, so nested (sub-SELECT) projections are removed before their enclosing ones.

      A projection directly below a DISTINCT or REDUCED is kept: those operators deduplicate over exactly the variables their input exposes, so anonymizing the hidden variables instead of dropping them would make the deduplication consider them too, changing the result.

      A projection directly below a SLICE is kept for a different reason: dropping it is sound - a projection without a DISTINCT preserves multiplicity, so the same rows fall in the window either way - but SPARQL has no way to write a LIMIT or OFFSET that is not on a SELECT, and toAst rejects the Slice it would be left holding.

      Type Parameters

      • T extends Operation

      Parameters

      Returns T

      The transformed operation without any PROJECT operations

      // Before: SELECT ?x { ?x ?y ?z }        (?y and ?z are not projected)
      // After: ?x ?v_0 ?v_1 (projection removed, hidden vars anonymized)