Modified lines:  43, 44, 45, 46, 47, 48, 60, 61, 65, 66
Added line:  45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 74, 75, 81, 82, 83, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218
Removed line:  37, 38, 39, 40, 72, 73, 74, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
Generated by diff2html
© Yves Bailly, MandrakeSoft S.A. 2001
diff2html is licensed under the GNU GPL.

  support-v1/time.lisp       support-v2.1/time.lisp
  106 lines
3437 bytes
Last modified : Wed Jun 29 13:31:51 2005

      229 lines
6454 bytes
Last modified : Wed Jun 29 13:32:46 2005

1 ;;; Mode: Lisp; Package: ocml     1 ;;; Mode: Lisp; Package: ocml
2     2
3 ;;; The Open University     3 ;;; The Open University
4     4
5 (in-package "OCML")     5 (in-package "OCML")
6     6
7 ;;;A minimalist set of time-related definitions.     7 ;;;A minimalist set of time-related definitions.
8 ;;;We may want to extend this in the future     8 ;;;We may want to extend this in the future
9     9
10 (in-ontology akt-support-ontology)     10 (in-ontology akt-support-ontology)
11     11
12 (def-class YEAR-IN-TIME (integer) ?x     12 (def-class YEAR-IN-TIME (integer) ?x
13 "A year-in-time must be an integer and integer can be a year-in-time"     13 "A year-in-time must be an integer and integer can be a year-in-time"
14 :iff-def (integer ?x)     14 :iff-def (integer ?x)
15         :avoid-infinite-loop t)     15         :avoid-infinite-loop t)
16     16
17 (def-class MONTH-IN-TIME (positive-integer)?x     17 (def-class MONTH-IN-TIME (positive-integer)?x
18 "A month-in-time is an integer in the interval 1-12"     18 "A month-in-time is an integer in the interval 1-12"
19 :iff-def (and (positive-integer ?x)(< ?x 13) )     19 :iff-def (and (positive-integer ?x)(< ?x 13) )
20         :avoid-infinite-loop t)     20         :avoid-infinite-loop t)
21     21
22 (def-class DAY-IN-TIME (positive-integer)?x     22 (def-class DAY-IN-TIME (positive-integer)?x
23 "A day-in-time is an integer in the interval 1-31"     23 "A day-in-time is an integer in the interval 1-31"
24 :iff-def (and (positive-integer ?x)(< ?x 32) )     24 :iff-def (and (positive-integer ?x)(< ?x 32) )
25         :avoid-infinite-loop t)     25         :avoid-infinite-loop t)
26     26
27 (def-class HOUR-IN-TIME (non-negative-integer)?x     27 (def-class HOUR-IN-TIME (non-negative-integer)?x
28 "A hour-in-time is an integer in the interval 0-23"     28 "A hour-in-time is an integer in the interval 0-23"
29 :iff-def (and (non-negative-integer ?x)(< ?x 24) )     29 :iff-def (and (non-negative-integer ?x)(< ?x 24) )
30         :avoid-infinite-loop t)     30         :avoid-infinite-loop t)
31     31
32 (def-class MINUTE-IN-TIME (non-negative-integer) ?x     32 (def-class MINUTE-IN-TIME (non-negative-integer) ?x
33 "A minute-in-time is an integer in the interval 0-59"     33 "A minute-in-time is an integer in the interval 0-59"
34 :iff-def (and (non-negative-integer ?x)(< ?x 60) )     34 :iff-def (and (non-negative-integer ?x)(< ?x 60) )
35         :avoid-infinite-loop t)     35         :avoid-infinite-loop t)
36     36
37 (def-class SECOND-IN-TIME (non-negative-integer)?x   3d)    
38 "A second-in-time is an integer in the interval 0-59"        
39 :iff-def (and (non-negative-integer ?x)(< ?x 60) )        
40         :avoid-infinite-loop t)        
41     37
42     38
43 (def-class TIME-ENTITY (intangible-thing)   3e) 39 (def-class SECOND-IN-TIME (real-number)?x
44   "WARNING: The constraint below ought to be extended to handle leap years.     40   "A second-in-time is a real number greater or equal to 0, less than 60"
45    We use this generic notion of time entity which subsumes both time intervals     41   :iff-def (and (real-number ?x)(not (< ?x 0))(< ?x 60))
46    and time points"     42   :avoid-infinite-loop t)
47   ((minute-of :type minute-in-time :max-cardinality 1 )     43
48    (second-of :type second-in-time :max-cardinality 1 )     44
      1 45 (def-class TIME-POSITION (intangible-thing)
        46   "A time position is either a time interval or a time point.
        47    Any time position is relative to a time zone"
        48   ((in-timezone :default-value "+00:00" :type timezone)))
        49
      1 50 (def-class TIMEZONE (string)
        51   "We represent a time zone as a string with the format
        52    {-/+}hh:mm ")
        53
        54
        55
        56
      1 57 (def-class TIME-POINT (time-position)
        58   "A point in time"
        59   ((second-of :type second-in-time :max-cardinality 1 )
        60    (minute-of :type minute-in-time :max-cardinality 1 )
49    (hour-of :type hour-in-time :max-cardinality 1 )   3d) 61    (hour-of :type hour-in-time :max-cardinality 1 )
50    (day-of :type day-in-time :max-cardinality 1)     62    (day-of :type day-in-time :max-cardinality 1)
51    (month-of :type month-in-time :max-cardinality 1)     63    (month-of :type month-in-time :max-cardinality 1)
52    (year-of :type year-in-time :max-cardinality 1 ))     64    (year-of :type year-in-time :max-cardinality 1 ))
53   :constraint (and (not (and (month-of ?x 2)     65   :constraint (and (not (and (month-of ?x 2)
54                              (> (the ?day (day-of ?x ?day))     66                              (> (the ?day (day-of ?x ?day))
55                                 29)))     67                                 29)))
56                     (not (and (member-of ?x (4 6 9 11))     68                     (not (and (member-of ?x (4 6 9 11))
57                               (> (the ?day (day-of ?x ?day))     69                               (> (the ?day (day-of ?x ?day))
58                                 30)))))     70                                 30)))))
59     71
60 (def-class TIME-POINT (time-entity)     72
61   "A point in time")     73
        74
        75
