Phenomics / ontolib

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

get parents #18

Open pnrobinson opened 7 years ago

pnrobinson commented 7 years ago

Hi! Are we planning to offer methods such as getParents() ? (distinct from getAncestors?) It would be useful to have this as a simple API function.

holtgrewe commented 7 years ago

Agreed, is currently only available through graph property of MinimalOntology<> and should be a convenience function in Ontology<>.

holtgrewe commented 7 years ago

Should be fine after merging #20.

drseb commented 7 years ago

DoesgetParents(Term t) and getAncestors(Term t) return the Term t itself? This is an important design decision. In ontologizer it did.

holtgrewe commented 7 years ago

getParents() does not return the parents, a term is not its own parent.

As for getAncestors(), there is a boolean flag and by default, it returns itself, a term is contained in the set of ancestors.

cf. http://javadoc.io/doc/com.github.phenomics/ontolib-core/0.3

This might be a break of consistency and principle of least surprise.

Maybe getParents() should not return itself, as should getAncestors() and then there should be a getParentsAndSelf() and a getAncestorsAndSelf()?

drseb commented 7 years ago

I think this is a good solution.