Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Constraints and Functional Dependencies

Re: Constraints and Functional Dependencies

From: Carl Federl <cfederl_at_yahoo.com>
Date: 24 Feb 2007 09:28:49 -0800
Message-ID: <1172338129.927321.228010@j27g2000cwj.googlegroups.com>


<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.

Definitions:
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 - 11:28:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US