Toggle Jena Reasoner

此生再无相见时 提交于 2019-12-03 03:50:53

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

Basically, I gained access to another model without a Reasoner, batched all my changes to the basic model, then rebound the full model with the reasoner to get the updates.

Here's some psuedo code. It doesn't exactly match 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....
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!