  Presented are algorithms for enforcing function diagram commutativity and
anti-commutativity database constraints, using the database software
application constraint-driven design and development methodology, in the realm
of the (Elementary) Mathematical Data Model ((E)MDM). MatBase, an intelligent
data and knowledge management system prototype mainly based on the (E)MDM, uses
these algorithms to automatically generate corresponding code in both its
versions (i.e., the MS Access and the .NET and SQL Server ones). Of course, any
software developer may also use these algorithms manually. The paper also
discusses the code generated to enforce two such constraints from a Geography
database.
