Example #1
0
 def drs_from_raw_field(self, field: (str, str, str)) -> DRS:
     """
     Given a field and source name, it returns a DRS with its representation
     :param field: a tuple with the name of the field, (db_name, source_name, field_name)
     :return: a DRS with the source-field internal representation
     """
     db, source, field = field
     nid = id_from(db, source, field)
     h = Hit(nid, db, source, field, 0)
     return self.drs_from_hit(h)
Example #2
0
 def _node_to_hit(self, node: (str, str, str)) -> Hit:
     """
     Given a field and source name, it returns a Hit with its representation
     :param node: a tuple with the name of the field,
         (db_name, source_name, field_name)
     :return: Hit
     """
     db, source, field = node
     nid = id_from(db, source, field)
     hit = Hit(nid, db, source, field, 0)
     return hit
Example #3
0
 def schema_neighbors(self, field: (str, str, str)) -> DRS:
     """
     Returns all the other attributes/fields that appear in the same relation than the provided field
     :param field: the provided field
     :return: returns a list of Hit elements of the form (id, source_name, field_name, score)
     """
     db_name, source_name, field_name = field
     hits = self.__network.get_hits_from_table(source_name)
     origin_hit = Hit(id_from(db_name, source_name, field_name), db_name, source_name, field_name, 0)
     o_drs = DRS([x for x in hits], Operation(OP.TABLE, params=[origin_hit]))
     return o_drs