@Nonnull
@Override
public NodeSet<OWLClass> getObjectPropertyDomains(
@Nonnull OWLObjectPropertyExpression pe, boolean direct) {
ensurePrepared();
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLObjectPropertyDomainAxiom axiom : ontology
.getObjectPropertyDomainAxioms(pe)) {
result.addNode(getEquivalentClasses(axiom.getDomain()));
if (!direct) {
result.addAllNodes(getSuperClasses(axiom.getDomain(), false)
.getNodes());
}
}
for (OWLObjectPropertyExpression invPe : getInverseObjectProperties(
pe).getEntities()) {
assert invPe != null;
for (OWLObjectPropertyRangeAxiom axiom : ontology
.getObjectPropertyRangeAxioms(invPe)) {
result.addNode(getEquivalentClasses(axiom.getRange()));
if (!direct) {
result.addAllNodes(getSuperClasses(axiom.getRange(),
false).getNodes());
}
}
}
}