|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> impl >> [ oldCode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.hp.hpl.jena.reasoner.rulesys.impl.oldCode
Class OrigFBRuleInfGraph

java.lang.Objectcom.hp.hpl.jena.graph.impl.GraphBase
com.hp.hpl.jena.reasoner.BaseInfGraph
com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph
com.hp.hpl.jena.reasoner.rulesys.impl.oldCode.OrigFBRuleInfGraph
- All Implemented Interfaces:
- com.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI, com.hp.hpl.jena.reasoner.rulesys.ForwardRuleInfGraphI, com.hp.hpl.jena.graph.Graph, com.hp.hpl.jena.graph.GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform, com.hp.hpl.jena.reasoner.InfGraph, com.hp.hpl.jena.reasoner.rulesys.SilentAddI
- public class OrigFBRuleInfGraph
- extends com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph
- implements com.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI
- extends com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph
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).
- Version:
- $Revision: 1.6 $ on $Date: 2005/02/21 12:18:05 $
| Nested Class Summary | |
static class |
OrigFBRuleInfGraph.RuleStore
Structure used to wrap up pre-processed/compiled rule sets. |
| Nested classes inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
com.hp.hpl.jena.reasoner.BaseInfGraph.InfCapabilities, com.hp.hpl.jena.reasoner.BaseInfGraph.InfFindSafeCapabilities, com.hp.hpl.jena.reasoner.BaseInfGraph.InfTransactionHandler |
| Field Summary | |
protected BRuleEngine |
bEngine
The core backward rule engine which includes all the memoized results |
protected com.hp.hpl.jena.reasoner.rulesys.impl.BBRuleContext |
context
Single context for the reasoner, used when passing information to builtins |
protected com.hp.hpl.jena.reasoner.Finder |
dataFind
A finder that searches across the data, schema, axioms and forward deductions |
(package private) static org.apache.commons.logging.Log |
logger
|
protected java.util.List |
preprocessorHooks
Optional list of preprocessing hooks to be run in sequence during preparation time |
protected java.util.List |
rawRules
The original rule set as supplied |
protected java.util.List |
rules
The rule list after possible extension by preprocessing hooks |
protected com.hp.hpl.jena.reasoner.rulesys.impl.TempNodeCache |
tempNodecache
Cache of temporary property values inferred through getTemp calls |
protected com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveEngine |
transitiveEngine
Optional precomputed cache of the subClass/subproperty lattices |
static boolean |
useRETE
Static switch from Basic to RETE implementation of the forward component |
protected boolean |
useTGCCaching
Flag, if true then subClass and subProperty lattices will be optimized using TGCs |
| Fields inherited from class com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph |
derivations, engine, fdeductions, schemaGraph, traceOn |
| Fields inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
fdata, isPrepared, reasoner, recordDerivations |
| Fields inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
bulkHandler, capabilities, closed, gem, pm, queryHandler, reifier, style |
| Fields inherited from interface com.hp.hpl.jena.graph.Graph |
emptyGraph |
| Constructor Summary | |
OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner,
com.hp.hpl.jena.graph.Graph schema)
Constructor. |
|
OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner,
java.util.List rules,
com.hp.hpl.jena.graph.Graph schema)
Constructor. |
|
OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner,
java.util.List rules,
com.hp.hpl.jena.graph.Graph schema,
com.hp.hpl.jena.graph.Graph data)
Constructor. |
|
| Method Summary | |
void |
addBRule(com.hp.hpl.jena.reasoner.rulesys.Rule brule)
Adds a new Backward rule as a rusult of a forward rule process. |
void |
addBRules(java.util.List rules)
Adds a set of new Backward rules |
void |
addDeduction(com.hp.hpl.jena.graph.Triple t)
Add a new deduction to the deductions graph. |
void |
addPreprocessingHook(com.hp.hpl.jena.reasoner.rulesys.RulePreprocessHook hook)
Add a new preprocessing hook defining an operation that should be run when the preparation phase is underway. |
void |
addRuleDuringPrepare(com.hp.hpl.jena.reasoner.rulesys.Rule rule)
Add a new rule to the rule set. |
com.hp.hpl.jena.reasoner.InfGraph |
cloneWithPremises(com.hp.hpl.jena.graph.Graph premises)
Return a new inference graph which is a clone of the current graph together with an additional set of data premises. |
void |
deleteBRule(com.hp.hpl.jena.reasoner.rulesys.Rule brule)
Deletes a new Backward rule as a rules of a forward rule process. |
private static java.util.List |
extractPureBackwardRules(java.util.List rules)
Scan the initial rule set and pick out all the backward-only rules with non-null bodies, and transfer these rules to the backward engine. |
com.hp.hpl.jena.util.iterator.ExtendedIterator |
find(com.hp.hpl.jena.reasoner.TriplePattern pattern)
Basic pattern lookup interface. |
com.hp.hpl.jena.util.iterator.ExtendedIterator |
findDataMatches(com.hp.hpl.jena.graph.Node subject,
com.hp.hpl.jena.graph.Node predicate,
com.hp.hpl.jena.graph.Node object)
Search the combination of data and deductions graphs for the given triple pattern. |
com.hp.hpl.jena.util.iterator.ExtendedIterator |
findDataMatches(com.hp.hpl.jena.reasoner.TriplePattern pattern)
Search the combination of data and deductions graphs for the given triple pattern. |
com.hp.hpl.jena.util.iterator.ExtendedIterator |
findWithContinuation(com.hp.hpl.jena.reasoner.TriplePattern pattern,
com.hp.hpl.jena.reasoner.Finder continuation)
Extended find interface used in situations where the implementator may or may not be able to answer the complete query. |
java.util.List |
getBRules()
Return an ordered list of all registered backward rules. |
private java.lang.Object |
getForwardRuleStore()
Return a compiled representation of all the registered forward rules. |
long |
getNRulesFired()
Return the number of rules fired since this rule engine instance was created and initialized |
java.util.List |
getRules()
Return the originally supplied set of rules, may be a mix of forward and backward rules. |
com.hp.hpl.jena.graph.Node |
getTemp(com.hp.hpl.jena.graph.Node instance,
com.hp.hpl.jena.graph.Node prop,
com.hp.hpl.jena.graph.Node pclass)
Retrieve or create a bNode representing an inferred property value. |
com.hp.hpl.jena.util.iterator.ExtendedIterator |
graphBaseFind(com.hp.hpl.jena.graph.Node subject,
com.hp.hpl.jena.graph.Node property,
com.hp.hpl.jena.graph.Node object)
Returns an iterator over Triples. |
protected void |
instantiateRuleEngine(java.util.List rules)
Instantiate the forward rule engine to use. |
void |
performAdd(com.hp.hpl.jena.graph.Triple t)
Add one triple to the data graph, run any rules triggered by the new data item, recursively adding any generated triples. |
void |
performDelete(com.hp.hpl.jena.graph.Triple t)
Removes the triple t (if possible) from the set belonging to this graph. |
protected boolean |
preloadDeductions(com.hp.hpl.jena.graph.Graph preloadIn)
Adds a set of precomputed triples to the deductions store. |
void |
prepare()
Perform any initial processing and caching. |
boolean |
processBuiltin(com.hp.hpl.jena.reasoner.rulesys.ClauseEntry clause,
com.hp.hpl.jena.reasoner.rulesys.Rule rule,
com.hp.hpl.jena.reasoner.rulesys.BindingEnvironment env)
Process a call to a builtin predicate |
void |
rebind()
Cause the inference graph to reconsult the underlying graph to take into account changes. |
void |
reset()
Flush out all cached results. |
void |
setDerivationLogging(boolean recordDerivations)
Set to true to enable derivation caching |
void |
setTraceOn(boolean state)
Set the state of the trace flag. |
void |
setUseTGCCache()
Instantiate the optional caches for the subclass/suproperty lattices. |
| Methods inherited from class com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph |
close, getCurrentDeductionsGraph, getDeductionsGraph, getDerivation, getSchemaGraph, graphBaseSize, logDerivation, rebind, setRuleStore, shouldLogDerivations, shouldTrace, silentAdd |
| Methods inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
discardState, find, getBulkUpdateHandler, getCapabilities, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getReifier, getTransactionHandler, graphBaseFind, isEmpty, testGlobalProperty, validate |
| Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
add, checkOpen, contains, contains, containsByFind, delete, dependsOn, find, find, getEventManager, graphBaseContains, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, reifierContains, reifierSize, reifierTriples, size, toString, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI |
logDerivation |
| Methods inherited from interface com.hp.hpl.jena.reasoner.rulesys.SilentAddI |
silentAdd |
| Methods inherited from interface com.hp.hpl.jena.reasoner.InfGraph |
find, getDeductionsGraph, getDerivation, getGlobalProperty, getRawGraph, getReasoner, rebind, testGlobalProperty, validate |
| Methods inherited from interface com.hp.hpl.jena.graph.Graph |
close, contains, contains, delete, dependsOn, find, find, getBulkUpdateHandler, getCapabilities, getEventManager, getPrefixMapping, getReifier, getTransactionHandler, isEmpty, isIsomorphicWith, queryHandler, size |
| Methods inherited from interface com.hp.hpl.jena.graph.GraphAdd |
add |
| Field Detail |
context
protected com.hp.hpl.jena.reasoner.rulesys.impl.BBRuleContext context
- Single context for the reasoner, used when passing information to builtins
dataFind
protected com.hp.hpl.jena.reasoner.Finder dataFind
- A finder that searches across the data, schema, axioms and forward deductions
bEngine
protected BRuleEngine bEngine
- The core backward rule engine which includes all the memoized results
rawRules
protected java.util.List rawRules
- The original rule set as supplied
rules
protected java.util.List rules
- The rule list after possible extension by preprocessing hooks
useRETE
public static boolean useRETE
- Static switch from Basic to RETE implementation of the forward component
useTGCCaching
protected boolean useTGCCaching
- Flag, if true then subClass and subProperty lattices will be optimized using TGCs
transitiveEngine
protected com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveEngine transitiveEngine
- Optional precomputed cache of the subClass/subproperty lattices
preprocessorHooks
protected java.util.List preprocessorHooks
- Optional list of preprocessing hooks to be run in sequence during preparation time
tempNodecache
protected com.hp.hpl.jena.reasoner.rulesys.impl.TempNodeCache tempNodecache
- Cache of temporary property values inferred through getTemp calls
logger
static org.apache.commons.logging.Log logger
| Constructor Detail |
OrigFBRuleInfGraph
public OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner, com.hp.hpl.jena.graph.Graph schema)
- Constructor.
OrigFBRuleInfGraph
public OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner, java.util.List rules, com.hp.hpl.jena.graph.Graph schema)
- Constructor.
OrigFBRuleInfGraph
public OrigFBRuleInfGraph(com.hp.hpl.jena.reasoner.Reasoner reasoner, java.util.List rules, com.hp.hpl.jena.graph.Graph schema, com.hp.hpl.jena.graph.Graph data)
- Constructor.
| Method Detail |
instantiateRuleEngine
protected void instantiateRuleEngine(java.util.List rules)
- Instantiate the forward rule engine to use.
Subclasses can override this to switch to, say, a RETE imlementation.
setUseTGCCache
public void setUseTGCCache()
- Instantiate the optional caches for the subclass/suproperty lattices.
Unless this call is made the TGC caching will not be used.
findDataMatches
public com.hp.hpl.jena.util.iterator.ExtendedIterator findDataMatches(com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node predicate, com.hp.hpl.jena.graph.Node object)
- 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.
- Specified by:
findDataMatchesin interfacecom.hp.hpl.jena.reasoner.rulesys.ForwardRuleInfGraphI
findDataMatches
public com.hp.hpl.jena.util.iterator.ExtendedIterator findDataMatches(com.hp.hpl.jena.reasoner.TriplePattern pattern)
- 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.
- Specified by:
findDataMatchesin interfacecom.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI
processBuiltin
public boolean processBuiltin(com.hp.hpl.jena.reasoner.rulesys.ClauseEntry clause, com.hp.hpl.jena.reasoner.rulesys.Rule rule, com.hp.hpl.jena.reasoner.rulesys.BindingEnvironment env)
- Process a call to a builtin predicate
- Specified by:
processBuiltinin interfacecom.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI
addBRule
public void addBRule(com.hp.hpl.jena.reasoner.rulesys.Rule brule)
- Adds a new Backward rule as a rusult of a forward rule process. Only some
infgraphs support this.
- Specified by:
addBRulein interfacecom.hp.hpl.jena.reasoner.rulesys.ForwardRuleInfGraphI
deleteBRule
public void deleteBRule(com.hp.hpl.jena.reasoner.rulesys.Rule brule)
- Deletes a new Backward rule as a rules of a forward rule process. Only some
infgraphs support this.
- Specified by:
deleteBRulein interfacecom.hp.hpl.jena.reasoner.rulesys.ForwardRuleInfGraphI
addBRules
public void addBRules(java.util.List rules)
- Adds a set of new Backward rules
getBRules
public java.util.List getBRules()
- Return an ordered list of all registered backward rules. Includes those
generated by forward productions.
getRules
public java.util.List getRules()
- Return the originally supplied set of rules, may be a mix of forward
and backward rules.
getForwardRuleStore
private java.lang.Object getForwardRuleStore()
- Return a compiled representation of all the registered
forward rules.
addDeduction
public void addDeduction(com.hp.hpl.jena.graph.Triple t)
- Add a new deduction to the deductions graph.
- Specified by:
addDeductionin interfacecom.hp.hpl.jena.reasoner.rulesys.ForwardRuleInfGraphI
getTemp
public com.hp.hpl.jena.graph.Node getTemp(com.hp.hpl.jena.graph.Node instance, com.hp.hpl.jena.graph.Node prop, com.hp.hpl.jena.graph.Node pclass)
- Retrieve or create a bNode representing an inferred property value.
- Specified by:
getTempin interfacecom.hp.hpl.jena.reasoner.rulesys.BackwardRuleInfGraphI
addRuleDuringPrepare
public void addRuleDuringPrepare(com.hp.hpl.jena.reasoner.rulesys.Rule rule)
- 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.
addPreprocessingHook
public void addPreprocessingHook(com.hp.hpl.jena.reasoner.rulesys.RulePreprocessHook hook)
- Add a new preprocessing hook defining an operation that
should be run when the preparation phase is underway.
prepare
public void prepare()
- 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.
- Specified by:
preparein interfacecom.hp.hpl.jena.reasoner.InfGraph
rebind
public void rebind()
- 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.
- Specified by:
rebindin interfacecom.hp.hpl.jena.reasoner.InfGraph
setTraceOn
public void setTraceOn(boolean state)
- Set the state of the trace flag. If set to true then rule firings
are logged out to the Log at "INFO" level.
setDerivationLogging
public void setDerivationLogging(boolean recordDerivations)
- Set to true to enable derivation caching
- Specified by:
setDerivationLoggingin interfacecom.hp.hpl.jena.reasoner.InfGraph
getNRulesFired
public long getNRulesFired()
- Return the number of rules fired since this rule engine instance
was created and initialized
findWithContinuation
public com.hp.hpl.jena.util.iterator.ExtendedIterator findWithContinuation(com.hp.hpl.jena.reasoner.TriplePattern pattern, com.hp.hpl.jena.reasoner.Finder continuation)
- 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.
graphBaseFind
public com.hp.hpl.jena.util.iterator.ExtendedIterator graphBaseFind(com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node property, com.hp.hpl.jena.graph.Node object)
- Returns an iterator over Triples.
This implementation assumes that the underlying findWithContinuation
will have also consulted the raw data.
find
public com.hp.hpl.jena.util.iterator.ExtendedIterator find(com.hp.hpl.jena.reasoner.TriplePattern pattern)
- Basic pattern lookup interface.
This implementation assumes that the underlying findWithContinuation
will have also consulted the raw data.
reset
public void reset()
- Flush out all cached results. Future queries have to start from scratch.
- Specified by:
resetin interfacecom.hp.hpl.jena.reasoner.InfGraph
performAdd
public void performAdd(com.hp.hpl.jena.graph.Triple t)
- Add one triple to the data graph, run any rules triggered by
the new data item, recursively adding any generated triples.
- Specified by:
performAddin interfacecom.hp.hpl.jena.graph.impl.GraphWithPerform
performDelete
public void performDelete(com.hp.hpl.jena.graph.Triple t)
- Removes the triple t (if possible) from the set belonging to this graph.
- Specified by:
performDeletein interfacecom.hp.hpl.jena.graph.impl.GraphWithPerform
cloneWithPremises
public com.hp.hpl.jena.reasoner.InfGraph cloneWithPremises(com.hp.hpl.jena.graph.Graph premises)
- Return a new inference graph which is a clone of the current graph
together with an additional set of data premises. Attempts to the replace
the default brute force implementation by one that can reuse some of the
existing deductions.
extractPureBackwardRules
private static java.util.List extractPureBackwardRules(java.util.List rules)
- Scan the initial rule set and pick out all the backward-only rules with non-null bodies,
and transfer these rules to the backward engine.
preloadDeductions
protected boolean preloadDeductions(com.hp.hpl.jena.graph.Graph preloadIn)
- 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.
|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> impl >> [ oldCode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC