Assignment 2, Object Oriented DB - Advanced Database Systems | CSE 880, Assignments of Deductive Database Systems

Material Type: Assignment; Professor: Pramanik; Class: Advanced Database Systems; Subject: Computer Science & Engineering; University: Michigan State University; Term: Spring 2008;

Typology: Assignments

Pre 2010

Uploaded on 07/22/2009

koofers-user-sqp-1
koofers-user-sqp-1 🇺🇸

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE 880: Homework 2
Object-Oriented DB
Due: Feb 14, 2008
1. (a) Write a schema using graphical representation for the following
object types:
project, document, project-leader and research-paper.
Use document-IF as an interface type for document, and research-
paper is-a subtype of document-IF. Use the following relations be-
tween the object types:
project has a set of documents and a project leader. Pro ject lead-
ers publish research-papers. Make appropriate assumptions on the
cardinalities of the relations.
(b) Write the above graphical representation of the schema in ODL.
2. Write OQL statements for the following queries using the schema for
Project-Task database given in the class:
(a) Get all those projects that John has worked for.
(b) Get all those Documents that the participating members of those
tasks with description ”Database design” have published.
(c) Get those projects all of whose task leaders have published at least
10 articles.
(d) Get all project names for those projects with a task leader who is
author of some article.
3. Following is a definition of two object classes student and course.
class student
relationship s courses is a set {course}
inverse of s courses is c students in course
class course
relationship c students is a set {student}
inverse of c students is s courses in student
1
pf3

Partial preview of the text

Download Assignment 2, Object Oriented DB - Advanced Database Systems | CSE 880 and more Assignments Deductive Database Systems in PDF only on Docsity!

CSE 880: Homework 2

Object-Oriented DB

Due: Feb 14, 2008

  1. (a) Write a schema using graphical representation for the following object types: project, document, project-leader and research-paper. Use document-IF as an interface type for document, and research- paper is-a subtype of document-IF. Use the following relations be- tween the object types: project has a set of documents and a project leader. Project lead- ers publish research-papers. Make appropriate assumptions on the cardinalities of the relations. (b) Write the above graphical representation of the schema in ODL.
  2. Write OQL statements for the following queries using the schema for Project-Task database given in the class:

(a) Get all those projects that John has worked for. (b) Get all those Documents that the participating members of those tasks with description ”Database design” have published. (c) Get those projects all of whose task leaders have published at least 10 articles. (d) Get all project names for those projects with a task leader who is author of some article.

  1. Following is a definition of two object classes student and course.

class student relationship s courses is a set {course} inverse of s courses is c students in course class course relationship c students is a set {student} inverse of c students is s courses in student

Most of the attributes for the above classes, such as student name and student id, are omitted from the definition. The relationship s courses in the student class represents a set of courses taken by a student and the relationship c students in the course class represents a set of students taking a course. Thus, a relationship is defined in a class to relate an object of that class to an object or a set of objects in another class. The line ”inverse of s courses is c students in course” in the definition of student class means that if ”student x is taking a course y” is in the relationship s courses then ”course y is taken by student x” is in the relationship c students. Answer the following four questions related to the definition of relationships and inverse of relationships.

(a) Is it necessary to have inverse statements in the definition of the student and the course classes? Give a justification for your answer. (b) In general, when is it necessary to have inverse statements in defining relationships? (c) Give the definition of a person class with the relationships mother, f ather and children. Note that the target class for the relation- ships is also person. (d) Is the inverse of the mother relationship the children relationship? Give a justification for your answer.

  1. Can a type ever be legal as both the type of an ODL attribute and the type of an ODL relationship? Explain why or why not.
  2. Following question relates to rules for multiple inheritance (refer to chapter 17 of the reference book: Advanced Database Systems, Caro Zaniolo, et. al. on reserve in the library).

(a) Draw the following classes showing the hierarchy for inheritance along with all the inherited attributes. Indicate which rules have been used for each inheritance: class worker(name:string, salary:int, car:car) inherit object-class class car(name:string, price:real, hp:integer) inherit object-class class exp-car(name:string, price:real, option: integer) inherit car class consultant(work-address:string, specialization:string) inherit