Refactor relation management

Correctly handles ../link/.. URLs as per the JSON API spec