apoc.node.labels

Details

Syntax

apoc.node.labels(node)

Description

Returns the labels for the given virtual NODE.

Arguments

Name

Type

Description

node

NODE

The node to return labels from.

Returns

LIST<ANY>

Usage Examples

The examples in this section are based on the following graph:

CREATE (s:Student {name: 'Alice', score: 71});
CREATE (s:Student {name: 'Mark', score: 95});
CREATE (s:Student {name: 'Andrea', score: 86});
CREATE (s:Student {name: 'Rajesh', score: 89});
CREATE (s:Student {name: 'Jennifer', score: 96});
CREATE (s:Student {name: 'Katarina', score: 80});

If we create virtual nodes containing students scores, we can use apoc.node.labels to return the labels of those virtual nodes:

MATCH (s:Student)
CALL apoc.create.vNode(['Score'],{value: s.score})
YIELD node
RETURN node, apoc.node.labels(node) AS labels;
Results
node labels

(:Score {value: 71})

["Score"]

(:Score {value: 95})

["Score"]

(:Score {value: 86})

["Score"]

(:Score {value: 89})

["Score"]

(:Score {value: 96})

["Score"]

(:Score {value: 80})

["Score"]