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
.
Trait | Value |
---|---|
Module type | util |
Implementation | C++ |
Parallelism | sequential |
Procedures
info
If you want to execute this algorithm on graph projections, subgraphs or portions of the graph, be sure to check out the guide on How to run a MAGE module on subgraphs.
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
- Step 1: Input graph
- Step 2: Cypher load commands
- Step 3: Running command
- Step 4: Results
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);
MATCH (n)
CALL uuid_generator.get() YIELD uuid
SET n.uuid = uuid
RETURN n.uuid AS node_uuid;
+----------------------------------------+
| node_uuid |
+----------------------------------------+
| "ef4722b2-628b-4f93-8667-fc91134ed980" |
| "601faade-8c61-4dc3-a68a-693fed4ad40c" |
| "dc4283b8-90d6-402e-8fc0-f37f9959b593" |
+----------------------------------------+