Refactored Term relationships to generate with deterministic ids.