Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Create unique address patterns

CREATE CONSTRAINT ON (city:City) ASSERT city.name IS UNIQUE
CREATE CONSTRAINT ON (p:Person) ASSERT p.name IS UNIQUE

Now, add two addresses in Berlin for the same person by merging the nodes.

MERGE (berlin:City{name:'Berlin'})
MERGE (joe:City{name:'Joe'})
CREATE joe-[:LIVES]->({name:'Address1'})-[:IN]->berlin
CREATE joe-[:LIVES]->({name:'Address2'})-[:IN]->berlin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.