edu.stanford.protege.webprotege.match.IriAnnotationsMatcher Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.match;
import edu.stanford.protege.webprotege.index.AnnotationAssertionAxiomsIndex;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 12 Jun 2018
*/
public class IriAnnotationsMatcher implements Matcher {
@Nonnull
private final AnnotationAssertionAxiomsIndex axiomProvider;
@Nonnull
private final Matcher annotationMatcher;
@Inject
public IriAnnotationsMatcher(@Nonnull AnnotationAssertionAxiomsIndex axiomProvider,
@Nonnull Matcher annotationMatcher) {
this.axiomProvider = checkNotNull(axiomProvider);
this.annotationMatcher = checkNotNull(annotationMatcher);
}
@Override
public boolean matches(@Nonnull IRI subject) {
return axiomProvider.getAnnotationAssertionAxioms(subject)
.map(OWLAnnotationAssertionAxiom::getAnnotation)
.anyMatch(annotationMatcher::matches);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy