% prov(Country) refs country(code) on delete cascade del_province(PN,C,PPop,PA,PCap,PCapProv) :- del_country(N,C,Cap,CapP,A,P), province(PN,C,PPop,PA,PCap,PCapProv). % city(Country) refs country(code) on delete set null upd_city(CN,C,CP,CPop,Long,Lat,El,CN,null,CP,CPop,Long,Lat,El) :- del_country(N,C,Cap,CapP,A,P), city(CN,C,CP,CPop,Long,Lat,El). % city(Country,Province) refs province(name,country) on delete cascade del_city(CN,C,PN,CPop,Long,Lat,El) :- del_province(PN,C,PPop,PA,PCap,PCapProv), city(CN,C,PN,CPop,Long,Lat,El). inconsistent :- del_city(CN,C,CP,CPop,Long,Lat,El), upd_city(CN,C,CP,CPop,Long,Lat,El,CN2,C2,CP2,CPop2,Long2,Lat2,El2). country("Germany","D","Berlin","Berlin",356910,83536115). province("Berlin","D",3472009,889,"Berlin","Berlin"). city("Berlin","D","Berlin",3472009,13,52,null). del_country("Germany","D","Berlin","Berlin",356910,83536115). % ?- error.