Source & Target optional
The properties panel includes the switches Target Optional and Source Optional. These properties allow you to toggle relationship dependencies between two entities.
What is a relationship dependency?
A relationship dependency describes whether an entity is dependent on or independent of an associated entity.
Let’s explore three different scenarios that use relationship dependencies.
Scenario 1: Target Optional
Let’s assume we have a diagram where a “Owner” can own many “Cars”, denoted in the diagram below.
In our fictional scenario we have a rule that any car must have an owner. This would mean that a Car has a dependent relationship with an Owner. In other words, an Owner may or may not own a Car but a Car must have an Owner.
If we say the source is an Owner and the Car is the target, the relationship would be target optional and would resemble the image below.
Scenario 2: Source Optional
This time, the rule is that a Car is not required to have an Owner, but everyone must own a Car. This would mean that a Car has an independent relationship with an Owner. In other words, an Owner must have a Car but a Car may have an Owner.
This relationship would be source optional as the Owner is still the source, and would resemble the image below.
Scenario 3: Source and Target Optional
In the final scenario, Cars are not required to have an Owner and an Owner is not required to have a Car. This means that an Owner and a Car have an independent relationship to each other. An Owner may or may not have a Car and a Car may or may not belong to an Owner. The relationship dependency in this situation would be both target optional and source optional and would be represented by the image below.