class_docstr: A data generator for working with triple-based knowledge graph models, like ComplEx.
  
  This requires a StellarGraph that contains all nodes/entities and every edge/relation type that
  will be trained or predicted upon. The graph does not need to contain the edges/triples that are
  used for training or prediction.
  
  .. seealso::
  
     Models using this generator: :class:`.ComplEx`, :class:`.DistMult`, :class:`.RotatE`, :class:`.RotE`, :class:`.RotH`.
  
     Example using this generator (see individual models for more): `link prediction with ComplEx <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/complex-link-prediction.html>`__.
  
  Args:
      G (StellarGraph): the graph containing all nodes, and all edge types.
  
      batch_size (int): the size of the batches to generate
class_docstr_tok: ["A","data","generator","for","working","with","triple-based","knowledge","graph","models",",","like","ComplEx",".","This","requires","a","StellarGraph","that","contains","all","nodes\/entities","and","every","edge\/relation","type","that","will","be","trained","or","predicted","upon",".","The","graph","does","not","need","to","contain","the","edges\/triples","that","are","used","for","training","or","prediction",".","..","seealso",":",":","Models","using","this","generator",":",":","class",":","`",".ComplEx","`",",",":","class",":","`",".DistMult","`",",",":","class",":","`",".RotatE","`",",",":","class",":","`",".RotE","`",",",":","class",":","`",".RotH","`",".","Example","using","this","generator","(","see","individual","models","for","more",")",":","`","link","prediction","with","ComplEx","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/complex-link-prediction.html",">","`","__",".","Args",":","G","(","StellarGraph",")",":","the","graph","containing","all","nodes",",","and","all","edge","types",".","batch_size","(","int",")",":","the","size","of","the","batches","to","generate"]
code: def __init__(self, G, batch_size):
      self.G = G
  
      if not isinstance(batch_size, int):
          raise TypeError(
              f"batch_size: expected int, found {type(batch_size).__name__}"
          )
  
      self.batch_size = batch_size
  
file_path: stellargraph/stellargraph/mapper/knowledge_graph.py
imports: import threading
  import numpy
  import pandas
  from tensorflow.keras.utils import Sequence
  from ..globalvar import SOURCE, TARGET, TYPE_ATTR_NAME
  from ..random import random_state, SeededPerBatch
  from .base import Generator
  from ..core.validation import comma_sep, require_integer_in_range
label_desc: Use image node_id 1 to create a new KGTripleGenerator object from inherited base classes: Generator with example: obj = KGTripleGenerator(G, batch_size)