文档名称:
图数据库原理.pdf
格式:pdf 大小:966KB 页数:10页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表
如果您已付费下载过本站文档,您可以点这里二次下载
文档介绍:Report
Graph Databases
CS341 Distributed Information Systems
ed in further rec-
ommendations for Pizza places. The figure 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 finding additional rec-
ommendations for user Alex based on his existing recommendations.
user recommends
Alex C
Alex D
Luke D
Luke E
Table 1
Table 1 shows the recommends edges for the presented graph in a relational database.
By a simple lookup, we find 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 filtering of already r