monarch-initiative / phenol

phenol: Phenotype ontology library
https://phenol.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 4 forks source link

ontology version #430

Closed pnrobinson closed 10 months ago

pnrobinson commented 1 year ago

It would be nice to add a convenience function to retrieve the ontology version. Now we need to do this

Ontology ontology = OntologyLoader("...");//
String version = ontology.getMetaInfo().getOrDefault("data-version", "unknown version");

but this is a relatively common operation and it is hard to remember the exact steps without searching for it. It would be nice to have a function in the Ontology class that would be like this

String getVersion() {
   return getMetaInfo().getOrDefault("data-version", "unknown version");
}

or possibly

Optional<String> getVersion() {
   return Optional.ofNullable(getMetaInfo().getOrDefault("data-version"));
}
ielis commented 10 months ago

Now MinimalOntology extends Versioned, so version is available as an optional attribute.