getting relation type and check if exist