use of ubic.basecode.ontology.model.OntologyClassRestriction in project Gemma by PavlidisLab.
the class GeneOntologyServiceImpl method getParents.
@Override
public Collection<OntologyTerm> getParents(OntologyTerm entry, boolean includePartOf) {
Collection<OntologyTerm> parents = entry.getParents(true);
Collection<OntologyTerm> results = new HashSet<>();
for (OntologyTerm term : parents) {
// The isRoot() returns true for the MolecularFunction, BiologicalProcess, CellularComponent
if (term.isRoot())
continue;
if (term.getUri().equalsIgnoreCase(GeneOntologyServiceImpl.ALL_ROOT))
continue;
// noinspection StatementWithEmptyBody // Better readability
if (term instanceof OntologyClassRestriction) {
// don't keep it. - for example, "ends_during" RO_0002093
} else {
results.add(term);
}
}
if (includePartOf)
results.addAll(this.getIsPartOf(entry));
return results;
}
Aggregations