Nodes and relationships in a Neo4j graph model

In toro4n you draw the schema of your graph: the node labels, the relationship types that connect them, and the properties on both. A node can carry several labels, such as :Router:Egress.

Adding nodes

A new model starts with one empty node in the middle of the canvas. To add more, click Add node at the top of the side panel, or right-click an empty spot on the canvas and choose Add node to place one right where you clicked. Each node you add opens with boxes for its labels and properties, so you can start typing straight away.

You can also paste a list of names to create many nodes at once (see Import).

Labels and naming conventions

Labels appear above the node. Since you're modeling a schema, each node needs a unique combination of labels. If you give a node labels that another node already has, toro4n doesn't save the change and tells you which labels are taken. A duplicated or pasted node keeps the original's labels, so both nodes show a red ring until you change the labels on one of them. Labels that differ only in case, such as OrderItem and Orderitem, count as the same label, even though Neo4j treats them as distinct.

toro4n follows the naming conventions in the Cypher manual: labels in PascalCase (Person, NetworkSwitch), relationship types in UPPER_SNAKE_CASE (ACTED_IN), and property keys in camelCase (firstName). We adjust the case of every name to match, whether you type it or it comes from a model you open or import. Spaces, underscores, and hyphens stay as they are.

Captions

The text inside a node is its caption: the example value of its top property. To show a different caption, drag the property you want to the top of the list. If the top property has no example, the node is blank inside, as it usually is in a schema without sample values. In Simple mode, a node without a caption shows its labels inside instead. Double-click any node in Simple mode to edit its caption in a single Caption box.

Relationships

To create a relationship, hover over a node until a ring appears around it, then drag from the ring to another node. Type the relationship type in the Type box above the line and press Enter. To create a new node at the same time, drop the relationship on an empty spot instead.

Editing on the canvas

To edit a node or relationship, double-click it (or tap it on a tablet), or select it and press Enter. On a node, a labels box opens above it and a properties box below it. On a relationship, a Type box and a properties box open. Press Enter to save and move to the next field, and press Esc or click the canvas when you're done. The same fields are in the side panel's Edit tab.

Circles or cards

By default, a node is a circle with its labels above it and its properties listed below. Turn on Square mode in the top bar, and every node becomes a card: a bold row of labels at the top, the caption in a band in the node's fill color, and the properties inside, in three columns for key, type, and example. Square mode applies to the whole model. Hide the Properties layer, and each card shows only its labels and caption. To edit a card, double-click it and type right inside it.

Selecting and moving

Click to select. Shift-click or ⌘-click to add to or remove from the selection, and ⌘-drag across an empty part of the canvas to select everything inside a rectangle (on Windows and Linux, use Ctrl instead of ⌘). Drag any selected item to move the whole selection, or nudge it with the arrow keys: 1 px at a time, or 10 px with Shift. If you drop a node on top of another, the node you dropped slides aside to make room. When the two are connected, it leaves just enough space for the relationship type between them.

To add a node that's similar to one you already have, select it and use Duplicate (⌘D). The copy has the same labels, properties, and relationships as the original, including relationships to nodes you didn't duplicate.

Related