I am starting a project creating a management system for a book shop. I have created a simple entity class diagram as you can see below. I just wanted some guidance on whether the relationships are correct for the entities?
The relationships meaning:
1 order can be placed for many items of stock and a stock item can exist without an order.
1 book is 1 item of stock and a book cannot exist without its counterpart stock item
each book can have many publishers and a book cannot exist without a publisher
Finally ebook and paper book are sub classes of the super class book as they are both "books"
I agree with the aggregation relationship between order and stock; but note that n
can equal zero. Can there be an order of no stock? Also consider the direction of the relationship. Does stock have an order, or does an order have stock?
The model shows a composition relationship between stock and book; however, your description states that a book is stock. An is a
relationship should be modeled by generalization, rather than composition.
The model shows that many books have one publisher. Per your description, it would be more accurate to say that many books have many publishers. Also the direction of the composition relationship in the model indicates that a publisher cannot exist without a book; whereas your description states the opposite.
Finally, the model shows a directed associated between book and its subclasses; whereas your description (correctly) implies generalization, which should be modeled as a closed arrowhead.
reference: UML basics: The class diagram
One question I don't know: Have ebooks a number of exemplars in stock? Or they have different logic?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.