CSC 543

We finished talking about spatial queries in Oracle and began talking about constraint databases (chapter 4 of the book). We are looking at a particular prototype system, MLPQ. Download, user manual (with many examples) and examples are all online at the http://www.cse.unl.edu/~revesz/MLPQ/mlpq.htm. The system doesn't always do exactly what one would expect, and it crashes occasionally, but overall it's pretty good.

**Submission**: you can submit the homework by hardcopy
in class or by sending it to me as an email.

1. [More spatial oracle, 30pt] Write and run queries for the following tasks in my_world.sql:

a) For every street find the closest lake and the best way to get there (i.e. the points on the street and the lake that are closest to each other together with their distance).

b) Pick any two queries from the last slide of the 2nd presentation on Oracle Spatial.

2. [First-Order Logic, 10pt] Using first order logic (i.e. using the "for all" and "there exists" quantifiers), express that rectangle lake lies entirely west of triangle lake. As in class, assume that you have relations rectangle(x,y) and triangle(x,y) which are true exactly for the points in the lake.

3. [Constraint Databases, 20pt] For this problem you need to download the MLPQ constraint database and install it. The questions here are about my_world.txt, a partial implementation of my world in the language of MLPQ.

a) To the world add code that creates the "poly lake" (with island). *
Hint:* as we said in class, poly lake can be written as the union of 4
convex sets (see the purple street example for how union is realized).

b) Write a query (use the SQL button) to list all points of interest and lakes (by name), so that the point of interest shares the "latitude" (i.e. y-coordinate in our world) of some point in the lake.

4. [Extra Credit, 15pt] Using first-order logic express that a point is on an island in a lake. (You will have to go beyond the linear constraint database model for this by allowing multiplication of variables).

Marcus Schaefer

Last updated: May 2nd, 2009.