All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.protege.webprotege.index.impl.EquivalentClassesAxiomsIndexImpl Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.index.impl;

import com.google.common.collect.ImmutableList;
import edu.stanford.protege.webprotege.change.OntologyChange;
import edu.stanford.protege.webprotege.index.EquivalentClassesAxiomsIndex;
import edu.stanford.protege.webprotege.inject.ProjectSingleton;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom;
import org.semanticweb.owlapi.model.OWLOntologyID;

import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.stream.Stream;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 2019-08-09
 */
@ProjectSingleton
public class EquivalentClassesAxiomsIndexImpl implements EquivalentClassesAxiomsIndex, UpdatableIndex {

    @Nonnull
    private final AxiomMultimapIndex index;

    @Inject
    public EquivalentClassesAxiomsIndexImpl() {
        index = AxiomMultimapIndex.createWithNaryKeyValueExtractor(OWLEquivalentClassesAxiom.class,
                                                                   OWLEquivalentClassesAxiom::getNamedClasses);
    }

    @Nonnull
    @Override
    public Stream getEquivalentClassesAxioms(@Nonnull OWLClass cls,
                                                                        @Nonnull OWLOntologyID ontologyID) {
        checkNotNull(cls);
        checkNotNull(ontologyID);
        return index.getAxioms(cls, ontologyID);
    }

    @Override
    public void applyChanges(@Nonnull ImmutableList changes) {
        index.applyChanges(changes);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy