Relation as predicate name or predicate argument?

How about:

relation(mother, teresa, teresas_daughter).
relation(mother, teresas_daughter, my_daughter).
relation(mother, me, my_daughter).

relation_calc(Rel, M, D) :-
    relation(Rel, M, D).

relation_calc(grandmother, GM, D) :-
    relation(mother, GM, M),
    relation(mother, M, D).

relation_calc(mother, GM, M) :-
    relation_calc(grandmother, GM, D),
    relation_calc(mother, M, D).

relation_calc(same_person, M1, M2) :-
    dif(M1, M2),
    relation_calc(mother, M1, D),
    relation_calc(mother, M2, D),
    % Break symmetry
    M1 @> M2.

This gives the seemingly-sensible answer:

?- relation_calc(same_person, P1, P2).
P1 = teresas_daughter,
P2 = me
1 Like