code: private AttributeAtom rewriteWithRelationVariable(Atom parentAtom){
          if (parentAtom.isResource() && ((AttributeAtom) parentAtom).getRelationVariable().isReturned()) return rewriteWithRelationVariable();
          return this;
      }
docs: rewrites the atom to one with relation variable
  @param parentAtom parent atom that triggers rewrite
  @return rewritten atom