pfcConjoin(true,X,X) :- !. pfcConjoin(X,true,X) :- !. pfcConjoin(C1,C2,(C1,C2)). % File : pfcdb.pl % Author : Tim Finin, finin@prc.unisys.com % Author : Dave Matuszek, dave@prc.unisys.com % Author : Dan Corpron % Updated: 10/11/87, ... % Purpose: predicates to manipulate a pfc database (e.g. save, % % restore, reset, etc.0 % pfcDatabaseTerm(P/A) is true iff P/A is something that pfc adds to % the database and should not be present in an empty pfc database pfcDatabaseTerm('$spft$'/3). pfcDatabaseTerm('$pt$'/2). pfcDatabaseTerm('$bt$'/2). pfcDatabaseTerm('$nt$'/3). pfcDatabaseTerm('==>'/2). pfcDatabaseTerm('<==>'/2). pfcDatabaseTerm('<-'/2). pfcDatabaseTerm(pfcQueue/1). % removes all forward chaining rules and justifications from db. pfcReset :- pfc_spft(P,F,Trigger), pfcRetractOrWarn(P), pfcRetractOrWarn('$spft$'(P,F,Trigger)), fail. pfcReset :- (pfcDatabaseItem(T)*-> (pfcError("Pfc database not empty after pfcReset, e.g., ~p.~n",[T]),fail) ; true). % true if there is some pfc crud still in the database. pfcDatabaseItem(Term:-Body) :- pfcDatabaseTerm(P/A), functor(Term,P,A), clause(Term,Body). pfcRetractOrWarn(X) :- retract(X), !. pfcRetractOrWarn(X) :- pfcWarn("Couldn't retract ~p.",[X]),nop((dumpST,pfcWarn("Couldn't retract ~p.",[X]))),!. pfcRetractOrQuietlyFail(X) :- retract(X), !. pfcRetractOrQuietlyFail(X) :- nop((pfcTraceMsg("Trace: Couldn't retract ~p.",[X]),nop((dumpST,pfcWarn("Couldn't retract ~p.",[X]))))), !,fail.