Search in sources :

Example 1 with OntologyClassRestriction

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;
}
Also used : OntologyClassRestriction(ubic.basecode.ontology.model.OntologyClassRestriction) OntologyTerm(ubic.basecode.ontology.model.OntologyTerm)

Aggregations

OntologyClassRestriction (ubic.basecode.ontology.model.OntologyClassRestriction)1 OntologyTerm (ubic.basecode.ontology.model.OntologyTerm)1