compfinds(expression,sentence,factset,ruleset) → expressionlist

The compfinds subroutine takes as arguments an expression (called the aspect), a sentence (called the query), a dataset, and a ruleset. It uses the facts in the dataset and the rules in the ruleset (and the definitions of predefined functions and relations) to derive all instance of the query. It returns a list of all instances of the aspect for each query instance it finds; if it fails to derive any instances of the query, it returns [].

Call: definefacts(repository,readdata('p(art,bob) p(bob,cal) p(bob,cam)')) Exit: true Call: definerules(library,readdata('g(X,Z) :- p(X,Y) & p(Y,Z)')) Exit: true Call: compfinds('Z',read('g(art,Z)'),repository,library) Exit: [cal,cam] Call: compfinds('X',read('g(art,cal)'),repository,library) Exit: [art] Call: compfinds(read('answer(X,Z)'),read('g(X,Z)'),repository,library) Exit: [answer(art,cal), answer(art,cam)] Call: compfinds(read('answer(X,Z)'),read('p(X,Y) & p(Y,Z)'),repository,library) Exit: [answer(art,cal), answer(art,cam)] Call: compfinds('Z',read('g(bob,Z)'),repository,library) Exit: []

See related subroutines compfindp, compfindx, and compfindg.

Comments and complaints to genesereth@stanford.edu.