next up previous
Next: Choosing too little Up: Issues Previous: Our Source Database

Choosing too much

Here we will import all Friends edges of people who are younger then 15 and then destroy those nodes reachable by a Friends edge where the Friends object doesn't have some other child.

Define x = select x
           From DB.Person x
           Where x.Age < 15
           With x.Age, x.Friend

This results in:

             |
             | x
             |
             o
             |\ 
             | \ 
             |P \ P
             |   \ 
           F | F  \ 
       o<----o----->o 
             |     |
          Age|     |Age
             |     |
            14     11

Then in order to delete those people objects which were imported via the friend link who are not less then 15 (the person on the far left) we remove all friends links where the friend has no subobjects. (There are many ways to write the following where clause.)

Define y.Friend -= z
           From x.Person y, y.Friend z
           where not exits (z.Age);

This results in:

             |
             | x
             |
             o
             |\ 
             | \ 
             |P \ P
             |   \ 
             | F  \ 
             o---->o
             |     |
          Age|     |Age
             |     |
            14   11



Jason McHugh
Thu Jan 30 14:22:16 PST 1997