Re: A simple situation shows confusion about basic concepts

From: Alan <alan_at_erols.com>
Date: Mon, 25 Oct 2004 16:39:27 -0400
Message-ID: <2u56jvF2510obU1_at_uni-berlin.de>


"Ney André de Mello Zunino" <zunino_at_inf.ufsc.br> wrote in message news:2u55lqF25f27iU1_at_uni-berlin.de...
> Hello.
>
> Even though I have designed and worked on some projects involving
> databases before, I realize my understanding of the concepts still needs
> a lot of improvement. After a relatively long period of inactivity, I
> find myself struggling to comprehend and get the design of a current
> project right. In particular, I am having trouble with a pair of
> entities and their interrelationship.
>
> The first entity represents what is called, in the context of the
> project, a /universal concept/. Think of it as a unique string which
> identifies a real concept such as a rock, a car, love, peace, etc. There
> I had my first dilemma: should I make that very string the primary key
> of my entity or should I use an artificial key such as "concept_id"?
> Because the strings can potentially become very long and cumbersome, I
> chose the latter option. All right, let's move on.
>
> The second entity represents entries in a knowledge base or a conceptual
> graph. Those entries establish binary relationships between pairs of
> /universal concepts/, the entity previously described. Schematically,
> the entities look something like:
>
> UC (Universal Concept)
> ======================
> uc_id (PK)
> uc
>
> KB (Knowledge Base)
> ===================
> entry_id (PK)
> uc1_id
> uc2_id
> relation_type
>
> So, basically, the KB is a collection of entries which represent binary
> connections of different types between UCs.
>
> Now for my questions (please, bear with me if some of them sound stupid):
>
> 1) While reading about the different ER relation types on the
> documentation of the modelling tool, I was having a hard time choosing
> among /identifying/, /non-identifying/ and /m:n/ relationships. Who is
> dependent and who is independent in the situation presented? Is it
> correct to think that the KB entity is dependent on the other because an
> entry needs universal concepts (two actually) to exist? In that case,
> what is the proper way of relating the entities UC and KB?
>
> 2) Are the /uw1_id/ and /uw2_id/ attributes in KB foreign keys? Is it
> correct to say that, whenever the primary key of an entity appears as an
> attribute on another entity, it is a foreign key? In other modelling
> environments with which I have worked, I was able to directly link an
> attribute such as /uw1_id/ to its corresponding primary key on the
> associated entity. With the present tool [1], however, the way to
> achieve that seems not so straightforward (of course, this is inherent
> to my lack of knowledge both of the tool and the theory). In other
> words, the foreign keys are created by establishing relationships, not
> explicitly. In the present context, that means I had to set up two
> relationships between the entities: one for the /uw1_id/ attribute and
> another for the /uw2_id/ one. I am not sure, but somehow, that doesn't
> seem right.
>
> I would be very grateful if someone would care to help me clarify my
> confusion with the above issues.
>
> [1] CASE Studio 2.17
>
> Thank you very much,
>
> --
> Ney André de Mello Zunino

Couple of things (and I am about to attack this backwards)...

0. It strikes me that KB is incorrect in that you have uc_id1 and uc_id2. There should only be uc_id, and this is a foreign key to UC. 1. You only need uc_id at all if you have more than one uc with the same name(description?) or you will be adding additional attributes to UC. So... 2. If you do not need uc_id, then you have a 1:1 realtionship between UC and KB. These will map into only one table, but I suspect that is not really your case so you will....
3. need uc_id, and you therefor have a 1:m relationship between UC and KB. uc_id is the PK in UC and the FK in KB.

You end up with:

 UC (Universal Concept)



 uc_id (PK)
 uc

 KB (Knowledge Base)



 entry_id (PK)
 uc_id (FK)
 relation_type (whatever that is)

You are making this much more complex than it really is. This is a simple 1:m situation. E.g., one word has one or more definitions. Received on Mon Oct 25 2004 - 22:39:27 CEST

Original text of this message