/** * Returns a derivations model. The rule reasoners typically create a * graph containing those triples added to the base graph due to rule firings. * In some applications it can useful to be able to access those deductions * directly, without seeing the raw data which triggered them. In particular, * this allows the forward rules to be used as if they were rewrite transformation * rules. * @return the deductions model, if relevant for this class of inference * engine or null if not. */ @Override public Model getDeductionsModel() { Graph deductionsGraph = getInfGraph().getDeductionsGraph(); if (deductionsGraph != null) { if (deductionsModel == null || (deductionsModel.getGraph() != deductionsGraph) ) { deductionsModel = new ModelCom(deductionsGraph); } } return deductionsModel; }
/** * <p>Returns a derivations model. The rule reasoners typically create a * graph containing those triples added to the base graph due to rule firings. * In some applications it can useful to be able to access those deductions * directly, without seeing the raw data which triggered them. In particular, * this allows the forward rules to be used as if they were rewrite transformation * rules.</p> * * @return The derivations model, if one is defined, or else null */ @Override public Model getDeductionsModel() { if (m_deductionsModel == null) { InfGraph infGraph = getInfGraph(); if (infGraph != null) { Graph deductionsGraph = infGraph.getDeductionsGraph(); if (deductionsGraph != null) { m_deductionsModel = ModelFactory.createModelForGraph( deductionsGraph ); } } } else { // ensure that the cached model sees the updated changes from the // underlying reasoner graph getInfGraph().prepare(); } return m_deductionsModel; }
InfGraph inf = context.getGraph(); Graph raw = inf.getRawGraph(); Graph deductions = inf.getDeductionsGraph(); for (int i = 0; i < length; i++) { Node clauseN = getArg(i, args, context);