(12 points) Here's the ODL code. Two new classes have to be added since
ODL does not allow attributes on relationships or multiway relationships.
Do not forget to specify inverses of relationships!
class Movie {
attribute string title;
attribute integer year;
attribute integer length;
attribute enum Film {color, blackAndWhite} filmType;
// copied from book; this can be any type you wish
relationship Set<Contract> supportedby
inverse Contract::hasMovie;
}
class Star {
attribute string name;
attribute string address;
relationship Set<Contract> participatesin
inverse Contract::participating;
}
class Studio {
attribute string name;
attribute string address;
relationship Set<Contract> engagesin
inverse Contract::hasStudio;
}
class Salary {
attribute integer dollaramount;
relationship Set<Contract> usedin
inverse Contract::hasSalary;
}
class Contract {
relationship Salary hasSalary
inverse Salary::usedin;
relationship Studio hasStudio
inverse Studio::engagesin;
relationship Movie hasMovie
inverse Movie::supportedby;
relationship Star participating
inverse Star::participatesin;
}
Notice that because of the push-out construction, the sole purpose of
the Contract class is to engage in many-one relationships with all the
other classes.