Cypher Clauses

You can use the Add button to add any of the following clauses:

  • CYPHER

  • MATCH

  • OPTIONAL MATCH

  • WHERE

  • RETURN

  • ORDER BY

  • SKIP

  • LIMIT

The Cypher clause is a free form Cypher block where you can type in any Cypher code. Note that there is special handling when using Cypher with the 'WITH' keyword. See WITH below for details.

As you add and fill out the blocks, the resulting Cypher statement is shown in the Cypher and Results tab at the bottom.

Data Model

If a Data Model is selected, the Data Model will be available in the Data Model panel on the right. See this link for how to work with panels. Additionally, information from the Data Model will be used to:

  • In Match and Optional Match clauses

    • Show available Node Labels

    • Prompt Relationship Types when connecting a Relationship Type between two Node Patterns

    • Prompt Relationship Type → Node Labels when drawing a Relationship Type to a blank area on the canvas

  • In Where, Return, Order By, and Cypher (With) clauses

    • Show properties in drop-downs and helpers

The Data Model is initially shown ghosted out. As Node Labels and Relationship Types are used in Cypher patterns, they are un-ghosted to indicate that they are in use.

Match and Optional Match

The Match and Optional Match blocks enable you to visually specify a Cypher pattern. A Cypher pattern consists of one or more Node Patterns connected by Relationship Patterns. As you add Node and Relationship patterns, they are shown in a canvas specific to the block you are working in. For general information about utilizing the canvas, see General Canvas.

Resizing the block

There is small corner icon in the lower-right of the block. You can click and drag up or down to resize the block.

Node Patterns

Node Patterns define how to match nodes. A Node Pattern consists of the following things:

  • Variable: Optional. The variable to use for the Node Pattern. The variable is used to make available any matching nodes to subsequent query blocks.

  • Node Label(s): Optional. One or more Node Labels to use as filter criteria. A node must have all of the defined Node Labels to match.

Note: At least one variable or one Node Label must be specified.

Cypher syntax supports specifying node property patterns within a Node Pattern, but the Cypher Builder does not support this syntax yet. If you need this syntax, use a Cypher block.

Adding Node Patterns

You can add a Node Pattern in one of 4 ways:

  • Click the +Node Pattern button

  • Click on a Node Label button in the button ribbon

  • Click on a Node Label in the Data Model panel

  • From an existing Node Pattern, drag out and release the mouse in an empty area

Editing Node Patterns

You can double click on a Node Pattern to edit it. A small dialog will appear with the following information:

  • Variable: type to edit the variable name

  • Node Label(s): any current Node Labels will be shown with a black border. Hover over the Node Labels and click the Pencil icon to edit, or the 'x' icon to remove.

  • Add Label: Enter text to add additional Node Labels to the pattern

Click the 'X' in the upper left, the <Enter> button, or the canvas to close the dialog.

Deleting Node Patterns

Click on a Node Pattern. A gray circle with a trash icon will appear. Click on the Trash icon to delete the Node Pattern.

Relationship Patterns

Adding Relationship Patterns

You can add a Relationship Pattern in one of 3 ways:

  • Drag out from an existing Node Pattern to another Node Pattern

  • Drag out from an existing Node Pattern to a blank area of the canvas

  • Click on a Relationship Type in the Data Model panel

When creating a Relationship Pattern between two Node Patterns, a small dialog will appear showing the possible Relationship Types between the two Node Patterns based on selected the Data Model. Choose the appropriate Relationship Type based on your needs. If there is no Relationship Type in the Data Model between the Node Patterns, a Relationship Pattern with no Relationship Type will be added.

When creating a Relationship Pattern in a the blank area of the canvas, a small dialog will appear showing the possible choices of Relationship Type → Node Label based on the Data Model. Choose the appropriate Relationship Type → Node Label based on your needs. If there is no Relationship Type → Node Label in the Data Model orginating from the source Node Pattern, a Relationship Pattern with no Relationship Type will be added, and a Node Pattern with no Node Label will be added.

Editing Relationship Patterns

You can double click on a Relationship Pattern to edit it. A small dialog will appear with the following information:

  • Variable: type to edit the variable name

  • Relationship Type(s): any current Relationship Types will be shown with a black border. Hover over the Relationship Types and click the Pencil icon to edit, or the 'x' icon to remove.

  • Add Type: Enter text to add additional Relationship Types to the pattern

  • Range: Enter a relationship range if appropriate. This is to specify traversing relationships from a minimum number of hops to a maximum number of hops.

