Model Canvas

The model canvas is where you build and view your model. Here you will add Node Labels, Relationship Types, Properties, and layout your model.

Node Labels

The following sections detail how to Add, Edit, and Remove Node Labels.

Adding

You can add a Node Label in 3 ways.

  • By clicking the +NODE LABEL button

  • By typing a word into the Model Input and hitting <Enter>

  • By dragging a relationship away from a Node Label, then releasing the mouse in a blank canvas area

The added Node Label will appear on the canvas.

Positioning Node Labels

Node Labels can be positioned by clicking within the Node Label circle and dragging to a new location. Connected Relationship Types will be repositioned automatically. Likewise, any Properties or Secondary Node Labels will be repositioned to available empty space during dragging.

Color and Size

You can change the color of a Node Label by selecting it, then clicking on one of the pre-defined color circles at the bottom of the canvas. The …​ icon on the far left will bring up a color picker allowing you to pick the color of your choice.

You can change the size of a Node Label by selecting it, then clicking on one of the pre-defined size circles at the bottom of the canvas.

Editing

You can edit a Node Label in 2 ways.

  • By double-clicking the Node Label

  • By single-clicking the Node Label, then clicking the arc with 3-bars in the upper-left

Double-clicking will prompt you to edit the existing Node Label value. You can type <Enter> or click the 'x' to finish editing. Hit <Esc> to cancel the edit. You can also add Secondary Node Labels in the box to the right.

When single-clicking, then clicking the arc, the same functionality will be available at the top of the Properties screen. To edit the Node Label, hover over the Node Label until you see a pencil icon. Click on the pencil icon to edit. Type <Enter> to finish editing or <Esc> to cancel.

Deleting

To delete a Node Label, single click on it, then click on the arc with the trash icon. If you have selected more than one item, you will be prompted to confirm the delete.

Relationship Types

The following sections detail how to Add, Edit, and Remove Relationship Types.

Adding

You can add a Relationship Type in two ways.

  • By dragging out from a Node Label

  • By typing 3 words into the Model Input and hitting <Enter>. The middle word will become the Relationship Type.

To create a relationship by dragging, move your mouse near a Node Label. As you approach the outer edge of the Node Label, a gray circle will appear and the mouse cursor will change. While your mouse is over the gray circle, click and drag away into an open area of the canvas. Release the mouse and a new Relationship Type to a new Node Label will be drawn.

Connecting to existing Node Labels

When dragging the new relationship line, you can hover over an existing Node Label. When you hover, the Node Label will highlight purple. If you release the mouse while hovering over the purple Node Label, the Relationship Type will be connected to the existing Node Label.

Self-connected Relationship Types

You can self-connect a Relationship Type by dragging out the relationship line, then releasing it over the same Node Label you started from.

Editing

You can edit a Relationship Type in 2 ways.

  • By double-clicking the Relationship Type

  • By single-clicking the Relationship Type, then clicking the button with 3-bars on the left

Double-clicking will prompt you to edit the existing Relationship Type value. You can type <Enter> or click the 'x' to finish editing. Hit <Esc> to cancel the edit.

When single-clicking, then clicking the button, the same functionality will be available at the top of the Properties screen. To edit the Relationship Type, hover over the Relationship Type until you see a pencil icon. Click on the pencil icon to edit. Type <Enter> to finish editing or <Esc> to cancel.

Reversing a Relationship Type

Single click the Relationship Type, then click the button with 2 arrow heads.

Deleting

To delete a Relationship Type, single click on it, then click on the button with the trash icon. If you have selected more than one item, you will be prompted to confirm the delete.

Node Label Properties

Node Label properties are used to define which key/value property pairs can be assigned to nodes with a specific Node Label. For instance, for a Node Label 'Movie', we might want to include the properties: title, release date, and rating. When entering Node Label Properties in Cypher Workbench, you can specify the following:

  • Name: Name of the property, this will be the 'key' in the key/value pairs assigned to node instances.

  • Data Type: Data type of the property. You can choose from a list of all Neo4j primitive data types including String, Integer, Date, etc, and arrays of those types.

  • Reference Data: Used for informational purposes only. You can include an example data value if desired.

  • Node Key: If on, indicates that this property is part of the Node Key for the Node Label. If multiple properties are on, they form a composite Node Key.

  • Unique: If on, indicates that a unique constraint applies to this property.

  • Indexed: If on, indicates that a single property index applies to this property.

  • Must Exist: If on, indicates that a must exist constraint applies to this property.

The specifics of Adding, Editing, and Deleting are discussed below.

