%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Simulate a simple workflow. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The simulate transaction creates and executes a workflow instance % for every work item, W. % simulate :- getItem(W) * (workflow(W) # simulate). simulate :- finished. % Work items are stored in the predicate source/1. % getItem(W) :- del(source(W)). % The transaction workflow(W) applies the workflow to work item W. % The workflow itself is a sequence of three tasks. % workflow(W) :- task(W,1) * task(W,2) * task(W,3). % Transaction task(I,W) applies task I to work item W. Since this is % a simulation, the task does nothing but monitor its own execution. % task(I,W) :- monitor(task(I,W)). % Create some work items. % load1 :- ins(source(a)). load2 :- ins(source(a)) * ins(source(b)). load3 :- ins(source(a)) * ins(source(b)) * ins(source(c)) * ins(source(d)) * ins(source(e)) * ins(source(f)) * ins(source(g)) * ins(source(h)) * ins(source(i)) * ins(source(j)).