Relations are the directed edges that give your knowledge graph its meaning. Where a node represents a single piece of content, a relation expresses how two nodes are connected — who wrote what, what influenced what, which works share a theme. Every relation has a source node, a target node, a semantic type, and a numeric weight that controls how strongly the two nodes are pulled together in the force simulation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DrDigett/Babel/llms.txt
Use this file to discover all available pages before exploring further.
The nine relation types
BaBel+ ships with nine predefined relation types, each carrying a distinct semantic role.es_autor_de — is author of
es_autor_de — is author of
dirigio — directed
dirigio — directed
Links a director node to a film. Mirrors the
es_autor_de pattern for the pelicula type.Example: [Andrei Tarkovsky] --dirigio--> [Stalker]trata_sobre — is about
trata_sobre — is about
Links a piece of content to a concept, theme, or subject it covers. Great for surfacing thematic clusters in the graph.Example:
[Gödel, Escher, Bach] --trata_sobre--> [Self-reference]pertenece_a — belongs to
pertenece_a — belongs to
Links content to a broader school, movement, genre, or canon.Example:
[Blood Meridian] --pertenece_a--> [American Literature]influyo_a — influenced
influyo_a — influenced
Links an author or work to what they went on to influence. The direction is from the influencer to the influenced.Example:
[Nietzsche] --influyo_a--> [Heidegger]critica_a — criticizes
critica_a — criticizes
Links content that critiques, rebuts, or takes an opposing position to another work or author.Example:
[A Critique of Pure Reason] --critica_a--> [Empiricism]inspiro — inspired
inspiro — inspired
Links a work to another work it directly inspired. Distinct from
influyo_a in that it captures concrete creative inspiration rather than broad intellectual influence.Example: [Frankenstein] --inspiro--> [Blade Runner]ocurre_en — occurs in
ocurre_en — occurs in
Links content to a historical period, geographic location, or cultural era in which it is set or was produced.Example:
[All Quiet on the Western Front] --ocurre_en--> [World War I]similar_a — similar to
similar_a — similar to
Links two thematically or stylistically similar pieces of content. By convention,
similar_a is best used between nodes of the same type (libro–libro, pelicula–pelicula, etc.) to keep similarity comparisons meaningful.Example: [Dune] --similar_a--> [Foundation]Relation fields
Weight
Every relation carries aweight value between 0.0 and 1.0 (inclusive). Weight serves two purposes:
- Graph rendering — edge opacity and stroke width scale with weight. A weight of
1.0produces a fully opaque, thick line; a weight of0.1produces a faint, thin line. - Graph visibility — only relations with
weight ≥ MIN_RELATION_WEIGHT(0.7) are loaded into the graph canvas and the node detail sidebar at all. Relations below this threshold are stored in the database but invisible in the UI.
Relation type weights (AI suggestion budget)
RELATION_TYPE_WEIGHTS is a separate concept from the per-relation weight field. It is a static lookup table used by the AI classification layer to decide how many relations of each type to suggest when you run Smart Add.
| Type | Weight | Interpretation |
|---|---|---|
es_autor_de | 4 | High priority — authorship is a primary structural relation |
dirigio | 4 | High priority — direction is equally fundamental for film |
trata_sobre | 4 | High priority — thematic links are core to knowledge mapping |
pertenece_a | 3 | Medium priority — genre/movement membership is useful but secondary |
influyo_a | 3 | Medium priority — influence chains are valuable but harder to verify |
critica_a | 4 | High priority — critical relationships add strong intellectual structure |
inspiro | 3 | Medium priority — inspiration links enrich but can be speculative |
ocurre_en | 1 | Low priority — historical/geographic context is supplementary |
similar_a | 1 | Low priority — similarity is subjective and easily overused |
RELATION_THRESHOLD (value: 4) as a cutoff; types at or above this threshold are suggested first and with greater confidence.
Validation rules
The relations API enforces the following rules on everyPOST /api/relations request:
- Self-loop prevention
- Node existence
- Type validation
- Weight range
400 Bad Request with "source and target must be different".When a node is deleted, all relations where it appears as
sourceId or targetId are automatically removed by the database’s ON DELETE CASCADE constraint.See also
- Relations API — full REST reference for listing, creating, and deleting relations
- AI Smart Add — how BaBel+‘s Groq-powered classifier uses relation type weights to suggest connections