uuid_generator

This module is used to generate string UUIDs which can be stored as properties on nodes or edges. The underlying implementation makes use of the uuid-dev library. When using the uuid module on Linux systems, the library can be installed by running sudo apt-get install uuid-dev.

docs-source (opens in a new tab)

TraitValue
Module typeutil
ImplementationC++
Parallelismsequential

Procedures

get()

Output:

  • uuid ➡ Returns a UUID string.

Usage:

MATCH (n)
CALL uuid_generator.get() YIELD uuid
SET n.uuid = uuid
RETURN n.uuid AS node_uuid;

Example

Input graph

Cypher load commands

MERGE (a:Node {id: 0}) MERGE (b:Node {id: 1}) CREATE (a)-[:RELATION]->(b);
MERGE (a:Node {id: 1}) MERGE (b:Node {id: 2}) CREATE (a)-[:RELATION]->(b);
MERGE (a:Node {id: 2}) MERGE (b:Node {id: 0}) CREATE (a)-[:RELATION]->(b);

Running command

MATCH (n)
CALL uuid_generator.get() YIELD uuid
SET n.uuid = uuid
RETURN n.uuid AS node_uuid;

Results

+----------------------------------------+
| node_uuid                              |
+----------------------------------------+
| "ef4722b2-628b-4f93-8667-fc91134ed980" |
| "601faade-8c61-4dc3-a68a-693fed4ad40c" |
| "dc4283b8-90d6-402e-8fc0-f37f9959b593" |
+----------------------------------------+