#
UID Types in Curiosity
Curiosity uses several types of Unique Identifiers (UIDs) to manage data efficiently. Understanding these types is crucial for data modeling and low-level graph operations.
#
Node UIDs (UID128)
Nodes are identified by a 128-bit UID (UID128).
- Stable: These UIDs are stable across all user-defined schemas. If you recreate a node with the same Type and Key, it will have the same UID.
- Deterministic: The UID is deterministically derived from the node's Type (string) and Key (string) using a hashing algorithm.
- Usage: This is equivalent to a Primary Key in a traditional database.
- Size: 16 bytes.
#
Node Type and Edge Type UIDs
Internally, Curiosity maps string type names (e.g., "Person", "KNOWS") to numeric UIDs for performance.
- Sequential: These are always sequential integers (uint).
- Schema Association: They are strictly associated with the current schema.
- Not Stable: These UIDs are not stable across deployments. If you export data and import it into a fresh workspace, the numeric Type UID for "Person" might change (e.g., from 10 to 15). Always refer to types by their string name in code/queries, and let the system handle the mapping.
- Size: 4 bytes.
#
Index UIDs (UID64)
Indexes and some internal structures use a 64-bit UID (UID64).
- Usage: Identifies specific indexes (e.g., a specific Lucene Text Index instance).
- Size: 8 bytes.
#
Edge Definition
An Edge in Curiosity is a lightweight structure connecting two nodes. Its definition includes:
- Edge UID: A derived UID identifying the edge itself (often a combination of the source node, edge type, and an internal counter).
- Target Node UID: The
UID128of the node the edge points to. - Target Node Type UID: The numeric Type UID of the target node. This allows the engine to know the type of the target without loading the target node itself.