* @param relationname
   * @return List
   */
  public static List getRelevantRulesForRelation(String modulename, String relationname) {
    { Module module = edu.isi.powerloom.PLI.getModule(modulename, null);
      LogicObject relation = edu.isi.powerloom.PLI.sGetRelation(GuiServer.guiNameToPlName(relationname), modulename, null);
      List rules = List.newList();

      { Object old$Module$000 = Stella.$MODULE$.get();
        Object old$Context$000 = Stella.$CONTEXT$.get();

        try {
          Native.setSpecial(Stella.$MODULE$, module);
          Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
          { Object old$Context$001 = Stella.$CONTEXT$.get();
            Object old$Module$001 = Stella.$MODULE$.get();

            try {
              Native.setSpecial(Stella.$CONTEXT$, Logic.getQueryContext());
              Native.setSpecial(Stella.$MODULE$, ((Context)(Stella.$CONTEXT$.get())).baseModule);
              { Proposition rule = null;
                Cons iter000 = Logic.callGetRules(relation);
                Cons collect000 = null;

                for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                  rule = ((Proposition)(iter000.value));
                  if (Proposition.trueP(rule) &&
                      (!GuiServer.subrelationRuleP(rule))) {
                    if (collect000 == null) {
                      {
                        { Proposition temp000 = ((Proposition)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, GuiServer.SYM_LOGIC_MASTER_PROPOSITION, null)));

                          collect000 = Cons.cons(((temp000 != null) ? temp000 : rule), Stella.NIL);
                        }
                        if (rules.theConsList == Stella.NIL) {
                          rules.theConsList = collect000;
                        }
                        else {
                          Cons.addConsToEndOfConsList(rules.theConsList, collect000);
                        }
                      }
                    }
                    else {
                      {
                        { Proposition temp001 = ((Proposition)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, GuiServer.SYM_LOGIC_MASTER_PROPOSITION, null)));

                          collect000.rest = Cons.cons(((temp001 != null) ? temp001 : rule), Stella.NIL);
                        }
                        collect000 = collect000.rest;
                      }
                    }
                  }
                }
              }
              rules.removeDuplicates();
              return (rules.sort(Native.find_java_method("edu.isi.powerloom.logic.Proposition", "propositionLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.logic.Proposition"), Native.find_java_class("edu.isi.powerloom.logic.Proposition")})));

            } finally {
              Stella.$MODULE$.set(old$Module$001);
              Stella.$CONTEXT$.set(old$Context$001);
            }
          }

        } finally {
          Stella.$CONTEXT$.set(old$Context$000);
          Stella.$MODULE$.set(old$Module$000);
        }
      }
    }
  }