2/12/01
Professor Richard Fikes
Representing Representing TimeTime
Computer Science DepartmentStanford University
CS222Winter 2001
Knowledge Systems Laboratory, Stanford University
Knowledge Systems Laboratory, Stanford University
2
About TimeAbout Time
A physical dimension (the Time-Dimension)
Time plenum Large temporal space in which all events are located
E.g., “time line”
“temporally possible worlds” Assume time is continuous and linear
> Time line analogous to continuous number line
Duration An amount of time
E.g., “a century”
“25 minutes”
“as long as it takes for the kettle to boil”
Knowledge Systems Laboratory, Stanford University
3
Points and IntervalsPoints and Intervals Time pointTime point
Position on a temporal coordinate systemE.g., “2:22 p.m., February 2, 2000”
Primitive object Analogous to a real number Also represented at varying granularities
E.g., “March 14, 1994”
Time intervalTime interval Set of two or more time pointsE.g., “the 16th century” “10:50 to 11:00 a.m. on May 30, 1993” “noon to 1:00 p.m. every Tuesday in 2000” Primitive object Convex intervalConvex interval analogous to interval on number line Has two distinguished points: Start-Point and End-Point Can be Left-Open, Left-Closed, Right-Open, and/or Right-Closed
Knowledge Systems Laboratory, Stanford University
4
Class Hierarchy of Time OntologyClass Hierarchy of Time Ontology
Calendar-January
. . .. . .. . .
Time-Point Time-Interval
Convex-Time-Interval
Regular- Non-Convex -Time-Interval
Time-Interval-Left-Open
Time-Interval-Right-Open
Time-Interval-Right-Closed
Time-Interval-Left-Open-Right-Open
Time-Interval-Left-Closed-Right-Closed
Time-Interval-Left-Open-Right-Open
Time-Interval-Left-Closed-Right-Closed
Calendar-Month Calendar-Day
Non-Convex-Time-Interval
Calendar-Sunday
Calendar-Saturday
Calendar-Day-1
Calendar-Day-31
Calendar-December
Time-Quantity
Time-Interval-Left-Closed
Knowledge Systems Laboratory, Stanford University
5
Class Frame Time-PointClass Frame Time-PointTime-Point
Subclass-Of: Thing *Location-Of
Maximum-Cardinality: 1Value-Type: Time-Quantity
*Year-OfMaximum-Cardinality: 1Value-Type: Integer
*Month-OfMaximum-Cardinality: 1Value-Type: Calendar-Month-Type
*Day-OfMaximum-Cardinality: 1Value-Type: Calendar-Day-Type
*Week-Day-OfMaximum-Cardinality: 1Value-Type: Calendar-Week-Day-Type
*Hour-OfMaximum-Cardinality: 1Value-Type: Integer
*Minute-OfMaximum-Cardinality: 1Value-Type: Integer
*Second-OfMaximum-Cardinality: 1Value-Type: Integer
*Granularity-OfSlot-Cardinality: 1Value-Type: Time-
Granularity
Knowledge Systems Laboratory, Stanford University
6
Location of Time PointsLocation of Time Points
Function Location-OfLocation-Of
Amount of time from “point zero” to the time-point
Value is a time quantity (i.e., a duration)
Point zero assumed to be midnight Jan 1, 1900
Midnight-January-1-1900Instance-Of: Time-PointLocation-Of: Time-Instant
Time-InstantInstance-Of: Time-Quantity
(=> (Time-Unit ?u) (Quantity-Magnitude Time-Instant ?u 0))
Knowledge Systems Laboratory, Stanford University
7
Year-Of, Month-Of, Day-Of, etc.Year-Of, Month-Of, Day-Of, etc. Derivable from Location-Of Value of Year-OfYear-Of, Hour-OfHour-Of, Minute-OfMinute-Of, & Second-OfSecond-Of is an integer
(=> (Time-Point ?p)
(= (Year-Of ?p)
(+ (LINLT (Quantity-Magnitude (Location-Of ?p) Year-Unit)) 1900)))
(=> (Time-Point ?p)
(= (Hour-Of ?p)
(Mod (LINLT (Quantity-Magnitude (Location-Of ?p) Hour-Unit)) 24)))
[Note: LINLT means “Largest Integer Less Than”.]
Value of Month-OfMonth-Of is a Calendar-Month-Type Calendar-Month-Type is a class whose instances are the 12 subclasses of
Calendar-Month (e.g., Calendar-January)
Value of Day-OfDay-Of is a Calendar-Day-Type Calendar-Day-Type is a class whose 31 instances are classes Calendar-Day-1
through Calendar-Day-31
Value of Week-Day-OfWeek-Day-Of is a Calendar-Week-Day-Type
Knowledge Systems Laboratory, Stanford University
8
Binary Relations on Time-PointsBinary Relations on Time-Points BeforeBefore, AfterAfter, Equal-PointEqual-Point
Defined in terms of Location-Of
(=> (and (Time-Point ?i) (Time-Point ?j)) (<=> (Before ?i ?j) ... (< (Location-Of ?i) (Location-Of ?j)) ... )
(=> (Physical-Quantity ?q1) (Physical-Dimension ?q1 ?d) (Physical-Quantity ?q2) (Physical-Dimension ?q2 ?d) (Unit-Of-Measure ?u) (Unit-Dimension ?u ?d) (<=> (< ?q1 ?q2) (< (Quantity-Magnitude ?q1 ?u) (Quantity-Magnitude ?q2 ?u))))
Point-In-IntervalPoint-In-Interval Primitive relation
Knowledge Systems Laboratory, Stanford University
9
Class Frame Time-IntervalClass Frame Time-IntervalTime-Interval
Instance-Of: Class*Starting-Point:
Value-Type: Time-PointSlot-Cardinality: 1
*Ending-Point:Value-Type: Time-PointSlot-Cardinality: 1
----------------------------------------------------------------------------(=> (Time-Interval ?i) (and (Before (Starting-Point ?i) (Ending-Point ?i)) (=> (Time-Point ?p) (and (=> (Before ?p (Starting-Point ?i)) (not (Point-In-Interval ?p ?i))) (=> (Before (Ending-Point ?i) ?p) (not (Point-In-Interval ?p ?i)))))))
Knowledge Systems Laboratory, Stanford University
10
Functions on Time-IntervalFunctions on Time-Interval Starting-PointStarting-Point and Ending-PointEnding-Point
(=> (and (Time-Point ?s) (Time-Interval ?i))
(<=> (Starting-Point ?i ?s)
(and (not (exists ?j (and (Time-Point ?j)
(Before ?j ?s)
(Point-In-Interval ?j ?i))))
(=> (Time-Point ?p)
(not (exists ?k (and (Time-Point ?k)
(Before ?k ?p)
(Point-In-Interval ?k ?i))))
(or (Equal-Point ?p ?s) (Before ?p ?s))))))) DurationDuration
Convex time interval> Time quantity whose magnitude is the difference between the location of the interval’s ending
point and starting point
Non-convex time interval> Sum of durations of all convex time intervals contained in it
Knowledge Systems Laboratory, Stanford University
11
Relations on Time-IntervalRelations on Time-Interval James Allen defined a “complete” set of relations on time intervals
Precedes: |————| End-1 < Start-2|——————|
Meets: |————| End-1 = Start-2|——————|
Overlaps: |————| Start-1 < Start-2 < End-1|——————|
Costarts: |————| Start-1 = Start-2|——————|
During: |————| Start-2 < Start-1|——————| End-1 < End-2
Cofinishes: |————| End-1 = End-2|——————|
Equal
Knowledge Systems Laboratory, Stanford University
12
Using the Interval RelationsUsing the Interval Relations
“The reign of George VI preceded that of Elizabeth II.”
(Precedes (ReignOf GeorgeVI) (ReignOf ElizabethII))
“The reign of Elvis overlapped with the 1950’s.”
(Starting-Point Fifties (Starting-Point AD1950))
(Ending-Point Fifties (Ending-Point AD1959))
(Overlaps Fifties (ReignOf Elvis))
Knowledge Systems Laboratory, Stanford University
13
““A Week in January”A Week in January”
(and (Subclass-Of Week-In-January Convex-Time-Interval)
(=> (Week-In-January ?w)
(and (Duration ?w (The-Quantity Day 7))
(exists ?j
(and (Calendar-January ?j)
(or (During ?w ?j)
(Costarts ?w ?j)
(Cofinishes ?w ?j)))))))
Knowledge Systems Laboratory, Stanford University
14
Class Hierarchy of Time OntologyClass Hierarchy of Time Ontology
Calendar-January
. . .. . .. . .
Time-Point Time-Interval
Convex-Time-Interval
Regular- Non-Convex -Time-Interval
Time-Interval-Left-Open
Time-Interval-Right-Open
Time-Interval-Right-Closed
Time-Interval-Left-Open-Right-Open
Time-Interval-Left-Closed-Right-Closed
Time-Interval-Left-Open-Right-Open
Time-Interval-Left-Closed-Right-Closed
Calendar-Month Calendar-Day
Non-Convex-Time-Interval
Calendar-Sunday
Calendar-Saturday
Calendar-Day-1
Calendar-Day-31
Calendar-December
Time-Quantity
Time-Interval-Left-Closed
Knowledge Systems Laboratory, Stanford University
15
Infinity and DensityInfinity and Density
Infinite-PastInfinite-Past and Infinite-FutureInfinite-Future are time points
(and (Time-Point Infinite-Past)
(=> (Time-Point ?p) (not (Before ?p Infinite-Past))))
The time line is considered to be dense (=> (and (Time-Point ?i) (Time-Point ?j) (Before ?i ?j))
(exists ?k (and (Before ?i ?k) (Before ?k ?j))))
Knowledge Systems Laboratory, Stanford University
16
Class Frame Time-PointClass Frame Time-PointTime-Point
Subclass-Of: Thing *Location-Of
Maximum-Cardinality: 1Value-Type: Time-Quantity
*Year-OfMaximum-Cardinality: 1Value-Type: Integer
*Month-OfMaximum-Cardinality: 1Value-Type: Calendar-Month-Type
*Day-OfMaximum-Cardinality: 1Value-Type: Calendar-Day-Type
*Week-Day-OfMaximum-Cardinality: 1Value-Type: Calendar-Week-Day-Type
*Hour-OfMaximum-Cardinality: 1Value-Type: Integer
*Minute-OfMaximum-Cardinality: 1Value-Type: Integer
*Second-OfMaximum-Cardinality: 1Value-Type: Integer
*Granularity-OfSlot-Cardinality: 1Value-Type: Time-
Granularity
Knowledge Systems Laboratory, Stanford University
17
Time GranularityTime Granularity
Time cannot be measured with infinite accuracy
Need a notion of “abstracted” time points
E.g., 1984, May-1927, 12:50 p.m. February 14, 2000
Time intervals are not sufficient
Specify a granularity for a time point Provides for uncertainty that a point occurs somewhere
in a certain time interval
E.g., The time point 1984 at granularity “year” occurs
somewhere during the convex interval 1984
Knowledge Systems Laboratory, Stanford University
18
Time GranularityTime GranularityTime-Granularity
Subclass-Of: Thing*Time-Unit-Of
Value-Type: Time-UnitMax-Cardinality: 1
Year-GranularityInstance-Of: Time-GranularityTime-Unit-Of: Year
Infinitely-Fine-GranularityInstance-Of: Time-GranularityTime-Unit-Of:
Slot-Cardinality: 0
Knowledge Systems Laboratory, Stanford University
19
Equal-PointEqual-Point
(<=> (Equal-Point ?i ?j)
(or (and (Granularity-Of ?i Infinitely-Fine-Granularity)
(Granularity-Of ?j Infinitely-Fine-Granularity)
(= (Location-Of ?i) (Location-Of ?j)))
(and (Granularity-Of ?i ?gran)
(Granularity-Of ?j ?gran)
(= (LINLT (Quantity-Magnitude (Location-Of ?i)
(Time-Unit-Of ?gran)))
(LINLT (Quantity-Magnitude (Location-Of ?j)
(Time-Unit-Of ?gran)))))))
Two time points on two different levels of granularity cannot be said to be equal to each other
Knowledge Systems Laboratory, Stanford University
20
Full Definition of BeforeFull Definition of Before(=> (and (Time-Point ?i) (Time-Point ?j))
(<=> (Before ?i ?j)
(or (and (Granularity-Of ?i Infinitely-Fine-Granularity)
(Granularity-Of ?j Infinitely-Fine-Granularity)
(< (Location-Of ?i) (Location-Of ?j)))
(and (Granularity-Of ?i Infinitely-Fine-Granularity) (Granularity-Of ?j ?gran-j)
(< (Location-Of ?i)
(The-Quantity (LINLT (Quantity-Magnitude (Location-Of ?j)
(Time-Unit-Of ?gran-j)))
(Time-Unit-Of ?gran-j)))) ... (and (Granularity-Of ?i ?gran-i) (Granularity-Of ?j ?gran-j)
(< (The-Quantity (SINLT (Quantity-Magnitude (Location-Of ?i)
(Time-Unit-Of ?gran-i))) (Time-Unit-Of ?gran-i))
(The-Quantity (LINLT (Quantity-Magnitude (Location-Of ?j)
(Time-Unit-Of ?gran-j))) (Time-Unit-Of ?gran-j)))))))
Knowledge Systems Laboratory, Stanford University
21
Styles of Temporal RepresentationsStyles of Temporal Representations Timeless Quantification
Functions and relations have a time argument
E.g., (Married Joe Anne 1993)
> Situation calculus
Objects have time intervals associated with them
E.g., (contains (time-of (Marriage Joe Anne)) 1993)
Sentences “hold true” at timesE.g., (holds (Married Joe Anne) 1993)
Tense logicsE.g., (F (Married Joe Anne))
(F (and (not (Married Joe Anne))
(P (Married Joe Anne))))