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:

  • Property types

  • Structural types

  • Composite types

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 subtypes Integer and Float

  • String

  • Boolean

  • The spatial type Point

  • Temporal types: Date, Time, LocalTime, DateTime, LocalDateTime and Duration

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.

Sorting of special characters

Strings that contain characters that do not belong to the Basic Multilingual Plane (BMP) can have inconsistent or non-deterministic ordering in Neo4j. BMP is a subset of all characters defined in Unicode. Expressed simply, it contains all common characters from all common languages.

The most significant characters not in BMP are those belonging to the Supplementary Multilingual Plane or the Supplementary Ideographic Plane. Examples are:

  • Historic scripts and symbols and notation used within certain fields such as: Egyptian hieroglyphs, modern musical notation, mathematical alphanumerics.

  • Emojis and other pictographic sets.

  • Game symbols for playing cards, Mah Jongg, and dominoes.

  • CJK Ideograph that were not included in earlier character encoding standards.

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.

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 Working with null).