start of pip3
This commit is contained in:
7
pip3/1.db
Normal file
7
pip3/1.db
Normal file
@@ -0,0 +1,7 @@
|
||||
left(1,wine). left(1,year). right(1,quality).
|
||||
left(2,wine). left(2,year). right(2,price).
|
||||
row(10,wine,chablis). row(10,year,1995). row(10,quality,good). row(10,price,17).
|
||||
row(11,wine,chablis). row(11,year,1996). row(11,quality,excellent). row(11,price,23).
|
||||
row(12,wine,rothschild). row(12,year,1997). row(12,quality,good). row(12,price,29).
|
||||
row(13,wine,rothschild). row(13,year,1997). row(13,quality,excellent). row(13,price,29).
|
||||
row(14,wine,rothschild). row(14,year,1997). row(14,quality,bof). row(14,price,29).
|
||||
5
pip3/2.db
Normal file
5
pip3/2.db
Normal file
@@ -0,0 +1,5 @@
|
||||
left(3,course). right(3,prof).
|
||||
left(4,prof). left(4,hour). right(4,course).
|
||||
row(14,prof,tom). row(14,course,se). row(14,hour,8).
|
||||
row(15,prof,ann). row(15,course,se). row(15,hour,8).
|
||||
row(16,prof,ann). row(16,course,krr). row(16,hour,8).
|
||||
28
pip3/rep.lp
Normal file
28
pip3/rep.lp
Normal file
@@ -0,0 +1,28 @@
|
||||
%#show violate/3.
|
||||
#show reprowID/1.
|
||||
%#show unreprowID/1.
|
||||
|
||||
% I and J have a different value on the attribute A of functional dependecy F
|
||||
% For the left and right part
|
||||
diffRight(I,J,F) :- right(F,A), row(I,A,X), row(J,A,Y), X != Y.
|
||||
diffLeft(I,J,F) :- left(F,A), row(I,A,X), row(J,A,Y), X != Y.
|
||||
|
||||
% I and J conflict on functional dependecy F
|
||||
violate(I,J,F) :- diffRight(I,J,F), not diffLeft(I,J,F).
|
||||
|
||||
% Simple projection of the row identifers violated
|
||||
violated(I) :- violate(I,G1,G2).
|
||||
|
||||
% I is in the repair because it conflict with nothing
|
||||
reprowID(I) :- row(I,G1,G2), not violated(I).
|
||||
% I is in the repair because it conflict with J but it is not in it
|
||||
%reprowID(I) :- violated(I), violate(I,J,G), unreprowID(J).
|
||||
|
||||
% Choose a I that conflict but the other row must not be there
|
||||
reprowID(I) :- violated(I), not unreprowID(I).
|
||||
unreprowID(I) :- violated(I), not reprowID(I).
|
||||
:- violate(I,J,G), reprowID(I), reprowID(J).
|
||||
|
||||
% There mut be at least one row that remain for a violated functional dependecy F
|
||||
represented(F) :- reprowID(I), violate(I,G,F).
|
||||
:- left(F,G1), violate(G2,G3,F), not represented(F).
|
||||
Reference in New Issue
Block a user