public class FRuleEngine extends Object implements FRuleEngineI
Modifier and Type | Class and Description |
---|---|
static class |
FRuleEngine.RuleStore
Structure used to wrap up processed rule indexes.
|
Constructor and Description |
---|
FRuleEngine(ForwardRuleInfGraphI parent)
Constructor.
|
FRuleEngine(ForwardRuleInfGraphI parent,
List<Rule> rules)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
void |
compile(List<Rule> rules,
boolean ignoreBrules)
Compile a list of rules into the internal rule store representation.
|
boolean |
delete(Triple t)
Remove one triple to the data graph.
|
void |
fastInit(Finder inserts)
Process all available data.
|
long |
getNRulesFired()
Return the number of rules fired since this rule engine instance
was created and initialized
|
Object |
getRuleStore()
Access the precomputed internal rule form.
|
void |
init(boolean ignoreBrules,
Finder inserts)
Process all available data.
|
static boolean |
match(Node pattern,
Node node,
BindingStack env)
Test if a pattern Node matches a Triple Node in the given binding
environment.
|
static boolean |
match(TriplePattern pattern,
Triple triple,
BindingStack env)
Test if a TriplePattern matches a Triple in the given binding
environment.
|
static int |
scoreNodeBoundness(Node n,
BindingEnvironment env)
Score a Node in terms of groundedness - heuristic.
|
void |
setDerivationLogging(boolean recordDerivations)
Set to true to enable derivation caching
|
void |
setRuleStore(Object ruleStore)
Set the internal rule from a precomputed state.
|
boolean |
shouldTrace()
Return true if the internal engine state means that tracing is worthwhile.
|
public FRuleEngine(ForwardRuleInfGraphI parent, List<Rule> rules)
parent
- the F or FB infGraph that it using this engine, the parent graph
holds the deductions graph and source data.rules
- the rule set to be processedpublic FRuleEngine(ForwardRuleInfGraphI parent)
parent
- the F or FB infGraph that it using this engine, the parent graph
holds the deductions graph and source data.public void init(boolean ignoreBrules, Finder inserts)
init
in interface FRuleEngineI
ignoreBrules
- set to true if rules written in backward notation should be ignoredinserts
- the set of triples to be processed, normally this is the
raw data graph but may include additional deductions made by preprocessing hookspublic void fastInit(Finder inserts)
fastInit
in interface FRuleEngineI
inserts
- the set of triples to be processed, normally this is the
raw data graph but may include additional deductions made by preprocessing hookspublic void add(Triple t)
add
in interface FRuleEngineI
public boolean delete(Triple t)
delete
in interface FRuleEngineI
public long getNRulesFired()
getNRulesFired
in interface FRuleEngineI
public boolean shouldTrace()
shouldTrace
in interface FRuleEngineI
public void setDerivationLogging(boolean recordDerivations)
setDerivationLogging
in interface FRuleEngineI
public Object getRuleStore()
getRuleStore
in interface FRuleEngineI
public void setRuleStore(Object ruleStore)
setRuleStore
in interface FRuleEngineI
public void addSet(BFRuleContext context)
context
- a context containing a set of new triples to be addedpublic void compile(List<Rule> rules, boolean ignoreBrules)
rules
- the list of Rule objectsignoreBrules
- set to true if rules written in backward notation should be ignoredpublic static int scoreNodeBoundness(Node n, BindingEnvironment env)
public static boolean match(TriplePattern pattern, Triple triple, BindingStack env)
public static boolean match(Node pattern, Node node, BindingStack env)
Licenced under the Apache License, Version 2.0