Re: Constraints and Functional Dependencies

From: Carl Federl <>
Date: 24 Feb 2007 09:28:49 -0800
Message-ID: <>

<Anyone have any alternate formulas for functional dependencies or
candidate keys? >

My primary objection to using FOL to define constraints is that it would require our theory of data to have two different but similar languages, one for defining constraints in the FOL language and then a second language for manipulating relations.

I will first give some definitions and then show why FOL is not needed.

Relational Manipulation Language consists of the Basic Relational Operators and Relational Assignment.

Basic Relational Operators (BRO) are Project, Extend, Restrict, Product, Minus, Union and Aggregation. It is also usefull to be able to define and name additional relational operators derived from the BRO such as join and divide, but these are not mandatory.

Relational Assignment is assiging a name to a relation. I have chosen a syntax of
<relation name> <= <any relation either base or derived>

Renaming a base relation is simply
NewName <= OldName

For constraints, a test needs to be defined to determine if the constraint has been violated. The syntax of ConstraintViolation( <relation name> ) means "when the named relation is not empty, the constraint has been violated"

An example:
Relation AnimalBreed with attributes AnimalBreedName and AnimalBreedMaximumWeight
Relation Animal with attributes AnimalName, AnimalBreedName and AnimalWeight:

Uniqueness constraint:
Ra <= AGGREGATE AnimalBreed add COUNT(*) as AB_Cnt group by AnimalBreedName
Rb <= RESTRICT Ra where AB_Cnt not = 1
ConstraintViolation (Rb)

Foreign Key constraint on Animal to AnimalBreed

Ra <= PROJECT Animal   ( AnimalBreedName  )
Rb <= PROJECT AnimalBreed  ( AnimalBreedName  )
Rc <= Ra MINUS Rb on ( Ra.AnimalBreedName ) corresponding
(Rc.AnimalBreedName )
ConstraintViolation (Rc)

A measurement constraint:
A1 <= PROJECT AnimalBreed ( AnimalBreedName as ABN , AnimalBreedMaximumWeight )
A2 <= PRODUCT ( A1, Animal )
A3 <= RESTRICT A2 where AnimalBreedName = ABN and NOT ( AnimalWeight
<= AnimalBreedMaximumWeight)

ConstraintViolation (A3) Received on Sat Feb 24 2007 - 18:28:49 CET

Original text of this message