Add adds a temporal fact to the output store.
(atom ast.Atom, interval ast.Interval)
| 550 | |
| 551 | // Add adds a temporal fact to the output store. |
| 552 | func (s *TeeingTemporalStore) Add(atom ast.Atom, interval ast.Interval) (bool, error) { |
| 553 | // Guard: Ensure interval is valid |
| 554 | if interval.Start.Type == ast.TimestampBound && interval.End.Type == ast.TimestampBound { |
| 555 | if interval.Start.Timestamp > interval.End.Timestamp { |
| 556 | return false, fmt.Errorf("invalid temporal interval: start %v > end %v", interval.Start, interval.End) |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | // Note: We don't check base for existence because semantics of Add |
| 561 | // usually imply adding *another* interval. |
| 562 | // But if we want deduplication... |
| 563 | // If base has exact same fact (same interval), we might want to skip. |
| 564 | // TemporalStore.Add returns false if duplicate. |
| 565 | // We can check Contains? No, ContainsAt checks point. |
| 566 | // Ideally we check if exact fact exists. |
| 567 | // For now, let's just write to Out. Duplicate facts are usually harmless or handled by upper layers. |
| 568 | return s.Out.Add(atom, interval) |
| 569 | } |
| 570 | |
| 571 | // AddEternal adds an eternal fact to the output store. |
| 572 | func (s *TeeingTemporalStore) AddEternal(atom ast.Atom) (bool, error) { |