Скачиваний:
140
Добавлен:
30.04.2013
Размер:
3.92 Mб
Скачать

Recursive Relationships in the Barker/Oracle-Like

Model

Recursive relationships in the Barker/Oracle-like model are drawn as shown in Figure 10.10. Once again, the dotted line in the relationship shows an optional relationship, the solid line would show a mandatory relationship, and a "crowsfoot" would show a "many" relationship. The relationships are named as shown. Figure 10.10 shows that an employee may supervise other employees and an employee may be supervised by one and only one supervisor. Note the foreign key, super_ssn, in the EMPLOYEE relation itself.

Figure 10.10: Barker/Oracle-Like Notation: Recursive

Relationships

Mapping M:N Relationships

Finally, we discuss one last important aspect that is treated differently in the Barker/Oracle-like model — an M:N relationship. In the Barker/Oracle-like model, all M:N relationships are resolved into two 1:M relationships with an intersection entity in the middle. In the Chen-like model, the M:N relationship can also be presented as two 1:M relationships.

Take Figure 10.11, for example (this is in the Chen-like format). In the Barker/Oracle-like model, this would be shown as in Figure 10.12.

Figure 10.11: An ER Diagram of an M:N Relationship in the Chen-Like Model

Figure 10.12: Barker/Oracle-Like Notation: M:N Relationship Broken into Two 1:M Relationships

Checkpoint 10.4

1.How are recursive relationships shown in the Barker/Oracle-like model?

2.Why is it difficult to show M:N relationships in the Barker/Oracle-like model?

3.How are the foreign keys treated in the Barker/Oracle-like model?

Chapter Summary

This chapter briefly discussed some of the main features of the Barker/Oraclelike model. The "one-entity" diagram, with attributes, was presented. The idea of optional versus mandatory attributes was discussed. Relationships and structural constraints were briefly discussed in the context of the Barker/Oracle-like model, and although the Barker/Oracle-like notation does not use the concept of the weak entity and multi-valued attributes, we showed how these concepts can be shown diagrammatically in the Barker/Oracle-like notation. An example of the depiction of the recursive relationship in the Barker/Oracle model was illustrated. Finally, the chapter showed how to map an M:N relationship into two 1:M relationships. Mapping rules were also discussed in the context of Barker/Oracle-like notation.

Chapter 10 Exercises

Exercise 10.1

Redraw Figure 6.12A using the Barker/Oracle notation. Map this to a relational database and show some sample data.

Exercise 10.2

Redraw Figure 6.7 using the Barker/Oracle notation. Map this to a relational database and show some sample data.

References

Barker, R., Case*Method, Entity Relationship Modelling, Addison-

Wesley, Reading, MA, 1990.

Hay, D.C., Data Model Patterns, Dorset House, New York, 1996.

Rodgers, Ulka, ORACLE: A Database Developer's Guide, Prentice Hall, Englewood Cliffs, NJ, 1991.

Glossary

A

Attribute:

Property used to describe an entity or relationship.

B

Binary relationship:

Relationship between two entities.

C

Candidate key:

An attribute or set of attributes that uniquely identifies individual occurrences of an entity type.

Cardinality ratio:

Describes the number of one entity that is related to another entity.

Composite attribute:

An attribute composed of multiple components, each with an independent existence.

D

Database:

A shared collection of logically associated or related data.

Degree of a relationship:

The number of participating entities in a relationship.

Derived attribute:

An attribute that gets a value that is calculated or derived from the database.