Documentation
¶
Overview ¶
Package graph implements the SQLite graph store for Cortex.
It provides knowledge graph operations for creating, querying, and deleting edges between observations. The store implements the domain.GraphRepository interface.
Index ¶
- type Store
- func (s *Store) CountAllEdges(ctx context.Context) (int, error)
- func (s *Store) CountEdgesByObservation(ctx context.Context, obsID int64) (int, error)
- func (s *Store) CreateEdge(ctx context.Context, edge *domain.Edge) error
- func (s *Store) DeleteEdge(ctx context.Context, id int64) error
- func (s *Store) GetContradictions(ctx context.Context, from, to time.Time) ([]*domain.Edge, error)
- func (s *Store) GetEdge(ctx context.Context, id int64) (*domain.Edge, error)
- func (s *Store) GetEdgesForObservation(ctx context.Context, obsID int64) ([]*domain.Edge, error)
- func (s *Store) GetEdgesValidAt(ctx context.Context, obsID int64, at time.Time) ([]*domain.Edge, error)
- func (s *Store) GetEvolutionChain(ctx context.Context, fromObsID, toObsID int64) ([]*domain.Edge, error)
- func (s *Store) GetRelated(ctx context.Context, obsID int64, depth int) ([]*domain.Observation, error)
- func (s *Store) UpdateEdge(ctx context.Context, edge *domain.Edge) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the SQLite graph store.
func (*Store) CountAllEdges ¶
CountAllEdges counts all edges in the system.
func (*Store) CountEdgesByObservation ¶
CountEdgesByObservation counts edges connected to a specific observation.
func (*Store) CreateEdge ¶
CreateEdge creates a relationship between two observations. Returns domain.ErrAlreadyExists if an edge with the same (from, to, relation_type) exists.
func (*Store) DeleteEdge ¶
DeleteEdge removes a relationship between observations.
func (*Store) GetContradictions ¶
GetContradictions retrieves contradiction edges created in a time range.
func (*Store) GetEdgesForObservation ¶
GetEdgesForObservation retrieves all edges where the observation is either source or target.
func (*Store) GetEdgesValidAt ¶ added in v1.0.0
func (s *Store) GetEdgesValidAt(ctx context.Context, obsID int64, at time.Time) ([]*domain.Edge, error)
GetEdgesValidAt retrieves edges for an observation that were valid at the given time. An edge is valid at time `at` if: (valid_from IS NULL OR valid_from <= at) AND (invalid_at IS NULL OR invalid_at > at).
func (*Store) GetEvolutionChain ¶
func (s *Store) GetEvolutionChain(ctx context.Context, fromObsID, toObsID int64) ([]*domain.Edge, error)
GetEvolutionChain retrieves all edges that share the same endpoints.
func (*Store) GetRelated ¶
func (s *Store) GetRelated(ctx context.Context, obsID int64, depth int) ([]*domain.Observation, error)
GetRelated retrieves observations related to the given observation ID, up to the specified depth using a recursive CTE.