Here we will first import all people who have age is less then 15, then we will add the links to the people via another Define statement. Note here that in the second query we must do some sort of mapping between the objects within the source database and those within the view database. Define statement.
First we import just the people whose age is less then 15.
Define x = select x From DB.Person x Where x.Age < 15 With x.Age
This results in:
| | DB | o |\ | \ |P \ P | \ o o | | Age| |Age | | 14 11
Then in order to add the edges between friends we run the second query which results in exactly what we want. In the following queries ``S'' is the name of the source database.
Define y1.Friend += z From S!DB.Person y1, S!DB.Person y2, y1.Friend z Where y1.Age < 15 and y2.Age < 15 and z = y
Here the mapping is implicit and happens "by magic". To make it more explicit we could (and I assume that we will) accept the following:
Define y1.Friend += y2 From X.Person y1, X.Person y2 Where y1@S in y2@S.Friend
This takes a bit of staring at, but it will do the same thing that the previous query does. The @ operator will transfer an object in a view to the corresponding object within the source database. If the object has no corresponding object within the source then it will always evaluate to FALSE.