Cypher

constraint

A rule the database enforces on every node or relationship with a given label or type, rejecting any write that breaks it.

Also written: constraints

Example

Every (:Person) must hold a name.

cypher
CREATE CONSTRAINT Person_name_exists IF NOT EXISTS
FOR (p:Person) REQUIRE p.name IS NOT NULL

A write creating a (:Person) without a name is rejected, and so is one removing the name from a person already in the graph. Either way the transaction fails and nothing is stored.

Lessons that use this term

The lesson and course links below open in a new tab.

No published lesson uses this term yet.

All glossary terms