EpilogJS
What
versus
How
 

basefindp


basefindp(sentence,dataset,ruleset) → boolean

The basefindp subroutine takes as arguments a sentence (called the query), a dataset, and a ruleset. It uses the facts in the dataset and the rules in the ruleset (and only those facts and rules) to derive an instance of the query. If it succeeds, it returns true; otherwise, it returns false.

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: basefindp(read('g(art,cal)'),repository,library) Exit: true Call: basefindp(read('g(X,Z)'),repository,library) Exit: true Call: basefindp(read(read('p(art,Y) & p(Y,cam)'),repository,library) Exit: true Call: basefindp(read('g(bob,art)'),repository,library) Exit: false

The basefindp subroutine differs from compfindp in that it does not use the definitions of predefined functions and relations (except for same and distinct. Otherwise, they are equivalent.




Comments and complaints to genesereth@stanford.edu.