For example, I create multiple Tweet nodes, these tweet nodes have id,reply_to id and retweet_id. Assuming I have 6 nodes. The code below shows the nodes I create.
CREATE (n:Tweet:Node {id:'123', title:'A'});
CREATE (cl:TweetLeaf:Node {id:'234', title:'IT Team', reply_to:'123'});
CREATE (cl:TweetLeaf:Node {id:'testingTeam', title:'TESTING Team', reply_to:'234'});
CREATE (cl:TweetLeaf:Node {id:'588', title:'TESTING Team', reply_to:'testingTeam'});
CREATE (cl:TweetLeaf:Node {id:'kk', title:'TESTING Team', retweet_to:'588'});
CREATE (cl:TweetLeaf:Node {id:'119', title:'TESTING Team', retweet_to:'kk'});
2.Now I would like to create a hierarchy tree and trying to create two relationships. Here is the code I tried, but the relationship retweet can not be created successfully.
CREATE (n:Tweet:Node {id:'123', title:'A'});
CREATE (cl:TweetLeaf:Node {id:'234', title:'IT Team', reply_to:'123'});
CREATE (cl:TweetLeaf:Node {id:'testingTeam', title:'TESTING Team', reply_to:'234'});
CREATE (cl:TweetLeaf:Node {id:'588', title:'TESTING Team', reply_to:'testingTeam'});
CREATE (cl:TweetLeaf:Node {id:'kk', title:'TESTING Team', retweet_to:'588'});
CREATE (cl:TweetLeaf:Node {id:'119', title:'TESTING Team', retweet_to:'kk'});
MATCH (c: TweetLeaf)
WHERE NOT (c)-[:reply_to]->() or not (c)-[:retweet]->()
MATCH (parent:Node {id:c.reply_to}),(retweet:Node {id:c.retweet_id})
CREATE (c)-[:reply_to]->(parent),(c)-[:retweet]->(retweet)