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