62     76
63 (def-class CALENDAR-DATE (time-point)     77 (def-class CALENDAR-DATE (time-point)
64  "A calendar date is a time point in which month, day and year have     78  "A calendar date is a time point in which month, day and year have
65   been specified"     79   been specified but hour, minute and second have not"
66   ((day-of :type day-in-time :cardinality 1)     80   ((minute-of :type minute-in-time :max-cardinality 0 )
      3d) 81    (second-of :type second-in-time :max-cardinality 0 )
        82    (hour-of :type hour-in-time :max-cardinality 0 )
        83    (day-of :type day-in-time :cardinality 1)
67    (month-of :type month-in-time :cardinality 1)     84    (month-of :type month-in-time :cardinality 1)
68    (year-of :type year-in-time :cardinality 1)))     85    (year-of :type year-in-time :cardinality 1)))
69     86
70     87
71     88
72 (def-class TIME-INTERVAL (time-entity)   2    
73   "An interval of time - e.g., 6 hours, 5 days, or '6 hours and 5 minutes'.        
74    We use the same structure as a time point to express intervals")        
75     89
        90 (def-class TIME-INTERVAL (time-position)
        91   "An interval is defined by two time points or a duration.
        92    Classes of intervals, e.g., a day, can be defined by specifying only
        93    a duration. A time interval has no gaps"
        94
      3d) 95   ((begins-at-time-point :type time-point :max-cardinality 1)
        96    (ends-at-time-point :type time-point :max-cardinality 1)
        97    (has-duration :type duration :max-cardinality 1)))
        98
      1 99 (def-class DAY (time-interval)
      3d) 100   ((has-duration :value 24-hour-duration)))
        101
      1 102 (def-class WEEK (time-interval)
      3d) 103   ((has-duration :value 7-day-duration)))
        104
      1 105 (def-class MONTH (time-interval))
        106
      1 107 (def-class JANUARY (month)
      3d) 108   ((has-duration :value 31-day-duration)))
        109
      1 110 (def-class FEBRUARY (month)
      3d) 111   ((has-duration :default-value 28-day-duration)))
        112
      1 113 (def-class FEBRUARY-IN-LEAP-YEARS (february)
      3d) 114   ((has-duration :value 29-day-duration)))
        115
        116
      1 117 (def-class MARCH (month)
      3d) 118   ((has-duration :value 31-day-duration)))
        119
      1 120 (def-class APRIL (month)
      3d) 121   ((has-duration :value 30-day-duration)))
        122
      1 123 (def-class MAY (month)
      3d) 124   ((has-duration :value 31-day-duration)))
        125
      1 126 (def-class JUNE (month)
      3d) 127   ((has-duration :value 30-day-duration)))
        128
      1 129 (def-class JULY (month)
      3d) 130   ((has-duration :value 31-day-duration)))
        131
      1 132 (def-class AUGUST (month)
      3d) 133   ((has-duration :value 31-day-duration)))
        134
      1 135 (def-class SEPTEMBER (month)
      3d) 136   ((has-duration :value 30-day-duration)))
        137
      1 138 (def-class OCTOBER (month)
      3d) 139   ((has-duration :value 31-day-duration)))
        140
      1 141 (def-class NOVEMBER (month)
      3d) 142   ((has-duration :value 30-day-duration)))
        143
      1 144 (def-class DECEMBER (month)
      3d) 145   ((has-duration :value 31-day-duration)))
        146
      1 147 (def-class YEAR (time-interval)
      3d) 148   ((has-duration :value 12-month-duration)))
        149
      1 150 (def-class DURATION (physical-quantity)
      3c) 151   "A measure of time, e.g., 5 hours"
      3d) 152   ((has-unit-of-measure :type time-measure)
        153    ))
        154
      1 155 (def-instance 24-HOUR-DURATION duration
      3d) 156   ((has-unit-of-measure time-measure-hour)
        157    (has-magnitude 24)))
        158
      1 159 (def-instance 7-DAY-DURATION duration
      3d) 160   ((has-unit-of-measure time-measure-day)
        161    (has-magnitude 7)))
        162
      1 163 (def-instance 28-DAY-DURATION duration
      3d) 164   ((has-unit-of-measure time-measure-day)
        165    (has-magnitude 28)))
        166
      1 167 (def-instance 29-DAY-DURATION duration
      3d) 168   ((has-unit-of-measure time-measure-day)
        169    (has-magnitude 29)))
        170
      1 171 (def-instance 30-DAY-DURATION duration
      3d) 172   ((has-unit-of-measure time-measure-day)
        173    (has-magnitude 30)))
        174
      1 175 (def-instance 31-DAY-DURATION duration
      3d) 176   ((has-unit-of-measure time-measure-day)
        177    (has-magnitude 31)))
        178
      1 179 (def-instance 12-MONTH-DURATION duration
      3d) 180   ((has-unit-of-measure time-measure-year)
        181    (has-magnitude 12)))
        182
      1 183 (def-class TIME-MEASURE (unit-of-measure)
      3c) 184   "The class of all unit of measures used to measure time,
        185    e.g., minute, second, hour, etc...")
        186
      1 187 (def-instance TIME-MEASURE-SECOND time-measure)
        188
      1 189 (def-instance TIME-MEASURE-MINUTE time-measure)
        190
      1 191 (def-instance TIME-MEASURE-HOUR time-measure)
        192
      1 193 (def-instance TIME-MEASURE-DAY time-measure)
        194
      1 195 (def-instance TIME-MEASURE-MONTH time-measure)
        196
      1 197 (def-instance TIME-MEASURE-YEAR time-measure)
        198
      1 199 (def-instance TIME-MEASURE-CENTURY time-measure)
        200
        201
      3b) 202 (def-axiom DURATION-IS-BEGIN-TIME-MINUS-END-TIME
        203   "This axiom states the relation between duration, begin time
        204    and end time in an interval"
        205   (=> (and (time-interval ?x)
        206            (begins-at-time-point ?x ?tp1)
        207            (ends-at-time-point ?x ?tp2))
        208       (= (has-duration ?x (time-difference
        209                            (the ?tp1 (begins-at-time-point ?x ?tp1))
        210                            (the ?tp2 (ends-at-time-point ?x ?tp2)))))))
        211
        212
      3d) 213 (def-function TIME-DIFFERENCE (?tp1 ?tp2) -> ?d
        214   "The duration between two time points.
        215    No operational definition is given here, only a spec"
        216   :def (and (time-point ?tp1)
        217             (time-point ?tp2)
        218             (duration ?d)))
76     219
77     220
78 (def-class TEMPORAL-THING (thing)   3e)    
79   "Like in Cyc, this is something which has a temporal extent."        
80   ((has-duration :type time-interval)        
81    (has-start-time :type time-point)        
82    (has-end-time :type time-point)))        
83        
84        
85 (def-axiom DURATION-IS-START-TIME-MINUS-END-TIME   3e)    
86   "This axiom states the relation between duration, start time        
87    and end time in a temporal thing"        
88   (=> (temporal-thing ?x)        
89       (= (the ?duration (has-duration ?x ?duration))        
90          (time-difference (the ?et (has-end-time ?x ?et))        
91                           (the ?st (has-start-time ?x ?st))))))        
92        
93 (def-function TIME-DIFFERENCE (?te1 ?te2) -> ?ti        
94   "The interval between two time entities."        
95   :def (and (time-entity ?te1)        
96             (time-entity ?te2)        
97             (time-interval ?ti)))        
98     221
99     222
100     223
101     224
102     225
103     226
104     227
105     228
106     229

Generated by diff2html on Wed Jun 29 13:51:00 2005
Command-line:
./diff2html support-v1/time.lisp support-v2.1/time.lisp