Administration

Cypher® contains a number of administrative commands which allows for efficient and sophisticated database management, alias management, server management, and role-based access-control.

More information about each of these topics can be found in the following sections:

Syntax summaries

Almost all administration commands have variations. The most common are parts of the command that are optional or that can have multiple values.

See below a summary of the syntax used to describe all versions of a command. These summaries use some special characters to indicate such variations.

Table 1. Special characters in syntax summaries
Character Meaning Example

|

Used to indicate alternative parts of a command (i.e. or). Needs to be part of a grouping.

If the syntax needs to specify either a name or *, this can be indicated with * | name.

{ and }

Used to group parts of the command. Commonly found together with |.

In order to use the or in the syntax summary, it needs to be in a group: {* | name}.

[ and ]

Used to indicate an optional part of the command. It also groups alternatives together, when there can be either of the alternatives or nothing.

If a keyword in the syntax can either be in singular or plural, we can indicate that the S is optional with GRAPH[S].

...

Repeated pattern. Related to the command part immediately before this is repeated.

A comma separated list of names would be name[, ...].

"

When a special character is part of the syntax itself, we surround it with " to indicate this.

To include { in the syntax use "{" { * | name } "}". In this case, you will get either { * } or { name }.

The special characters in the table above are the only ones that need to be escaped using " in the syntax summaries.

Here is an example that uses all the special characters. It grants the READ privilege:

GRANT READ
  "{" { * | property[, ...] } "}"
  ON {HOME GRAPH | GRAPH[S] { * | name[, ...] }}
    [ ELEMENT[S] { * | label-or-rel-type[, ...] }
    | NODE[S] { * | label[, ...] }
    | RELATIONSHIP[S] { * | rel-type[, ...] }]
  TO role[, ...]

Note that this command includes { and } in the syntax, and between them there can be a grouping of properties or the character *. It also has multiple optional parts, including the entity part of the command which is the grouping following the graph name.

However, there is no need to escape any characters when creating a constraint for a node property. This is because ( and ) are not special characters, and [ and ] indicate that the constraint name is optional, and therefore not part of the command.

CREATE CONSTRAINT [constraint_name] [IF NOT EXISTS]
FOR (n:LabelName)
REQUIRE n.propertyName IS NOT NULL