Getting Started

Tutorial: Building with CleaveDB

Relationships & References (BOND & LINK) — Overview

In traditional relational databases, connecting data across different tables requires foreign keys, junction tables, and expensive multi-table JOIN operations. CleaveDB replaces this friction with native graph relationships and references.

Two Distinct Connection Mechanisms

CleaveDB provides two distinct relationship mechanisms with different architectures, semantics, and storage engines:

1. Graph Bonds (BOND)

Rich semantic graph edges stored in _bonds. A bond requires an explicit relationship label via AS "<label>" (e.g. AS "friend"). Supports weights, conditions, TTL, mutual connections, and cascading deletes. Removed with SEVER.

2. Document Links (LINK)

Direct structural document pointers or external URL references stored in _links. Relationship label is optional (defaults to "linked"). Can reference external web URLs (https://...). Cannot take graph modifiers. Removed with UNLINK.

FeatureBOND (Graph Relationship)LINK (Document / URL Reference)
Primary PurposeSemantic graph relationships with meaning (edges)Direct document / external URL references
Relationship LabelRequired via AS "<label>"Optional (defaults to "linked")
Internal Storage_bonds_links
External Web URLsNo (internal documents only)Yes (https://...)
Weights & ModifiersWITH, IF, EXPIRING, EXCLUSIVELYNo (rejected by parser)
Removal CommandSEVER <doc1> FROM <doc2>UNLINK <doc1> FROM <doc2>

Explore the relationship & reference topics

Each lesson provides practical CleaveQL examples covering the complete relationship and reference toolkit: