コード例 #1
0
 /** Removes the triple t (if possible) from the set belonging to this graph. */
 @Override
 public void performDelete(Triple t) {
   version++;
   if (fdata != null) {
     Graph data = fdata.getGraph();
     if (data != null) {
       data.delete(t);
     }
   }
   if (isPrepared) {
     fdeductions.getGraph().delete(t);
   }
 }
コード例 #2
0
 /**
  * Adds a set of precomputed triples to the deductions store. These do not, themselves, fire any
  * rules but provide additional axioms that might enable future rule firing when real data is
  * added. Used to implement bindSchema processing in the parent Reasoner.
  *
  * @return return true if the rule set has also been loaded
  */
 protected boolean preloadDeductions(Graph preloadIn) {
   Graph d = fdeductions.getGraph();
   BasicForwardRuleInfGraph preload = (BasicForwardRuleInfGraph) preloadIn;
   // If the rule set is the same we can reuse those as well
   if (preload.rules == rules) {
     // Load raw deductions
     for (Iterator<Triple> i = preload.find(null, null, null); i.hasNext(); ) {
       d.add(i.next());
     }
     engine.setRuleStore(preload.engine.getRuleStore());
     return true;
   } else {
     return false;
   }
 }
コード例 #3
0
 /**
  * Create the graph used to hold the deductions. Can be overridden by subclasses that need special
  * purpose graph implementations here. Assumes the graph underlying fdeductions and associated
  * SafeGraph wrapper can be reused if present thus enabling preservation of listeners.
  */
 protected Graph createDeductionsGraph() {
   if (fdeductions != null) {
     Graph dg = fdeductions.getGraph();
     if (dg != null) {
       // Reuse the old graph in order to preserve any listeners
       safeDeductions.getBulkUpdateHandler().removeAll();
       return dg;
     }
   }
   Graph dg = Factory.createGraphMem(style);
   safeDeductions = new SafeGraph(dg);
   return dg;
 }