Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-15-2021 05:53 AM
I have two types of nodes: :Person
and :Event
.
Between these nodes there can be several different relations: :DECEDENT
, :SPOUSE
, :CHILD
, :PARENT
, etc.
Q1: Is it possible to set constraint on allowed relation types for specific :Event
type?
Example:
For (:Event {id: "9452ae03-8f8c-4675-a7aa-21ed9e868559", type: "Death"})
only allowed relation should be (:Event)-[:DECEDENT]->(:Person)
and all other relation types should be banned.
Q2: Is it possible to set limit on relation count per node?
Example: Following above case node :Person
should be pointed by [0-1] :DECEDENT
relation.
I would imagine syntax to be sth like:
CREATE CONSTRAINT ON (:Event)-(r:DECEDENT)->(:Person) ASSERT count(r) < 2
01-15-2021 07:16 AM
Constraint functionality and what is possible is described at Constraints - Neo4j Cypher Manual
and to which at this time for Q1 and Q2 from the initial post, both are not possible
01-15-2021 07:46 AM
Would it be feature that could be implemented in the future?
All the sessions of the conference are now available online