Time Ontology in KIF

HP Labs 1994
This document is an attempt to create a 'canonical' kif time ontology which is closer to the kif that prologic will interpret. We are basically eliminating the use of the frame ontology.

Back to main ontology page.

We draw heavily on the JAT ontology and we have added concepts of time granularity.

For a full description of the motivation and underlying issues see the file Basis of ontology

;;First we define the predicate time
(<=  (time ?t)
     (= ?t (listof @temporal-measure-terms)))
;;see the definition of a time.

(<= (time-exact ?te)
    (= ?te (listof @temporal-measure-terms)))
;;time accessor function
(<= (time.limits ?time ?start ?end)
    (time-to-interval ?time (t-interval ?start ?end))))

;;Next we define the t-interval which is an interval that has a start
;;and end time.  These intervals are compared using a set of relations
;;similiar to Allen's relations except that the start and end are themselves intervals 
;;and not  points.  By doing this we disambiguate the issue 
;;of granularity
(<= (t-interval ?t1 ?t2)
    (and (time ?t1)
         (time ?t2)
         (t< ?t1 ?t2)))

;;the following are accessor functions for the start and end of an interval
(<= (t-interval.start ?ti ?start)
    (t-interval ?start ?end))

(<= (t-interval.end ?tr ?end)
    (t-interval ?start ?end))

(<= (t-interval.limits ?tr ?start ?end)
    (t-interval ?start ?end))

;;the following 4 relations define the possible relations between time
;;values. Note these are not the same as Allen's relations because we
;;are comparing unit-intervals and not intervals.  i.e. no 2 unit-intervals
;;can lead or lag each other.
(<= (t< ?tu1 ?tu2)
    (and (time.limits ?tu1 ?start1 ?end1)
         (time.limits ?tu2 ?start2 ?end2)
         (or (tp= ?end1 ?start2)
             (tp< ?end1 ?start2))))

(<= (t> ?tu1 ?tu2)
    (t< ?tu2 ?tu1))

(<= (t== ?tu1 ?tu2)
    (and (time.limits ?tu1 ?start1 ?end1)
         (time.limits ?tu2 ?start2 ?end2)
         (tp= ?start1 ?start2)
         (tp= ?end1 ?end2)))

(<= (t= ?tu1 ?tu2)
    (and (time.limits ?tu1 ?start1 ?end1)
         (time.limits ?tu2 ?start2 ?end2)
         (or (and (tp= ?start1 ?start2)
                  (tp= ?end1 ?end2))
             (and (tp= ?start1 ?start2)
                  (tp< ?end2 ?end1))
             (and (tp= ?end1 ?end2)
                  (tp< ?start1 ?start2))
             (and (tp> ?start2 ?start1)
                  (tp< ?end2 ?end1)))))




;;
;;Basic interval relations:
;
;
;    "a time interval ?tr1 preceeds a time interval ?tr2."		 
;
(<= (before ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t<  ?end1 ?start2)))

;
;    "a time interval ?tr1 succeeds a time interval ?tr2."
;
(<= (after ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t> ?start1 ?end2)))


;
;    "a time interval ?tr1 is identical to a time interval ?tr2."		 
;
(<= (equals ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t= ?start1 ?start2)
          (t= ?end1 ?end2)))


;
;    "a time interval ?tr1 ends at the same time a time interval ?tr2 starts."
;
(<= (meets ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t= ?end1 ?start2)))

;
; "a time interval ?tr1 starts from the end of time interval ?tr2"
;
(<= (from ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t= ?start1 ?end2)))

;
;    "a time interval ?tr1 is properly included in a time interval ?tr2."
;
(<= (during ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)     
          (t> ?start1 ?start2)
          (t< ?end1 ?end2)))


;
; "a time interval ?tr1 contains ?tr2 if ?tr2 is during ?tr1"
;
(<= (contains ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t> ?start2 ?start1) 
          (t< ?end2 ?end1)))
          
 


;
; "a time interval ?tr1 leads ?tr2 when ?tr1 starts before ?tr2 but ends
;  after ?tr2 starts and before ?tr2 end"
;
;
(<= (leads ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-range.limits ?ti2 ?start2 ?end2)
          (t< ?end1 ?end2)
          (t< ?start1 ?start2)
          (t> ?end1 ?start2)))
         


; "a time interval ?tr1 lags ?tr2 when ?tr1 starts after ?tr2 but ends
;  before ?tr2 end and after ?tr2 start"
;
(<= (lags ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t> ?start1 ?start2)
          (t< ?start1 ?end2)
          (t> ?end1 ?end2)))
          

