3.2.1. Values and types

Cypher provides first class support for a number of data types.

These fall into several categories which will be described in detail in the following subsections:

3.2.1.1. Property types

  • ✓ Can be returned from Cypher queries
  • ✓ Can be used as parameters
  • ✓ Can be stored as properties
  • ✓ Can be constructed with Cypher literals

Property types comprise:

  • Number, an abstract type, which has the following subtypes:

    • Integer
    • Float
  • String
  • Boolean

The adjective 'numeric' — when used in the context of describing Cypher functions or expressions — indicates that any type of Number applies (Integer or Float).

Homogeneous lists of simple types can also be stored as properties, although lists in general (see Composite types) cannot be stored.

Cypher also provides pass-through support for byte arrays, which can be stored as property values. Byte arrays are not considered a first class data type by Cypher, so do not have a literal representation.

3.2.1.2. Structural types

  • ✓ Can be returned from Cypher queries
  • ❏ Cannot be used as parameters
  • ❏ Cannot be stored as properties
  • ❏ Cannot be constructed with Cypher literals

Structural types comprise:

  • Nodes, comprising:

    • Id
    • Label(s)
    • Map (of properties)
  • Relationships, comprising:

    • Id
    • Type
    • Map (of properties)
    • Id of the start and end nodes
  • Paths

    • An alternating sequence of nodes and relationships

Nodes, relationships, and paths are returned as a result of pattern matching.

Labels are not values but are a form of pattern syntax.

3.2.1.3. Composite types

  • ✓ Can be returned from Cypher queries
  • ✓ Can be used as parameters
  • ❏ Cannot be stored as properties
  • ✓ Can be constructed with Cypher literals

Composite types comprise:

  • Lists are heterogeneous, ordered collections of values, each of which has any property, structural or composite type.
  • Maps are heterogeneous, unordered collections of (key, value) pairs, where:

    • the key is a String
    • the value has any property, structural or composite type

Composite values can also contain null.

Special care must be taken when using null (see Section 3.2.10, “Working with null).