Hello,
I try to merge nodes if two different statements are true. I work with twitter data and I want to merge tweets if the Text of the tweet and the id of the creator is the same. How can I do a collection of that? I know how to collect data where one attribute is the same:
MATCH (f:Tweet)
WITH f.Text as Text, collect(f) as nodes
WHERE size(nodes) > 1
[...]
but I am not sure how I can get the second MATCH into that.
I hope someone can help ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=9)
Best Regards,
Lars
Hello
I don't have that much time but this link would help you a bit as a non pure Cypher solution:
MATCH (tw)
WITH DISTINCT tw.text AS text, tw.id AS id, collect(tw) AS nodes <- This line create a list of tweets that have the same unique text and id properties pair
CALL [Replace this with the apoc procedure]
Cypher by itself without APOC is not optimise to refactor a graph at this scale. It's better to avoid these situations by creating CONSTRAINTS before importing or creating data.