/** * Get the single static precomputed rule closure. */ protected synchronized InfGraph getPreload() { if (cachePreload && preload == null) { preload = (new FBRuleInfGraph(this, rules, null)); preload.prepare(); } return preload; }
/** * Perform any initial processing and caching. This call is optional. Most * engines either have negligable set up work or will perform an implicit * "prepare" if necessary. The call is provided for those occasions where * substantial preparation work is possible (e.g. running a forward chaining * rule system) and where an application might wish greater control over when * this prepration is done rather than just leaving to be done at first query time. */ @Override public void prepare() { getInfGraph().prepare(); }
/** * Perform any initial processing and caching. This call is optional. Most * engines either have negligable set up work or will perform an implicit * "prepare" if necessary. The call is provided for those occasions where * substantial preparation work is possible (e.g. running a forward chaining * rule system) and where an application might wish greater control over when * this prepration is done rather than just leaving to be done at first query time. */ @Override public void prepare() { if (getGraph() instanceof InfGraph) { ((InfGraph) getGraph()).prepare(); } }
/** * Get the single static precomputed rule closure. */ @Override protected synchronized InfGraph getPreload() { // We only support this in HYBRID mode if (cachePreload && preload == null && mode == HYBRID) { preload = new FBRuleInfGraph( this, rules, null, Factory.createDefaultGraph() ); if (enableTGCCaching) ((FBRuleInfGraph)preload).setUseTGCCache(); preload.prepare(); } return preload; }
protected MultiValueMap<ATermAppl, ATermAppl> run(Collection<ATermAppl> classes) { addClasses( classes ); addClasses( m_Names.getAllAnons() ); Reasoner reasoner = new GenericRuleReasoner(new ArrayList<Rule>(m_Rules)); InfGraph inf = reasoner.bind( m_Facts ); inf.prepare(); MultiValueMap<ATermAppl, ATermAppl> subsumers = getSubsumptions(inf); for( ATermAppl c : classes ) { subsumers.add( ATermUtils.BOTTOM, c ); } return subsumers; }
protected MultiValueMap<ATermAppl, ATermAppl> run(Collection<ATermAppl> classes) { addClasses( classes ); addClasses( m_Names.getAllAnons() ); Reasoner reasoner = new GenericRuleReasoner(new ArrayList<Rule>(m_Rules)); InfGraph inf = reasoner.bind( m_Facts ); inf.prepare(); MultiValueMap<ATermAppl, ATermAppl> subsumers = getSubsumptions(inf); for( ATermAppl c : classes ) { subsumers.add( ATermUtils.BOTTOM, c ); } return subsumers; }
/** * <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; }