class_docstr: Implementation of knowledge graph interface in pglke.
  
  Args:
      triplets (dict):
          Triplet data of knowledge graphs with keys 'train', 'valid' and 'test'.
      num_ents (int, optional):
          Number of entities in a knowledge graph.
          If not provided, it will be inferred from triplets.
      num_rels (int, optional):
          Number of relations in a knowledge graph.
          If not provided, it will be inferred from triplets.
      ent_feat (np.ndarray, optional):
          Entity features, which have consistent order with entity ids.
      rel_feat (np.ndarray, optional):
          Relation features, which have consistent order with relation ids.
docstr: All existing triplets (np.ndarray).
          
docstr_tok: ["All","existing","triplets","(","np.ndarray",")","."]
code: def triplets(self):
      """All existing triplets (np.ndarray)."""
      valid = (
          np.stack(
              [self._valid["h"], self._valid["r"], self._valid["t"]],
              axis=1,
          )
          if self._valid is not None
          and self._valid["mode"] != "wikikg90m"
          else None
      )
      test = (
          np.stack(
              [self._test["h"], self._test["r"], self._test["t"]],
              axis=1,
          )
          if self._test is not None
          and self._test["mode"] != "wikikg90m"
          else None
      )
      unempty = [x for x in [self._train, valid, test] if x is not None]
      return np.concatenate(unempty, axis=0)
  
imports: import os
  import json
  from collections import defaultdict
  import numpy
label_desc: Use image node_id 20 for calling the TriGraph obj's underlying member method code with example usage: obj.triplets() and returns: np