1 package jalview.datamodel.ontology;
3 import java.util.ArrayList;
4 import java.util.HashSet;
9 * A base class for models of Sequence Ontology and others
14 public abstract class OntologyBase implements OntologyI
17 public Set<String> getParentTerms(Set<String> terms)
19 Set<String> parents = new HashSet<>(terms);
21 boolean childRemoved = true;
24 childRemoved = removeChild(parents);
30 * Removes the first term in the given set found which is a child of another
31 * term in the set. Answers true if a child was found and removed, else false.
36 boolean removeChild(Set<String> terms)
38 for (String t1 : terms)
40 for (String t2 : terms)
61 public List<String> getChildTerms(String parent, List<String> terms)
63 List<String> children = new ArrayList<>();
64 for (String term : terms)
66 if (!term.equals(parent) && isA(term, parent))