CPSC 333: More About Associative Objects

Location: [CPSC 333] [Listing by Topic] [Listing by Date] [Previous Topic] [Next Topic] More About Associative Objects


This material was not covered in lectures in Winter, 1997, due to lack of time. However, it is ``required reading'' for CPSC 333 students.


Types of Binary Associative Objects

Recall that we have defined ten types of binary relationships based on their cardinality and conditionality. For binary relationships connecting an entity A to an entity B, these describe the number of instances of B that can be connected to any given instance of A, and vice-versa.

We have also described two kinds of associative objects.

Types of Objects of the First Kind

For the first kind of associative object, you can have at most one connection from any given instance of A to any given instance of B.

In this case, each ``relationship type'' is possible for the relationship part of the associative object. Thus, there are ten different ``types'' of this kind of associative object, and their definitions (or descriptions) are virtually identical to those for the ten types of binary relationships.

To obtain names for these ten types of associative objects for use in this course, we'll add the word ``Single'' after the name of the type for the relationship, to form the names ``1:1 Single,'' ``1:M Single,'' and so on.

Types of Objects of the Second Kind

For the second kind of associative object, you can have multiple connections between any given instance of A and any given instance of B. Since no two rows in a data table corresponding to the associative object should ever be identical, it will be possible to use the values for the associative object's own attributes, to distinguish instances of the associative object that connect the same instance of A to the same instance of B.

Now, once again, all ten types for the ``relationship part'' of the associative object can arise; we should reinterpret (or revise) the description of each type (and its picture), understanding that if an instance of A is connected to an instance of B ``at all,'' then multiple connections between these instances are possible.

To name the ten types for the second kind of associative object for use in this course, we'll add the word ``Multiple'' after the name of the type for the relationship part, to form the names ``1:1 Multiple,'' ``1:M Multiple,'' and so on.

Types of k-Way Associative Objects

As already mentioned, we could classify 3-way relationships, 4-way relationships, and so on, in a similar way - ``in principle.'' However, there would be too many different types - even for 3-way relationships - for this to be of much use. So, we won't bother.

Instead, we'll consider the ``type'' of any relationship that isn't binary to be ``k-way,'' and we'll create two corresponding types of associative objects - ``k-way Single'' and ``k-way Multiple'' - just as we created two types of associative object corresponding to each type of binary relationship, above.

Choosing Primary Keys

For associative objects of the first kind, you can select a primary key (consisting of key attributes from one or more of the entities connected by the associative object), by considering the type of its ``relationship part,'' and choosing a key as previously described.

For associative objects of the second kind, you will need to choose the primary key for the relationship part, as above, and then add one or more of the associative object's own attributes. Add (only) as many attributes as you need to guarantee that the values of the attributes in the key can be used to distinguish between instances of the associative object. As mentioned above, no two rows in a data table corresponding to the associative object should ever be identical, so there should always be some subset of the associative object's attributes (maybe, all of them), that can be added to the ``key'' obtained by considering the relationship part, in order to achieve this.

Location: [CPSC 333] [Listing by Topic] [Listing by Date] [Previous Topic] [Next Topic] More About Associative Objects


Department of Computer Science
University of Calgary

Office: (403) 220-5073
Fax: (403) 284-4707

eberly@cpsc.ucalgary.ca