CS341 Distributed Information Systems
ed in further rec-
ommendations for Pizza places. The ﬁgure shows one possible (graphical) solution by
looking at other user’s recommendations based on Alex’ favorites.
Figure 1: An example graph illustrating a graphical solution for ﬁnding additional rec-
ommendations for user Alex based on his existing recommendations.
Table 1 shows the recommends edges for the presented graph in a relational database.
By a simple lookup, we ﬁnd all recommendations of Alex. Then, we have to reach
other users that recommended the same places (Luke in our case). This is done by
self-joining the table. Now, we again have to use a self-join to ‘traverse’ from Luke to his
recommendations. The following SQL query shows a possible solution:3
SELECT * FROM recommendations r1
JOIN recommendations r2 ON
r2. user <> r1. user AND
r2. recommends = r1. recommends
JOIN recommendations r3 ON
r3. user = r2. user
Notice that the ﬁltering of already r