For a school project, I'm supposed to design the systems of a previous semester's project. We're using UML, creating an extremely simple use case diagram (no <<extend>>
type nonsense, just actors pointing at use cases inside of a system), from which we make a class diagram, then a relational model.
Use Case and Class Diagram attempts:
The last diagram is just me eventually thinking that maybe my use cases were the issue.
My application lets people/restaurants list food they're willing to donate. Charities that feed the homeless request food. If there's a match, the charities can create a truck route to pick up food from all their matches.
I'm having trouble figuring out how to represent matching, as well as if this diamond of the FoodItems and matching connecting to route makes any sense. I know inheritance is generally a bad idea in relational modeling. Is it just a matter of having FKs everywhere? I feel like I'm walking in circles.
This object relational mapping topic can be quite complex. But looking at your diagram, here an oversimplified rules of thumbs:
1 - 1..*
, or1-0..*
) add the primary key (ID) on the 1 side as foreign key in the table on the n side. Do this also for the your aggregates. This is called foreign key mapping.1..* - 1..*
) you need to add a relational table, with the ID of the two linked tables (each defined as foreign key, and both together as a combined primary key). This is called association table mapping.ItemMatch
, I think it cwould be sufficient to add two fields corresponding each to afoodItemID
(use different names).0..*
relationAdditional readings: