pub struct TemporalReasoningEngine { /* private fields */ }Expand description
A production-grade temporal logic reasoning system.
Stores a collection of TemporalEvents and a set of TemporalConstraints,
and provides rich queries over them including Allen’s interval algebra
classification, windowed search, tag-based lookup, chain analysis, and
full constraint checking.
Implementations§
Source§impl TemporalReasoningEngine
impl TemporalReasoningEngine
Sourcepub fn add_event(&mut self, event: TemporalEvent) -> Result<(), TemporalError>
pub fn add_event(&mut self, event: TemporalEvent) -> Result<(), TemporalError>
Add an event. Returns Err if the id already exists or if the engine
is at capacity.
Sourcepub fn remove_event(&mut self, id: &str) -> bool
pub fn remove_event(&mut self, id: &str) -> bool
Remove an event by id. Returns true if it existed.
Sourcepub fn get_event(&self, id: &str) -> Option<&TemporalEvent>
pub fn get_event(&self, id: &str) -> Option<&TemporalEvent>
Retrieve a reference to an event by id.
Sourcepub fn events_in_window(&self, window: &TimeInterval) -> Vec<&TemporalEvent>
pub fn events_in_window(&self, window: &TimeInterval) -> Vec<&TemporalEvent>
Return all events whose interval overlaps window, sorted by start time
(then end time as tiebreaker).
Sourcepub fn events_with_tag(&self, tag: &str) -> Vec<&TemporalEvent>
pub fn events_with_tag(&self, tag: &str) -> Vec<&TemporalEvent>
Return all events that carry tag, sorted by start time.
Sourcepub fn timeline(&self) -> Vec<&TemporalEvent>
pub fn timeline(&self) -> Vec<&TemporalEvent>
Return all events sorted chronologically (by start, then end).
Sourcepub fn concurrent_events(&self, id: &str) -> Vec<&TemporalEvent>
pub fn concurrent_events(&self, id: &str) -> Vec<&TemporalEvent>
Return all events that overlap with the event identified by id,
excluding the event itself. Returns an empty Vec if id not found.
Sourcepub fn allen_relation(&self, a: &str, b: &str) -> Option<AllenRelation>
pub fn allen_relation(&self, a: &str, b: &str) -> Option<AllenRelation>
Classify the Allen relation between two events. Returns None if
either event is not found.
Sourcepub fn add_constraint(&mut self, c: TemporalConstraint)
pub fn add_constraint(&mut self, c: TemporalConstraint)
Register a constraint. Constraints are not validated on insertion;
call check_constraints
to evaluate them.
Sourcepub fn check_constraints(&self) -> Vec<ConstraintViolation>
pub fn check_constraints(&self) -> Vec<ConstraintViolation>
Evaluate all registered constraints and return a list of violations.
Sourcepub fn event_chains(&self) -> Vec<Vec<&TemporalEvent>>
pub fn event_chains(&self) -> Vec<Vec<&TemporalEvent>>
Compute connected components of the overlap graph.
Two events are in the same component if they overlap (directly or transitively). Returns chains sorted by the start time of their first event; within each chain events are also sorted by start time.
Sourcepub fn stats(&self) -> TemporalStats
pub fn stats(&self) -> TemporalStats
Compute aggregate statistics about the current engine state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemporalReasoningEngine
impl RefUnwindSafe for TemporalReasoningEngine
impl Send for TemporalReasoningEngine
impl Sync for TemporalReasoningEngine
impl Unpin for TemporalReasoningEngine
impl UnsafeUnpin for TemporalReasoningEngine
impl UnwindSafe for TemporalReasoningEngine
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more