%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  ENTITY-RELATIONSHIP-RELATIONAL TRANSFORMATION EXAMPLE
%  Author: Jesus Almendros and Luis Iribarne. March 2012.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



 

%(17) 
val:duplicate_col_name(Row) :- mmB:row(Row) and mmB:col(Row,Col1)
and mmB:col(Row,Col2) and
      mmB:name(Col1,Name1) and mmB:name(Col2,Name2) and
      differentFrom(Col1,Col2) and equal(Name1,Name2).

 
%(18) 
val:duplicate_foreign_name(Row) :- mmB:row(Row) and mmB:foreign(Row,Col1)
and mmB:foreign(Row,Col2) and
      mmB:name(Col1,Name1) and mmB:name(Col2,Name2) and
      differentFrom(Col1,Col2) and equal(Name1,Name2).
     
%(19) 
val:duplicate_key_name(Row) :- mmB:row(Row) and mmB:key(Row,Col1)
and mmB:key(Row,Col2) and
      mmB:name(Col1,Name1) and mmB:name(Col2,Name2) and
      differentFrom(Col1,Col2) and equal(Name1,Name2).
     
     
%(27)
val:duplicate_row_name(Row1) and duplicate_row_names(Row2):-
      mmB:row(Row1) and mmB:row(Row2) and differentFrom(Row1,Row2)
      and mmB:name(Row1,Name1) and mmB:name(Row2,Name2)
      and equal(Name1,Name2).
     
%(29)
val:bad_row_key_foreign(Row):- mmB:key(Row,_) and mmB:foreign(Row,_).
val:bad_row_col_foreign(Row):-mmB:col(Row,_) and mmB:foreign(Row,_).