在neo4j中添加触发器时无法创建关系

时间:2017-04-26 07:59:45

标签: neo4j cypher neo4j-apoc

我用apoc.trigger.add创建了一个触发器:

CALL apoc.trigger.add('increase_followings_and_followers',
'UNWIND {createdRelationships} AS rel 
WITH rel, STARTNODE(rel) as follower, ENDNODE(rel) AS followed WITH rel, follower, followed
WHERE TYPE(rel)="FOLLOW" and labels(followed)="User" and labels(follower)="User" 
SET follower.followings = follower.followings +1, followed.followers= followed.followers+1',
{phase:'after'})

我构建了一个社交网络,当用户关注另一个时,触发器会自动增加关注者号码和跟随号码。但它不起作用,我不能创造新的关系" FOLLLOW"两个用户节点之间的

1 个答案:

答案 0 :(得分:4)

节点上的标签是一个集合,因此您需要使用IN运算符:

 val sc = SparkSession.builder()
                            .master("local")
                            .appName("Lea")
                            .getOrCreate()
   // example login = angelique
   var login:String = (givenName+"."+sn).replaceAll(" ", "")

   sc.sql("SELECT login FROM global_temp.users where login="+login).show