| com.hp.hpl.jena.reasoner.BaseInfGraph com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph com.hp.hpl.jena.reasoner.rulesys.FBRuleInfGraph
All known Subclasses: com.hp.hpl.jena.reasoner.rulesys.RDFSRuleInfGraph, com.hp.hpl.jena.reasoner.rulesys.impl.oldCode.FBLPRuleInfGraph,
FBRuleInfGraph | public class FBRuleInfGraph extends BasicForwardRuleInfGraph implements BackwardRuleInfGraphI(Code) | | An inference graph that uses a mixture of forward and backward
chaining rules. The forward rules can create direct deductions from
the source data and schema and can also create backward rules. A
query is answered by consulting the union of the raw data, the forward
derived results and any relevant backward rules (whose answers are tabled
for future reference).
author: Dave Reynolds version: $Revision: 1.67 $ on $Date: 2008/01/02 12:07:47 $ |
Inner Class :public static class RuleStore | |
Method Summary | |
public boolean | accept(Object tin) Post-filter query results to hide unwanted
triples from the glare of publicity. | public void | addBRule(Rule brule) Adds a new Backward rule as a rusult of a forward rule process. | public void | addBRules(List rules) | public void | addDeduction(Triple t) Add a new deduction to the deductions graph. | public void | addPreprocessingHook(RulePreprocessHook hook) Add a new preprocessing hook defining an operation that
should be run when the preparation phase is underway. | public void | addRuleDuringPrepare(Rule rule) Add a new rule to the rule set. | public void | close() Free all resources, any further use of this Graph is an error. | public void | deleteBRule(Rule brule) Deletes a new Backward rule as a rules of a forward rule process. | public ExtendedIterator | find(TriplePattern pattern) Basic pattern lookup interface. | public ExtendedIterator | findDataMatches(Node subject, Node predicate, Node object) Search the combination of data and deductions graphs for the given triple pattern. | public ExtendedIterator | findDataMatches(TriplePattern pattern) Search the combination of data and deductions graphs for the given triple pattern. | public ExtendedIterator | findFull(TriplePattern pattern) Internal variant of find which omits the filters which block illegal RDF data. | public ExtendedIterator | findWithContinuation(TriplePattern pattern, Finder continuation) Extended find interface used in situations where the implementator
may or may not be able to answer the complete query. | public List | getBRules() Return an ordered list of all registered backward rules. | public long | getNRulesFired() Return the number of rules fired since this rule engine instance
was created and initialized. | public List | getRules() Return the originally supplied set of rules, may be a mix of forward
and backward rules. | public Node | getTemp(Node instance, Node prop, Node pclass) Retrieve or create a bNode representing an inferred property value.
Parameters: instance - the base instance node to which the property applies Parameters: prop - the property node whose value is being inferred Parameters: pclass - the (optional, can be null) class for the inferred value. | public ExtendedIterator | graphBaseFind(Node subject, Node property, Node object) Returns an iterator over Triples. | public void | hideNode(Node n) Called to flag that a node should be hidden from external queries. | protected void | instantiateRuleEngine(List rules) Instantiate the forward rule engine to use. | public synchronized void | performAdd(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 | performDelete(Triple t) Removes the triple t (if possible) from the set belonging to this graph. | protected boolean | preloadDeductions(Graph preloadIn) Adds a set of precomputed triples to the deductions store. | public void | prepare() Perform any initial processing and caching. | public void | printLPProfile() Print a profile of LP rules used since the last reset. | public boolean | processBuiltin(ClauseEntry clause, Rule rule, BindingEnvironment env) | public void | rebind() Cause the inference graph to reconsult the underlying graph to take
into account changes. | public void | rebindAll() Cause the inference graph to reconsult both the underlying graph and
the reasoner ruleset, permits the forward rule set to be dynamically changed.
Causes the entire rule engine to be rebuilt from the current ruleset and
reinitialized against the current data. | public void | reset() Flush out all cached results. | public void | resetLPProfile(boolean enable) Reset the LP engine profile. | public void | setDerivationLogging(boolean recordDerivations) | public void | setFunctorFiltering(boolean param) Set to true to cause functor-valued literals to be dropped from rule output. | public void | setTabled(Node predicate) Set a predicate to be tabled/memoized by the LP engine. | public void | setTraceOn(boolean state) Set the state of the trace flag. | public void | setUseTGCCache() Instantiate the optional caches for the subclass/suproperty lattices. | public ValidityReport | validate() Test the consistency of the bound data. |
bEngine | protected LPBRuleEngine bEngine(Code) | | The core backward rule engine which includes all the memoized results
|
context | protected BBRuleContext context(Code) | | Single context for the reasoner, used when passing information to builtins
|
dataFind | protected Finder dataFind(Code) | | A finder that searches across the data, schema, axioms and forward deductions
|
filterFunctors | public boolean filterFunctors(Code) | | Flag, if true then find results will be filtered to remove functors and illegal RDF
|
hiddenNodes | protected Set hiddenNodes(Code) | | Table of temp nodes which should be hidden from output listings
|
preprocessorHooks | protected List preprocessorHooks(Code) | | Optional list of preprocessing hooks to be run in sequence during preparation time
|
rawRules | protected List rawRules(Code) | | The original rule set as supplied
|
rules | protected List rules(Code) | | The rule list after possible extension by preprocessing hooks
|
tempNodecache | protected TempNodeCache tempNodecache(Code) | | Cache of temporary property values inferred through getTemp calls
|
transitiveEngine | protected TransitiveEngine transitiveEngine(Code) | | Optional precomputed cache of the subClass/subproperty lattices
|
useRETE | public static boolean useRETE(Code) | | Static switch from Basic to RETE implementation of the forward component
|
useTGCCaching | protected boolean useTGCCaching(Code) | | Flag, if true then subClass and subProperty lattices will be optimized using TGCs
|
FBRuleInfGraph | public FBRuleInfGraph(Reasoner reasoner, Graph schema)(Code) | | Constructor.
Parameters: reasoner - the reasoner which created this inf graph instance Parameters: schema - the (optional) schema graph to be included |
FBRuleInfGraph | public FBRuleInfGraph(Reasoner reasoner, List rules, Graph schema)(Code) | | Constructor.
Parameters: reasoner - the reasoner which created this inf graph instance Parameters: rules - the rules to process Parameters: schema - the (optional) schema graph to be included |
FBRuleInfGraph | public FBRuleInfGraph(Reasoner reasoner, List rules, Graph schema, Graph data)(Code) | | Constructor.
Parameters: reasoner - the reasoner which created this inf graph instance Parameters: rules - the rules to process Parameters: schema - the (optional) schema graph to be included Parameters: data - the data graph to be processed |
accept | public boolean accept(Object tin)(Code) | | Post-filter query results to hide unwanted
triples from the glare of publicity. Unwanted triples
are triples with Functor literals and triples with hidden nodes
as subject or object.
|
addBRule | public void addBRule(Rule brule)(Code) | | Adds a new Backward rule as a rusult of a forward rule process. Only some
infgraphs support this.
|
addBRules | public void addBRules(List rules)(Code) | | Adds a set of new Backward rules
|
addDeduction | public void addDeduction(Triple t)(Code) | | Add a new deduction to the deductions graph.
|
addPreprocessingHook | public void addPreprocessingHook(RulePreprocessHook hook)(Code) | | Add a new preprocessing hook defining an operation that
should be run when the preparation phase is underway.
|
addRuleDuringPrepare | public void addRuleDuringPrepare(Rule rule)(Code) | | Add a new rule to the rule set. This should only be used by implementations
of RuleProprocessHook (which are called during rule system preparation phase).
If called at other times the rule won't be correctly transferred into the
underlying engines.
|
close | public void close()(Code) | | Free all resources, any further use of this Graph is an error.
|
deleteBRule | public void deleteBRule(Rule brule)(Code) | | Deletes a new Backward rule as a rules of a forward rule process. Only some
infgraphs support this.
|
find | public ExtendedIterator find(TriplePattern pattern)(Code) | | Basic pattern lookup interface.
This implementation assumes that the underlying findWithContinuation
will have also consulted the raw data.
Parameters: pattern - a TriplePattern to be matched against the data a ExtendedIterator over all Triples in the data setthat match the pattern |
findDataMatches | public ExtendedIterator findDataMatches(Node subject, Node predicate, Node object)(Code) | | Search the combination of data and deductions graphs for the given triple pattern.
This may different from the normal find operation in the base of hybrid reasoners
where we are side-stepping the backward deduction step.
|
findDataMatches | public ExtendedIterator findDataMatches(TriplePattern pattern)(Code) | | Search the combination of data and deductions graphs for the given triple pattern.
This may different from the normal find operation in the base of hybrid reasoners
where we are side-stepping the backward deduction step.
|
findFull | public ExtendedIterator findFull(TriplePattern pattern)(Code) | | Internal variant of find which omits the filters which block illegal RDF data.
Parameters: pattern - a TriplePattern to be matched against the data |
findWithContinuation | public ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation)(Code) | | Extended find interface used in situations where the implementator
may or may not be able to answer the complete query. It will
attempt to answer the pattern but if its answers are not known
to be complete then it will also pass the request on to the nested
Finder to append more results.
Parameters: pattern - a TriplePattern to be matched against the data Parameters: continuation - either a Finder or a normal Graph whichwill be asked for additional match results if the implementormay not have completely satisfied the query. |
getBRules | public List getBRules()(Code) | | Return an ordered list of all registered backward rules. Includes those
generated by forward productions.
|
getNRulesFired | public long getNRulesFired()(Code) | | Return the number of rules fired since this rule engine instance
was created and initialized. The current implementation only counts
forward rules and does not track dynamic backward rules needed for
specific queries.
|
getRules | public List getRules()(Code) | | Return the originally supplied set of rules, may be a mix of forward
and backward rules.
|
getTemp | public Node getTemp(Node instance, Node prop, Node pclass)(Code) | | Retrieve or create a bNode representing an inferred property value.
Parameters: instance - the base instance node to which the property applies Parameters: prop - the property node whose value is being inferred Parameters: pclass - the (optional, can be null) class for the inferred value. the bNode representing the property value |
graphBaseFind | public ExtendedIterator graphBaseFind(Node subject, Node property, Node object)(Code) | | Returns an iterator over Triples.
This implementation assumes that the underlying findWithContinuation
will have also consulted the raw data.
|
hideNode | public void hideNode(Node n)(Code) | | Called to flag that a node should be hidden from external queries.
|
instantiateRuleEngine | protected void instantiateRuleEngine(List rules)(Code) | | Instantiate the forward rule engine to use.
Subclasses can override this to switch to, say, a RETE imlementation.
Parameters: rules - the rule set or null if there are not rules bound in yet. |
performAdd | public synchronized void performAdd(Triple t)(Code) | | Add one triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples.
|
performDelete | public void performDelete(Triple t)(Code) | | Removes the triple t (if possible) from the set belonging to this graph.
|
preloadDeductions | protected boolean preloadDeductions(Graph preloadIn)(Code) | | 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.
true if the preload was able to load rules as well |
prepare | public void prepare()(Code) | | 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.
|
printLPProfile | public void printLPProfile()(Code) | | Print a profile of LP rules used since the last reset.
|
processBuiltin | public boolean processBuiltin(ClauseEntry clause, Rule rule, BindingEnvironment env)(Code) | | Process a call to a builtin predicate
Parameters: clause - the Functor representing the call Parameters: env - the BindingEnvironment for this call Parameters: rule - the rule which is invoking this call true if the predicate succeeds |
rebind | public void rebind()(Code) | | Cause the inference graph to reconsult the underlying graph to take
into account changes. Normally changes are made through the InfGraph's add and
remove calls are will be handled appropriately. However, in some cases changes
are made "behind the InfGraph's back" and this forces a full reconsult of
the changed data.
|
rebindAll | public void rebindAll()(Code) | | Cause the inference graph to reconsult both the underlying graph and
the reasoner ruleset, permits the forward rule set to be dynamically changed.
Causes the entire rule engine to be rebuilt from the current ruleset and
reinitialized against the current data. Not needed for normal cases.
|
reset | public void reset()(Code) | | Flush out all cached results. Future queries have to start from scratch.
|
resetLPProfile | public void resetLPProfile(boolean enable)(Code) | | Reset the LP engine profile.
Parameters: enable - it true then profiling will continue with a new empty profile table,if false profiling will stop all current data lost. |
setDerivationLogging | public void setDerivationLogging(boolean recordDerivations)(Code) | | Set to true to enable derivation caching
|
setFunctorFiltering | public void setFunctorFiltering(boolean param)(Code) | | Set to true to cause functor-valued literals to be dropped from rule output.
Default is true.
|
setTabled | public void setTabled(Node predicate)(Code) | | Set a predicate to be tabled/memoized by the LP engine.
|
setTraceOn | public void setTraceOn(boolean state)(Code) | | Set the state of the trace flag. If set to true then rule firings
are logged out to the Log at "INFO" level.
|
setUseTGCCache | public void setUseTGCCache()(Code) | | Instantiate the optional caches for the subclass/suproperty lattices.
Unless this call is made the TGC caching will not be used.
|
validate | public ValidityReport validate()(Code) | | Test the consistency of the bound data. This normally tests
the validity of the bound instance data against the bound
schema data.
a ValidityReport structure |
|
|