On Tue, 2011-01-11 at 20:26 -0500, Marco Neumann wrote: > I have the following inference work-flow: > > Model m = TDBFactory.createModel(directory) ; > > m.read(data); > > Reasoner reasoner = ReasonerRegistry.getOWLMiniReasoner(); > > InfModel inf = ModelFactory.createInfModel(reasoner, m); > > //up to here everything runs pretty fast > > m.add(inf.getDeductionsModel()); > > // here the model.add takes forever to complete > > m.commit(); > > Has anyone recommendations to improve performance here or share best practice?
The reasoners do all their work in memory so running over the TDB copy just slows things down without any benefit of scalability. I'd do something like: Model m = TDBFactory.createModel(directory) ; Model tmp = ModelFactory.createDefaultModel(); tmp.read(data); Reasoner reasoner = ReasonerRegistry.getOWLMiniReasoner(); InfModel inf = ModelFactory.createInfModel(reasoner, tmp); m.add(tmp); m.add(inf.getDeductionsModel()); Note 1. Depending on what inferences you want OWLMicro can be notably faster than OWLMini. Note 2. The deductionsModel only contains the forward deductions. When you ask an InfModel a query it will also run backward chaining rules so to get the entire inference closure you need to ask inf for everything. In that case replace the last two lines by: m.add( inf ); If you only want certainly types of inference then ask more specific queries to inf and add only those results to m. Dave
