Draw the eight possible Entity-Relationship diagrams for relationship set R and entity sets E1, E2, and E3 when arities are specified. (There are eight possibilities because each entity set can either have or not have an arrow pointing to it.) For each E/R diagram, specify a relation for R and underline in the relation a minimal key. Recall from Problem (4) on Assignment #1 that a key is minimal if attributes that are not needed in the key are not included. The relations for the entity sets are trivial and need not be included.
interface MedStudent { key ID; attribute integer ID; attribute string name; relationship List<Internships> positions inverse Internships::wants-position; relationship Set<Internships> wants-me inverse Internships::students; } interface Internships { key (hospital, city); attribute string hospital; attribute string city; attribute integer #positions; relationship List<MedStudent> students inverse MedStudent::wants-me; relationship Set<MedStudent> wants-position inverse MedStudent::positions; }
In the schema, relationship positions in class MedStudent is an ordered list reflecting a medical student's choice of internships, while relationship students in class Internships is an ordered list reflecting a hospital's choice of interns. Relationships MedStudent::positions and Internships::students are not inverses of each other, since in general there is not an exact (or even close) match between the internship positions students desire and the students desired for a particular internship. Instead, we've specified separate inverse relationships: a relationship MedStudent::wants-me that is the inverse of Internships::students, and a relationship Internships::wants-position that is the inverse of MedStudent::positions. Since there is not necessarily an ordering among the related objects in these inverse relationships, they are specified as sets rather than lists.
Finally, here's the problem: Putting together the techniques described in class and in the course notes for translating the various ODL constructs in the schema above to relations, produce a set of relations for this database design: