1 10 package com.hp.hpl.jena.reasoner.rulesys; 11 12 import com.hp.hpl.jena.graph.*; 13 import com.hp.hpl.jena.reasoner.*; 14 import com.hp.hpl.jena.reasoner.rulesys.impl.*; 15 16 import java.util.*; 17 18 24 public class RETERuleInfGraph extends BasicForwardRuleInfGraph { 25 26 36 public RETERuleInfGraph(Reasoner reasoner, Graph schema) { 37 super(reasoner, schema); 38 } 39 40 51 public RETERuleInfGraph(Reasoner reasoner, List rules, Graph schema) { 52 super(reasoner, rules, schema); 53 } 54 55 64 public RETERuleInfGraph(Reasoner reasoner, List rules, Graph schema, Graph data) { 65 super(reasoner, rules, schema, data); 66 } 67 68 73 protected void instantiateRuleEngine(List rules) { 74 if (rules != null) { 75 engine = new RETEEngine(this, rules); 76 } else { 77 engine = new RETEEngine(this); 78 } 79 } 80 81 85 public synchronized void performAdd(Triple t) { 86 if (!isPrepared) prepare(); 87 fdata.getGraph().add(t); 88 engine.add(t); 89 } 90 91 94 public void performDelete(Triple t) { 95 if (!isPrepared) prepare(); 96 if (fdata != null) { 97 Graph data = fdata.getGraph(); 98 if (data != null) { 99 data.delete(t); 100 } 101 } 102 engine.delete(t); 103 fdeductions.getGraph().delete(t); 104 } 105 106 } 107 108 109 | Popular Tags |