CREATE (n:Tweet {id:'123', title:'A'})
CREATE (cl1:TweetLeaf {id:'234', title:'IT Team', reply_to:'123'})
CREATE (cl2:TweetLeaf {id:'testingTeam', title:'TESTING Team', reply_to:'234'})
CREATE (cl3:TweetLeaf {id:'588', title:'TESTING Team', reply_to:'testingTeam'})
CREATE (cl4:TweetLeaf {id:'kk', title:'TESTING Team', retweet_to:'588'})
CREATE (cl5:TweetLeaf {id:'119', title:'TESTING Team', retweet_to:'kk'})
CREATE (n:Tweet:Node {id:'588', title:'B'})
MATCH (c: TweetLeaf)
WHERE NOT (c)-[:reply_to]->() or not (c)-[:retweet_to]->()
MATCH (parent:Tweet {id:c.reply_to})
WITH parent, c
MERGE (c)-[:reply_to]->(parent)
MATCH (c: TweetLeaf)
WHERE NOT (c)-[:reply_to]->() or not (c)-[:retweet_to]->()
MATCH (retweet:Tweet {id:c.retweet_to})
WITH c, retweet
MERGE (c)-[:retweet_to]->(retweet)`Preformatted text`
The output should like the screenshot below:
However, my output just like this(AB should link to A but there is no relationship between node AB and node A):