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 subjects and objects complementary to a triple (?,p,?).
  
  Returns the participating entities in the relation ?-p-o and s-p-?.
  Function used during evaluation.
  
  WARNING: If the parent is set the triples returned are coming with parent indexing.
  
  Parameters
  ----------
  x_triple: nd-array, shape (N, 3)
      Triples `(s, p, o)` that we are querying.
  
  Returns
  -------
  entities: tuple
       Tuple containing two lists, one with the subjects and one of with the objects participating in the
       relations ?-p-o and s-p-?.
docstr_tok: ["Get","subjects","and","objects","complementary","to","a","triple","(","?",",","p",",","?",")",".","Returns","the","participating","entities","in","the","relation","?","-p-o","and","s-p-","?",".","Function","used","during","evaluation",".","WARNING",":","If","the","parent","is","set","the","triples","returned","are","coming","with","parent","indexing",".","Parameters","--","--","--","--","--","x_triple",":","nd-array",",","shape","(","N",",","3",")","Triples","`","(","s",",","p",",","o",")","`","that","we","are","querying",".","Returns","--","--","--","-","entities",":","tuple","Tuple","containing","two","lists",",","one","with","the","subjects","and","one","of","with","the","objects","participating","in","the","relations","?","-p-o","and","s-p-","?","."]
code: def _get_complementary_entities(self, triples, use_filter=None):
      """Get subjects and objects complementary to a triple (?,p,?).
  
      Returns the participating entities in the relation ?-p-o and s-p-?.
      Function used during evaluation.
  
      WARNING: If the parent is set the triples returned are coming with parent indexing.
  
      Parameters
      ----------
      x_triple: nd-array, shape (N, 3)
          Triples `(s, p, o)` that we are querying.
  
      Returns
      -------
      entities: tuple
           Tuple containing two lists, one with the subjects and one of with the objects participating in the
           relations ?-p-o and s-p-?.
      """
  
      logger.debug("Getting complementary entities")
  
      if self.parent is not None:
          logger.debug(
              "Parent is set, WARNING: The triples returned are coming with parent indexing."
          )
  
          logger.debug("Recover original indexes.")
          triples_original_index = self.mapper.get_indexes(
              triples, order="ind2raw"
          )
          #            with shelve.open(self.mapper.entities_dict) as ents:
          #                with shelve.open(self.mapper.relations_dict) as rels:
          #                    triples_original_index = np.array([(ents[str(xx[0])], rels[str(xx[1])],
          # ents[str(xx[2])]) for xx in triples], dtype=np.int32)
          logger.debug("Query parent for data.")
          logger.debug(
              "Original index: {}".format(triples_original_index)
          )
          subjects = self.parent.get_complementary_subjects(
              triples_original_index, use_filter=use_filter
          )
          objects = self.parent.get_complementary_objects(
              triples_original_index, use_filter=use_filter
          )
          logger.debug(
              "What to do with this new indexes? Evaluation should happen in the original space, \
              shouldn't it? I'm assuming it does so returning in parent indexing."
          )
          return subjects, objects
      else:
          subjects = self._get_complementary_subjects(
              triples, use_filter=use_filter
          )
          objects = self._get_complementary_objects(
              triples, use_filter=use_filter
          )
      return subjects, objects
  
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 9 for calling the NoBackend obj's underlying member method code with example usage: obj._get_complementary_entities(triples, use_filter) and returns: subjects,  objects, subjects,  objects