Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-26-2019 06:45 AM
Hello every one. I would like to know how can I create relationships when one of the nodes has constraints while the other one has no constraints. While I load the csv file and try to make the relationship between these two nodes I am having troubles and unnecessary relationships are created?
Solved! Go to Solution.
06-27-2019 08:02 PM
MERGE (a:Node {primary_key: guid})
CREATE (a)-[r1:relationship]->(b:Node {attributes: stuff})
CREATE (a)-[r2:relationship]->(c:Node {attributes: stuff})
CREATE (a)-[r3:relationship]->(d:Node {attributes: stuff})
RETURN *
06-26-2019 08:04 PM
I assume you mean the node with a constraint, you're just trying to avoid duplicates of the node being created, and the other nodes you want multiples of? Use MERGE
for the node you want to keep unique and CREATE
for the other nodes that you should have duplicates of.
06-27-2019 04:58 AM
Thanks for replying. I have one node which is constrained by an attribute name and 5 other nodes that will be connected to this node but they cannot be constrained by any attribute. How can I create the relationship between the first node and other nodes but to not have a cartesian connection? Also can we assign uuid for the nodes to we can use the uuid to make the matching between nodes?? Thanks
06-27-2019 08:02 PM
MERGE (a:Node {primary_key: guid})
CREATE (a)-[r1:relationship]->(b:Node {attributes: stuff})
CREATE (a)-[r2:relationship]->(c:Node {attributes: stuff})
CREATE (a)-[r3:relationship]->(d:Node {attributes: stuff})
RETURN *
All the sessions of the conference are now available online