org.protege.owlapi.inference.cls.NamedClassExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protege-owlapi-extensions Show documentation
Show all versions of protege-owlapi-extensions Show documentation
Extensions to the OWL API (http://owlapi.sourceforge.net/) for Protege
package org.protege.owlapi.inference.cls;
import java.util.HashSet;
import java.util.Set;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf;
import org.semanticweb.owlapi.util.OWLClassExpressionVisitorAdapter;
public class NamedClassExtractor extends OWLClassExpressionVisitorAdapter {
Set result = new HashSet();
public void reset() {
result.clear();
}
public Set getResult() {
return result;
}
public void visit(OWLClass desc) {
result.add(desc);
}
public void visit(OWLObjectIntersectionOf desc) {
for (OWLClassExpression op : desc.getOperands()) {
op.accept(this);
}
}
}