private CycList queryVariablesInternal(final CycList queryVariables,
          final CycObject query,
          final CycObject mt,
          final InferenceParameters queryProperties,
          final String inferenceProblemStoreName,
          final long timeoutMsecs)
          throws UnknownHostException, IOException, CycApiException {
    //// Preconditions
    if (queryVariables == null) {
      throw new NullPointerException("queryVariables must not be null");
    }
    if (queryVariables.isEmpty()) {
      throw new IllegalArgumentException("queryVariables must not be empty");
    }
    if (query == null) {
      throw new NullPointerException("query must not be null");
    }
    if (mt == null) {
      throw new NullPointerException("mt must not be null");
    }
    if (inferenceProblemStoreName == null) {
      throw new NullPointerException("inferenceProblemStoreName must not be null");
    }
    if (inferenceProblemStoreName.length() == 0) {
      throw new IllegalArgumentException("inferenceProblemStoreName must not be an empty list");
    }
    final InferenceParameters tempQueryProperties = (queryProperties == null) ? getHLQueryProperties() : queryProperties;
    tempQueryProperties.put(makeCycSymbol(":problem-store"), makeCycSymbol("problem-store", false));
    final String script =
            "(clet ((problem-store (find-problem-store-by-name \"" + inferenceProblemStoreName + "\")))"
            + "  (query-template " + queryVariables.stringApiValue() + " "
            + query.stringApiValue() + " " + makeELMt(mt).stringApiValue() + " " + queryPropertiesToString(tempQueryProperties) + "))";
    SubLWorkerSynch worker = new DefaultSubLWorkerSynch(script, this, timeoutMsecs);
    if (CycObjectFactory.nil.equals(worker.getWork())) {
      return new CycList<Object>();
    }
    return (CycList) worker.getWork();
  }