class_docstr: :class:`KnowledgeBasedDataset` is based on :class:`~recbole.data.dataset.dataset.Dataset`,
  and load ``.kg`` and ``.link`` additionally.
  
  Entities are remapped together with ``item_id`` specially.
  All entities are remapped into three consecutive ID sections.
  
  - virtual entities that only exist in interaction data.
  - entities that exist both in interaction data and kg triplets.
  - entities only exist in kg triplets.
  
  It also provides several interfaces to transfer ``.kg`` features into coo sparse matrix,
  csr sparse matrix, :class:`DGL.Graph` or :class:`PyG.Data`.
  
  Attributes:
      head_entity_field (str): The same as ``config['HEAD_ENTITY_ID_FIELD']``.
  
      tail_entity_field (str): The same as ``config['TAIL_ENTITY_ID_FIELD']``.
  
      relation_field (str): The same as ``config['RELATION_ID_FIELD']``.
  
      entity_field (str): The same as ``config['ENTITY_ID_FIELD']``.
  
      kg_feat (pandas.DataFrame): Internal data structure stores the kg triplets.
          It's loaded from file ``.kg``.
  
      item2entity (dict): Dict maps ``item_id`` to ``entity``,
          which is loaded from  file ``.link``.
  
      entity2item (dict): Dict maps ``entity`` to ``item_id``,
          which is loaded from  file ``.link``.
  
  Note:
      :attr:`entity_field` doesn't exist exactly. It's only a symbol,
      representing entity features.
  
      ``[UI-Relation]`` is a special relation token.
docstr: Add auxiliary relations in ``self.relation_field``.
docstr_tok: ["Add","auxiliary","relations","in","``","self.relation_field","``","."]
code: def _add_auxiliary_relation(self):
      """Add auxiliary relations in ``self.relation_field``."""
      if self.kg_reverse_r:
          # '0' is used for padding, so the number needs to be reduced by one
          original_rel_num = (
              len(self.field2id_token[self.relation_field]) - 1
          )
          original_hids = self.kg_feat[self.head_entity_field]
          original_tids = self.kg_feat[self.tail_entity_field]
          original_rels = self.kg_feat[self.relation_field]
  
          # Internal id gap of a relation and its reverse edge is original relation num
          reverse_rels = original_rels + original_rel_num
  
          # Add mapping for internal and external ID of relations
          for i in range(1, original_rel_num + 1):
              original_token = self.field2id_token[self.relation_field][
                  i
              ]
              reverse_token = original_token + "_r"
              self.field2token_id[self.relation_field][
                  reverse_token
              ] = (i + original_rel_num)
              self.field2id_token[self.relation_field] = np.append(
                  self.field2id_token[self.relation_field],
                  reverse_token,
              )
  
          # Update knowledge graph triples with reverse relations
          reverse_kg_data = {
              self.head_entity_field: original_tids,
              self.relation_field: reverse_rels,
              self.tail_entity_field: original_hids,
          }
          reverse_kg_feat = pd.DataFrame(reverse_kg_data)
          self.kg_feat = pd.concat([self.kg_feat, reverse_kg_feat])
  
      # Add UI-relation pairs in the relation field
      kg_rel_num = len(self.field2id_token[self.relation_field])
      self.field2token_id[self.relation_field][
          "[UI-Relation]"
      ] = kg_rel_num
      self.field2id_token[self.relation_field] = np.append(
          self.field2id_token[self.relation_field], "[UI-Relation]"
      )
  
imports: import os
  from collections import Counter
  import numpy
  import pandas
  import torch
  from scipy.sparse import coo_matrix
  from recbole.data.dataset import Dataset
  from recbole.utils import FeatureSource, FeatureType, set_color
  from recbole.utils.url import decide_download, download_url, extract_zip
label_desc: Use image node_id 19 for calling the KnowledgeBasedDataset obj's underlying member method code with example usage: obj._add_auxiliary_relation() without return types