org.semanticweb.owlapi.search.EquivalentVisitor Maven / Gradle / Ivy
The newest version!
package org.semanticweb.owlapi.search;
import static org.semanticweb.owlapi.util.OWLAPIStreamUtils.empty;
import java.util.stream.Stream;
import org.semanticweb.owlapi.model.OWLAxiomVisitorEx;
import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom;
import org.semanticweb.owlapi.model.OWLDisjointClassesAxiom;
import org.semanticweb.owlapi.model.OWLDisjointDataPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLSameIndividualAxiom;
@SuppressWarnings("unchecked")
class EquivalentVisitor implements OWLAxiomVisitorEx> {
private final boolean equiv;
EquivalentVisitor(boolean equiv) {
this.equiv = equiv;
}
@Override
public Stream doDefault(Object o) {
return empty();
}
@Override
public Stream visit(OWLEquivalentClassesAxiom axiom) {
if (equiv) {
return (Stream) axiom.classExpressions();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLEquivalentDataPropertiesAxiom axiom) {
if (equiv) {
return (Stream) axiom.properties();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLEquivalentObjectPropertiesAxiom axiom) {
if (equiv) {
return (Stream) axiom.properties();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLDifferentIndividualsAxiom axiom) {
if (!equiv) {
return (Stream) axiom.individuals();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLSameIndividualAxiom axiom) {
if (equiv) {
return (Stream) axiom.individuals();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLDisjointClassesAxiom axiom) {
if (!equiv) {
return (Stream) axiom.classExpressions();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLDisjointDataPropertiesAxiom axiom) {
if (!equiv) {
return (Stream) axiom.properties();
}
return doDefault(axiom);
}
@Override
public Stream visit(OWLDisjointObjectPropertiesAxiom axiom) {
if (!equiv) {
return (Stream) axiom.properties();
}
return doDefault(axiom);
}
}