S. Embury, P. Gray, N. Bassiliades, “Constraint Maintenance Using Generated Methods in the P/FDM Object-Oriented Database”, Proc. 1st International Workshop on Rules in Database Systems, N.W. Paton and M.H. Williams (Eds.), Springer-Verlag, pp. 364-381, Edinburgh, Scotland, 30 August- 1 September 1993, 1994.
Proc. 1st International Workshop on Rules in Database Systems, N.W. Paton and M.H. Williams (Eds.), Springer-Verlag, pp. 364-381, Edinburgh, Scotland, 30 August- 1 September 1993, 1994.
We discuss the use of code-generated methods in Prolog as a flexible and efficient way to implement complex semantic constraints in an OODB. We introduce a high-level constraint language CoLan, based on functions and sets and including range quantifiers, from which fragments of code are generated to check the constraints. These fragments are attached to slots in class descriptors, and are also inherited (constraints cannot be overridden). Thus many fragments can come from one constraint and one slot may have attached fragments from many constraints. Constraints can be selectively disabled or removed which causes inhibition or disabling of corresponding fragments. This overcomes many objections to implementing constraints through methods. We have prototyped it by using the metaclass facilities of ADAM to initiate code generation. We are now re-implementing it in P/FDM, using changes to metadata (P/FDM does not have full metaclasses). This will incorporate a transaction mechanism and also provide queries on constraints. This approach opens a number of interesting future directions.