@Nonnull
@Override
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(
OWLNamedIndividual ind, @Nonnull OWLObjectPropertyExpression pe) {
ensurePrepared();
OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet();
Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe);
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLObjectPropertyAssertionAxiom axiom : ontology
.getObjectPropertyAssertionAxioms(ind)) {
if (!axiom.getObject().isAnonymous()
&& axiom.getProperty().getSimplified()
.equals(pe.getSimplified())) {
if (getIndividualNodeSetPolicy().equals(
IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject()
.asOWLNamedIndividual()));
} else {
result.addNode(new OWLNamedIndividualNode(axiom
.getObject().asOWLNamedIndividual()));
}
}
// Inverse of pe
if (axiom.getObject().equals(ind)
&& !axiom.getSubject().isAnonymous()) {
OWLObjectPropertyExpression invPe = axiom.getProperty()
.getInverseProperty().getSimplified();
if (!invPe.isAnonymous()
&& inverses.contains(invPe.asOWLObjectProperty())) {
if (getIndividualNodeSetPolicy().equals(
IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject()
.asOWLNamedIndividual()));
} else {
result.addNode(new OWLNamedIndividualNode(axiom
.getObject().asOWLNamedIndividual()));
}
}
}
}