class_docstr: Class implementing database connection.
  
  Example
  -------
  >>> AMPLIGRAPH_DATA_HOME='/your/path/to/datasets/'
  >>> # Initialize GraphDataLoader from .csv file
  >>> data = GraphDataLoader("data.csv", backend=SQLiteAdapter)
  >>> # Initialize GraphDataLoader from .txt file using indexer
  >>> # to map entities to integers
  >>> data = GraphDataLoader(AMPLIGRAPH_DATA_HOME + "fb15k/test.txt",
  >>>                        backend=SQLiteAdapter("database.db",
  >>>                        use_indexer=True))
  >>> for elem in data:
  >>>     print(elem)
  >>>     break
  [(1, 1, 2)]
  >>> # Populate the database with raw triples for training
  >>> with SQLiteAdapter("database.db") as backend:
  >>>     backend.populate(AMPLIGRAPH_DATA_HOME + "fb15k/train.txt",
  >>>                      dataset_type="train")
  >>> # Populate the database with indexed triples for training
  >>> with SQLiteAdapter("database.db", use_indexer=True) as backend:
  >>>     backend.populate(AMPLIGRAPH_DATA_HOME + "fb15k/train.txt",
  >>>                      dataset_type="train")
docstr: Get indexed triples.
  
  Parameters
  ----------
  chunk: ndarray
       Numpy array with a fragment of data of size (N,3), where each
       element is: (subject, predicate, object).
  dataset_type: str
       Defines what kind of data we are considering
       (`"train"`, `"test"`, `"validation"`).
  
  Returns
  -------
  tmp: ndarray
       Numpy array of size (N, 4) with indexed triples, where each
       element is of the form
       (subject index, predicate index, object index, dataset_type).
docstr_tok: ["Get","indexed","triples",".","Parameters","--","--","--","--","--","chunk",":","ndarray","Numpy","array","with","a","fragment","of","data","of","size","(","N,3",")",",","where","each","element","is",":","(","subject",",","predicate",",","object",")",".","dataset_type",":","str","Defines","what","kind","of","data","we","are","considering","(","`","``","train","''","`",",","`","``","test","''","`",",","`","``","validation","''","`",")",".","Returns","--","--","--","-","tmp",":","ndarray","Numpy","array","of","size","(","N",",","4",")","with","indexed","triples",",","where","each","element","is","of","the","form","(","subject","index",",","predicate","index",",","object","index",",","dataset_type",")","."]
code: def get_indexed_triples(self, chunk, dataset_type="train"):
      """Get indexed triples.
  
      Parameters
      ----------
      chunk: ndarray
           Numpy array with a fragment of data of size (N,3), where each
           element is: (subject, predicate, object).
      dataset_type: str
           Defines what kind of data we are considering
           (`"train"`, `"test"`, `"validation"`).
  
      Returns
      -------
      tmp: ndarray
           Numpy array of size (N, 4) with indexed triples, where each
           element is of the form
           (subject index, predicate index, object index, dataset_type).
      """
      if self.verbose:
          logger.debug("getting triples...")
      if isinstance(chunk, pd.DataFrame):
          chunk = chunk.values
      if self.use_indexer:
          # logger.debug(chunk)
          triples = self.mapper.get_indexes(chunk[:, :3])
          if self.data_shape > 3:
              weights = chunk[:, 3:]
              # weights = preprocess_focusE_weights(data=triples,
              #                                     weights=weights)
              return np.hstack(
                  [
                      triples,
                      weights,
                      np.array(len(triples) * [dataset_type]).reshape(
                          -1, 1
                      ),
                  ]
              )
          return np.append(
              triples,
              np.array(len(triples) * [dataset_type]).reshape(-1, 1),
              axis=1,
          )
      else:
          return np.append(
              chunk,
              np.array(len(chunk) * [dataset_type]).reshape(-1, 1),
              axis=1,
          )
  
imports: import logging
  import os
  import sqlite3
  import tempfile
  from sqlite3 import Error
  from urllib.request import pathname2url
  import numpy
  import pandas
  import tensorflow
  from ampligraph.utils.profiling import get_human_readable_size
  from .data_indexer import DataIndexer
label_desc: Use image node_id 15 for calling the SQLiteAdapter obj's underlying member method code with example usage: obj.get_indexed_triples(chunk, dataset_type) and returns: np, np, np