/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public synchronized void rebind(Graph data) { fdata = new FGraph(data); isPrepared = false; }
/** * Constructor * @param data the raw data file to be augmented with entailments * @param reasoner the engine, with associated tbox data, whose find interface * can be used to extract all entailments from the data. */ public BaseInfGraph(Graph data, Reasoner reasoner) { super( ); this.fdata = new FGraph( data ); this.reasoner = reasoner; }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public void rebind(Graph data) { fdata = new FGraph( data ); rebind(); }
/** * Extracts all of the subClass and subProperty declarations from * the given schema/tbox and caches the resultant graphs. * It can only be used once, can't stack up multiple tboxes this way. * This limitation could be lifted - the only difficulty is the need to * reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf * subClassOf is discovered. * @param tbox schema containing the property and class declarations */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { return bindSchema(new FGraph(tbox)); }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public synchronized void rebind(Graph data) { engine.checkSafeToUpdate(); fdata = new FGraph(data); this.setPreparedState(false); }
/** * Extracts all of the subClass and subProperty declarations from * the given schema/tbox and caches the resultant graphs. * It can only be used once, can't stack up multiple tboxes this way. * This limitation could be lifted - the only difficulty is the need to * reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf * subClassOf is discovered. * @param tbox schema containing the property and class declarations */ @Override public Reasoner bindSchema(Model tbox) throws ReasonerException { return bindSchema(new FGraph(tbox.getGraph())); }
/** * Constructor. Create a new backward inference graph to process * the given data. The parent reasoner supplies the ruleset and * any additional schema graph. * * @param reasoner the parent reasoner * @param ruleStore the indexed set of rules to use * @param data the data graph to be processed * @param schema optional precached schema (use null if not required) */ public LPBackwardRuleInfGraph(Reasoner reasoner, LPRuleStore ruleStore, Graph data, Graph schema) { super(data, reasoner); if (schema != null) { fschema = new FGraph(schema); } engine = new LPBRuleEngine(this, ruleStore); tempNodecache = new TempNodeCache(this); }
/** * 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. */ @Override public synchronized void prepare() { if (this.isPrepared()) return; fdeductions = new FGraph( Factory.createGraphMem() ); extractAxioms(); dataFind = fdata; if (fdeductions != null) { dataFind = FinderUtil.cascade(dataFind, fdeductions); } if (fschema != null) { dataFind = FinderUtil.cascade(dataFind, fschema); } this.setPreparedState(true); }
/** * 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. */ @Override public synchronized void prepare() { if (this.isPrepared()) return; this.setPreparedState(true); // initilize the deductions graph fdeductions = new FGraph( createDeductionsGraph() ); boolean rulesLoaded = false; if (schemaGraph != null) { rulesLoaded = preloadDeductions(schemaGraph); } if (rulesLoaded) { engine.fastInit(fdata); } else { engine.init(true, fdata); } }
oldDeductions.clear(); } else { fdeductions = new FGraph( createDeductionsGraph() ); FGraph finserts = new FGraph(inserts); dataSource = FinderUtil.cascade(fdata, finserts); dataFind = FinderUtil.cascade(dataFind, finserts); Graph rawPreload = ((InfGraph)schemaGraph).getRawGraph(); if (rawPreload != null) { dataFind = FinderUtil.cascade(dataFind, new FGraph(rawPreload));