toro4n Open toro4n

Guide Properties and constraints

Properties and constraints

Give each property a key, a property type, and an example value. Add uniqueness, existence, or key constraints, and we'll write them into your Cypher export.

Key, Type, and Example

Edit properties in the side panel's Edit tab, or double-click a node or relationship to edit them right on the canvas. Either way, you'll see the same three fields:

Add a property in the empty row at the bottom: Tab moves between its fields, and Enter saves the whole row as one undo step. To set the key and type in one go, type key: TYPE in the Key field, such as orderId: STRING. Cypher's synonyms work too, so quantity: int gets the type INTEGER. Each key can appear only once on a node or relationship, and it can't be all digits.

Unique, Required, and Key constraint

Three checkboxes sit at the top of the type list. Unique adds a property uniqueness constraint, and Required adds a property existence constraint. Check Key constraint on one property of a node or relationship, or on several to form a composite key constraint. On the canvas, a required property shows Cypher's ! shorthand for NOT NULL after its type (orderId: STRING!). A unique property is marked · unique, and a property in a key constraint is marked · key constraint.

The Cypher export starts with one CREATE CONSTRAINT … IF NOT EXISTS statement per constraint. A key constraint is written as a single statement: REQUIRE (n.orderId, n.lineNo) IS NODE KEY on a node, or IS RELATIONSHIP KEY on a relationship. Because a key constraint already makes every property in it required, those properties don't get separate property existence constraints. If a Unique property is the only property in a key constraint, the export writes just the key constraint, since Neo4j doesn't allow a property uniqueness constraint and a key constraint on the same property. Existence and key constraints need Neo4j Enterprise Edition or Aura; uniqueness constraints work in every edition.

Reorder properties

Drag a row by the dots at its far left, either in the side panel or on the canvas. A line shows where the row will land. Order matters: the top property's example appears inside the node as its caption.

Paste several properties at once

Paste one of these into the Key field of the empty row at the bottom, and we'll add all of its properties in a single undo step:

If a property already exists, we keep its type, example, and constraints and only fill in what's missing. A message sums up the result, such as “Added 3 properties · 1 already existed”.

How properties are drawn and exported

Properties are listed one per line, as key: TYPE (example) or whichever parts you've filled in. A node shows them in a box below it, and a relationship shows them in a box next to its type. To style the boxes, open the Format tab and look under Properties. To show or hide them all at once, use the Properties layer in the Layers tab. In Square mode, each card lists its properties inside it, in three columns: key, type, and example.

In the Cypher export, each property's value is its example, written to match its property type, so a DATE example becomes date(…). An example that doesn't fit its type is exported as a string, and a property without an example gets its type name as a placeholder string. Cypher and JSON exports include the properties even when the Properties layer is hidden.

Related