code: public static boolean isGroundTerm(Term term) {
          if (term instanceof Function) {
              return ((Function)term).getVariables().isEmpty();
          }
          return term instanceof Constant;
      }
docs: Returns true if is a ground term (even if it is not explicitly typed as such).