edu.stanford.protege.webprotege.index.impl.ObjectPropertyRangeAxiomsIndexImpl Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.index.impl;
import edu.stanford.protege.webprotege.index.AxiomsByTypeIndex;
import edu.stanford.protege.webprotege.index.DependentIndex;
import edu.stanford.protege.webprotege.index.Index;
import edu.stanford.protege.webprotege.index.ObjectPropertyRangeAxiomsIndex;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLObjectPropertyRangeAxiom;
import org.semanticweb.owlapi.model.OWLOntologyID;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2019-08-10
*/
public class ObjectPropertyRangeAxiomsIndexImpl implements ObjectPropertyRangeAxiomsIndex, DependentIndex {
@Nonnull
private final AxiomsByTypeIndex axiomsByTypeIndex;
@Inject
public ObjectPropertyRangeAxiomsIndexImpl(@Nonnull AxiomsByTypeIndex axiomsByTypeIndex) {
this.axiomsByTypeIndex = axiomsByTypeIndex;
}
@Nonnull
@Override
public Collection getDependencies() {
return List.of(axiomsByTypeIndex);
}
@Nonnull
@Override
public Stream getObjectPropertyRangeAxioms(@Nonnull OWLObjectProperty property,
@Nonnull OWLOntologyID ontologyId) {
checkNotNull(property);
checkNotNull(ontologyId);
return axiomsByTypeIndex.getAxiomsByType(AxiomType.OBJECT_PROPERTY_RANGE, ontologyId)
.filter(ax -> ax.getProperty().equals(property));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy