Relations in NDO

The object oriented approach models the relationships between classes in two hierarchies:

·      Part-of-hierarchy

·      Kind-of-hierarchy

The last one is based on inheritance. The first one contains all sorts of relations that objects of the different classes can have to each other. The relations differ from each other by these characteristics:

Cardinality:

Denotes the count of objects the relation targets to; possible values are 0, 1, n (often denoted as ‘*’), and value ranges like 1..n respectively. In a bidirectional relationship the cardinality is denoted for each side of the relationship.

Direction:

Relations can be unidirectional or bidirectional.

Type:

There are two relation types: composition and association. In a composition relation the life span of a child object is directly connected with the life span of its parent object. Child objects cannot be moved to other parent objects and they are deleted together with the parent objects. In an association relation the child objects are independent objects that can belong to several parents. The two terms are complementary antonyms: A relation is either of type composition or association

Role:

There can be more than one relation to the same target class. In that case it is important to distinguish the relations using role names.