41 The Architectural Perspective
The architectural perspective emphasizes the number and abstraction level of the components of a relationship, which together characterize the complexity of the relationship. We will briefly consider three architectural issues: degree (or arity), cardinality, and directionality.
These architectural concepts come from data modeling and they enable relationships to be described precisely and abstractly, which is essential for maintaining an organizing system that implements relationships among resources. Application and technology lifecycles have never been shorter, and vast amounts of new data are being created by increased tracking of online interactions and by all the active resources that are now part of the Internet of Things. Organizing systems built without clear architectural foundations cannot easily scale up in size and scope to handle these new requirements.
Degree
The degree or arity of a relationship is the number of entity types or categories of resources in the relationship. This is usually, though not always, the same as the number of arguments in the relationship expression.
Homer Simpson (husband) ⇔ is-married-to ⇔ Marge Simpson (wife)
is a relationship of degree 2, a binary relationship between two entity types, because the “is-married-to” relationship as we first defined it requires one of the arguments to be of entity type “husband” and one of them to be of type “wife.”
Now suppose we change the definition of marriage to allow the two participants in a marriage to be any instance of the entity type “person.” The relationship expression looks exactly the same, but its degree is now unary because only 1 entity type is needed to instantiate the two arguments:
Homer Simpson (person) ⇔ is-married-to ⇔ Marge Simpson (person)
Some relationships are best expressed as ternary ones that involve three different entity types. An example that appears in numerous data modeling books is one like this:
Supplier → provides → Part → assembled-in → Product
It is always possible to represent ternary relationships as a set of binary ones by creating a new entity type that relates to each of the others in turn. This new entity type is called a dummy in modeling practice.
Supplier → provides → DUMMY
Part → provided-for → DUMMY
DUMMY → assembled-in → Product
This transformation from a sensible ternary relationship to three binary ones involving a DUMMY entity type undoubtedly seems strange, but it enables all relationships to be binary while still preserving the meaning of the original ternary one. Making all relationships binary makes it easier to store relationships and combine them to discover new ones.
Cardinality
The cardinality of a relationship is the number of instances that can be associated with each entity type in a relationship. At first glance this might seem to be degree by another name, but it is not.
Cardinality is easiest to explain for binary relationships. If we return to Homer and Marge, the binary relationship that expresses that they are married husband and wife is a one-to-one relationship because a husband can only have one wife and a wife can only have one husband (at a time, in monogamous societies like the one in which the Simpsons live).
In contrast, the “is-parent-of” relationship is one-to-many, because the meaning of being a parent makes it correct to say that:
Homer Simpson → is-parent-of → Bart AND Lisa AND Maggie
As we did with the ternary relationship in “Degree”, we can transform this more complex relationship architecture to a set of simpler ones by restricting expressions about being a parent to the one-to-one cardinality.
Homer Simpson → is-parent-of → Bart
Homer Simpson → is-parent-of → Lisa
Homer Simpson → is-parent-of → Maggie
The one-to-many expression brings all three of Homer’s children together as arguments in the same relational expression, making it more obvious that they share the same relationship than in the set of separate and redundant one-to-one expressions.
Directionality
The directionality of a relationship defines the order in which the arguments of the relationship are connected. A one-way or uni-directional relationship can be followed in only one direction, whereas a bi-directional one can be followed in both directions.
All symmetric relationships are bi-directional, but not all bi-directional relationships are symmetric. (See “Symmetry”.) A relationship between a manager and an employee that he manages is “employs,” a different meaning than the “is-employed-by” relationship in the opposite direction. As in this example, the relationship is often lexicalized in only one direction.