Search code examples
entityentity-relationshiperd

What is the difference of partiality and optionality when drawing ER diagrams


Partial relationships are shown by single lines total relationships are shown by double lines. And in some ER diagrams optional and mandatory relationship is shown by a dotted line and a single line respectively.

What is the exact difference of definitions between these concepts? Please use an example if possible.


Solution

  • Consider the following example:

    ERD example

    A Patient or a Laboratory may exist independently of any relationship. Some Patients may Purchase Medicine, and some Laboratories may Produce Medicine, hence those entity sets participate partially in their relationships.

    Medicine cannot exist without being Produced by a Laboratory, thus Medicine participate totally in the Produced relationship. Medicine can exist without being Purchased hence Medicine participate partially in the Purchase relationship.

    A Patient may Purchase some Medicine without a Prescription, thus a Prescription is optional to the Buys relationship. In contrast, a Purchase cannot exist without a Patient and Medicine, hence those roles are mandatory to the relationship. In the Produced relationship, both roles are mandatory.

    The basic difference here is that cardinality constrains the existence of relationships, while participation constrains the existence of entities. When a role in a relationship set is mandatory, it means a relationship instance can't exist without an entity filling that role. When an entity set participates totally in a relationship, it means an entity can't exist without being related.