docs: def es_json(self, role='rdf_class', remove_empty=True, **kwargs):
          """ Returns a JSON object of the class for insertion into es
  
          args:
              role: the role states how the class data should be returned
                    depending upon whether it is used as a subject of an object.
                    options are kds_esNested or rdf_class
              remove_empty: True removes empty items from es object
          """
          def test_idx_status(cls_inst, **kwargs):
              """
              Return True if the class has already been indexed in elastisearch
  
              Args:
              -----
                  cls_inst: the rdfclass instance
  
              Kwargs:
              -------
                  force[boolean]: True will return false to force a reindex of the
                          class
              """
              if kwargs.get("force") == True:
                  return False
              idx_time = cls_inst.get("kds_esIndexTime", [None])[0]
              mod_time = cls_inst.get("dcterm_modified", [None])[0]
              error_msg = cls_inst.get("kds_esIndexError", [None])[0]
              if (not idx_time) or \
                 error_msg or \
                 (idx_time and mod_time and idx_time < mod_time):
                 return False
              return True
  
          # if self.__class__.__name__ == 'rdf_type':
          #     pdb.set_trace()
          rtn_obj = {}
          if kwargs.get("depth"):
              kwargs['depth'] += 1
          else:
              kwargs['depth'] = 1
          if role == 'rdf_class':
              if test_idx_status(self, **kwargs):
                  return None
              for prop, value in self.items():
                  if prop in ['kds_esIndexTime', 'kds_esIndexError']:
                      continue
                  new_val = value.es_json()
                  rtn_method = get_attr(self[prop], 'kds_esObjectType', [])
                  if 'kdr_Array' in rtn_method:
                      rtn_obj[prop] = new_val
                  elif (remove_empty and new_val) or not remove_empty:
                      if len(new_val) == 1:
                          rtn_obj[prop] = new_val[0]
                      else:
                          rtn_obj[prop] = new_val
              nested_props = None
          else:
              try:
                  nested_props = self.es_defs.get('kds_esNestedProps',
                                                  list(self.keys())).copy()
              except AttributeError:
                  nested_props = list(self.keys())
              for prop, value in self.items():
                  # if prop == 'bf_hasInstance':
                  #     pdb.set_trace()
                  if prop in ['kds_esIndexTime', 'kds_esIndexError']:
                      continue
                  new_val = value.es_json(**kwargs)
                  rtn_method = get_attr(self[prop], 'kds_esObjectType', [])
                  if 'kdr_Array' in rtn_method:
                      rtn_obj[prop] = new_val
                  elif (remove_empty and new_val) or not remove_empty:
                      if len(new_val) == 1:
                          rtn_obj[prop] = new_val[0] \
                                  if not isinstance(new_val, dict) \
                                  else new_val
                      else:
                          rtn_obj[prop] = new_val
          # if 'bf_Work' in self.hierarchy:
          #     pdb.set_trace()
  
          rtn_obj = get_es_label(rtn_obj, self)
          rtn_obj = get_es_value(rtn_obj, self)
          rtn_obj = get_es_ids(rtn_obj, self)
          if nested_props:
              nested_props += ['value', 'id', 'uri']
              rtn_obj = {key: value
                         for key, value in rtn_obj.items()
                         if key in nested_props}
          # rml_procs = self.es_defs.get("kds_esRmlProcessor", [])
          # # if role == 'rdf_class':
          # #     pdb.set_trace()
          # rml_procs = [proc for proc in rml_procs
          #              if role == 'rdf_class' or
          #              proc['force']]
          # if rml_procs:
          #     rml_maps = {}
          #     for rml in rml_procs:
          #         proc_kwargs = {rml['subj']: self.subject,
          #                        "dataset": self.dataset}
          #         proc_kwargs.update(rml['proc_kwargs'])
          #         rml_maps[rml['name']] = rml['processor'](**proc_kwargs)
          #     if rml_maps:
          #         rtn_obj['rml_map'] = rml_maps
          rml_maps = self.get_all_rml(role=role)
          if rml_maps:
                  rtn_obj['rml_map'] = rml_maps
          # if self.get('bf_contribution'):
          #     pdb.set_trace()
          return rtn_obj