public static boolean topLevelQueryContextP(Context self) {
    { Context querycontext = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).queryContext;

      return ((self == querycontext) ||
          (Logic.worldStateP(self) ||
           (((Context)(KeyValueList.dynamicSlotValue(((World)(self)).dynamicSlots, Logic.SYM_LOGIC_INFERENCE_CACHE_OF, null))) == querycontext)));
    }
  }