Properties with Neo4j types, examples, and constraints
Every node and relationship has a list of properties. Each property has a key, a type from Neo4j's list of property types, and an example value, and can be marked unique or required. Here's how to add, type, order, and export them.
Key, Type, and Example
Properties are edited in three columns, in the side panel's Edit tab and in the box under a node or relationship on the canvas:
- Key – the property name, written the Neo4j way (
orderId). -
Type – a dropdown with Neo4j's 13 property types (BOOLEAN, DATE,
DURATION, FLOAT, INTEGER, LOCAL DATETIME, LOCAL TIME, POINT, STRING, UUID, VECTOR, ZONED
DATETIME, ZONED TIME) and the lists of them (LIST<STRING> and so on), 25 options.
The most common types come first, then the rest alphabetically. Type the first letters to
jump to a type. Typed synonyms are corrected:
stringbecomes STRING,intbecomes INTEGER,array<bool>becomes LIST<BOOLEAN>. - Example – an example value, such as
ORD-1001. The example of the topmost property is the node's caption.
The new-property row at the bottom has all three fields. Enter in any of them saves the
row as one undo step; Tab moves between the fields. Typing key: TYPE in the Key
field saves both. A key that already exists, or that is only digits, is stopped with a
message.
Unique and Required
At the top of the type list are two checkboxes, Unique and
Required: Neo4j's two property constraints. On the canvas, a required
property gets Cypher's exclamation mark after its type (orderId: STRING!) and a
unique property the word unique at the end of its line. In the Cypher export each
one becomes a CREATE CONSTRAINT … IF NOT EXISTS statement.
Order
Drag a property by the handle (the dots) at the left of its row to move it, in the side panel or on the canvas; a line shows where it will land. The up and down buttons on the handle move it one step. The order matters: the topmost property's example is the caption.
Paste a whole block
Paste into the Key field of the new-property row and toro4n reads the whole block, in one undo step:
- JSON or a Cypher map, also a list of objects. The values become examples, and the type is worked out from each value: integer, float, boolean, ISO date or datetime, a list of one kind, otherwise STRING.
-
A SQL
CREATE TABLEstatement. Column types are converted to Neo4j types,NOT NULLbecomes required, a primary key becomes unique and required, andUNIQUEbecomes unique. -
A table copied from a spreadsheet or a database tool, with tabs, commas,
or
|between the cells, with or without a header row (aDESCRIBEresult works too). - Lines such as
key: TYPE (example)orkey: value.
A property that is already there keeps its type, example, and rules and only gets what it lacks. A message sums it up: "Added 3 properties · 1 was already there".
How properties are drawn and exported
Under a circle node, and under a relationship's type, the properties are listed on a box
whose color is Property background in the Format tab, one line per property:
key: TYPE (example), or only what's filled in. The fixed
Properties layer hides or shows all of them at once. In Square mode they
are three columns inside the card and can't be hidden. In the Cypher export, the value of a
property is its example if there is one, otherwise its type name; JSON files always carry
everything.