(self, dc_string, schema)
Constructing denial constraint object.
        This class contains a list of predicates and the tuple_names which define a Denial Constraint

        :param dc_string: (str) string for denial constraint
        :param schema: (list[str]) list of attribute
Constructing denial constraint object.
        This class contains a list of predicates and the tuple_names which define a Denial Constraint
Constructing denial constraint object . This class contains a list of predicates and the tuple_names which define a Denial Constraint
def __init__(self, dc_string, schema):
        """
        Constructing denial constraint object.
        This class contains a list of predicates and the tuple_names which define a Denial Constraint

        :param dc_string: (str) string for denial constraint
        :param schema: (list[str]) list of attribute
        """
        dc_string = dc_string.replace('"', "'")
        split = dc_string.split('&')
        self.tuple_names = []
        self.predicates = []
        self.cnf_form = ""
        self.components = []

        # Find all tuple names used in DC
        logging.debug('DONE pre-processing constraint: %s', dc_string)
        for component in split:
            if contains_operation(component):
                break
            else:
                self.tuple_names.append(component)
        logging.debug('DONE extracting tuples from constraint: %s', dc_string)

        # Make a predicate for each component that's not a tuple name
        for i in range(len(self.tuple_names), len(split)):
            try:
                self.predicates.append(Predicate(split[i], self.tuple_names, schema))
            except Exception:
                logging.error('predicate %s', split[i])
                raise
        for p in self.predicates:
            self.components.append(p.components[0][1])

        # Create CNF form of the DC
        cnf_forms = [predicate.cnf_form for predicate in self.predicates]
        self.cnf_form = " AND ".join(cnf_forms)
def __init__ ( self , dc_string , schema ) : dc_string = dc_string . replace ( '"' , "'" ) split = dc_string . split ( '&' ) self . tuple_names = [ ] self . predicates = [ ] self . cnf_form = "" self . components = [ ] # Find all tuple names used in DC logging . debug ( 'DONE pre-processing constraint: %s' , dc_string ) for component in split : if contains_operation ( component ) : break else : self . tuple_names . append ( component ) logging . debug ( 'DONE extracting tuples from constraint: %s' , dc_string ) # Make a predicate for each component that's not a tuple name for i in range ( len ( self . tuple_names ) , len ( split ) ) : try : self . predicates . append ( Predicate ( split [ i ] , self . tuple_names , schema ) ) except Exception : logging . error ( 'predicate %s' , split [ i ] ) raise for p in self . predicates : self . components . append ( p . components [ 0 ] [ 1 ] ) # Create CNF form of the DC cnf_forms = [ predicate . cnf_form for predicate in self . predicates ] self . cnf_form = " AND " . join ( cnf_forms )