Dave,

I have something like this:

==== A.owl ====

<#A> a owl:Ontology ;
  owl:imports <#B>, <#C> .

<#RA> a owl:Class ;
  gp:uriTemplate "/A" ;
  rdfs:isDefinedBy <#A> .

==== B.owl ====

<#B> a owl:Ontology .

<#RB> a owl:Class ;
  gp:uriTemplate "/B" ;
  rdfs:isDefinedBy <#A> .

==== C.owl ====

<#C> a owl:Ontology .

<#RC> a owl:Class ;
  gp:uriTemplate "/C" ;
  rdfs:isDefinedBy <#C> .

=============

What I want to do, is to process OntClasses that have gp:uriTemplate
values, but give classes from <#B> and <#C> lower priority since they
are owl:imported. That is, if a URI template matches <#RA>, then <#RB>
and <#RC> need not be processed. Does that sound reasonable?

I called <#A> the "root" ontology because it imports the other two.
But since OntModel is a union of all statements, that is probably
irrelevant.

Alternatively I guess I could check rfds:isDefinedBy to see if
OntClass belongs to <#A> or not.

Martynas

On Tue, Aug 26, 2014 at 9:57 AM, Dave Reynolds
<[email protected]> wrote:
> 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