Toggle Jena Reasoner

I have a Yen ontology model ( OntModel ), which I modify programmatically. This model was originally created using the defaultFactoryFactory method to create an ontology model (without parameters) . The problem was that as the program starts and the model changes, by default, Jena Reasoner will start (and start, run, and run). The process was too slow for what I needed, and on large datasets, out of memory would end.

I modified the program to use a different factory ontology model to create a model with no argument. This happened very quickly and did not display any of the memory problems that I had seen before (even for very large datasets). The problem with this approach is that I can access data directly using its direct class type (I cannot access objects using its parent class).

For example, imagine that I had two class resources: a flower and a seed. They are inherited from the common parent, "plant material." My program accepts all the "seeds", launches the "grow" method, which turns the "seed" object into a "flower" object. The grow method is too slow and runs out of memory when using a Reasoner (even Micro Reasoner). If I turn off Reasoner, then I will not be able to access all the "flowers" and "seeds" using the class "plant material".

Is there a preferred way (happy environment) to do this ... allowing the ability to access objects using your superclass, as well as being fast rather than a memory swamp?

I was looking for a way to "disable the argumentator" while I run my grow method and then return it as soon as the method completes. Is it possible somehow?

+4
source share
1 answer

I got some help and suggestions , this is how I solved this problem.

Basically, I got access to another model without Reasoner, put all my changes in the base model, and then bounced the full model with an argument to get updates.

Here is some psuedo code. This doesn't exactly fit my "real" scenario, but you get the idea.

// Create a model with a reasoner and load the full model from owl files or // whatever OntModel fullModel = ModelFactory.createOntologyModel(); fullModel.read(...); // create a model without a reasoner and load it from the full model with // reified statements OntModel basicModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); basicModel.add(fullModel); // batch modifications to the basic model programatically //(**** RUNS REALLY QUICK *****) // rebind the full model fullModel.rebind(); // continue on.... 
+4
source

All Articles