code: @Override
      public boolean hasAncestor(QueryNode descendantNode, QueryNode ancestorNode) {
          return getAncestors(descendantNode).contains(ancestorNode);
      }
docs: TODO: replace by a more efficient implementation