edu.stanford.protege.webprotege.index.impl.OntologySignatureIndexImpl Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.index.impl;
import edu.stanford.protege.webprotege.index.DependentIndex;
import edu.stanford.protege.webprotege.index.Index;
import edu.stanford.protege.webprotege.index.OntologySignatureIndex;
import edu.stanford.protege.webprotege.inject.ProjectSingleton;
import org.semanticweb.owlapi.model.EntityType;
import org.semanticweb.owlapi.model.OWLEntity;
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-15
*/
@ProjectSingleton
public class OntologySignatureIndexImpl implements OntologySignatureIndex, DependentIndex {
@Nonnull
private final AxiomsByEntityReferenceIndexImpl axiomsByEntityReferenceIndex;
@Inject
public OntologySignatureIndexImpl(@Nonnull AxiomsByEntityReferenceIndexImpl axiomsByEntityReferenceIndex) {
this.axiomsByEntityReferenceIndex = checkNotNull(axiomsByEntityReferenceIndex);
}
@Nonnull
@Override
public Collection getDependencies() {
return List.of(axiomsByEntityReferenceIndex);
}
@Nonnull
@Override
public Stream getEntitiesInSignature(@Nonnull OWLOntologyID ontologyID) {
checkNotNull(ontologyID);
var streamsBuilder = Stream.>builder();
EntityType.values().forEach(entityType -> {
var sig = axiomsByEntityReferenceIndex.getOntologyAxiomsSignature(entityType,
ontologyID);
streamsBuilder.add(sig);
});
return streamsBuilder.build().flatMap(s -> s);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy