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.

TraitValue
Module typeutil
ImplementationC++
Parallelismsequential

Procedures

get()

Use the procedure to the the UUID string.

Output:

  • uuid ➡ Returns a UUID string.

Usage:

To get a UUID string, use the following query:

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

Example

Database state

The database contains the following data:

Created with the following Cypher queries:

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);

Get UUID

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" |
+----------------------------------------+