class_docstr: KnowledgeGraph link prediction dataset
  
  The dataset contains a graph depicting the connectivity of a knowledge
  base. Currently, the knowledge bases from the
  `RGCN paper <https://arxiv.org/pdf/1703.06103.pdf>`_ supported are
  FB15k-237, FB15k, wn18
  
  Parameters
  -----------
  name : str
      Name can be 'FB15k-237', 'FB15k' or 'wn18'.
  reverse : bool
      Whether add reverse edges. Default: True.
  raw_dir : str
      Raw file directory to download/contains the input data directory.
      Default: ~/.dgl/
  force_reload : bool
      Whether to reload the dataset. Default: False
  verbose : bool
      Whether to print out progress information. Default: True.
  transform : callable, optional
      A transform that takes in a :class:`~dgl.DGLGraph` object and returns
      a transformed version. The :class:`~dgl.DGLGraph` object will be
      transformed before every access.
class_docstr_tok: ["KnowledgeGraph","link","prediction","dataset","The","dataset","contains","a","graph","depicting","the","connectivity","of","a","knowledge","base",".","Currently",",","the","knowledge","bases","from","the","`","RGCN","paper","<","https",":","\/\/arxiv.org\/pdf\/1703.06103.pdf",">","`","_","supported","are","FB15k-237",",","FB15k",",","wn18","Parameters","--","--","--","--","--","-","name",":","str","Name","can","be","'FB15k-237","'",",","'FB15k","'","or","'wn18","'",".","reverse",":","bool","Whether","add","reverse","edges",".","Default",":","True",".","raw_dir",":","str","Raw","file","directory","to","download\/contains","the","input","data","directory",".","Default",":","~\/.dgl\/","force_reload",":","bool","Whether","to","reload","the","dataset",".","Default",":","False","verbose",":","bool","Whether","to","print","out","progress","information",".","Default",":","True",".","transform",":","callable",",","optional","A","transform","that","takes","in","a",":","class",":","`","~dgl.DGLGraph","`","object","and","returns","a","transformed","version",".","The",":","class",":","`","~dgl.DGLGraph","`","object","will","be","transformed","before","every","access","."]
docstr: The original knowledge base is stored in triplets.
  This function will parse these triplets and build the DGLGraph.
docstr_tok: ["The","original","knowledge","base","is","stored","in","triplets",".","This","function","will","parse","these","triplets","and","build","the","DGLGraph","."]
code: def process(self):
      """
      The original knowledge base is stored in triplets.
      This function will parse these triplets and build the DGLGraph.
      """
      root_path = self.raw_path
      entity_path = os.path.join(root_path, "entities.dict")
      relation_path = os.path.join(root_path, "relations.dict")
      train_path = os.path.join(root_path, "train.txt")
      valid_path = os.path.join(root_path, "valid.txt")
      test_path = os.path.join(root_path, "test.txt")
      entity_dict = _read_dictionary(entity_path)
      relation_dict = _read_dictionary(relation_path)
      train = np.asarray(
          _read_triplets_as_list(train_path, entity_dict, relation_dict)
      )
      valid = np.asarray(
          _read_triplets_as_list(valid_path, entity_dict, relation_dict)
      )
      test = np.asarray(
          _read_triplets_as_list(test_path, entity_dict, relation_dict)
      )
      num_nodes = len(entity_dict)
      num_rels = len(relation_dict)
      if self.verbose:
          print("# entities: {}".format(num_nodes))
          print("# relations: {}".format(num_rels))
          print("# training edges: {}".format(train.shape[0]))
          print("# validation edges: {}".format(valid.shape[0]))
          print("# testing edges: {}".format(test.shape[0]))
  
      # for compatability
      self._train = train
      self._valid = valid
      self._test = test
  
      self._num_nodes = num_nodes
      self._num_rels = num_rels
      # build graph
      g, data = build_knowledge_graph(
          num_nodes, num_rels, train, valid, test, reverse=self.reverse
      )
      (
          etype,
          ntype,
          train_edge_mask,
          valid_edge_mask,
          test_edge_mask,
          train_mask,
          val_mask,
          test_mask,
      ) = data
      g.edata["train_edge_mask"] = train_edge_mask
      g.edata["valid_edge_mask"] = valid_edge_mask
      g.edata["test_edge_mask"] = test_edge_mask
      g.edata["train_mask"] = train_mask
      g.edata["val_mask"] = val_mask
      g.edata["test_mask"] = test_mask
      g.edata["etype"] = etype
      g.ndata["ntype"] = ntype
      self._g = g
  
imports: from __future__ import absolute_import
  import os, sys
  import pickle
  import networkx
  import numpy
  import scipy.sparse
  from ..None import backend
  from ..convert import graph
  from ..utils import retry_method_with_fix
  from .dgl_dataset import DGLBuiltinDataset
  from .utils import _get_dgl_url, deprecate_function, deprecate_property, download, extract_archive, generate_mask_tensor, get_download_dir, load_graphs, load_info, makedirs, save_graphs, save_info
label_desc: Use image node_id 3 for calling the KnowledgeGraphDataset obj's underlying member method code with example usage: obj.process() without return types