Phenomics / ontolib

A modern Java library for working with (biological) ontologies.
https://ontolib.readthedocs.org
Other
9 stars 2 forks source link

Subontology #31

Open pnrobinson opened 6 years ago

pnrobinson commented 6 years ago

I have added code that makes the TermMap and the ReleationMap of subontologies created with the function subOntology in ImmuntableOntology containly only there terms and relations of the suibontology (previously, they contained the terms of the original ontology). I have added a line to the metadata that says that the ontology was subsetted.

pnrobinson commented 6 years ago

This Javadoc behavior should be changed

The constructed sub ontology will use the same maps from {@link TermId} to {@code T} and same
   * edge relation maps as the original ontology. However, the functions
   * {@link Ontology#getAllTermIds()}, {@link Ontology#getNonObsoleteTermIds()},
   * {@link Ontology#getObsoleteTermIds()}, and {@link Ontology#getTerms()} will only contain the
   * ids of the sub ontology. The term ID and relation maps might contain more elements in the case
   * of creating sub ontologies and might refer to elements that are not present in the term id sets
   * or the graph.

When client code creates a subontology, e.g., all phenotype terms, then there are many situations where one needs to iterate over all of the terms and it is useful to use the TermMap for this purpose. It is not useful to have an ontology and a term map that are not consistent with one another. I think we should change this behavior