You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Steve Vestal <st...@adventiumlabs.com> on 2021/06/21 17:46:17 UTC

Questions about structure of an OntModel

I am trying to understand, for an OntModel, the differences between the 
base model, an imported model, a sub-model, and a bound schema.  My use 
case is that I have a number of "imports" (actually sub-models I add 
myself) to an OntModel, one of which might have its content changed 
during use.  I have a few questions, which I simplified to yes-no hoping 
that would make this easier.

I'm looking at the diagram in 
https://jena.apache.org/documentation/ontology/#compound-ontology-documents-and-imports-processing 


When an OntModel processes its imports (IIRC the default behavior), and 
an imported document says it is an OWL ontology, does that get imported 
as a simple Model without all that layering, e.g., no reasoner?

Is calling OntModel#addSubModel basically the same as importing but 
without chasing down transitive imports?

When an imported OWL ontology has imports, is the collection of 
transitive imports flattened out under that one union graph?

That diagram shows imports being different than the base model. If a 
change is made to an import or sub-model, does that mean there will be 
no reasoner rebind because there was no change to the base model?  If an 
import or sub-model is changed, does rebind need to be explicitly called 
on the overall OntModel and its reasoner?

If OntModel#setDynamicImports(true), and Ontology#addImport and 
Ontology#removeImport are called during a session, is that basically the 
same as using various sub-model adds and removes with rebinding?

Looking now at the diagram 
https://jena.apache.org/documentation/inference/#overview

If I call Reasoner#bindSchema, where does that go?  Same place as the 
imports in the earlier diagram?




Re: Questions about structure of an OntModel

Posted by Steve Vestal <st...@adventiumlabs.com>.
Thanks, that does help.  I do addSubModel to an OntModel where standard 
import does not work, and those may be OntModels.  Sounds like I should 
check and see if I should be adding the base model of the added OntModel 
rather than the OntModel itself.

On 6/23/2021 4:05 AM, Andy Seaborne wrote:
>
>
> On 21/06/2021 18:46, Steve Vestal wrote:
>> I am trying to understand, for an OntModel, the differences between 
>> the base model, an imported model, a sub-model, and a bound schema.  
>> My use case is that I have a number of "imports" (actually sub-models 
>> I add myself) to an OntModel, one of which might have its content 
>> changed during use.  I have a few questions, which I simplified to 
>> yes-no hoping that would make this easier.
>>
>> I'm looking at the diagram in 
>> https://jena.apache.org/documentation/ontology/#compound-ontology-documents-and-imports-processing 
>>
>>
>> When an OntModel processes its imports (IIRC the default behavior), 
>> and an imported document says it is an OWL ontology, does that get 
>> imported as a simple Model without all that layering, e.g., no reasoner?
>
> Simple model. The reasoner is over the the combined union.
>
> However, if you put an inference model in as a sub-model, (imports 
> processing does not do this) that will have inference.
>
>> Is calling OntModel#addSubModel basically the same as importing but 
>> without chasing down transitive imports?
>
> For a non-inference model, yes.
>
>> When an imported OWL ontology has imports, is the collection of 
>> transitive imports flattened out under that one union graph?
>
> The code is in OntDocumentManager.
>
> It looks like it gets flatten - but it does not make an functional 
> difference because a union of a tree of models behaves like a flat 
> union of all the elements.
>
>> That diagram shows imports being different than the base model. If a 
>> change is made to an import or sub-model, does that mean there will 
>> be no reasoner rebind because there was no change to the base model? 
>
> Correct.
>
>> If an import or sub-model is changed, does rebind need to be 
>> explicitly called on the overall OntModel and its reasoner?
>
> Yes.
>
>> If OntModel#setDynamicImports(true), and Ontology#addImport and 
>> Ontology#removeImport are called during a session, is that basically 
>> the same as using various sub-model adds and removes with rebinding?
>
> Not sure - the source code is your friend!
>
>> Looking now at the diagram 
>> https://jena.apache.org/documentation/inference/#overview
>>
>> If I call Reasoner#bindSchema, where does that go?  Same place as the 
>> imports in the earlier diagram?
>
> Not sure what the question is getting at - the reasoner is over the 
> union; for workspace it has its own in-memory datastructures as well 
> as the base graph.
>
>     HTH
>     Andy


Re: Questions about structure of an OntModel

Posted by Andy Seaborne <an...@apache.org>.

On 21/06/2021 18:46, Steve Vestal wrote:
> I am trying to understand, for an OntModel, the differences between the 
> base model, an imported model, a sub-model, and a bound schema.  My use 
> case is that I have a number of "imports" (actually sub-models I add 
> myself) to an OntModel, one of which might have its content changed 
> during use.  I have a few questions, which I simplified to yes-no hoping 
> that would make this easier.
> 
> I'm looking at the diagram in 
> https://jena.apache.org/documentation/ontology/#compound-ontology-documents-and-imports-processing 
> 
> 
> When an OntModel processes its imports (IIRC the default behavior), and 
> an imported document says it is an OWL ontology, does that get imported 
> as a simple Model without all that layering, e.g., no reasoner?

Simple model. The reasoner is over the the combined union.

However, if you put an inference model in as a sub-model, (imports 
processing does not do this) that will have inference.

> Is calling OntModel#addSubModel basically the same as importing but 
> without chasing down transitive imports?

For a non-inference model, yes.

> When an imported OWL ontology has imports, is the collection of 
> transitive imports flattened out under that one union graph?

The code is in OntDocumentManager.

It looks like it gets flatten - but it does not make an functional 
difference because a union of a tree of models behaves like a flat union 
of all the elements.

> That diagram shows imports being different than the base model. If a 
> change is made to an import or sub-model, does that mean there will be 
> no reasoner rebind because there was no change to the base model? 

Correct.

> If an 
> import or sub-model is changed, does rebind need to be explicitly called 
> on the overall OntModel and its reasoner?

Yes.

> If OntModel#setDynamicImports(true), and Ontology#addImport and 
> Ontology#removeImport are called during a session, is that basically the 
> same as using various sub-model adds and removes with rebinding?

Not sure - the source code is your friend!

> Looking now at the diagram 
> https://jena.apache.org/documentation/inference/#overview
> 
> If I call Reasoner#bindSchema, where does that go?  Same place as the 
> imports in the earlier diagram?

Not sure what the question is getting at - the reasoner is over the 
union; for workspace it has its own in-memory datastructures as well as 
the base graph.

     HTH
     Andy