Esempio n. 1
0
 def __check_gp_mappings(self, gp=None):
     """
     Used in _save method. Seeks matches with some fragment already registered
     :param gp: By default, _graph_pattern attribute is used when gp is None
     :return: The matching fragment id and the mapping dictionary or None if there is no matching
     """
     if gp is None:
         gp = self._graph_pattern
     gp_keys = r.keys('{}:*:gp'.format(self._fragments_key))
     for gpk in gp_keys:
         stored_gp = GraphPattern(r.smembers(gpk))
         mapping = stored_gp.mapping(gp)
         if mapping:
             return gpk.split(':')[-2], mapping
     return None