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
Linha de entidade com dados suficientes para exportação/consulta de grafo.
NewEntity
Input payload used to upsert a single entity.
NewRelationship
Input payload used to upsert a typed relationship between entities.
RelationshipRow
Estrutura representando uma relação existente.

Functions§

create_or_fetch_relationship
Cria uma relação se não existir (retorna action=“created”) ou retorna a relação existente (action=“already_exists”) com peso atualizado.
delete_entities_by_ids
Deleta entidades e seus vetores associados. Retorna o número de entidades removidas.
delete_relationship_by_id
Remove uma relação pelo id e limpa memory_relationships.
find_entity_id
Busca a entidade por nome e namespace. Retorna o id se existir.
find_orphan_entity_ids
Localiza entidades órfãs: sem vínculo em memory_entities e sem relações.
find_relationship
Busca uma relação específica por (source_id, target_id, relation).
increment_degree
knn_search
link_memory_entity
link_memory_relationship
list_entities
Lista entidades, filtrando por namespace se fornecido.
list_relationships_by_namespace
Lista relações filtradas por namespace (das entidades de origem/destino).
recalculate_degree
Recalcula o campo degree de uma entidade.
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.