refactored getValidSynset and getRelation