code: public Atom rewriteWithTypeVariable(Atom parentAtom) {
          if (parentAtom.getPredicateVariable().isReturned()
                  && !this.getPredicateVariable().isReturned()
                  && this.getClass() == parentAtom.getClass()) {
              return rewriteWithTypeVariable();
          }
          return this;
      }
docs: rewrites the atom to user-defined type variable
  
  @param parentAtom parent atom that triggers rewrite
  @return rewritten atom