Last active
November 14, 2023 16:11
-
-
Save boulderalf/a81fd509d539bedf678e95624fc5583e to your computer and use it in GitHub Desktop.
As referenced in https://youtu.be/aONuw5e9XXg
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.meta.data() YIELD label, property, type, elementType | |
WHERE elementType <> 'relationship' | |
AND type <> 'RELATIONSHIP' | |
WITH label, collect(property + ' (' + type + ')') AS properties | |
WITH apoc.map.fromLists(collect(label), collect(properties)) AS properties_map | |
CALL apoc.meta.graph() YIELD nodes, relationships | |
UNWIND nodes AS n | |
WITH n, apoc.node.labels(n)[0] AS label, properties_map, relationships | |
CALL apoc.create.setProperty(n, 'properties', apoc.text.join(properties_map[label], '\n')) YIELD node | |
RETURN collect(node) AS nodes, relationships; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi very very helpful. Would you have an idea how to represent nodes in the schema which have multiple labels? For example I have a label A and 60% of those Label A nodes also have a label B the rest of the nodes have additional label C. As a result I would like to have one node in the schema with indication that it bases on one overarching label and sub labels. Currently I get three nodes and all having the same relationships which makes the picture messy.
Kudos to your work anyways.
Best