Adding

To add Properties, click on a Node Label to bring up the arc icons that surround the Node Label. Click on the icon in the upper-left with the 3-bars to show the property dialog.

Click on the +Property button to add a new property row. Fill out the values as appropriate. Data is saved automatically. Click the Close button when you are finished adding properties.

If the Layout > Display Properties option is checked, any properties you enter will be shown on the Canvas once the Properties dialog is closed.

Editing

To edit Properties, click on a Node Label to bring up the arc icons that surround the Node Label. Click on the icon in the upper-left with the 3-bars to show the property dialog.

You can edit any existing properties by modifying the values directly either by changing the values in the text fields, changing the value of a drop down, or changing the value of the switches.

Note that there are some business rules enforced for Node Key, Unique, Indexed, and Must Exist switches. These business rules are:

  • Node Key: If on, Unique, Indexed, and Must Exist will be turned on and cannot be turned off. This corresponds with how Neo4j implements Node Keys in the database.

  • Unique: If on, Indexed will be turned on and cannot be turned off. This corresponds with how Neo4j implements Uniqueness in the database.

  • Indexed: If neither Node Key or Unique is turned on, it can be turned on/off as desired.

  • Must Exist: If Node Key is off, it can be turned on/off as desired.

Deleting

To delete a Property, click on a Node Label to bring up the arc icons that surround the Node Label. Click on the icon in the upper-left with the 3-bars to show the property dialog.

In the property dialog, click on the trash icon on the far right to delete the property.

Relationship Type Properties

Relationship Type properties are used to define which key/value property pairs can be assigned to relationships with a specific Relationship Type. For instance, for a Relationship Type 'ACTED_IN', we might want to include the property: role. When entering Relationship Type Properties in Cypher Workbench, you can specify the following:

  • Name: Name of the property, this will be the 'key' in the key/value pairs assigned to node instances.

  • Data Type: Data type of the property. You can choose from a list of all Neo4j primitive data types including String, Integer, Date, etc, and arrays of those types.

  • Reference Data: Used for informational purposes only. You can include an example data value if desired.

  • Must Exist: If on, indicates that a must exist constraint applies to this property.

The specifics of Adding, Editing, and Deleting are discussed below.

Adding

To add Properties, click on a Relationship Type to bring up the icon ribbon. Click on the icon in the far-left with the 3-bars to show the property dialog.

Click on the +Property button to add a new property row. Fill out the values as appropriate. Data is saved automatically. Click the Close button when you are finished adding properties.

If the Layout > Display Properties option is checked, any properties you enter will be shown on the Canvas once the Properties dialog is closed.

Editing

To edit Properties, click on a Relationship Type to bring up the icon ribbon. Click on the icon in the far-left with the 3-bars to show the property dialog.

You can edit any existing properties by modifying the values directly either by changing the values in the text fields, changing the value of a drop down, or changing the value of the switches.

Must Exist currently exists for Relationship Properties. Indexed Relationship properties (added in 4.3) are not available yet.

Deleting

To delete a Property, click on a Relationship Type to bring up the icon ribbon. Click on the icon in the far-left with the 3-bars to show the property dialog.

In the property dialog, click on the trash icon on the far right to delete the property.

Adding Descriptions

In the Property Dialog, there is a Show Descriptions button at bottom. Clicking this button will show description fields for the Node Label or Relationship Type at the top, and a Description field under each property. Click Hide Descriptions to hide the Description fields.

Information entered into the Description fields will be shown in the Export HTML and Export Markdown data dictionaries.

Composite Indexes

In the Property Dialog, there is a Composite Indexes tab. Click on this tab to access the Composite Indexes area. There are two sections in this tab, a section to add a new composite index and the Composite indexes section - a section to view/delete existing composite indexes. At this time, existing composite indexes can not be edited, they must be removed and re-added.

To add a composite index, follow these steps:

  • Click on 2 or more properties in the Available Properties area.

    • A Search box is provided to filter the list of there are many properties to choose from.

    • Selected properties will be added to the New Index Properties area.

    • If you added a property by accident, you can hover over the property and click the 'x' to remove it.

  • Optionally add an Index Name for the index.

  • Click the +Add Index button to add the composite index.

The new index will appear in the Composite indexes section. The Compsite indexes section will also show any previously added indexes.

To remove a composite index, click the Trash icon to the right of the index.

Secondary Node Labels

In the Neo4j database, a Node Label is a Node Label, there are no primary or secondary node labels. However, in Cypher Workbench, we have made a distinction to assist with data modeling. The Primary Node Label is the Node Label which appears as the text value inside of a circle on the canvas. Secondary Node Labels can be added which appear in an annotation bubble outside of the circle.

