这样的事情可以帮助你开始
object_properties :-
object_properties(O, Ps),
query_user_loop(O, Ps).
query_user_loop(_, []).
query_user_loop(O, [P|Ps]) :-
write([object, O, has, P, ?]),
read(Answer),
( Answer == yes
-> query_user_loop(O, Ps)
).
object_properties(jackass, [comedy, -australian]).
object_properties(the_godfather, [drama, crime, -character_batman]).
这适用于简单的交互(请注意每个答案后的点):
9 ?- object_properties.
[object,jackass,has,comedy,?]yes.
[object,jackass,has,-australian,?]no.
[object,the_godfather,has,drama,?]yes.
[object,the_godfather,has,crime,?]yes.
[object,the_godfather,has,-character_batman,?]yes.
true