I have an OntModel in Jena with an OWL_MEM_RDFS_INF ModelSpec. However I created a utility to count the number of individuals, properties, etc... in the model. As explained here it takes forever to execute the model.listIndividuals()
method which is normal because I am using some reasoning abilities.
It's further demonstrated because if I use the basic OWL_MEM ModelSpec I don't have any problem.
I tried to clone the model graph and use another ModelSpec by using what's explained here:
Model copyOfOntModel = ModelFactory.createModelForGraph(model.getGraph());
OntModel newModel = new OntModelImpl(OntModelSpec.OWL_MEM, copyOfOntModel);
But it still takes forever when I execute the model.listIndividuals()
method. Is there a way to clone the model but use the basic ModelSpec for example?
I applied what UniformedUser said, but as as the result of the getRawModel()
method is not an OntModel
, I just did:
Model _model = model.getRawModel();
OntModel newModel = new OntModelImpl(OntModelSpec.OWL_MEM, _model);
And it just works!!