On 24/12/2020 13:49, Steve Vestal wrote:
I am doing my own import closure, and I saw some behaviors that I was a
bit curious about. For my own education, I'd appreciate any
observations you might have.
I call setProcessImports(false) when creating the document manager, but
1) my OntModel gets created as a UnionModel,
There is a comment in the code:
/** The union graph that contains the imports closure - there is
always one of these, which may also be _the_ graph for the model */
protected MultiUnion m_union = new MultiUnion();
There is always a union, even if union of one.
Because imports may change as add/deletes happen 9including
setSubModel), always being a union is probably a lot easier than having
a special case.
The code is OntModelImpl.generateGraph
and 2) a query is made to
OntModel#getGraph() to find all owl:Imports.
when does this happen? It does not seem to happen with the setup code
you gave.
I thought these would be
unnecessary with setProcessImports(false). Is there any non-negligible
overhead, or processing I am not anticipating, going on?
Andy
Are there
additional properties I should be setting? Is it the case that
setProcessImports(false) has no effect on how the overall structure is
assembled, but it does stop the actual creation of new sub-models and
the loading of those imported documents?
As background, I am constructing the sort of tree shown in section
/Compound Ontology Documents and Imports Processing/ on page
https://jena.apache.org/documentation/ontology/. I do some custom
ontology management, and my code processes all imports, OWL and
otherwise. Some of the leaf (non-base) models are OntModels. I am
loading those leaf OntModels as
leafDocMgr = new OntDocumentManager();
leafDocMgr.setFileManager();
leafDocMgr.setProcessImports(false);
leafDocMgr.setCacheModels(false);
leafModelSpec = new OntModelSpec(OntModelSpec.OWL_MEM);
leafModelSpec.setDocumentManager(leafDocMgr);
OntModel leafOntModel =
ModelFactory.createOntologyModel(leafModelSpec);