public static NamedDescription createDescriptionForStellaRelation(Relation self) {
    { Relation renamed_Super = null;
      Iterator iter000 = Logic.directSuperrelations(self);

      while (iter000.nextP()) {
        renamed_Super = ((Relation)(iter000.value));
        if ((renamed_Super != null) &&
            ((!Stella_Object.isaP(renamed_Super, Logic.SGT_STELLA_CLASS)) ||
             Logic.logicClassP(((Stella_Class)(renamed_Super))))) {
          Logic.getDescription(renamed_Super);
        }
      }
    }
    { NamedDescription description = null;
      Module homemodule = null;

      { Surrogate testValue000 = Stella_Object.safePrimaryType(self);

        if (Surrogate.subtypeOfClassP(testValue000)) {
          { Stella_Class self000 = ((Stella_Class)(self));

            homemodule = Logic.classLogicalType(self000).homeModule();
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_SLOT)) {
          { Slot self000 = ((Slot)(self));

            homemodule = self000.homeModule();
          }
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
      }
      if (!(Context.visibleFromP(Logic.$PL_KERNEL_MODULE$, homemodule))) {
        homemodule = Logic.$PL_KERNEL_MODULE$;
      }
      { Surrogate testValue001 = Stella_Object.safePrimaryType(self);

        if (Surrogate.subtypeOfClassP(testValue001)) {
          { Stella_Class self000 = ((Stella_Class)(self));

            if (!Logic.logicClassP(self000)) {
              { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

                { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

                  try {
                    Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                    {
                      stream001.nativeStream.println("ERROR: Can't use the class `" + self000 + "' as a logic class because it");
                      stream001.nativeStream.println("   does not inherit the top-level class THING..");
                    }
;
                    Logic.helpSignalPropositionError(stream001, Logic.KWD_ERROR);

                  } finally {
                    Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
                  }
                }
                throw ((PropositionError)(PropositionError.newPropositionError(stream001.theStringReader()).fillInStackTrace()));
              }
            }
            description = Logic.createPrimitiveDescription(Stella.NIL_LIST, List.list(Cons.cons(Logic.classLogicalType(self000), Stella.NIL)), false, true, false, homemodule);
          }
        }
        else if (Surrogate.subtypeOfP(testValue001, Logic.SGT_STELLA_SLOT)) {
          { Slot self000 = ((Slot)(self));

            { Surrogate slotref = self000.slotSlotref;
              Surrogate superslotref = Logic.mostGeneralEquivalentSlotref(slotref);

              if (!(slotref == superslotref)) {
                self000 = ((Slot)(superslotref.surrogateValue));
                if (((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))) != null) {
                  return (((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))));
                }
              }
            }
            { List self005 = List.newList();

              self005.theConsList = Logic.slotColumnTypes(self000, Stella.NULL_INTEGER);
              description = Logic.createPrimitiveDescription(Stella.NIL_LIST, self005, false, false, !Logic.booleanTypeP(self000.slotBaseType), homemodule);
            }
          }
        }
        else {
          { OutputStringStream stream002 = OutputStringStream.newOutputStringStream();

            stream002.nativeStream.print("`" + testValue001 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream002.theStringReader()).fillInStackTrace()));
          }
        }
      }
      Logic.linkStellaRelationAndDescription(self, description);
      Logic.finalizeSuperrelationLinks(self);
      Description.ensureDescriptionBody(description);
      return (description);
    }
  }