Deductive Databases

Safety

Say whether each of the following rules is safe.

a. r(X,Y) :- p(X,Y) & q(Y,X)
b. r(X,Y) :- p(X,Y) & q(Y,Z)
c. r(X,Y) :- p(X,X) & q(X,Z)
d. r(X,Y) :- p(X,Y) & ~q(Y,Z)
e. r(X,Y) :- p(X,Y) & ~q(Y,X)