Last active
September 28, 2015 13:28
-
-
Save agrison/c0b9623ddbb654820f2f to your computer and use it in GitHub Desktop.
Create a meta model of nodes and relationship already in Neo4J.
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 (n1)-[r]->(n2) | |
WITH labels(n1) AS node1_labels, type(r) AS relation_type, labels(n2) AS node2_labels | |
UNWIND node1_labels as node1_label | |
UNWIND node2_labels as node2_label | |
MERGE (n1:Meta_Node {name: node1_label}) | |
MERGE (n2:Meta_Node {name: node2_label}) | |
MERGE (n1)-[:META_RELATIONSHIP {name:relation_type}]->(n2) |
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 (node:Meta_Node)-[r]-() | |
RETURN node, r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment