apoc.node.labels

Function APOC Core

returns labels for (virtual) nodes

Signature

apoc.node.labels(node :: NODE?) :: (LIST? OF ANY?)

Input parameters

Name Type Default

node

NODE?

null

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;
Table 1. 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"]