
% The parent transaction illustrates partial rollback.  It is modelled
% on Example 3 in my DBPL'97 paper.  Before executing parent, be sure
% that p(b) is in the database, and p(a) is not.

trans(parent) :- seq(task(1),choose).

trans(choose) :- seq(task(2),p(a)).

trans(choose) :- seq(task(3),p(b)).

trans(task(I)) :- monitor(task(I)).


% Declare p/1 to be a base predicate.
%
p(X) :- db(p(X)).


% These dummy rules tell Prolog that certain predicates are defined.
%
parent :- fail.
choose :- fail.
task(dummy) :- fail.



% This rule tests the above program.
%
test :- execute(seq(ins(p(b)),parent)).