Click the 'X' in the upper left, the <Enter> button, or the canvas to close the dialog.

To reverse the direction of the relationship, click on the relationship to bring up the button ribbon. Click on the Arrow icon to reverse the relationship.

Deleting Relationship Patterns

Click on the relationship to bring up the button ribbon. Click on the Trash icon to delete the Relationship Pattern.

Where

The Where block consists of 2 lines:

  • A top section with fields to add a Where condition

  • A bottom section showing the Where condtions

The top section let’s you add where conditions in the form of: <left> <operator> <right>

such as:

genre.name = 'Comedy'
transaction.amount >= 10.0

The top section consists of the following fields:

  • Left Item: This item is a drop-down that list all of the variables in the Match clause along with any associated properties from the Data Model. You can also enter a free text here if needed.

  • Operator: One of the following operators: =, <>, <, >, < =, >=, =~, IS NULL, IS NOT NULL, IN, STARTS WITH, ENDS WITH, CONTAINS. If you enter a complete Where condition in the Left Item, you can select <no operator> here.

  • Right Item: The value or expression to check. If you are connected to a database, and the operator is '=', a searchable list of values will be presented. Otherwise, you can type in free text. If the value is a string, you need to enclose it in single or double quotes.

  • Add button: Click the Add button to add the <left> <operator> <right> Where condition to the Where clause.

  • Grouping/Operator buttons: There are buttons for And, Or, Not, Xor, and left '(' and right ')' parentheses. Click on one to create expressions in your Where clause.

The bottom section consists of the built Where clause. You can not edit the Where conditions that have been added, you will need to remove and re-add the condition. Hovering over the Where condition will show an 'x'. Click on the 'x' to remove the condition.

When you click the Add button or a Grouping/Operator button the item gets added to the end of the Where clause by default. If you click on a Where condition in the bottom line, it will be selected and an orange cursor will appear in front of the item. If an item is selected, clicking the Add/Grouping/Operator button will add it at the location of the orange cursor. Clicking a selected item will unselect it.

Return

The Return block consists of 3 lines:

  • A top section with two lines:

    • Variables: a button list of in-scope variables

    • Properties: a button list of properties for the selected variable

  • A bottom section showing the Return Items

Variables

  • Use the Search field to filter the list of displayed items

  • Clicking on a variable will highlight it and change the display of the Properties

Properties

  • Use the Search field to filter the list of displayed items

  • Clicking on a property will highlight it and add it as a Return Item

  • On the far left will be an entry like: variable (var) where variable is a variable from the Variables line. The (var) indicates that you will be adding the variable directly as a Return Item.

Return Items Section

You can use the Add Return Item drop-down to add a Return Item from the list, or you can enter a free text Return Item. If entering free text, hit <Enter> to add it.

Hovering over a Return Item will show the Pencil and 'X' icons. Click the Pencil icon to edit the item and the 'X' icon to remove it.

Added Return Items are added to the end by default. If you click on a Return Item, it will be selected and an orange cursor will appear in front of the item. If an item is selected, adding a new Return Item will add it at the location of the orange cursor. Clicking a selected item will unselect it.

Order By

The Order By clause works exactly the same as the Return clause, except one additional icon is added in an Order By Item. Each Order By Item has small triangle:

  • Up: Sort Ascending. This is the default.

  • Down: Sort Descending. You will see the DESC clause get added to the Cypher.

Skip and Limit

The Skip and Limit clauses work the same. Each contains a text box where you can type in a numerical value to specify the Skip or Limit value.

With

You can enter WITH clauses in a Cypher block. Click on the Cypher button and then type WITH as the first word in the Cypher block. As compared to other arbitrary Cypher clauses, WITH clauses have the following features:

  • Scope-aware: WITH clauses change the scope of variables in blocks that come after it. Only declared variables and aliases in the WITH will be available to following blocks.

  • Type-ahead support: As you type, in scope variables and their properties will be popped up as appropriate. Use arrow keys to move up and down a pop-up and <Enter> to select a value. Some functions will also be available from the pop-up.

Note: Only functions and not procedures will be shown.