Motivating Object Relational Databases

Consider a relational database to represent orthogonal rectangles in a plane (say X-Y plane). The rectangles have sides parallel to coordinate axis . There are three relations:

rectangle( rectangle-name, one-of-the-edges),
edge( edge-name, one-of-the-endpoints),
point( point-name, x-coordinate, y-coordinate ).
The first attribute in each relation is a unique identifier. Geometric computations can be represented by queries over this database.

EXAMPLE: Unit square will be represented in the database as a collection of following tuples:

rectangle( unit-square, edge1), rectangle( unit-square, edge2),
rectangle( unit-square, edge3), rectangle( unit-square, edge4),
edge( edge1, point1), edge( edge1, point2), edge( edge2, point2),
edge( edge2, point3 ), edge( edge3, point3), edge( edge3, point4 ), 
edge( edge4, point4), edge( edge4, point1 ),
point(  point1 , 0, 0 ), point( point2, 0, 1 ),
point( point3, 1, 1 ), point( point4, 1, 0 ).

Question 1. Write SQL expressions for the following queries:

(i) Find all rectangles which contain "point1" as a corner point.
(ii) Find all rectangles which contain "point1" as an inside point.

Question 2. Extensible databases and query languages can be used to simplify the queries considerably. Propose new abstract data types and operations to simplify the representation of the rectangles and queries given in questions 1a and 1b.

Question 3. Which indexing scheme is suitable for efficient processing of queries in questions 1a and 1b? Justify your answer.

Question 4. Why do spatial databases work with rectangles even though real maps usually have points, lines, polygons and other shapes?