Refactor relation checks to globals

All /relation/id# checks involving xpath expressions are using global methods in a different file