Documentation
¶
Overview ¶
Package temporal provides temporal graph semantics and evolution tracking for the knowledge graph in Cortex.
This package extends the basic graph functionality with temporal awareness, enabling tracking of how facts evolve over time, handling temporal validity, and providing temporal reasoning capabilities similar to Zep's temporal knowledge graph.
Index ¶
- type TemporalService
- func (s *TemporalService) CreateTemporalEdge(ctx context.Context, edge *domain.Edge) error
- func (s *TemporalService) CreateTemporalSnapshot(ctx context.Context, snapshotKey string, rootObsID int64, description string) (*domain.TemporalSnapshot, error)
- func (s *TemporalService) GetCurrentFactState(ctx context.Context, obsID int64) (map[string]*domain.Edge, error)
- func (s *TemporalService) GetEvolutionPath(ctx context.Context, edgeID int64) ([]*domain.Edge, error)
- func (s *TemporalService) GetTemporalEdges(ctx context.Context, obsID int64, at time.Time) ([]*domain.Edge, error)
- func (s *TemporalService) GetTemporalMetrics(ctx context.Context, sessionID string, from, to time.Time) ([]*domain.Metrics, error)
- func (s *TemporalService) GetTemporalRelevant(ctx context.Context, obsID int64, at time.Time, depth int) ([]*domain.Observation, error)
- func (s *TemporalService) HandleTemporalContradiction(ctx context.Context, factA, factB *domain.Edge) (*domain.Edge, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TemporalService ¶
type TemporalService struct {
// contains filtered or unexported fields
}
TemporalService provides enhanced temporal graph functionality.
func NewTemporalService ¶
func NewTemporalService( graphRepo domain.GraphRepository, observationRepo domain.ObservationRepository, snapshotRepo domain.TemporalSnapshotRepository, metricsRepo domain.MetricsRepository, ) *TemporalService
NewTemporalService creates a new temporal graph service.
func (*TemporalService) CreateTemporalEdge ¶
CreateTemporalEdge creates an edge with temporal validity and evolution tracking.
func (*TemporalService) CreateTemporalSnapshot ¶
func (s *TemporalService) CreateTemporalSnapshot(ctx context.Context, snapshotKey string, rootObsID int64, description string) (*domain.TemporalSnapshot, error)
CreateTemporalSnapshot creates a point-in-time snapshot of the knowledge graph.
func (*TemporalService) GetCurrentFactState ¶
func (s *TemporalService) GetCurrentFactState(ctx context.Context, obsID int64) (map[string]*domain.Edge, error)
GetCurrentFactState determines the current state of facts related to an observation.
func (*TemporalService) GetEvolutionPath ¶
func (s *TemporalService) GetEvolutionPath(ctx context.Context, edgeID int64) ([]*domain.Edge, error)
GetEvolutionPath retrieves the evolution history of an edge.
func (*TemporalService) GetTemporalEdges ¶
func (s *TemporalService) GetTemporalEdges(ctx context.Context, obsID int64, at time.Time) ([]*domain.Edge, error)
GetTemporalEdges retrieves edges that are valid at a specific time point.
func (*TemporalService) GetTemporalMetrics ¶
func (s *TemporalService) GetTemporalMetrics(ctx context.Context, sessionID string, from, to time.Time) ([]*domain.Metrics, error)
GetTemporalMetrics retrieves metrics related to temporal operations.
func (*TemporalService) GetTemporalRelevant ¶
func (s *TemporalService) GetTemporalRelevant(ctx context.Context, obsID int64, at time.Time, depth int) ([]*domain.Observation, error)
GetTemporalRelevant retrieves observations relevant at a specific time point, respecting temporal validity and fact evolution.
func (*TemporalService) HandleTemporalContradiction ¶
func (s *TemporalService) HandleTemporalContradiction(ctx context.Context, factA, factB *domain.Edge) (*domain.Edge, error)
HandleTemporalContradiction handles contradictions between facts with temporal reasoning.