On 26/08/14 02:10, Martynas Jusevičius wrote:
Hey,

is it possible to check if resource in OntModel comes from the
main/root ontology or the owl:imports?

Is thought that is what isInBaseModel() does, but I don't get expected result.
http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/ontology/OntModel.html#isInBaseModel(com.hp.hpl.jena.rdf.model.RDFNode)

Depends what you mean by a resource "coming from" a model.

In Jena models just contain statements, there is no separate notion of a model containing a resource.

What OntModel#inBaseModel(RDFNode) does is test if there are any statements involving that RDFNode in the base model. However, typically in ontologies terms can be used in the base ontology but defined in the imports. If that's the case you will see statements about it in both the base and the import models.

You may want to use isInBaseModel(Statement) to, for example, see whether the type of your resource is defined in the base model.

Dave

Reply via email to