Managing relationships between types in Akwatype enables you to structure your data model with precision, by defining links such as composition and aggregation. These two concepts are essential for indicating degrees of dependency between entities and structuring information according to their role and importance in the model. By default, any relationship created in Akwatype is an association, a simple connection between two entities. It is then possible to specify more precise levels of connection, such as composition or aggregation, for more advanced structuring needs. The use of these advanced concepts is optional when modeling. This page looks at how to use these relationships to create a structured model that is adaptable to business needs.
Find out more about type relationship
Composition: Strong Dependency Relationship
Composition is used when the "part" entity is an integral part of the "whole" entity. In a composition relationship, the lifetime of the part depends on that of the whole, i.e. if the main entity is deleted, so are its parts. This reflects a strong dependency relationship, where the part has no independent existence.
Example of Composition: A Command can have several Command Lines which depend directly on it. If the command is deleted, the associated command lines will also be deleted.
Use in Akwatype: In Akwatype, composition is defined by structuring a close relationship where the main entity encompasses the sub-elements. This link guarantees data integrity in the event of deletion or updating.
Composition is ideal for representing the intrinsic links between a central entity and its components, thus ensuring model consistency.
Aggregation: Weak Dependency Relationship
Aggregation represents a looser relationship between entities, where the part and the whole can exist independently. Unlike composition, the deletion of the main entity does not result in the deletion of its parts. This type of relationship is often used for functional links between entities that cooperate without being strictly interdependent.
Aggregation example: A class can have several registered students, but deleting the class does not delete the students. They retain their existence in the system, independently of the class.
Use in Akwatype: In Akwatype, an aggregation relationship is defined without imposing a strong dependency, allowing associated entities to function autonomously.
Aggregation is ideal for modeling relationships that require interaction without imposing direct dependency.
Choose between Composition, Aggregation and Association
The choice between association, composition and aggregation depends on the nature of the relationship between the entities:
Use Composition if the part has no existence of its own and depends on the main entity for its lifetime.
Opt for Aggregation if the entities can exist independently of each other, but are functionally associated.
Assume a default Association if the relationship does not imply dependency or a strong link, allowing a simple connection between entities.
Example of modeling with Composition and Aggregation
We have a compositional link between the Organization and its departments. The departments cannot exist without the organization.
We have an aggregation link between a department and the employees working in it. If the department disappears, the employees don't disappear and can be assigned to other departments.
Conclusion
Akwatype's relationship management, integrating the concepts of association, composition, aggregation and cardinality, enables links between entities to be structured rigorously. By choosing relationships adapted to business needs, teams can build a flexible and durable data model.