sparql-view-unfold
    Preparing search index...

    Function freshVarGenerator

    • Creates a generator of fresh (non-colliding) RDF variables, coining names from a monotonically increasing index and remembering every name it hands out.

      Parameters

      • existing: Iterable<string>

        Variable names that already exist within the operation tree

      • prefix: string = 'v_'

        Prefix used for the coined variable names

      Returns () => Variable

      a function that returns a new, unused variable on each call

      const fresh = freshVarGenerator([ 'x', 'v_0' ]);
      fresh(); // ?v_1 (v_0 was taken)
      fresh(); // ?v_2