我正在使用orientdb,我正在扩展跟随我的所有顶点。现在我也跟随一些顶点,所以我想检查我是否跟踪特定的顶点。
我正在使用的查询:
SELECT @rid, name FROM (SELECT expand(in('Follow')) FROM users WHERE @rid = #123:8 LIMIT 20)
我试图做
SELECT @rid as userRid, name, if(SELECT FROM follow where out = #123:8 And in = userRid, 1, 0) as followed FROM (SELECT expand(in('follow')) FROM users WHERE @rid = #123:8 LIMIT 20)
知道如何达到预期效果吗?
答案 0 :(得分:1)
试试这个:
select from <your rid> where out('Follow').@rid contains <person rid>
希望有所帮助
此致
答案 1 :(得分:0)
好的,在Michela Bonizzi的回答中,我设法像这样解决它
SELECT @rid, name, if(eval("in('Follow') contains #123:8"), 1, 0) as followed FROM (SELECT expand(in('Follow')) FROM users WHERE @rid = #123:8 LIMIT 20)
现在这个人会告诉我是否也跟随我的粉丝。所以Michela的答案是正确的。
答案 2 :(得分:0)
让(来源) - &gt;(目标)
可以验证边缘是否存在两个方向
SELECT IN('EDGE_CLASS').sourceProperty FROM (SELECT FROM Target WHERE targetProperty = 'value')
SELECT OUT('EDGE_CLASS').targetProperty FROM (SELECT FROM Source WHERE sourceProperty = 'value')
或者,您可以使用别名和EXPAND函数来获取感兴趣的属性。
SELECT EXPAND(IN('EDGE_CLASS').sourceProperty) AS sourceProperty FROM (SELECT FROM Target WHERE targetProperty = 'value')