Created
July 6, 2018 22:49
-
-
Save kshefchek/3bca6db792164e4749cf50fea9562dbd to your computer and use it in GitHub Desktop.
Creating meta graphs for monarch-lite
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
| CALL apoc.periodic.iterate( | |
| "MATCH (a)-[r]->(b) | |
| WITH FILTER(lab in labels(a) | |
| WHERE ( | |
| lab <> 'Class' AND | |
| lab <> 'NamedIndividual' AND | |
| lab <> 'Node' AND | |
| lab <> 'cliqueLeader' | |
| )) AS a_labels, | |
| type(r) AS rel_type, | |
| FILTER(lab in labels(b) | |
| WHERE ( | |
| lab <> 'Class' AND | |
| lab <> 'NamedIndividual' AND | |
| lab <> 'Node' AND | |
| lab <> 'cliqueLeader' | |
| )) AS b_labels | |
| UNWIND a_labels as l | |
| UNWIND b_labels as l2 | |
| RETURN l, l2, rel_type", | |
| "MERGE (a:Node:Meta {name:l}) | |
| MERGE (b:Node:Meta {name:l2}) | |
| MERGE (a)-[:OUTGOING]->(:Relationship:Meta {name:rel_type})-[:INCOMING]->(b)", | |
| {batchSize:1000, parallel:false, iterateList:true} | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment