label
Labels are used to categorize nodes, and the label module provides a function
to check the existence of a label within the node.
| Trait | Value |
|---|---|
| Module type | util |
| Implementation | C++ |
| Graph direction | directed/undirected |
| Edge weights | weighted/unweighted |
| Parallelism | sequential |
Functions
exists()
Checks whether a specified node is labeled with the provided label.
Input:
node: Any➡ The target node for label check.label: string➡ Denotes the specific label name to be verified on the given node.
Output:
bool➡ A boolean value indicating whether the specified label is present on the provided node.
Usage:
The following query checks if the created node labeled Student also has a
Teacher label:
CREATE (:Student {name: 'Ana'});
MATCH (s:Student {name: 'Ana'}) RETURN label.exists(s, "Teacher") AS exists;Results:
+----------------------------+
| exists |
+----------------------------+
| False |
+----------------------------+