This is probably a very stupid question (I just started studying Prolog a few hours ago), but is it possible to find all the sentences related to the atom? For example, assuming the following knowledge base:
cat(tom).
animal(X) :- cat(X).
Is there any way to get all the possible information about that (or at least all the facts that are explicitly indicated in the database)? I understand that such a request is not possible:
?- Pred(tom).
so I thought I could write a rule that displays the correct information:
meta(Object, Predicate) :-
Goal =.. [Predicate, Object],
call(Goal).
so that I can write queries like
?- meta(tom, Predicate).
but this does not work because the arguments are callnot sufficiently instantiated. So basically my question is: is this possible, or is Prolog not developing this information? And if this is not possible, why?
source
share