Skip to main content

Module entities

Module entities 

Source
Expand description

Persistence layer for entities, relationships and their junction tables.

The entity graph mirrors the conceptual content of memories: entities holds nodes, relationships holds typed edges and memory_entities and memory_relationships connect each memory to the graph slice it emitted.

Structs§

EntityNode
Entity row with enough data for graph export/query.
NewEntity
Input payload used to upsert a single entity.
NewRelationship
Input payload used to upsert a typed relationship between entities.
RelationshipRow
Structure representing an existing relation.

Functions§

create_or_fetch_relationship
Creates a relation if it does not exist (returns action=“created”) or returns the existing relation (action=“already_exists”) with updated weight.
delete_entities_by_ids
Deletes entities and their associated vectors. Returns the number of entities removed.
delete_relationship_by_id
Removes a relation by id and cleans up memory_relationships.
find_entity_id
Busca a entidade por nome e namespace. Retorna o id se existir.
find_orphan_entity_ids
Locates orphan entities: no link in memory_entities and no relations.
find_relationship
Looks up a specific relation by (source_id, target_id, relation).
increment_degree
knn_search
link_memory_entity
link_memory_relationship
list_entities
Lists entities, filtering by namespace if provided.
list_relationships_by_namespace
Lists relations filtered by namespace (of source/target entities).
recalculate_degree
Recalculates the degree field of an entity.
upsert_entity
Upserts an entity and returns its primary key.
upsert_entity_vec
Replaces the vector row for an entity in vec_entities.
upsert_relationship
Upserts a typed relationship between two entity ids.