public static Keyword relationHierarchySpecialist(ControlFrame frame, Keyword lastmove) {
    { Proposition proposition = frame.proposition;
      GeneralizedSymbol relation = proposition.operator;
      Stella_Object boundarg = (proposition.arguments.theArray)[0];
      Stella_Object boundargvalue = Logic.argumentBoundTo(boundarg);
      Stella_Object otherarg = (proposition.arguments.theArray)[1];
      Stella_Object otherargvalue = Logic.argumentBoundTo(otherarg);
      boolean reflexiveP = false;
      Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null)));
      Cons collection = Stella.NIL;

      lastmove = lastmove;
      if (boundargvalue == null) {
        if (otherargvalue == null) {
          return (Logic.KWD_TERMINAL_FAILURE);
        }
        else {
          boundarg = otherarg;
          boundargvalue = otherargvalue;
          otherarg = (proposition.arguments.theArray)[0];
          otherargvalue = null;
          if (relation == Logic.SGT_PL_KERNEL_KB_DIRECT_SUBRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_DIRECT_SUPERRELATION;
          }
          else if (relation == Logic.SGT_PL_KERNEL_KB_DIRECT_SUPERRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_DIRECT_SUBRELATION;
          }
          else if (relation == Logic.SGT_PL_KERNEL_KB_SUBRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_SUPERRELATION;
          }
          else if (relation == Logic.SGT_PL_KERNEL_KB_SUPERRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_SUBRELATION;
          }
          else if (relation == Logic.SGT_PL_KERNEL_KB_PROPER_SUBRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_PROPER_SUPERRELATION;
          }
          else if (relation == Logic.SGT_PL_KERNEL_KB_PROPER_SUPERRELATION) {
            relation = Logic.SGT_PL_KERNEL_KB_PROPER_SUBRELATION;
          }
          else {
          }
        }
      }
      if (!Stella_Object.isaP(boundargvalue, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
        return (Logic.KWD_TERMINAL_FAILURE);
      }
      if (iterator == null) {
        if (relation == Logic.SGT_PL_KERNEL_KB_DIRECT_SUBRELATION) {
          collection = NamedDescription.allDirectSubrelations(((NamedDescription)(boundargvalue)), true);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_SUBRELATION) {
          reflexiveP = true;
          collection = NamedDescription.allSubrelations(((NamedDescription)(boundargvalue)), false);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_PROPER_SUBRELATION) {
          collection = NamedDescription.allSubrelations(((NamedDescription)(boundargvalue)), true);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_DIRECT_SUPERRELATION) {
          collection = NamedDescription.allDirectSuperrelations(((NamedDescription)(boundargvalue)), true);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_SUPERRELATION) {
          reflexiveP = true;
          collection = NamedDescription.allSuperrelations(((NamedDescription)(boundargvalue)), false);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_PROPER_SUPERRELATION) {
          collection = NamedDescription.allSuperrelations(((NamedDescription)(boundargvalue)), true);
        }
        else if (relation == Logic.SGT_PL_KERNEL_KB_EQUIVALENT_RELATION) {
          collection = NamedDescription.allEquivalentRelations(((NamedDescription)(boundargvalue)), true);
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + relation + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
        if (reflexiveP &&
            (!collection.membP(boundargvalue))) {
          collection = Cons.cons(boundargvalue, collection);
        }
      }
      if (otherargvalue != null) {
        if (collection.membP(otherargvalue)) {
          return (Logic.KWD_FINAL_SUCCESS);
        }
        else {
          return (Logic.KWD_TERMINAL_FAILURE);
        }
      }
      if (iterator == null) {
        if (collection == Stella.NIL) {
          return (Logic.KWD_TERMINAL_FAILURE);
        }
        iterator = collection.allocateIterator();
        KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, iterator, null);
      }
      if (iterator.nextP() &&
          Logic.bindArgumentToValueP(otherarg, iterator.value, true)) {
        return (Logic.KWD_CONTINUING_SUCCESS);
      }
      else {
        return (Logic.KWD_TERMINAL_FAILURE);
      }
    }
  }