;
;    "a time interval ?tr1 and a time interval ?tr2 starts at the same time
;and a duration of ?tr1 is shorter than that of ?tr2."
;
(<= (starts ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t= ?start1 ?start2)
          (t< ?end1 ?end2)))




;    "a time interval ?tr1 and a time interval ?tr2 ends at the same time and
;a duration of ?tr1 is shorter than that of ?tr2."
;		       
;

(<= (finishes ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t> ?start1 ?start2)
          (t= ?end1 ?end2)))


;;
;;The next set of relations introduce some extra relations that may have some overlap
;;with the set of 11 relations defined above.
;;



;
;  "a time interval ?tr2 and a time interval ?tr1 starts at the same time
;and a duration of ?tr2 is shorter than that of ?tr1."
;
(<= (started-by ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t= ?start2 ?start1)
          (t< ?end2 ?end3)))



;
;  "a time interval ?tr2 and a time interval ?tr1 ends at the same time and
;   a duration of ?tr2 is shorter than that of ?tr1."
;
(<= (finished-by ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t> ?start2 ?start1)
          (t= ?end2 ?end2)))


;
;    "a time interval ?tr1 and a time interval ?tr2 overlaps."		 
;
(<= (overlaps ?ti1 ?ti2)
     (and (t-interval.limits ?ti1 ?start1 ?end1)
          (t-interval.limits ?ti2 ?start2 ?end2)
          (t< ?start1 ?start2)
          (t< ?start2 ?end1)
          (t< ?end1 ?end2)))



;before=
;
(<= (before= ?ti1 ?ti2)
     (or (before ?ti1 ?ti2)
         (meets ?ti1 ?ti2)))

;after=
;
(<= (after= ?ti1 ?ti2)
     (or (after ?ti1 ?ti2)
         (meets ?ti1 ?ti2)))

;during=
;
(<= (during= ?ti1 ?ti2)
     (or (during ?ti1 ?ti2)
         (starts ?ti1 ?ti2)
         (finishes ?ti1 ?ti2)
         (equals ?ti1 ?ti2)))


;overlaps=
;
(<= (overlaps= ?ti1 ?ti2)
     (or (overlaps ?ti1 ?ti2)
         (meets ?ti1 ?ti2)))


;start=
;
(<= (start= ?ti1 ?ti2)
     (or (starts ?ti1 ?ti2)
         (equals ?ti1 ?ti2)))



;finishes=
;
(<= (finishes= ?ti1 ?ti2)
     (or (finishes ?ti1 ?ti2)
         (equals ?ti1 ?ti2)))


;    "time ranges ?tr1 and ?tr2 do not overlap"
;
(<= (disjoint-tr ?ti1 ?ti2)
     (or (before ?ti1 ?ti2)
         (before ?ti2 ?ti1)))



;;We define t-interval-exact in terms of time-point-exact

;;a time interval-exact is a relation between 2 time-exact points 
(<= (t-interval-exact ?ti)
    (and (= ?ti (t-interval-exact ?tp1 ?tp2))
         (time-exact ?tp1)
         (time-exact ?tp2)
         (tp> ?tp1 ?tp2)))


;accessor functions for time-interval-exact
;
(<= (t-interval-exact.limits ?ti ?start ?end)
    (= ?ti (t-interval-exact ?start ?end)))

(<= (t-interval-exact.start ?ti ?start)
    (= ?ti (t-interval-exact ?start ?end)))

(<= (t-interval-exact.end ?ti ?end)
    (= ?ti (t-interval-exact ?start ?end)))

;;the start of a time 
(<= (= (from ?t1) ?start)
    (and (time ?t1)
         (time.limits ?start ?end))

(<= (= (to ?t1) ?start)
    (and (time ?t1)
         (time.limits ?start ?end)))

(<= (= (through ?t1) ?end)
    (and (time ?t1)
         (time.limits ?start ?end)))

;;These 2 rules are unnecessary but are provided for clarity. 
;;
(<= (= (t-interval-exact (from ?t1) (to ?t2)) (t-interval-exact ?time-exact1 ?time-exact2))
    (and (= ?time-exact1 (from ?t1))
         (= ?time-exact2 (to ?t2))))

(<= (= (t-interval-exact (from ?t1) (through ?t2)) (t-interval-exact ?start ?end))
    (and (= ?start (from ?t1))
         (= ?end (through ?t2))))
   


;    "Ti+ denotes a t-interval-exact ?ti2 whose length is longer that ?ti1 by
;     a duration ?duration."
;

(<= (= (tie+ ?ti1 ?duration) (t-interval-exact ?tp1 ?tp3))
    (and  (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.end-time ?ti1) ?tp2)
          (= (tp+ ?tp2 ?duration) ?tp3))) 


