In prologs, variables should start with a capital letter, so pay attention to this.
Everyone who respects himself is respected by others. I think you need some basic facts, for example, who respects them. Then you can declare a rule that says that X is respected by others, implied by himself.
respects(john, mary). %john respects mary
respects(john, john). %john respects himself
respects(X, Y) :- respectedbyothers(Y). %X respects Y if Y is respected by others
respectedbyothers(X):-respects(X, X).
source
share