October 2017
Beginner to intermediate
316 pages
8h
English
Now, to dissociate a property from a node to a new node, for example, to share a value between nodes, we will see how to dissociate the countries of our towers from the country property to new nodes with the :country label, linked to the towers with a :IN_COUNTRY relation:
MATCH (t:Tower)MERGE (c:Country {code: t.country})CREATE UNIQUE (t)-[:IN_COUNTRY]->(c)REMOVE t.countryRETURN t,c
You get extra points if you saw that, although a new kind of node is added, no constraint is created.
CREATE UNIQUE makes the relation unique. Run this code several times; there will be only one relation between the nodes.
Read now
Unlock full access