A Theory of Link Prediction via Relational Weisfeiler-Leman on Knowledge Graphs