Implementing relation type checking