class_docstr: Class providing an artificial backend, that reads data into memory.
class_docstr_tok: ["Class","providing","an","artificial","backend",",","that","reads","data","into","memory","."]
docstr: Get triples whose subjects belongs to ``subjects``, objects to ``objects``,
  or, if neither object nor subject is provided, triples whose subject or object belong to entities.
docstr_tok: ["Get","triples","whose","subjects","belongs","to","``","subjects","``",",","objects","to","``","objects","``",",","or",",","if","neither","object","nor","subject","is","provided",",","triples","whose","subject","or","object","belong","to","entities","."]
code: def _get_triples(self, subjects=None, objects=None, entities=None):
      """Get triples whose subjects belongs to ``subjects``, objects to ``objects``,
      or, if neither object nor subject is provided, triples whose subject or object belong to entities.
      """
      if subjects is None and objects is None:
          if entities is None:
              msg = "You have to provide either subjects and objects indexes or general entities indexes!"
              logger.error(msg)
              raise Exception(msg)
  
          subjects = entities
          objects = entities
      # check_subjects = np.vectorize(lambda t: t in subjects)
      if subjects is not None and objects is not None:
          check_triples = np.vectorize(
              lambda t, r: (t in objects and r in subjects)
              or (t in subjects and r in objects)
          )
          triples = self.data[
              check_triples(self.data[:, 2], self.data[:, 0])
          ]
      elif objects is None:
          triples = self.data[np.isin(self.data[:, 0], subjects)]
      elif subjects is None:
          triples = self.data[np.isin(self.data[:, 2], objects)]
      triples = np.append(
          triples,
          np.array(len(triples) * [self.dataset_type]).reshape(-1, 1),
          axis=1,
      )
      # triples_from_objects = self.data[check_objects(self.data[:,0])]
      # triples = np.vstack([triples_from_subjects, triples_from_objects])
      return triples
  
imports: import logging
  import tempfile
  import uuid
  from datetime import datetime
  import numpy
  import pandas
  import tensorflow
  from .data_indexer import DataIndexer
  from .source_identifier import DataSourceIdentifier
label_desc: Use image node_id 7 for calling the NoBackend obj's underlying member method code with example usage: obj._get_triples(subjects, objects, entities) and returns: triples