def root(stubborn=false)

      previous = nil
      current = @h

      exps = @context.storage.find_expressions(
        h.fei['wfid']
      ).each_with_object({}) { |exp, h|
        h[exp['fei']] = exp
      }

      while current && current['parent_id']
        previous = current
        current = exps[current['parent_id']]
      end

      current ||= previous unless stubborn

      current ? Ruote::Exp::FlowExpression.from_h(@context, current) : nil
    end
def root(stubborn=false)

      previous = nil
      current = @h

      exps = @context.storage.find_expressions(
        h.fei['wfid']
      ).each_with_object({}) { |exp, h|
        h[exp['fei']] = exp
      }

      while current && current['parent_id']
        previous = current
        current = exps[current['parent_id']]
      end

      current ||= previous unless stubborn

      current ? Ruote::Exp::FlowExpression.from_h(@context, current) : nil
    end
An expensive method, looks up all the expressions with the same wfid
 in the storage (for some storages this is not expensive at all),
 and determine the root of this expression.
 It does this by recursively going from an expression to its parent,
 starting with this expression. The root is when the parent can't be
 reached.

 By default, this method will always return an expression, but if
 stubborn is set to true and the top expression points to a gone parent
 then nil will be returned.
 The default (stubborn=true) is probably what you want anyway.