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: Populate the database with data.
  
   Condition: before you can store triples, you have to index data.
  
  Parameters
  ----------
  data_source: ndarray or str
       Numpy array or file (e.g., csv file)  with data.
  dataset_type: str
       What type of data is it?
       options (`"train"` | `"test"` | `"validation"`).
  get_indexed_triples: func
       Function to obtain indexed triples.
  loader: func
       Loading function to be used to load data; if `None`, the
       `DataSourceIdentifier` will try to identify the type of
       ``data_source`` and return an adequate loader.
docstr_tok: ["Populate","the","database","with","data",".","Condition",":","before","you","can","store","triples",",","you","have","to","index","data",".","Parameters","--","--","--","--","--","data_source",":","ndarray","or","str","Numpy","array","or","file","(","e.g.",",","csv","file",")","with","data",".","dataset_type",":","str","What","type","of","data","is","it","?","options","(","`","``","train","''","`","|","`","``","test","''","`","|","`","``","validation","''","`",")",".","get_indexed_triples",":","func","Function","to","obtain","indexed","triples",".","loader",":","func","Loading","function","to","be","used","to","load","data",";","if","`","None","`",",","the","`","DataSourceIdentifier","`","will","try","to","identify","the","type","of","``","data_source","``","and","return","an","adequate","loader","."]
code: def populate(
      self,
      data_source,
      dataset_type="train",
      get_indexed_triples=None,
      loader=None,
  ):
      """Populate the database with data.
  
       Condition: before you can store triples, you have to index data.
  
      Parameters
      ----------
      data_source: ndarray or str
           Numpy array or file (e.g., csv file)  with data.
      dataset_type: str
           What type of data is it?
           options (`"train"` | `"test"` | `"validation"`).
      get_indexed_triples: func
           Function to obtain indexed triples.
      loader: func
           Loading function to be used to load data; if `None`, the
           `DataSourceIdentifier` will try to identify the type of
           ``data_source`` and return an adequate loader.
  
      """
      self.data_source = data_source
      self.loader = loader
      if loader is None:
          self.loader = self.identifier.fetch_loader()
      if not self.is_indexed() and self.use_indexer is not False:
          if self.verbose:
              logger.debug("indexing...")
          self.index_entities()
      else:
          logger.debug(
              "Data is already indexed or no\
                      indexing is required."
          )
      if get_indexed_triples is None:
          get_indexed_triples = self.get_indexed_triples
      data = self.loader(data_source, chunk_size=self.chunk_size)
  
      self.reload_data()
      for (
          chunk
      ) in data:  # chunk is a numpy array of size (n,m) with m=3/4
          if chunk.shape[1] > 3:
              # weights = preprocess_focusE_weights(data=chunk[:, :3],
              # weights=chunk[:, 3:]) # weights normalization
              weights = chunk[:, 3:]
              chunk = np.concatenate([chunk[:, :3], weights], axis=1)
          self.data_shape = chunk.shape[1]
          values_triples = get_indexed_triples(
              chunk, dataset_type=dataset_type
          )
          self._insert_values_to_a_table(
              "triples_table", values_triples
          )
      if self.verbose:
          logger.debug("data is populated")
  
      query = "SELECT count(*) from triples_table;"
      _ = self._execute_query(query)
  
      if isinstance(self.use_filter, dict):
          for key in self.use_filter:
              present_filters = [
                  x[0]
                  for x in self._execute_query(
                      "SELECT\
                          DISTINCT dataset_type FROM triples_table"
                  )
              ]
              if key not in present_filters:
                  # to allow users not to pass weights in test and validation
                  if (
                      self.data_shape > 3
                      and self.use_filter[key].shape[1] == 3
                  ):
                      nan_weights = np.empty(
                          (self.use_filter[key].shape[0], 1)
                      )
                      nan_weights.fill(np.nan)
                      self.use_filter[key] = np.concatenate(
                          [self.use_filter[key], nan_weights], axis=1
                      )
                  self.populate(self.use_filter[key], key)
      query = "SELECT count(*) from triples_table;"
      _ = self._execute_query(query)
  
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 19 for calling the SQLiteAdapter obj's underlying member method code with example usage: obj.populate(data_source, dataset_type, get_indexed_triples, loader) without return types