Skip to main content

TemporalReference

Trait TemporalReference 

Source
pub trait TemporalReference: Clone + Debug {
    // Required methods
    fn is_groundable(&self) -> bool;
    fn to_utc_range(&self) -> Option<(DateTime<Utc>, DateTime<Utc>)>;
    fn source_text(&self) -> &str;
    fn confidence(&self) -> f64;
}
Expand description

A temporal reference within a specific ontology.

This represents “a point or region in time” according to some temporal system. It intentionally does NOT assume:

  • Linear time (can represent cyclical or event-based time)
  • Fixed granularity (can be fuzzy, range, or precise)
  • Gregorian calendar (can be any calendar system)

§Design Philosophy

The trait uses associated types rather than concrete DateTime to allow:

  • Event-based references (“after the harvest”)
  • Cyclical references (“Year of the Dragon”)
  • Fuzzy references (“recently”)
  • Composite references (“the third Monday of Ramadan”)

Required Methods§

Source

fn is_groundable(&self) -> bool

Can this reference be grounded to UTC?

Returns false for:

  • Event-based time (“when the war ended”) without known dates
  • Recurring patterns (“every Monday”) without a specific instance
  • Purely relational time (“in my grandfather’s time”)
Source

fn to_utc_range(&self) -> Option<(DateTime<Utc>, DateTime<Utc>)>

Attempt to convert to a UTC range.

Returns None if this reference cannot be mapped to Gregorian time. Even groundable references may have wide ranges (e.g., “the 90s” → 10 years).

Source

fn source_text(&self) -> &str

Get the original text of this reference.

Source

fn confidence(&self) -> f64

Confidence in the interpretation (0.0 to 1.0).

Lower for ambiguous expressions like “soon” or “long ago”.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§