uk.ac.manchester.cs.owl.owlapi.OWLAxiomIndexImpl Maven / Gradle / Ivy
package uk.ac.manchester.cs.owl.owlapi;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.search.Filters;
/**
* @author ignazio
* @since 4.0.0
*/
public abstract class OWLAxiomIndexImpl extends OWLObjectImpl implements OWLAxiomIndex, HasTrimToSize {
@Nonnull protected final Internals ints = new Internals();
@Override
public void trimToSize() {
ints.trimToSize();
}
@Override
public Stream datatypeDefinitions(OWLDatatype datatype) {
// XXX stream better?
return ints.filterAxioms(Filters.datatypeDefFilter, datatype).stream()
.map(ax -> (OWLDatatypeDefinitionAxiom) ax);
}
@Override
public Stream subAnnotationPropertyOfAxioms(OWLAnnotationProperty subProperty) {
return ints.filterAxioms(Filters.subAnnotationWithSub, subProperty).stream()
.map(ax -> (OWLSubAnnotationPropertyOfAxiom) ax);
}
@Override
public Stream annotationPropertyDomainAxioms(OWLAnnotationProperty property) {
return ints.filterAxioms(Filters.apDomainFilter, property).stream()
.map(ax -> (OWLAnnotationPropertyDomainAxiom) ax);
}
@Override
public Stream annotationPropertyRangeAxioms(OWLAnnotationProperty property) {
return ints.filterAxioms(Filters.apRangeFilter, property).stream()
.map(ax -> (OWLAnnotationPropertyRangeAxiom) ax);
}
}