Prev |  | Next

## 15.2. Expressions

An expression in Cypher can be:

- A numeric literal (integer or double): `13`, `40000`, `3.14`.
- A string literal: `"Hello"`, `'World'`.
- A boolean literal: `true`, `false`, `TRUE`, `FALSE`.
- An identifier: `n`, `x`, `rel`, `myFancyIdentifier`, ``A name with weird stuff in it[]!``.
- A property: `n.prop`, `x.prop`, `rel.thisProperty`, `myFancyIdentifier.`(weird property name)``.
- A nullable property: it’s a property, with a question mark or exclamation mark —`n.prop?`, `rel.thisProperty!`.
- A parameter: `{param}`, `{0}`
- A collection of expressions: `["a", "b"]`, `[1,2,3]`, `["a", 2, n.property, {param}]`, `[ ]`.
- A function call: `length(p)`, `nodes(p)`.
- An aggregate function: `avg(x.prop)`, `count(*)`.
- Relationship types: `:REL_TYPE`, `:`REL TYPE``, `:REL1|REL2`.
- A path-pattern: `a-->()<--b`.
- A predicate expression is an expression that returns true or false: a.prop = "Hello", length(p) > 10, has(a.name)

### 15.2.1. Note on string literals

String literals can contain these escape sequences.

Escape sequence | Character
--- | ---
`\t` | Tab
`\b` | Backspace
`\n` | Newline
`\r` | Carriage return
`\f` | Form feed
`\'` | Single quote
`\"` | Double quote
`\\` | Backslash

Copyright © 2013 Neo Technology

Prev | Up | Next
| Home |