Abstract
Natural language (NL) interfaces for databases often struggle with temporal reasoning, failing to interpret queries regarding historical states or durations. This paper introduces a computational model implemented in Prolog that maps natural language temporal expressions to a discrete, calendar-based logic. By distinguishing between events and states, the model allows for sophisticated querying of historical data, bridging the gap between static database snapshots and the dynamic nature of real-world information.
Introduction
In the mid-1980s, natural language interfaces for databases, such as the "Intellect" system, began to gain traction. However, these systems possessed a significant limitation: an inability to process temporal context. While a system could answer "When was Smith hired?", it would fail on nuanced questions like "How much was Jones making last September?" or "How long has Green worked here?"
Standard databases are typically "snapshots" of current states or simple logs of events. They lack the semantic "glue" to understand that a salary remains valid from the entry date until a subsequent change, or how to calculate durations across varying calendar units. This research argues that for an NL interface to be truly useful for professionals, it requires a conceptual framework that understands the relationship between events, states, and the calendar.
The Temporal Reasoning Framework
The proposed solution is a two-part reasoning model implemented in Prolog, designed to handle the complexities of time within a deterministic database environment.
1. The Time Domain Model
Rather than treating time as a continuous line—a common but computationally expensive approach in AI—this model treats time as a sequence of discrete units (days). This allows for the definition of:
- Distance functions: To calculate the interval between two specific dates.
- Calendars: Structures for weeks, months, and years that resolve relative references like "last month."
- Periodic Descriptors: A method to handle iterative queries, such as "each of the past five years."
2. The Event Model
This layer defines how database records (events) create "states." For example, a "salary change" event triggers a state where an employee "holds" a specific salary. Using predicates like startof, endof, and trueon, the model deduces whether a condition was true at any given point in the past, even in the absence of a specific database entry for that exact date.
Modeling Temporal Data
To demonstrate the model's capabilities, the research utilizes several illustrative "mini-databases" that represent different ways temporal information is captured in business and medical contexts.
As shown in Figure 1, temporal attributes can describe individuals (e.g., birth dates), transactions (e.g., medical procedures), attribute changes (e.g., salary history), or process transitions (e.g., the publication lifecycle of a document). The model distinguishes between exclusive attributes, like salary (where a new value replaces the old), and non-exclusive attributes, like degrees (where new values are additive), which is vital for accurately reconstructing past states.
Implementation and Results
The primary result is a proof-of-concept implementation that successfully translates complex temporal queries into executable logic. A standout example is the query: "Which employees are making at least twice as much now as they made 5 years ago?"
To answer this, the model identifies the current date, calculates the date exactly five years prior, and deduces the salary at that past date by finding the most recent salary change before that point. Finally, it performs the comparison and returns the result. The use of Prolog acts as a logic bridge, translating human concepts into a series of database lookups and arithmetic tests.
Conclusion and Future Work
The research concludes that discrete, calendar-like structures are sufficient for the vast majority of business-oriented temporal queries. However, several areas for future work remain. The current model assumes days as the base unit, which may not suffice for high-frequency data. Additionally, the model needs extensions to handle "incomplete" calendars (e.g., excluding weekends) and subjective temporal references like "recently." While the reasoning engine is robust, further integration with syntactic components is required to fully automate the translation of English text into Prolog predicates.
Summary updated