1 package jalview.datamodel.ontology;
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.HashSet;
11 * A base class for models of Sequence Ontology and others
16 public abstract class OntologyBase implements OntologyI
18 protected Map<String, List<String>> rootParents = new HashMap<>();
21 public Set<String> getParentTerms(Set<String> terms)
23 Set<String> parents = new HashSet<>(terms);
25 boolean childRemoved = true;
28 childRemoved = removeChild(parents);
34 * Removes the first term in the given set found which is a child of another
35 * term in the set. Answers true if a child was found and removed, else false.
40 boolean removeChild(Set<String> terms)
42 for (String t1 : terms)
44 for (String t2 : terms)
65 public List<String> getChildTerms(String parent, List<String> terms)
67 List<String> children = new ArrayList<>();
68 for (String term : terms)
70 if (!term.equals(parent) && isA(term, parent))