【发布时间】:2016-12-05 01:25:45
【问题描述】:
我正在尝试使此脚本工作以检索文件中存在的所有边缘,以及从用户到电影的评分。
new File('ratings.dat').eachLine{
line ->
components = line.split('::');
userId = components[0].toInteger();
movieId = components[1].toInteger();
g.V().has('userId', userId).as('o').V().has('movieId', movieId).addE('rated').to('o');
}
如果我在这个闭包中添加一些调试打印,我可以看到所有信息都正确加载到我的变量中,但是在执行结束时,我计算了我图中的边数,它只增加了1、什么时候应该是多个。一些调查表明,被有效添加到图中的边是最后被读取的。可能出了什么问题?
【问题讨论】:
标签: groovy graph closures gremlin tinkerpop