28 lines
914 B
Plaintext
28 lines
914 B
Plaintext
%qsat(Q,R) :- qrow(Q,A,V), row(R,A,V), not qunsat(Q,R).
|
|
%qunsat(Q,R) :- qrow(Q,_,_), row(R,_,_), not qsat(Q,R).
|
|
%:- qsat(Q,R), qrow(Q,A,V), not row(R,A,V).
|
|
|
|
%qsat(I) :- qsat(I,_).
|
|
%:- qrow(I,G1,G2), not qsat(I).
|
|
|
|
|
|
%#show qunsat/2.
|
|
%#show qsat/2.
|
|
#show sat/0.
|
|
#show unsat/0.
|
|
|
|
% Querry Q is not satisfied by row R if :
|
|
% One attribute A1 match a part of the querry Q in the row R
|
|
% But another attribute A2 do not in the same row R
|
|
qunsat(Q,R) :- qrow(Q,A1,V1), row(R,A1,V1), qrow(Q,A2,V2), not row(R,A2,V2), A1 != A2.
|
|
% Querry Q is satisfied by row R if :
|
|
% Querry Q match an attribute A in the row R
|
|
% And thereare no attribute of the querry that do not match
|
|
% In other words there can not be qunsat(Q,R)
|
|
qsat(Q,R) :- qrow(Q,A,V), row(R,A,V), not qunsat(Q,R).
|
|
qsat(Q) :- qsat(Q,G1).
|
|
|
|
% If a particular querry Q is not satisfied then the whole is not
|
|
unsat() :- qrow(Q,G1,G2), not qsat(Q).
|
|
sat() :- not unsat().
|