How to create unique CONSTRAINT to relationship by neo4j cypher?

Kail picture Kail · May 12, 2014 · Viewed 12.6k times · Source

How to create unique CONSTRAINT to relationship by neo4j cypher?

Answer

FrobberOfBits picture FrobberOfBits · May 12, 2014

At present, there is only one kind of CONSTRAINT neo4j will let you create, and that's a UNIQUENESS constraint. That link cites what's in the internal API, and you'll notice there's only one type at present.

Here's a link on how to create a uniqueness constraint.

This lets you assert that a certain property of a node must be unique, but it doesn't say anything about relationships. I don't think it's possible to constrain what sort of relationships can come off of various nodes.