;
;    "t-interval-exact.duration denotes a duration of a time interval ti."
;  
;
(<= (=  (t-interval-exact.duration ?ti) ?duration)
    (and (= (t-interval-exact.end-time ?ti) ?tp2)
         (= (t-interval-exact.start-time ?ti) ?tp1)
         (= (tp- ?tp2 ?tp1) ?duration)))


;
;"The difference between two time-points is a duration.  
;Time point1 must have occured
;after tp2.  This is a specification and not a complete procedure."
;
(<= (= (TP- ?tp1  ?tp2) (duration @terms))
    (and (time-exact ?tp1)
	 (time-exact ?tp2)
         (tp> ?tp1 ?tp2)))

;
;this also is an incomplete definition
;
(<= (= (tp+ ?tp2 ?duration) ?tp3)
    (and (time-exact ?tp2)
         (duration ?duration)))
         
         
;;Note the interval-exact are very similiar to the interval relations:
;;
;;Basic interval-exact relations the first 11 relations are mutually exclusive
;
;
;    "a time interval-exact ?ti1 preceeds a interval-exact  ?ti2."		 
;
(<=> (before ?ti1 ?ti2)
     (and  (t-interval-exact ?ti1)
           (t-interval-exact ?ti2)
           (= (t-interval-exact.end-time ?ti1) ?tp1)
           (= (t-interval-exact.start-time ?ti2) ?tp2)
           (tp< ?tp1 ?tp2)))

;
;    "a time interval-exact ?ti1 succeeds a time interval-exact ?ti2."
;
(<=> (after ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.end-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (tp< ?tp1 ?tp2)))

;    "a time interval-exact ?ti1 is identical to a time interval-exact ?ti2."		 
;
(<=> (equals ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
          (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp= ?tp3 ?tp4)
          (tp= ?tp1 ?tp2)))


;
;    "a time interval-exact ?ti1 ends at the same time a time interval-exact ?ti2 starts."
;
(<=> (meets ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.end-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (tp= ?tp1 ?tp2)))

;
;    "a time interval-exact ?tr1 ends at the same time a time interval-exact ?ti2 starts."
;
(<=> (meets ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.end-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (tp= ?tp1 ?tp2)))

;
; "a time interval-exact ?ti1 starts from the end of time interval-exact ?ti2"
;
(<=> (from ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.end-time ?ti2) ?tp2)
          (= (t-interval-exact.start-time ?ti1) ?tp)
          (tp= ?tp1 ?tp2)))

;
;    "a time interval-exact ?ti1 is properly included in a time interval-exact ?ti2."
;
(<=> (during ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2) 
          (= (t-interval-exact.end-time ?ti1) ?tp3)
          (= (t-interval-exact.end-time ?ti2) ?tp4)     
          (tp> ?tp1 ?tp2)
          (tp< ?tp3 ?tp4)))





;;

(<=> (contains ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2) 
          (= (t-interval-exact.end-time ?ti1) ?tp3)
          (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp> ?tp2 ?tp1)
          (tp< ?tp4 ?tp3))) 



;
; "a time interval-exact ?ti1 leads ?ti2 when ?ti1 starts before ?ti2 but ends
;  after ?ti2 start and before ?ti2 end"
;
;
(<=> (leads ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
          (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp< ?tp3 ?tp4)
          (tp< ?tp1 ?tp2)
          (tp> ?tp3 ?tp2)))
         
; "a time interval-exact ?ti1 lags ?ti2 when ?ti1 starts after ?ti2 but ends
;  before ?ti2 end and after ?ti2 start"
;
(<=> (lags ?ti1 ?ti2)
     (and (t-interval-exact ?ti1) 
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
          (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp> ?tp1 ?tp2)
          (tp< ?tp1 ?tp4)
          (tp> ?tp3 ?tp4)))
          

;
;    "a time interval-exact ?ti1 and a time interval-exact ?ti2 starts at the same time
;and a duration of ?ti1 is shorter than that of ?ti2."
;
(<=> (starts ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
	  (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp= ?tp1 ?tp2)
          (tp< ?tp3 ?tp4))) 

