Thank you, you answered my question: they should behave the same.
I tried a couple of reasoners and no reasoning, same result.
I'm doing something a bit odd in how reasoning is structured. I recall
seeing some code in OntModelImpl that handles special cases for
Individuals. It would probably take me more trial-and-error time to
create a simple self-contained test that reproduces this than to fish
around with the debugger first. OntModel#listIndividuals works for me,
good enough for now.
On 1/1/2023 3:49 AM, Lorenz Buehmann wrote:
I can't reproduce this with a dummy example just containing a single
OWL class with a single individual.
Both ways return the individual. Do you have some inference enabled?
Can you share sample data and code? All entities are strongly typed
(don't know if this matters here)?
OntModel::listIndividuals(type) calls
getGraph().find( null, RDF.type.asNode(), type.asNode() );
OntClass::listInstances() does
getModel()
.listStatements( null, RDF.type, this )
.mapWith( s -> s.getSubject().as( Individual.class ) )
.filterKeep( o -> o.hasRDFType( OntClassImpl.this,
direct ))
.filterKeep( new UniqueFilter<Individual>());
On 31.12.22 21:07, Steve Vestal wrote:
Given an OntModel myModel and an OntClass myClass contained in
myModel, the call myModel.listIndividuals(myClass) provides the
expected list of Individuals that are members of myClass; but the
call myClass.listInstances() doesn't list anything. I am curious
what the difference is between the two (I was not able to make that
out from the javadoc).