public static Cons evaluateQueryCommandInModule(edu.isi.webtools.http.Session session, String query, String modulename, boolean continuationqueryP, boolean partialqueryP) {
    { Module module = Stella.getStellaModule(modulename, false);
      Cons querytree = Stella.NIL;
      QueryIterator queryiterator = null;
      Cons tuple = Stella.NIL;
      Cons result = Stella.NIL;

      if (module == null) {
        module = ((Module)(Stella.$MODULE$.get()));
      }
      try {
        { 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())));
            querytree = ((Cons)(Stella.readSExpressionFromString(query)));
            if (querytree.value == GuiServer.SYM_STELLA_ASK) {
              {
                queryiterator = Logic.createAskQuery(querytree.rest);
                session.insertAt(StringWrapper.wrapString("QueryIterator"), queryiterator);
                if (partialqueryP) {
                  result = Cons.cons(FloatWrapper.wrapFloat(Logic.callAskPartial(queryiterator)), Stella.NIL);
                }
                else {
                  result = Cons.cons(Logic.callAsk(queryiterator), Stella.NIL);
                }
                return (Cons.cons(result, Stella.NIL));
              }
            }
            else {
              {
                if (continuationqueryP) {
                  Logic.$MOST_RECENT_QUERY$ = ((QueryIterator)(session.lookup(StringWrapper.wrapString("QueryIterator"))));
                }
                else {
                  Logic.$MOST_RECENT_QUERY$ = null;
                }
                queryiterator = Logic.createRetrieveQuery(querytree.rest);
                session.insertAt(StringWrapper.wrapString("QueryIterator"), queryiterator);
                if (partialqueryP) {
                  Logic.callRetrievePartial(queryiterator);
                }
                else {
                  Logic.callRetrieve(queryiterator);
                }
                { QuerySolution solution = null;
                  DictionaryIterator iter000 = ((DictionaryIterator)(queryiterator.solutions.allocateIterator()));
                  Cons collect000 = null;

                  while (iter000.nextP()) {
                    solution = ((QuerySolution)(iter000.value));
                    tuple = solution.bindings.consify();
                    if (partialqueryP) {
                      tuple.concatenate(Cons.cons(FloatWrapper.wrapFloat(solution.matchScore), Stella.NIL), Stella.NIL);
                    }
                    if (collect000 == null) {
                      {
                        collect000 = Cons.cons(tuple, Stella.NIL);
                        if (result == Stella.NIL) {
                          result = collect000;
                        }
                        else {
                          Cons.addConsToEndOfConsList(result, collect000);
                        }
                      }
                    }
                    else {
                      {
                        collect000.rest = Cons.cons(tuple, Stella.NIL);
                        collect000 = collect000.rest;
                      }
                    }
                  }
                }
                return (result);
              }
            }

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Stella.$MODULE$.set(old$Module$000);
          }
        }
      } catch (java.lang.Exception e) {
        throw ((java.lang.RuntimeException)(((java.lang.RuntimeException)(e)).fillInStackTrace()));
      }
    }
  }