next up previous
Next: Glossed over Up: View Specification Previous: Sample Specification

More Complex Examples

Figure 2: Some more views

What about an example where we wish to create a link between two people in our database? This is unique because we have never encountered any examples where just a link will be added between two existing objects.

This is the specification for View 3 shown in Figure 2. It is actually an addition to view 2. Notice here that I do not need to assign a name to my import, since it already has one.

Import new_link (x->y Pals)
       View_From Friends.Students.P x, Friends.TAs.P y
       where /* Some where clause that only captures o3 and o4*/

As a last example consider when we would like to augment every person within our view with the person's address if it exists within the source database. Here is the specification for that:

Import p.Address += View_From Friends.Person p

Or, since this doesn't capture the feel that the additional information ``.Phone'' is coming from the source database:

Import p2, p2.Address += View_From Friends.Person p1
                       Source_From DB.#.Person p2
                       where p1 = p2; /* Oid comparison */

If we wanted to add these elements only for a subset of our view, then a where directly below the View_From would filter out only those that we wanted.



Jason McHugh
Tue Dec 10 15:35:11 PST 1996