;
;    "a time interval-exact ?ti1 and a time interval-exact ?ti2 starts at the same time
;and a duration of ?ti1 is shorter than that of ?ti2."
;
(<=> (starts ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
          (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
	  (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp= ?tp1 ?tp2)
          (tp< ?tp3 ?tp4))) 




;    "a time interval-exact ?ti1 and a time interval-interval ?ti2 ends at the same time and
;a duration of ?ti1 is shorter than that of ?ti2."
;		       
;

(<=> (finishes ?ti1 ?ti2)
     (and (t-interval-exact ?ti1)
          (t-interval-exact ?ti2)
          (= (t-interval-exact.start-time ?ti1) ?tp1)
	  (= (t-interval-exact.start-time ?ti2) ?tp2)
          (= (t-interval-exact.end-time ?ti1) ?tp3)
	  (= (t-interval-exact.end-time ?ti2) ?tp4)
          (tp> ?tp1 ?tp2)
          (tp= ?tp3 ?tp4)))

;an lt-point predicate
;
(<= (time-exact ?tp)
    (= ?tp (time-exact ?year @terms)))


;
;"The difference between two time-exacts is a duration.  
;Time point1 must have occured
;after tp2.  This is a specification and not a complete procedure."
;
(<= (= (TP- ?tp1  ?tp2) (duration @terms))
    (and (time-exact ?tp1)
	 (time-exact ?tp2)
         (tp> ?tp1 ?tp2)))

;
;this also is an incomplete definition
;
(<= (= (tp+ ?tp2 ?duration) ?tp3)
    (and (time-exact ?tp2)
         (duration ?duration)))
 
;the procedure is not defined here however, tp< means that a point        
;tp1 must occur before a point tp2.  Since, lt-points have infinite
;granularity, there is no ambiguity in any comparison
(<= (tp< ?tp1 ?tp2)         
    (and (time-exact ?tp1)
         (time-exact ?tp2)))

(<= (tp= ?tp1 ?tp2)
    (and (time-exact ?tp1)
         (time-exact ?tp2)))

(<= (tp> ?tp1 ?tp2)
    (tp< ?tp2 ?tp1))

       
;
; "YEAR-NUMBER deontes a year of A.D."
;
(<= (year-number ?year)
    (integer ?year))

;
;"MONTH-NUMBER denotes a month of a year."
;
(<= (month-number ?month-number)
    (and (integer ?month-number)
         (>= ?month-number 1)
         (<= ?month-number 12)))


;
;
;"MONTH-NAME denotes a name of a month of a year."
;(<= (month-name ?month)
;    (member ?month
;       (setof january february march april may june july
;       august september october november december)))
;

;"DAY-NUMBER denotes a day of a month."
(<=  (day-number ?d)
     (and (>= ?day 1)
          (=< ?day 31)))


;"DAY-NAME denotes a name of a day of a week."
;(<= (day-name ?day) 
;    (member ?day (setof sunday monday tuesday wednesday thursday
;		friday saturday)))

;
;"HOUR-NUMBER denotes an hour of a day."
;
(<= (hour-number ?hour-number)
		    (>= ?hour-number 0)
		    (=< ?hour-number 23))



;"MINUTE-NUMBER denotes a minute of a hour."
(<= (minute-number ?minute-number)
		    (>= ?minute-number 0)
		    (=< ?minute-number 59))    


;"SECOND-NUMBER denotes a second of a minute."
(<= (second-number ?second-number)
		    (>= ?second-number 0)
		    (=< ?second-number 59))    


;;
;; Definitions related to DURATION
;;

;
;a duration can be specified just like a t-unit
;
(<= (duration ?x)
    (= ?x (listof @terms)))

    



;"Two durations have the same length."
;
(<= (DR= ?dr1 ?dr2) 
    (and (duration ?dr1)
         (duration ?dr2)))

;"A duration ?dr1 is shorter than a duration ?dr2."
;
(<= (DR< ?dr1 ?dr2)
    (and (duration ?dr1)
	 (duration ?dr2)))

(<= (DR> ?dr1 ?dr2)
    (dr< ?dr2 ?dr1))

(<= (= (DR+ ?dr1 ?dr2) ?dr3)
       (and (duration ?dr1)
	    (duration ?dr2)
	    (duration ?dr3)))

;;
;; Definitions related to TEMPORAL-MEASURE
;;

;
;"TEMPORAL-MEASURE denotes a measure of a length of a temporal
;interval." 
;(<= (TEMPORAL-MEASURE ?measure)
;    (member ?measure (setof year month week day hour minute second)))


(temporal-measure second)
(temporal-measure minute)
(temporal-measure hour)
(temporal-measure day)
(temporal-measure month)
(temporal-measure year)