comptransform(sentlist,sentlist,sentlist,factset,ruleset) → boolean
The subroutine comptransform takes as arguments a list of sentences (the conditions), two lists of atoms (the additions and the deletions), a dataset, and a ruleset. It computes all instances of the conditions that can be derived using the facts in the dataset and the rules in the ruleset. For each of these instances, it deletes from the dataset the corresponding instances of the deletions. Then, for each of the computed instances, it adds the corresponding instances of the additions.
Call: definefacts(repository,readdata('p(a,b) p(b,c) p(c,d)'))
Exit: ...
Call: comptransform([['p','X','Y']],[['p','Y','X']],[['p','X','Y']],repository,[])
Exit: true
Call: grindem(repository)
Exit: p(b,a) p(c,b) p(d,c)
Call: comptransform([],[['p','a','b']],[['p','b','a']],repository,[])
Exit: true
Call: grindem(repository)
Exit: p(a,b) p(c,b) p(d,c)
Note that the condition, addition, and deletion instances are computed before any changes are made. Hence, performing additions and deletions does not change which additions and deletions are made. Ideally, there should be no overlap between additions and deletions. However, deletions are performed first and additions are performed second. Consequently, in the event of overlaps, the additions prevail.
|