public static PLRelationContainer createRelationContainer(List collectedrelations, Module module, boolean includechildrenP) {
    { PLRelationContainer container = PLRelationContainer.new_PLRelationContainer();
      List plrelations = List.newList();

      { Description relation = null;
        Cons iter000 = collectedrelations.theConsList;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          relation = ((Description)(iter000.value));
          { PLRelation plrelation = PLRelation.new_PLRelation();
            edu.isi.powerloom.PlIterator childrelationiter = edu.isi.powerloom.PLI.getDirectSubrelations(relation, module, null);
            List surrogatechildren = List.newList();

            if (Logic.functionP(relation)) {
              plrelation.IsFunction = "TRUE";
            }
            else {
              plrelation.IsFunction = "FALSE";
            }
            if (Logic.closedTermP(relation)) {
              plrelation.IsClosed = "TRUE";
            }
            else {
              plrelation.IsClosed = "FALSE";
            }
            plrelation.RelationName = GuiServer.xmlifyString(GuiServer.plObjectToGuiName(relation));
            plrelation.Module = relation.homeModule().moduleFullName;
            plrelation.SourceString = "";
            if (includechildrenP) {
              { LogicObject child = null;
                edu.isi.powerloom.PlIterator iter001 = childrelationiter;
                Cons collect000 = null;

                while (iter001.nextP()) {
                  child = ((LogicObject)(iter001.value));
                  if ((!Logic.classP(child)) &&
                      (!BooleanWrapper.coerceWrappedBooleanToBoolean((child.deletedP() ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER)))) {
                    if (collect000 == null) {
                      {
                        collect000 = Cons.cons(GuiServer.makeLogicSurrogate(child), Stella.NIL);
                        if (surrogatechildren.theConsList == Stella.NIL) {
                          surrogatechildren.theConsList = collect000;
                        }
                        else {
                          Cons.addConsToEndOfConsList(surrogatechildren.theConsList, collect000);
                        }
                      }
                    }
                    else {
                      {
                        collect000.rest = Cons.cons(GuiServer.makeLogicSurrogate(child), Stella.NIL);
                        collect000 = collect000.rest;
                      }
                    }
                  }
                }
              }
            }
            surrogatechildren = surrogatechildren.sort(Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogate", "PLSurrogateL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate"), Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate")}));
            plrelation.PLSurrogate = surrogatechildren;
            plrelations.insert(plrelation);
          }
        }
      }
      plrelations = plrelations.sort(Native.find_java_method("edu.isi.powerloom.server.gui.PLRelation", "PLRelationL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLRelation"), Native.find_java_class("edu.isi.powerloom.server.gui.PLRelation")}));
      container.PLRelation = plrelations;
      return (container);
    }
  }