EpilogJS
What
versus
How
 

debugfindp


debugfindp(sentence,dataset,ruleset) → boolean

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

The subroutine debugfindp differs from compfindp in two ways. (1) It limits the depth of recursion based on the value of the global variable depth. (2) It allows the user to trace attempts to compute relations specified via the value of the variable traces (which can be modified directly or using the trace and untrace subroutines). Trace output is printed using the Javascript subroutine console.log.




Comments and complaints to genesereth@stanford.edu.