Created
May 16, 2019 17:35
-
-
Save vladbatushkov/1e79522101ab75cd5ff880d181493691 to your computer and use it in GitHub Desktop.
Set SHARE relationship
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (m1:Movie), (m2:Movie) | |
WHERE NOT (m1)-[:SHARE]-(m2) AND id(m1) <> id(m2) | |
WITH m1, m2, apoc.coll.intersection(m1.keywords, m2.keywords) as sameKeys | |
WITH m1, m2, sameKeys, size(sameKeys) as total | |
WHERE total > 3 | |
MERGE (m1)-[:SHARE { keywords: sameKeys }]->(m2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment