In this article we present an approach to integrity maintenance, consi
sting of automatically generating production rules for integrity enfor
cement. Constraints are expressed as particular formulas of Domain Rel
ational Calculus; they are automatically translated into a set of repa
ir actions, encoded as production rules of an active database system.
Production rules may be redundant (they enforce the same constraint in
different ways) and conflicting (because repairing one constraint may
cause the violation of another constraint). Thus, it is necessary to
develop techniques for analyzing the properties of the set of active r
ules and for ensuring that any computation of production rules after a
ny incorrect transaction terminates and produces a consistent database
state. Along these guidelines, we describe a specific architecture fo
r constraint definition and enforcement. The components of the archite
cture include a Rule Generator, for producing all possible repair acti
ons, and a Rule Analyzer and Selector, for producing a collection of p
roduction rules such that their execution after an incorrect transacti
on always terminates in a consistent state (possibly by rolling back t
he transaction); moreover, the needs of applications are modeled, so t
hat integrity-enforcing rules reach the final state that better repres
ents the original intentions of the transaction's supplier. Specific i
nput from the designer can also drive the process and integrate or mod
ify the rules generated automatically by the method. Experimental resu
lts of a prototype implementation of the proposed architecture are als
o described.