Re: Constraint problem

From: Philip Lijnzaad <lijnzaad_at_ebi.ac.uk>
Date: 2000/05/24
Message-ID: <u766s4166s.fsf_at_o2-3.ebi.ac.uk>#1/1


Svenn> I have 2 entities complex and reference, and the relations between Svenn> them are;

Svenn> each complex MUST have at LEAST ONE (or more) reference(s). Svenn> each reference CAN refer to at LEAST ONE (or more) complex(es).

(CAN and AT LEAST don't go together well. Drop AT LEAST or change CAN to MUST ...) Anyway, in UML, this would look like:

  +-------------+           +---------------+

| Complex | | Reference |
|-------------|-----------|---------------|
| | + + | |
| | | |
+-------------+ +---------------+

In this case, Complex <-> Reference is a many-to-many association for which you need to have additional link table; see your text books.

Or is it more like:

                            
             +-----+        
           + |     |        
  +-------------+  |        

| Complex |--+
|-------------| +
| |

  +-------------+

, where the self-accociation would be _implemented_ using a link table called Reference. By the look of it, I suspect this is not the case.

Svenn> So how would I make sure that for every complex has a reference and Svenn> every reference refers to a complex?

Make sure the link table has the appropriate foreign keys to Complex and Reference.

                                                                      Philip
-- 
/dev/brain:  character special (53/0)
-----------------------------------------------------------------------------
Philip Lijnzaad, lijnzaad_at_ebi.ac.uk \ European Bioinformatics Institute,rm A2-24
+44 (0)1223 49 4639                 / Wellcome Trust Genome Campus, Hinxton
+44 (0)1223 49 4468 (fax)           \ Cambridgeshire CB10 1SD,  GREAT BRITAIN
PGP fingerprint: E1 03 BF 80 94 61 B6 FC  50 3D 1F 64 40 75 FB 53
Received on Wed May 24 2000 - 00:00:00 CEST

Original text of this message