Re: Question on Multiplicity
Date: Wed, 26 Oct 2005 11:33:03 -0700
Message-ID: <djoi55$7vk$1_at_news.Stanford.EDU>
It may also depend on how much detail you want to record and why.
To get really fancy, you could make a table listing "pattern":
id | pattern
1 | entirely 2 | stripes 3 | spots 4 | background 5 | rings
etc.
and, if you wanted to be incredibly fancy, "parts":
id | part
1 | body 2 | foreleg 3 | hindleg 4 | wing 5 | head 6 | tail
etc.
And then you could encode the information that "pandas have black spots; pandas' bodies have a white background; pandas have black forelegs; pandas have black hindlegs" in a fifth table that just linked the ids (each statement would be a separate record):
speciesid -> partid -> patternid -> colorid
The question you'd have to ask first is, WHY? What do you want to record, what will you be using the information for? What do you want to be able to search for.
If you need a list of "all animals with brown or white heads but no stripes anywhere on their bodies," the more complex structure would be the way to go.
If ALL you need is, "given a species of animal, tell me what it looks like," you might only need a string describing the animal (panda: "mostly white body with black legs and black spots around the eyes").
HTH, Bruce
"jason.glumidge_at_gmail.com" <Jason.Glumidge_at_gmail.com> wrote in message
news:1130348425.226719.139110_at_f14g2000cwb.googlegroups.com...
> Roy Hann wrote:
>> "jason.glumidge_at_gmail.com" <Jason.Glumidge_at_gmail.com> wrote in message >> news:1130334318.730554.140170_at_f14g2000cwb.googlegroups.com... >> > Imagine you were knocking up a simple table of animals and their >> > predominant colors. Something of the order: >> > >> > ---------------------- >> > animal | color >> > ---------------------- >> > swan | white >> > lion | yellow >> > oranguatan | orange >> > ---------------------- >> >> To see what is going on here, ask yourself what sentence you intend to >> plug >> these words into to form true statements. (i.e. what is the predicate?) >> Here are some suggestions: >> >> All <animal> are <color>. >> Food for <animal> is stored in warehouse zone <color>. >> A <animal> can be entirely <color>. >> A <animal> is >93% <colour>. >> A <animal> can be partly <color>. >> A <animal> can never be <color>. >> T-shirts with <animal> logo are <color>. >> >
> Many thanks for the reply. I think i still have a way to go to clarify
> the model in my mind, so that I instinctively encode information in the
> best possible way. I'm certainly starting to understand that it's not
> just a case of knowing you're way around SQL and the basics of
> normalization, and thinking you have expertise in relational modelling.
> With the above example the predicate I had in mind (although not
> explicitly - probably my first mistake), was:
>
> "There is an animal:<A> with some fur colored <C>"
>
> This may be a bad choice (i'm still not completely clear on this) - is
> the implication that such a predicate constrains my declaration of the
> world to all animals only having one fur-color?
> >> > Consider also that some animals that have multicolored fur. For >> > instance a zebra is black and white. Keeping the table nice and >> > normalized yields: >> > >> > ---------------------- >> > animal | color >> > ---------------------- >> > swan | white >> > lion | yellow >> > oranguatan | orange >> > zebra | black >> > zebra | white >> > ---------------------- >> >> It would appear that you have a table but you don't know the predicate, >> or >> you know the predicate and the table is wrong. >> >> [snip] >> > Now my question is am I missing anything - is there any method of >> > making this distinction without having to introduce a new reference >> > column to resolve the ambiguity? >> >> You'll need to decide on the predicate, and it's not clear to me that you >> have one. You might even find you need multiple predicates (and multiple >> tables). >> >
> Just for the sake of completeness (even though this example is a bit
> contrived), here's the simple strategy that seemed intuitive
>> id | animal_name
> -----------------
> -----------------
> 1 | swan
> 2 | swan
> 3 | lion
> 4 | oranguatan
> 5 | zebra
> -----------------
>
> ------------
> id | color
> ------------
> 1 | white
> 2 | black
> 3 | yellow
> 4 | orange
> 5 | black
> 5 | white
> ------------
>
> Now this works fine, but i'm still a touch confused as to how my
> predicate choice could have altered this structure. I intended a
> one->many fur color, but seem to have a problem in that i don't have an
> observation between different types of swan - I'm assuming I just have
> their coloquial name.
>
> As ever, I'm much obliged for any pointers.
>
Received on Wed Oct 26 2005 - 20:33:03 CEST