% % This program demonstrates the use of predicates defined in % time.pl. To run this program, type "go." % % On each line output by this program, the string in "[ ]" indicates % the expected answer returned by the reasoner, and the string printed % out after the "?" is the result returned by the reasoner. The % reasoner works correct if both strings have the same value.. % % License & documentation: http://cobra.umbc.edu/time/ % % author: Harry Chen (harry.chen@umbc.edu, http://umbc.edu/~hchen4") % cvs: $Revision: 1.1 $, $Date: 2003/12/10 21:32:22 $ % :- ensure_loaded('time'). go :- NewYear03 = '2003-01-01T00:00:00', XMas03 = '2003-12-25T00:00:00', HCBDay03 = '2003-12-26T00:00:00', GGBDay03 = '2003-11-25T00:00:00', ThanksGiving03 = '2003-11-27T00:00:00', TGDinner03_B = '2003-11-27T06:30:00', TGDinner03_E = '2003-11-28T00:33:00', BadDay1 = '2003---------------', BadDay2 = '2003T11-12T00:24:99', test_instant([NewYear03],yes), test_instant([ThanksGiving03],yes), test_instant([XMas03],yes), test_instant([BadDay1],no), test_instant([BadDay2],no), test_interval([NewYear03,XMas03],yes), test_interval([TGDinner03_B,TGDinner03_E],yes), test_interval([ThanksGiving03,XMas03],yes), test_proper_interval([NewYear03,XMas03],yes), test_proper_interval([TGDinner03_B,TGDinner03_E],yes), test_proper_interval([ThanksGiving03,XMas03],yes), test_proper_interval([XMas03,ThanksGiving03],no), test_proper_interval([XMas03,XMas03],no), test_begins([NewYear03],[NewYear03],yes), test_begins([NewYear03],[NewYear03,XMas03],yes), test_ends([NewYear03],[NewYear03,XMas03],no), test_ends([XMas03],[NewYear03,XMas03],yes), test_before([NewYear03],[XMas03],yes), test_before([NewYear03],[TGDinner03_B,TGDinner03_E],yes), test_before([GGBDay03,ThanksGiving03],[XMas03],yes), test_before([GGBDay03,XMas03],[ThanksGiving03],no), test_before([GGBDay03,ThanksGiving03],[XMas03,HCBDay03],yes), test_before([GGBDay03,HCBDay03],[ThanksGiving03,XMas03],no), test_after([NewYear03],[XMas03],no), test_after([NewYear03],[TGDinner03_B,TGDinner03_E],no), test_after([GGBDay03,ThanksGiving03],[XMas03],no), test_after([GGBDay03,XMas03],[ThanksGiving03],no), test_after([GGBDay03,ThanksGiving03],[XMas03,HCBDay03],no), test_after([GGBDay03,HCBDay03],[ThanksGiving03,XMas03],no), test_after([ThanksGiving03,HCBDay03],[NewYear03,GGBDay03],yes), test_inside([GGBDay03],[NewYear03,XMas03],yes), test_inside([NewYear03],[NewYear03,XMas03],no), test_inside([ThanksGiving03,HCBDay03],[NewYear03,GGBDay03],no), test_begins_or_in([GGBDay03],[NewYear03,XMas03],yes), test_begins_or_in([NewYear03],[NewYear03,XMas03],yes), test_begins_or_in([ThanksGiving03,HCBDay03],[NewYear03,GGBDay03],no), test_time_between([NewYear03,XMas03],[NewYear03],[XMas03],yes), test_time_between([NewYear03,XMas03],[HCBDay03],[XMas03],no), test_time_between([ThanksGiving03,HCBDay03],[NewYear03],[GGBDay03],no), test_int_equals([ThanksGiving03,HCBDay03],[NewYear03,GGBDay03],no), test_int_equals([ThanksGiving03,HCBDay03],[ThanksGiving03,HCBDay03], yes), test_int_before([NewYear03,GGBDay03],[ThanksGiving03,HCBDay03],yes), test_int_after([NewYear03,GGBDay03],[ThanksGiving03,HCBDay03],no), test_int_meets([ThanksGiving03,HCBDay03],[HCBDay03,HCBDay03],no), test_int_meets([ThanksGiving03,XMas03],[XMas03,HCBDay03],yes), test_int_met_by([XMas03,HCBDay03],[ThanksGiving03,XMas03], yes), test_int_overlaps([NewYear03,XMas03],[GGBDay03,HCBDay03],yes), test_int_overlapped_by([GGBDay03,HCBDay03],[NewYear03,XMas03],yes), test_int_overlapped_by([NewYear03,XMas03],[GGBDay03,HCBDay03],no), test_int_starts([NewYear03,GGBDay03],[NewYear03,XMas03],yes), test_int_started_by([NewYear03,XMas03],[NewYear03,GGBDay03],yes), test_int_started_by([NewYear03,GGBDay03],[NewYear03,XMas03],no), test_int_during([GGBDay03,XMas03],[NewYear03,HCBDay03],yes), test_int_during([NewYear03,HCBDay03],[GGBDay03,XMas03],no), test_int_contains([NewYear03,HCBDay03],[GGBDay03,XMas03],yes), test_int_contains([NewYear03,HCBDay03],[NewYear03,XMas03],no), test_int_finishes([NewYear03,GGBDay03],[NewYear03,GGBDay03],no), test_int_finishes([GGBDay03,ThanksGiving03],[NewYear03,ThanksGiving03], yes), test_int_finished_by([NewYear03,XMas03],[XMas03,HCBDay03],no), test_int_finished_by([NewYear03,XMas03],[GGBDay03,XMas03],yes), test_starts_or_during([TGDinner03_B,TGDinner03_E], [NewYear03,XMas03],yes), test_starts_or_during([NewYear03,TGDinner03_E], [NewYear03,XMas03],yes), test_starts_or_during([NewYear03,HCBDay03], [NewYear03,XMas03],no), test_nonoverlap([NewYear03,HCBDay03],[NewYear03,XMas03],no), test_nonoverlap([NewYear03,GGBDay03],[XMas03,HCBDay03],yes). do_test(Goal) :- call(Goal), writef(" yes.\n"). do_test(Goal) :- not(call(Goal)), writef(" no.\n"). test_instant(X,ExpAns) :- writef('Is %w an instant [%w]? ',[X,ExpAns]), do_test(instant(X)). test_interval(X,ExpAns) :- writef('Is %w an interval [%w]? ',[X,ExpAns]), do_test(interval(X)). test_begins(X,Y,ExpAns) :- writef('%w begins %w true [%w]? ',[X,Y,ExpAns]), do_test(begins(X,Y)). test_ends(X,Y,ExpAns) :- writef('%w ends %w true [%w]? ',[X,Y,ExpAns]), do_test(ends(X,Y)). test_before(X,Y,ExpAns) :- writef('Is %w before %w [%w]? ',[X,Y,ExpAns]), do_test(before(X,Y)). test_after(X,Y,ExpAns) :- writef('Is %w after %w [%w]? ',[X,Y,ExpAns]), do_test(after(X,Y)). test_inside(X,Y,ExpAns) :- writef('Is %w inside of %w [%w]? ',[X,Y,ExpAns]), do_test(inside(X,Y)). test_begins_or_in(X,Y,ExpAns) :- writef('Is %w begins or in %w [%w]? ',[X,Y,ExpAns]), do_test(begins_or_in(X,Y)). test_time_between(X,Y1,Y2,ExpAns) :- writef('Is %w in between of %w, %w [%w]? ',[X,Y1,Y2,ExpAns]), do_test(time_between(X,Y1,Y2)). test_proper_interval(X,ExpAns) :- writef('Is %w proper interval [%w]? ',[X,ExpAns]), do_test(proper_interval(X)). test_int_equals(X,Y,ExpAns) :- writef('Is %w int-equals %w [%w]? ',[X,Y,ExpAns]), do_test(int_equals(X,Y)). test_int_before(X,Y,ExpAns) :- writef('Is %w int-before %w [%w]? ',[X,Y,ExpAns]), do_test(int_before(X,Y)). test_int_after(X,Y,ExpAns) :- writef('Is %w int-after %w [%w]? ',[X,Y,ExpAns]), do_test(int_after(X,Y)). test_int_meets(X,Y,ExpAns) :- writef('Is %w int-meets %w [%w]? ',[X,Y,ExpAns]), do_test(int_meets(X,Y)). test_int_met_by(X,Y,ExpAns) :- writef('Is %w int-met-by %w [%w]? ',[X,Y,ExpAns]), do_test(int_met_by(X,Y)). test_int_overlaps(X,Y,ExpAns) :- writef('Is %w int-overlaps %w [%w]? ',[X,Y,ExpAns]), do_test(int_overlaps(X,Y)). test_int_overlapped_by(X,Y,ExpAns) :- writef('Is %w int-overlapped-by %w [%w]? ',[X,Y,ExpAns]), do_test(int_overlapped_by(X,Y)). test_int_starts(X,Y,ExpAns) :- writef('Is %w int-starts %w [%w]? ',[X,Y,ExpAns]), do_test(int_starts(X,Y)). test_int_started_by(X,Y,ExpAns) :- writef('Is %w int-started-by %w [%w]? ',[X,Y,ExpAns]), do_test(int_started_by(X,Y)). test_int_during(X,Y,ExpAns) :- writef('Is %w int-during %w [%w]? ',[X,Y,ExpAns]), do_test(int_during(X,Y)). test_int_contains(X,Y,ExpAns) :- writef('Is %w int-contains %w [%w]? ',[X,Y,ExpAns]), do_test(int_contains(X,Y)). test_int_finishes(X,Y,ExpAns) :- writef('Is %w int-finishes %w [%w]? ',[X,Y,ExpAns]), do_test(int_finishes(X,Y)). test_int_finished_by(X,Y,ExpAns) :- writef('Is %w int-finished-by %w [%w]? ',[X,Y,ExpAns]), do_test(int_finished_by(X,Y)). test_starts_or_during(X,Y,ExpAns) :- writef('Is %w int-starts-or-during %w [%w]? ',[X,Y,ExpAns]), do_test(starts_or_during(X,Y)). test_nonoverlap(X,Y,ExpAns) :- writef('Is %w int-nonoverlap %w [%w]? ',[X,Y,ExpAns]), do_test(nonoverlap(X,Y)).