public static void htmlExecuteQuery(KeyValueList querydata, org.powerloom.PrintableStringWriter stream) {
    { String modulename = ((StringWrapper)(querydata.lookup(StringWrapper.wrapString("MODULE")))).wrapperValue;
      Module module = Logic.getModule(StringWrapper.wrapString(modulename));
      StringWrapper nvalueentry = ((StringWrapper)(querydata.lookup(StringWrapper.wrapString("NANSWERS"))));
      Stella_Object nvalueobject = ((nvalueentry != null) ? Stella.readSExpressionFromString(nvalueentry.wrapperValue) : ((Stella_Object)(null)));
      int nvalues = (Stella_Object.integerP(nvalueobject) ? ((IntegerWrapper)(nvalueobject)).wrapperValue : Stella.NULL_INTEGER);
      StringWrapper timeoutentry = ((StringWrapper)(querydata.lookup(StringWrapper.wrapString("TIMEOUT"))));
      Stella_Object timeoutobject = ((timeoutentry != null) ? Stella.readSExpressionFromString(timeoutentry.wrapperValue) : ((Stella_Object)(null)));
      double timeout = (Stella_Object.floatP(timeoutobject) ? ((FloatWrapper)(timeoutobject)).wrapperValue : Stella.NULL_FLOAT);
      Cons query = Stella.NIL;
      Cons options = Cons.list$(Cons.cons(OntosaurusUtil.KWD_SORT_BY, Cons.cons(OntosaurusUtil.KWD_VALUES, Cons.cons(Stella.NIL, Stella.NIL))));
      List variables = List.newList();

      if (module != null) {
        { 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())));
            query = ((Cons)(Stella.readSExpressionFromString(((StringWrapper)(querydata.lookup(StringWrapper.wrapString("QUERYSOURCE")))).wrapperValue)));
            Logic.collectUndeclaredVariables(query, Stella.NIL, variables);
            if (timeout != Stella.NULL_FLOAT) {
              options = options.concatenate(Cons.list$(Cons.cons(OntosaurusUtil.KWD_TIMEOUT, Cons.cons(FloatWrapper.wrapFloat(timeout), Cons.cons(Stella.NIL, Stella.NIL)))), Stella.NIL);
            }
            if (variables.emptyP()) {
              OntosaurusUtil.htmlExecuteAskQuery(query, options, module, stream);
            }
            else {
              OntosaurusUtil.htmlExecuteRetrieveQuery(nvalues, variables.theConsList, query, options, module, stream);
            }
            OntosaurusUtil.htmlLineBreak(stream);
            stream.println("<HR SIZE=2>");
            OntosaurusUtil.writePowerloomTrailer(stream);

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Stella.$MODULE$.set(old$Module$000);
          }
        }
      }
      else {
        OntosaurusUtil.htmlUnknownModuleResponse(OntosaurusUtil.KWD_QUERY, "", modulename, stream);
      }
    }
  }