apoc.coll.elements

Details

Syntax

apoc.coll.elements(coll [, limit, offset ]) :: (_1-_10, _1s-_10s, _1i-_10i, _1f-_10f, _1b-_10b, _1l-_10l, _1m-_10m, _1n-_10n, _1r-_10r, _1p-_10p, elements)

Description

Deconstructs a LIST<ANY> into identifiers indicating their specific type.

Input arguments

Name

Type

Description

coll

LIST<ANY>

A list of values to deconstruct.

limit

INTEGER

The maximum size of elements to deconstruct from the given list. The default is: -1.

offset

INTEGER

The offset to start deconstructing from. The default is: 0.

Return arguments

Name

Type

Description

_1-_10

ANY

The value of the first item to tenth item.

_1s-_10s

STRING

The value of the first to tenth item, if it is a string value.

_1i-_10i

INTEGER

The value of the first to tenth item, if it is an integer value.

_1f-_10f

FLOAT

The value of the first to tenth item, if it is a float value.

_1b-_10b

BOOLEAN

The value of the first to tenth item, if it is a boolean value.

_1l-_10l

LIST<ANY>

The value of the first to tenth item, if it is a list value.

_1m-_10m

MAP

The value of the first to tenth item, if it is a map value.

_1n-_10n

NODE

The value of the first to tenth item, if it is a node value.

_1r-_10r

RELATIONSHIP

The value of the first to tenth item, if it is a relationship value.

_1p-_10p

PATH

The value of the first to tenth item, if it is a path value.

elements

INTEGER

The number of deconstructed elements.

Usage Examples

The following deconstructs a list of 3 values into identifiers of the correct type:

CALL apoc.coll.elements([9, true, "Neo4j"])
YIELD _1, _1s, _1i, _1b, _1l, _1m, _1n, _1r, _1p,
      _2, _2s, _2i, _2b, _2l, _2m, _2n, _2r, _2p,
      _3, _3s, _3i, _3b, _3l, _3m, _3n, _3r, _3p
RETURN _1, _1s, _1i, _1b, _1l, _1m, _1n, _1r, _1p,
       _2, _2s, _2i, _2b, _2l, _2m, _2n, _2r, _2p,
       _3, _3s, _3i, _3b, _3l, _3m, _3n, _3r, _3p;

The output below would usually be in one table, but for readability we format it into multiple tables

Results
_1 _1s _1i _1b _1l _1m _1n _1r _1p

9

NULL

9

NULL

NULL

NULL

NULL

NULL

NULL

Results
_2 _2s _2i _2b _2l _2m _2n _2r _2p

TRUE

NULL

NULL

TRUE

NULL

NULL

NULL

NULL

NULL

Results
_3 _3s _3i _3b _3l _3m _3n _3r _3p

"Neo4j"

"Neo4j"

NULL

NULL

NULL

NULL

NULL

NULL

NULL