apoc.coll.elements
Syntax |
|
||
Description |
Deconstructs a |
||
Input arguments |
Name |
Type |
Description |
|
|
A list of values to deconstruct. |
|
|
|
The maximum size of elements to deconstruct from the given list. The default is: |
|
|
|
The offset to start deconstructing from. The default is: |
|
Return arguments |
Name |
Type |
Description |
|
|
The value of the first item to tenth item. |
|
|
|
The value of the first to tenth item, if it is a string value. |
|
|
|
The value of the first to tenth item, if it is an integer value. |
|
|
|
The value of the first to tenth item, if it is a float value. |
|
|
|
The value of the first to tenth item, if it is a boolean value. |
|
|
|
The value of the first to tenth item, if it is a list value. |
|
|
|
The value of the first to tenth item, if it is a map value. |
|
|
|
The value of the first to tenth item, if it is a node value. |
|
|
|
The value of the first to tenth item, if it is a relationship value. |
|
|
|
The value of the first to tenth item, if it is a path value. |
|
|
|
The number of deconstructed elements. |
Usage Examples
The following example demonstrates how to deconstruct a list of three values into identifiers and determine their types using both APOC and Cypher.
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;
UNWIND [9, true, "Neo4j"] AS value
RETURN
value,
CASE WHEN value IS :: STRING THEN value ELSE null END AS _s,
CASE WHEN value IS :: INTEGER THEN value ELSE null END AS _i,
CASE WHEN value IS :: BOOLEAN THEN value ELSE null END AS _b,
CASE WHEN value IS :: ANY LIST THEN value ELSE null END AS _l,
CASE WHEN value IS :: MAP THEN value ELSE null END AS _m,
CASE WHEN value IS :: NODE THEN value ELSE null END AS _n,
CASE WHEN value IS :: RELATIONSHIP THEN value ELSE null END AS _r,
CASE WHEN value IS :: PATH THEN value ELSE null END AS _p
The output below would appear in a single table for apoc.coll.elements
, but for readability it has been formatted it into multiple tables.
_1 | _1s | _1i | _1b | _1l | _1m | _1n | _1r | _1p |
---|---|---|---|---|---|---|---|---|
9 |
NULL |
9 |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
_2 | _2s | _2i | _2b | _2l | _2m | _2n | _2r | _2p |
---|---|---|---|---|---|---|---|---|
TRUE |
NULL |
NULL |
TRUE |
NULL |
NULL |
NULL |
NULL |
NULL |
_3 | _3s | _3i | _3b | _3l | _3m | _3n | _3r | _3p |
---|---|---|---|---|---|---|---|---|
"Neo4j" |
"Neo4j" |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |