/** Loads the terms from the ontology when needed. */ private synchronized void loadTerms() { if (this.terms == null) { this.terms = this.ontology.getTerms(this.identifiers); } } }
@Override public void initialize() throws InitializationException { Map<String, OntologyService> newOntologiesMap = new HashMap<String, OntologyService>(); for (OntologyService ontology : this.ontologies.values()) { for (String alias : ontology.getAliases()) { newOntologiesMap.put(alias, ontology); } } this.ontologies = newOntologiesMap; }
/** * Modify this function to add more version types. * * @return Map of all the version types. Each entry becomes an object in the patient record. */ public Map<String, String> getOntologiesVersions() { Map<String, String> result = new HashMap<>(); for (Entry<String, OntologyService> ontology : this.ontologies.entrySet()) { String version = ontology.getValue().getVersion(); if (StringUtils.isNotBlank(version)) { result.put(ontology.getKey(), version); } } return result; } }
@Override public OntologyTerm resolveTerm(String termId) { OntologyService ontology = getOntologyForTerm(termId); if (ontology != null) { return ontology.getTerm(termId); } return null; }