[New] Test OntoDocManager document update#11
Conversation
| assertEquals(1, getOntologyClassesLocalNames(indirectlyImportedModel).size()); | ||
|
|
||
| // update the model globally | ||
| docManager.getFileManager().addCacheModel(indirectlyImportedOntologyUri, indirectlyImportedModel); |
There was a problem hiding this comment.
@chlupnoha this is method that you were looking for to replace cached model:
docManager.getFileManager().addCacheModel(....);
-
the issue is with concurrent access here
-
once, you find out that model has changed in FS, you can use it to update imported models
There was a problem hiding this comment.
Thank you! I did not expect this kind of approach. However, I will stick to my solution, which is very costly but working as I want and do not require any other handling.
ModelMakerImpl modelMaker = new ModelMakerImpl(new SimpleGraphMaker());
OntModelSpec ontModelSpec = new OntModelSpec(modelMaker, null, null, ProfileRegistry.OWL_LANG);
OntModel model = documentManager.getOntology(fileUri, ontModelSpec);
Your suggested still solution does not work correctly in the execution of multiple tests, but it may be related to the static context of the OntModelSpec or something else. Also, it will be tough to look for and manage more complex ontologies in the future.
No description provided.