Message from discussion
Ternary Relationship cardinality
Path: g2news2.google.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail
From: "Jan Hidders" <hidd...@gmail.com>
Newsgroups: comp.databases.theory
Subject: Re: Ternary Relationship cardinality
Date: 19 Sep 2006 01:41:29 -0700
Organization: http://groups.google.com
Lines: 47
Message-ID: <1158655289.492999.196590@m73g2000cwd.googlegroups.com>
References: <1158605847.044728.267640@e3g2000cwe.googlegroups.com>
<nJMPg.3411$UG4.2842@newsread2.news.pas.earthlink.net>
<1158653002.250096.72440@b28g2000cwb.googlegroups.com>
NNTP-Posting-Host: 143.129.75.148
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1158655295 9684 127.0.0.1 (19 Sep 2006 08:41:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 19 Sep 2006 08:41:35 +0000 (UTC)
In-Reply-To: <1158653002.250096.72440@b28g2000cwb.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: m73g2000cwd.googlegroups.com; posting-host=143.129.75.148;
posting-account=U78G8Q0AAACV8HVhabWnSmNCyAn1Kbks
mikl...@gmail.com wrote:
> I know what cardinality is... and I know how to implement it
>
> My problem is with the notation for a particular Ternary relationship.
>
> (Supertype) [Parent]------[0..*]----- <Breeding>
> ----[1..1]--------[Child](subtype)
> |-------------[0..*]------------|
Your ASCII art is a bit unclear so let me tell you how I interpret
this:
- You have a relationship Breeding(Parent1, Parent2, Child)
Your depicted cardinality constraints are as follows:
- Each Child participates in exactly one instance of that relationship.
- Each Parent participates in zero or more instances of that
relationship.
Minor detail: if *every* child has two parents your database will
either be infinite or some will be their own descendants.
> The prob is when I use the N:1 notation..my first reaction would be to
> do something like this:
>
> (Supertype) [Parent]------1-----
> <Breeding>-----M-------[Child](subtype)
> |-------------1------------|
The general rule is as follows: If you have a relationship R(a,b,c)
then you have to ask for each role, say 'a', how its cardinality
depends on the combination of the other two, in this case 'b' and 'c'.
If the upperbound is 1 then you put 1 on the corresponding edge in the
diagram, if there is no upperbound you put N or M there.
So let's look at Child. Given two particular parents what is the upper
bound on the number of children. There is no upperbound so the edge
Breeding--Child is annotated with N. Let's look at Parent1. Given
Parent2 and a child is there un upper bound on the number of associted
Parent1's? Yes, there can be at most one, (in fact, this is already the
case just for Child) so we annotate the edge Breeding--Parent(1) with
1.
Clear?
-- Jan Hidders