Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-16-2023 05:13 AM - edited 01-16-2023 05:18 AM
01-16-2023 07:01 AM
Apoc has a suite of procedures for refactoring. One is merging relationships. Maybe this will help.
https://neo4j.com/labs/apoc/4.1/graph-updates/graph-refactoring/
https://neo4j.com/labs/apoc/4.1/overview/apoc.refactor/apoc.refactor.mergeRelationships/
01-16-2023 07:10 AM - edited 01-16-2023 07:13 AM
Thank you for the response, but my doubt is regarding the data attached, how do I create relations for different type of devices present.
Ex, hierarchy is Equipment->Card-> Port
Now all of them have their properties(device names, resource type, parent resource type , parent resource id, etc)
After creating the nodes and properties of equipment, port and card separately, how do I create relationship amongst such huge data of 1 million records.? Any examples to support?
01-16-2023 08:40 PM
From your sample data, which columns correspond to Equipment, Card, and Port nodes?
01-16-2023 08:42 PM
"A_ RESOURCE_TYPE" column has the difference resource types, with respective parent resource type and ids.
01-17-2023 11:03 AM
Which version of Neo4j are you using?
01-17-2023 08:11 AM
Does each row represent a single entity (node)? If so, does the A_RESOURCE_ID represent the unique id for the node? Does the A_PARENT_RESOURCE_ID represent the node's parent's A_RESOURCE_ID? Does a node with a blank A_PARENT_RESOURCE_ID must represent a root node, i.e. does not have a parent. If you answer yes to each of these questions, then you can you can use this spreadsheet to create the relationships after you have created the nodes in a previous script. The script would look something like the following:
load csv with headers from "file:///relationships.csv" as row
match(child:Resource{resource_id: $row.A_RESOURCE_ID})
match(parent:Resource{resource_id: $row.A_PARENT_RESOURCE_ID})
merge(child)-[:HAS_PARENT]->(parent)
Does this help?
All the sessions of the conference are now available online