Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Test OntoDocManager document update #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blcham
Copy link
Contributor

@blcham blcham commented Jun 2, 2021

No description provided.

assertEquals(1, getOntologyClassesLocalNames(indirectlyImportedModel).size());

// update the model globally
docManager.getFileManager().addCacheModel(indirectlyImportedOntologyUri, indirectlyImportedModel);
Copy link
Contributor Author

@blcham blcham Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Contributor

@chlupnoha chlupnoha Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants