On 07/04/18 10:49, Martynas Jusevičius wrote:
Sorry for the noise, it looks like the listImportedOntologyURIs() was a red
herring -- the submodel count actually comes from InfModel which includes
the schema submodels.
But I was able to dig a little further, and observed after the code I have
shown is executed, there are inconsistencies in models for the same
ontology but accessed in different ways:
ontology.getOntModel().getOntology("
https://localhost:4443/demo/iswc-2017/ns/templates#
").listImports().toList().toString()
[http://atomgraph.com/ns/platform/templates#,
https://www.w3.org/ns/ldt/core/templates#]
ontology.getOntModel().getDocumentManager().getOntology("
https://localhost:4443/demo/iswc-2017/ns/templates#",
org.apache.jena.ontology.OntModelSpec.OWL_MEM).getOntology("
https://localhost:4443/demo/iswc-2017/ns/templates#
").listImports().toList().toString()
[https://www.w3.org/ns/ldt/core/templates#]
Notice how imports for
https://localhost:4443/demo/iswc-2017/ns/templates# differ.
How is that possible, and how do I avoid this?
No idea but since the first example has some inference enabled that
might be a clue.
Do you have a complete minimal example of an ontology which exhibits
this difference?
Dave
On Fri, Apr 6, 2018 at 3:19 PM, Martynas Jusevičius <[email protected]>
wrote:
I guess dynamic imports is what I need. But will they get triggered if I
remove and then re-add the whole Model (as shown in my example), rather
than statements?
I could probably removeAll() statements from it instead of removing it
from cache.
On Fri, Apr 6, 2018 at 1:59 PM, Martynas Jusevičius <
[email protected]> wrote:
Hi,
we have an ontology editor that stores ontologies and their terms in a
triplestore. On the other end, they are being loaded by OntDocumentManager.
The question is: what is the proper way to clear and reload an ontology
and its imports in OntDocumentManager?
Because, for example, a user could totally change owl:imports statements
of an ontology, and we need this feature to be able to reload a completely
new OntModel without any old imported submodels.
Right now I'm simply doing the following:
OntDocumentManager.getInstance().getFileManager().
removeCacheModel(ontologyURI)
OntDocumentManager.getInstance().addModel(ontologyURI, infModel);
OntModel ontModel = OntDocumentManager.getInstance().getOntology(ontologyURI,
ontModelSpec);
But this is not enough, because doing ontModel.listImportedOntologyURIs()
lists all the old imports from before.
Am I getting this right and what needs to be done to reload the imports
as well?
I can see there is a concept of dynamic imports in OntModel, but not sure
it's related.
Martynas