| java.lang.Object com.hp.hpl.jena.reasoner.rulesys.impl.FRuleEngine
FRuleEngine | public class FRuleEngine implements FRuleEngineI(Code) | | The processing engine for forward production rules. It neeeds to reference
an enclosing ForwardInfGraphI which holds the raw data and deductions.
author: Dave Reynolds version: $Revision: 1.28 $ on $Date: 2008/01/02 12:06:16 $ |
Inner Class :protected static class ClausePointer | |
Inner Class :public static class RuleStore | |
Method Summary | |
public synchronized void | add(Triple t) Add one triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples. | public void | addSet(BFRuleContext context) Add a set of new triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples. | public void | compile(List rules, boolean ignoreBrules) Compile a list of rules into the internal rule store representation. | public synchronized boolean | delete(Triple t) Remove one triple to the data graph. | public void | fastInit(Finder inserts) Process all available data. | protected void | findAndProcessActions() | protected void | findAndProcessAxioms() | public long | getNRulesFired() | public Object | getRuleStore() Access the precomputed internal rule form. | public void | init(boolean ignoreBrules, Finder inserts) Process all available data. | public static boolean | match(TriplePattern pattern, Triple triple, BindingStack env) Test if a TriplePattern matches a Triple in the given binding
environment. | public static boolean | match(Node pattern, Node node, BindingStack env) Test if a pattern Node matches a Triple Node in the given binding
environment. | public static int | scoreNodeBoundness(Node n, BindingEnvironment env) Score a Node in terms of groundedness - heuristic.
Treats a variable as better than a wildcard because it constrains
later clauses. | public void | setDerivationLogging(boolean recordDerivations) | public void | setRuleStore(Object ruleStore) Set the internal rule from from a precomputed state. | public boolean | shouldTrace() Return true if the internal engine state means that tracing is worthwhile. |
clauseIndex | protected OneToManyMap clauseIndex(Code) | | Map from predicate node to rule + clause, Node_ANY is used for wildcard predicates
|
logger | protected static Log logger(Code) | | |
nAxiomRulesFired | long nAxiomRulesFired(Code) | | performance stats - number of rules fired during axiom initialization
|
nRulesFired | long nRulesFired(Code) | | performance stats - number of rules fired
|
nRulesTriggered | int nRulesTriggered(Code) | | performance stats - number of rules passing initial trigger
|
predicatesUsed | protected HashSet predicatesUsed(Code) | | List of predicates used in rules to assist in fast data loading
|
processedAxioms | boolean processedAxioms(Code) | | True if we have processed the axioms in the rule set
|
recordDerivations | protected boolean recordDerivations(Code) | | Set to true to flag that derivations should be logged
|
rules | protected List rules(Code) | | Set of rules being used
|
wildcardRule | protected boolean wildcardRule(Code) | | Flag, if true then there is a wildcard predicate in the rule set so that selective insert is not useful
|
FRuleEngine | public FRuleEngine(ForwardRuleInfGraphI parent, List rules)(Code) | | Constructor.
Parameters: parent - the F or FB infGraph that it using this engine, the parent graphholds the deductions graph and source data. Parameters: rules - the rule set to be processed |
FRuleEngine | public FRuleEngine(ForwardRuleInfGraphI parent)(Code) | | Constructor. Build an empty engine to which rules must be added
using setRuleStore().
Parameters: parent - the F or FB infGraph that it using this engine, the parent graphholds the deductions graph and source data. |
add | public synchronized void add(Triple t)(Code) | | Add one triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples.
|
addSet | public void addSet(BFRuleContext context)(Code) | | Add a set of new triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples.
Technically the triples having been physically added to either the
base or deduction graphs and the job of this function is just to
process the stack of additions firing any relevant rules.
Parameters: context - a context containing a set of new triples to be added |
compile | public void compile(List rules, boolean ignoreBrules)(Code) | | Compile a list of rules into the internal rule store representation.
Parameters: rules - the list of Rule objects Parameters: ignoreBrules - set to true if rules written in backward notation should be ignored an object that can be installed into the engine using setRuleStore. |
delete | public synchronized boolean delete(Triple t)(Code) | | Remove one triple to the data graph.
true if the effects could be correctly propagated orfalse if not (in which case the entire engine should be restarted). |
fastInit | public void fastInit(Finder inserts)(Code) | | Process all available data. This version expects that all the axioms
have already be preprocessed and the clause index already exists.
Parameters: inserts - the set of triples to be processed, normally this is theraw data graph but may include additional deductions made by preprocessing hooks |
findAndProcessActions | protected void findAndProcessActions()(Code) | | Scan the rules for any actions and run those
|
findAndProcessAxioms | protected void findAndProcessAxioms()(Code) | | Scan the rules for any axioms and insert those
|
getNRulesFired | public long getNRulesFired()(Code) | | Return the number of rules fired since this rule engine instance
was created and initialized
|
getRuleStore | public Object getRuleStore()(Code) | | Access the precomputed internal rule form. Used when precomputing the
internal axiom closures.
|
init | public void init(boolean ignoreBrules, Finder inserts)(Code) | | Process all available data. This should be called once a deductions graph
has be prepared and loaded with any precomputed deductions. It will process
the rule axioms and all relevant existing exiting data entries.
Parameters: ignoreBrules - set to true if rules written in backward notation should be ignored Parameters: inserts - the set of triples to be processed, normally this is theraw data graph but may include additional deductions made by preprocessing hooks |
match | public static boolean match(TriplePattern pattern, Triple triple, BindingStack env)(Code) | | Test if a TriplePattern matches a Triple in the given binding
environment. If it does then the binding environment is modified
the reflect any additional bindings.
true if the pattern matches the triple |
match | public static boolean match(Node pattern, Node node, BindingStack env)(Code) | | Test if a pattern Node matches a Triple Node in the given binding
environment. If it does then the binding environment is modified
the reflect any additional bindings.
true if the pattern matches the node |
scoreNodeBoundness | public static int scoreNodeBoundness(Node n, BindingEnvironment env)(Code) | | Score a Node in terms of groundedness - heuristic.
Treats a variable as better than a wildcard because it constrains
later clauses. Treats rdf:type as worse than any other ground node
because that tends to link to lots of expensive rules.
|
setDerivationLogging | public void setDerivationLogging(boolean recordDerivations)(Code) | | Set to true to enable derivation caching
|
setRuleStore | public void setRuleStore(Object ruleStore)(Code) | | Set the internal rule from from a precomputed state.
|
shouldTrace | public boolean shouldTrace()(Code) | | Return true if the internal engine state means that tracing is worthwhile.
It will return false during the axiom bootstrap phase.
|
|
|