结构推理 电影数据库涉及如下数据:电影类包括电影名、制作年份、电影长度等属性;演员类包括姓名、年龄、地址等属性。每部电影都可能有多个演员出演,而每个演员都可能出演多部电影。 (1)用ODL给出类的说明; (2)用OQL查询演员张晓丽所出演的电影的电影名和制作年份。
【正确答案】(1)interface Movie{ (extent Movies) attribute string title; attribute integer year; attribute integer length; relationship Set<Act>acts inverse Act∷starredIn; }; interface Act{ (extent Acts) attribute string name; attribute integer age; attribute string address; relationship Set<Movie> starredIn inverse Movie∷acts; }; (2)SELECT m. title m. year FROM Acts a,a. starredIn m WHERE a. name=‘张晓丽’;
【答案解析】