CS157a
Chris Pollett
Oct 23, 2019
We now describe how a UML Diagram can be mapped to a relational schema:
class <name> { <list of properties> };
class Movie { attribute string title; attribute integer year; attribute integer length; attribute enum Genres {drama, comedy, sciFi, teen} genre; };
class Star { attribute string name; attribute Struct Addr {string street, string city} address; };
class Movie { attribute string title; attribute integer year; attribute integer length; attribute enum Genres {drama, comedy, sciFi, teen} genre; relationship Set<Star> stars; }; class Star { attribute string name; attribute Struct Addr {string street, string city} address; relationship Set<Movie> starredIn; };
relationship Set<Star> stars; becomes relationship Set<Star> stars inverse Star::starredIn; and relationship Set<Movie> starredIn; becomes relationship Set<Movie> starredIn inverse Movie::stars;
class Cartoon extends Movie { relationship Set<Star> voices; };
class Movie (key (title, year)){ ...