Values and types
This describes how to work with values and types when writing user-defined procedures and functions.
The input and output to and from a procedure or a function must be one of the supported types, as described in Cypher Manual → Values and types.
Composite types are supported via:
-
List<T>
, whereT
is one the supported types, and -
Map<String, Object>
, where the values in the map must have one of the supported types.
The use of Object
is supported for the case where the type is not known beforehand.
Note, however, that the actual value must still have one of the aforementioned types.
The Cypher types and their equivalents in Java are outlined in the table below:
Cypher type | Java type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For more details, see the Neo4j Javadocs org.neo4j.procedure.Procedure
.
Take note that there are two cases where more than one Java type is mapped to a single Cypher type. When this happens, type information is lost. If the following objects are returned from procedures, the original types cannot be recreated:
-
A Cypher
Duration
is created when either ajava.time.Duration
or ajava.time.Period
is provided. If aDuration
is returned, only the common interfacejava.time.temporal.TemporalAmount
will remain. -
A Cypher
DateTime
is created when ajava.time.OffsetDateTime
is provided. If aDateTime
is returned, it will be converted into ajava.time.ZonedDateTime
.
Was this page helpful?