On 24/01/13 13:08, Panagiotis Papadakos wrote:
Ian and Dave, thank you both for your help.

I didn't post the correct code and I am sorry for this.

Regarding the ontology, I know it is not correct.
Maybe changing Europe to European, Germany to German, etc. would be better.

Now regarding the listInstances method, I still believe something is
wrong either in the code, in the API or in my way of thinking.

listInstances is supposed to return the instances, either direct or
instances of its subclasses. Unfortunately if I use a simple RDF_MEM
model with no inference, listInstances(false) for the Manufacturer class
returns no result. Somehow I feel this is wrong.
I was thinking that internally, since there is no inference, jena should
visit each subclass, and the subclasses of them, etc. getting the direct
instances of each one and returning all the instances of the class and
its subclasses. Is this correct?

No.

The notion is that reasoning is the job of the reasoner and that the OntAPI provides convenient access to that, but doesn't duplicate it. There are a few special cases but in general if you want reasoning then configure a reasoner.

Now regarding listInstances(true), I am supposing that it should return
all direct instances of the class, even if these instances are also
instances of a subclass (which for example can happen if I load the
TestInference.rdf file).

No. That's the point of direct, as it says in the javadoc setting direct=true means "excluding sub-classes of this class".

If something is also an instance of a subclass of C then it is not a direct instance of C and should not be returned by listInstances(true).

Dave

Reply via email to