PDA

View Full Version : Identifying entities and relationships


mailman62
11-29-2004, 04:23 AM
Hi,

I have a little problem with the detection of entities and relationships in rational databases.
I want to write a algorithm to identify entities and relationships.
My first thougth was to look whether the primary key of the actual relation (table) only consists of foreign keys (then the relation is a relationship table). This worked for 80 %.
Then I thougth about the idea that if foreign keys are only part of the primary key of the actual relation ( then the relation is a relationship table). This also worked for 80%, but not the same 80%.

Does anyone have an idea to solve my problem.

Thanks, mailman62

stuka
11-29-2004, 11:04 AM
An algorithm for detecting entities vs. relationships...interesting thought - trying to reverse engineer ER diagrams from the database? Kinda cool concept.

Do the 2 80% tests overlap to cover 100% of the cases? If so, why can't you just combine them?

mailman62
11-29-2004, 11:18 AM
No, unfortunately it does not. It seems that two ideas are excluding themselves.

Some of the relations that are detected correctly in the first algorithm are not correctly detected in the second one.