Secondary Node Labels can be useful for modeling class/subclass hierarchies if you intend to assign a node instance Node Labels corresponding to both the class and subclass. For instance, we might have a primary Node Label 'Horse', and a secondary Node Label, 'Mammal'. From a modeling perspective, this would indicate that all Horses are Mammals. When data is added to the database, a specific instance, such a horse named Seabiscuit, would have both labels assigned to the node, e.g. (horse1:Horse:Mammal {name: 'Seabiscuit'}).

Secondary Node Labels can also be useful for using Node Labels like tags. For instance you may have a primary Node Label called 'Transaction' and a secondary Node Label called 'Fraud'. For instances of these Node Labels, we could have a non-fraudulent transaction and a fraudulent transaction like this: (txn1:Transaction {id: 1, amt: 5.00}), (txn2:Transaction:Fraud {id: 2, amt: 50000.00}).

To add Secondary Node Labels, click on a Node Label to bring up the arc icons that surround the Node Label. Click on the icon in the upper-left with the 3-bars to show the property dialog. Near the top you will see an editable drop down 'Add Node Label'. Enter a new value or re-use an existing value to assign a Secondary Node Label to the Primary Node Label. You can hover over a Secondary Node Label to edit or delete it.

If you wish for the Secondary Node Label to have color, you must first add it to the canvas as it’s own Primary Node Label, then color it. Once colored, if the Node Label if used a Secondary Node Label elsewhere all instances will take on the color you chose. Afterwards, you can remove the Primary Node Label you just colored if desired.

Relationship Cardinality

Relationship Cardinality specifies validation criteria for relationships between 2 node instances. Cardinality is simply counting the number of relationships between 2 nodes. This currently is not enforced in the database, but could potentially be used by data loading tools to ensure the cardinality restrictions are enforced when data is loaded.

To edit Relationship Cardinality, click on a Relationship Type to bring up the icon ribbon. Click on the second from the left icon that looks like a mini-graph to show the Relationship Cardinality dialog.

You can specify both outbound and inbound cardinality:

  • Outbound: specifies cardinality from an instance of the source Node Label to instances of destination Node Label

  • Inbound: specifies cardinality to an instance of the destination Node Label from instances of the source Node Label

Both Outbound and Inbound have the following settings: * At least: can specify either 0 (for optional) or 1 * At most: can specify either 1 (for maximum) or many

The defaults are 0 and many.

As an example, let’s say you had a rigid taxonomy where a single :Movie can belong to only one :Genre, but it must belong to at least 1 :Genre. Therefore, our outbound cardinality would be :Movie -HAS_GENRE (1..1)→ :Genre, which indicates that a Movie must have a relationship to a Genre, but it can only have a relationship to a single Genre.

However, we know that many different Movies can belong to the same Genre, or for a new Genre no Movie may belong, so from the inbound perspective of a Genre instance, it would look like :Movie -(0..many) HAS_GENRE→ :Genre.

Selecting

You can select one or more Node Labels or Relationship Types on the canvas. When multiple items are selected, coloring, sizing, moving, position locking, and deleting will affect all selected items.

You can select an item by single clicking on it, and you can deselect an item by clicking on a blank area of the canvas.

To select multiple items, you can:

  • Hold down the Shift key, then start dragging on an empty area of the canvas. As you continue dragging, a selection rectangle will be shown and as items fall within the rectangle they will be selected. Once you have selected multiple items and wish to bring up the node arcs or relationship ribbons, continue holding Shift and click on a selected item.

  • Hold down the Command key (Mac) or Ctrl key (Windows) and click on the desired items to select. Once you have selected multiple items and wish to bring up the node arcs or relationship ribbons, continue holding Command/Ctrl and click on a selected item twice. The first time you deselect it, the second time it will get selected and present the node arcs/relationship ribbons.

If multiple items are selected, you can also hold Command/Ctrl to deselect items.

Pan and Zoom

You can pan the canvas by dragging on a blank area of the canvas. You can zoom the canvas by clicking on the - and + magnifying glass icons in the bottom right of the canvas.

To reset the pan/zoom, click on the cross-hairs icon to the right of the zoom icons.

Search within the Canvas

To search for and highlight a specific item in the canvas, use the magnifying glass icon in the upper-right of the canvas. Clicking the icon will show a drop-down of all items in the canvas. Type in the search box to filter the list. Clicking on an item in the list will select the item and center in the canvas.