Question

Suppose the ASCII tree below is a UML generalized concept model. To represent these entities/classes in UML, lets assume [mammal] a super class, and the level 1 classes, [wild] and [domestic] are sub classes in UML. In other words, class [wild] inherits all attributes from [mammal], and [domestic] inherits all attributes from [mammal] as well. Furthermore, [raccoon] and [white tail deer] inherit all attributes from [wild].

I want to convert the UML model to a relational database model.

Notice how [raccoon] extends both [wild] and [domestic]. In other words, it has two parents. I would normally make the primary key of all descendant tables the same as their parent primary key. In addition, I'd make the foreign key in the descendant table the same as the primary key in its parent table. Because [raccoon] has two parents, how would I build that table?

mammal
 |
 +- wild
 |  |
 |  +- raccoon
 |  |
 |  +- white tail deer
 |
 +- domestic
    |
    +- cat
    |   |
    |   +- siberian
    |
    +- dog
    |   |
    |   +- golden retriever
    |   |
    |   +- lab
    |
    +- raccoon 

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top