Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-14-2021 09:51 PM
Migrating from the following which I assume is the 'hyper edge' pattern:
(node)-[:rel]-(properties node)-[:rel]-(node)
to the following given that the Enterprise version now supports relationship indexes and property constraints:
(node)-[:rel]-(node)
The problem I'm running into is that when I attempt to set unique property constraints on the relationship within Cypher, I'm unable to do so. Am I missing something? Setting indexes on relationship properties works well, but when I attempt to set UNIQUE constraints Neo4j errors out. Has anyone figured out what the new commands are in the latest version of Neo4j Enterprise, which I assumed supported this feature out-of-the-box? The exact command I'm using is as follows:
CREATE CONSTRAINT constraint_name ON ()-[r:LIKES]-() ASSERT r.date IS UNIQUE
10-14-2021 11:14 PM
Is the work-around for us to use Merge with a property index set on a subset of fields? Using this approach, the remaining fields could be set in ON CREATE
MERGE (keanu:Person {name: 'Keanu Reeves'})
ON CREATE
SET keanu.created = timestamp()
RETURN keanu.name, keanu.created
10-15-2021 02:03 PM
Hello! This is an excellent question, and one which is probably not clear enough in the documentation. Neo4j did add support for relationship indexes in 4.3, but there is not yet support for relationship constraints. I also made the same assumption that support of one should also mean support of the other, but that doesn't seem to be the case here.
All the sessions of the conference are now available online