Referential attributes are used to formalize binary and associative relationships. All objects should have one or more identifiers each of which is composed of one or more identifying attributes. Any attribute on an object can be identifying. It is common for identifiers to be composed of more than one identifying attribute. Some analysts get lazy and create arbitrary ID identifiers everywhere but I try to avoid them whenever possible. To formalize a one-to-one or one-to-many binary relationship between two objects (or participants), a target identifier is chosen on one object and a set of referential attributes are chosen (or added) to the other object where each referential attribute is mapped to an identifying attribute of the target identifier. These referential attributes can't be set directly by the analyst, they exist only as a by product of a relationship instance existing. A referential attribute may be used in many participant mappings each of which is annotated in the referential suffix.
OOA08 (and OOA Tool) fully supports the use of referential attributes to formalize binary and associative relationships. However, OOA08 requires all referential attributes be resolvable to a single base attribute (non-referential and non-polymorphic). This wasn't an explicit requirement in OOA91 or OOA96. An analyst could keep a model consistent by using the same data type (or attribute domain) for overlapping referential attributes. However, in my experience it is always possible to resolve overlapping referential attributes to a single base attribute and the resulting model is always more complete.
As a result of this requirement, all referential attributes have a base attribute status of either:
Unresolvedindicating that there is no path from the referential attribute to any base attribute,
Partially Resolvedindicating that there is a path from the referential attribute to a base attribute but that there are also other non-circular paths which don't lead to a base attribute yet,
Fully Resolvedindicating that all paths from the referential attribute lead to a single base attribute (ignoring circular references),
Incompatibleindicating that one or more paths from the referential attribute lead to a base attribute with a data type that doesn't match the manual data type associated with this attribute (which can't happen if a manual data type is not specified),
Multiple Base Attributesindicating that one or more paths from the referential attribute lead to multiple base attributes (whether they have the same data type is not relevant in OOA08),
Only Circular Referencesindicating that all paths from the referential attribute are circular in nature.
The example above should help illustrate the different base attribute statuses.
Attribute A1 is
Unresolved since it is declared as referential but doesn't appear in any participant mappings.
Attribute A2 is
Unresolved since although it references
Attribute B1, that attribute is
Attribute A3 is
Partially Resolved since although it references
Attribute B2 which is a base attribute, it also references
Attribute C1 which is
Attribute A4 is
Fully Resolved since it only references
Attribute D1 which is a base attribute. If
Attribute A4 had a manual data type of
Attribute D1 had a manual data type of
Attribute A4 would have an
Incompatible status instead. If
Attribute C1 was a base attribute rather than a referential attribute then
Attribute A3 would have a
Multiple Base Attributes status instead. If
Attribute B1 formalized relationship
R4 then both
Attribute A2 and
Attribute B1 would have a
Only Circular References status.
Circular references are common when composed identifiers are used, i.e. the identifiers for a set of related objects may all have a common identifying attribute. Having circular references is not a problem unless there are only circular references. However, once a referential attribute with this problem has been identified, it can normally be easily fixed, i.e. a set of related objects with a common identifying attribute implies a relationship should exist to an object defining the common attribute as a base attribute. There are situations that appear to be correct but which still have referential attributes with only circular references, i.e. when an identifying attribute which should have been a base attribute has become a referential attribute. However, an analyst should always be able to determine the home object of a referential attribute and if that attribute is not a base attribute, the analyst should make it a base attribute by separating the referential duties off into another attribute and noting the constraint.
The algorithm for resolving base attributes is highly iterative because referential attribute mappings form arbitrary graphs which may be cyclic, i.e. they may include circular paths. The algorithm is briefly outlined below:
- Add all referential attributes to a set of unresolved referential attributes
- Loop thru the set of unresolved referential attributes until a complete iteration occurs without resolving a single referential attribute
- Attempt to resolve the base attribute and base attribute status of each referential attribute using previously resolved referential attributes (or previously determined true attributes for polymorphic attributes) while checking for error conditions at the same time
- If any unresolved referential attributes are referenced by this attribute then skip the resolution of this attribute for now
- A base attribute status can be resolved if all references from this attribute are non-referential attributes, previously resolved referential attributes or if an error condition can be detected without the need to completely resolve all references from this attribute, e.g. for
Multiple Base Attributeserror conditions
- If a base attribute status can be resolved then remove this attribute from the set and perform another complete iteration of the unresolved referential attributes after this iteration completes
- If the set still contains unresolved referential attributes then
a final iteration thru the set is madere-enter the above loop, except that references to unresolved referential attributes are treated as circular references and ignored
- Any unresolved referential attributes after this final iteration are all given the base attribute status of
Only Circular References
The data type of a referential attribute is determined from the resolved base attribute. However, a manual data type can be specified for a referential attribute for consistency checking purposes. An error condition will be flagged if the resolved base attribute's data type doesn't match the manual data type.
The conditionality of the referential attribute is determined from the resolved base attribute's conditionality along with the navigation conditionality across all the paths to the resolved base attribute. This can also be weakened by specifying a manual conditionality for the referential attribute. Further discussion of attribute conditionality will be left for another day.