|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.FBRuleInfGraph
public class FBRuleInfGraph
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).
Nested Class Summary | |
---|---|
static class |
FBRuleInfGraph.RuleStore
Structure used to wrap up pre-processed/compiled rule sets. |
Nested classes/interfaces inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
---|
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities, BaseInfGraph.InfTransactionHandler |
Field Summary | |
---|---|
boolean |
filterFunctors
Flag, if true then find results will be filtered to remove functors and illegal RDF |
static boolean |
useRETE
Static switch from Basic to RETE implementation of the forward component |
Fields inherited from interface com.hp.hpl.jena.graph.Graph |
---|
emptyGraph |
Constructor Summary | |
---|---|
FBRuleInfGraph(Reasoner reasoner,
Graph schema)
Constructor. |
|
FBRuleInfGraph(Reasoner reasoner,
java.util.List rules,
Graph schema)
Constructor. |
|
FBRuleInfGraph(Reasoner reasoner,
java.util.List rules,
Graph schema,
Graph data)
Constructor. |
Method Summary | |
---|---|
boolean |
accept(java.lang.Object tin)
Post-filter query results to hide unwanted triples from the glare of publicity. |
void |
addBRule(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(Triple t)
Add a new deduction to the deductions graph. |
void |
addPreprocessingHook(RulePreprocessHook hook)
Add a new preprocessing hook defining an operation that should be run when the preparation phase is underway. |
void |
addRuleDuringPrepare(Rule rule)
Add a new rule to the rule set. |
InfGraph |
cloneWithPremises(Graph premises)
Return a new inference graph which is a clone of the current graph together with an additional set of data premises. |
void |
close()
Free all resources, any further use of this Graph is an error. |
void |
deleteBRule(Rule brule)
Deletes a new Backward rule as a rules of a forward rule process. |
ExtendedIterator |
find(TriplePattern pattern)
Basic pattern lookup interface. |
ExtendedIterator |
findDataMatches(Node subject,
Node predicate,
Node object)
Search the combination of data and deductions graphs for the given triple pattern. |
ExtendedIterator |
findDataMatches(TriplePattern pattern)
Search the combination of data and deductions graphs for the given triple pattern. |
ExtendedIterator |
findFull(TriplePattern pattern)
Internal variant of find which omits the filters which block illegal RDF data. |
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. |
java.util.List |
getBRules()
Return an ordered list of all registered backward 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. |
Node |
getTemp(Node instance,
Node prop,
Node pclass)
Retrieve or create a bNode representing an inferred property value. |
ExtendedIterator |
graphBaseFind(Node subject,
Node property,
Node object)
Returns an iterator over Triples. |
void |
hideNode(Node n)
Called to flag that a node should be hidden from external queries. |
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. |
void |
performDelete(Triple t)
Removes the triple t (if possible) from the set belonging to this graph. |
void |
prepare()
Perform any initial processing and caching. |
void |
printLPProfile()
Print a profile of LP rules used since the last reset. |
boolean |
processBuiltin(ClauseEntry clause,
Rule rule,
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 |
resetLPProfile(boolean enable)
Reset the LP engine profile. |
void |
setDerivationLogging(boolean recordDerivations)
Set to true to enable derivation caching |
void |
setFunctorFiltering(boolean param)
Set to true to cause functor-valued literals to be dropped from rule output. |
void |
setTabled(Node predicate)
Set a predicate to be tabled/memoized by the LP engine. |
void |
setTraceOn(boolean state)
Set the state of the trace flag. |
void |
setUseTGCCache()
Instantiate the optional caches for the subclass/suproperty lattices. |
ValidityReport |
validate()
Test the consistency of the bound data. |
Methods inherited from class com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph |
---|
getCurrentDeductionsGraph, getDeductionsGraph, getDerivation, getSchemaGraph, graphBaseSize, logDerivation, rebind, setRuleStore, shouldLogDerivations, shouldTrace, silentAdd |
Methods inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
---|
find, getBulkUpdateHandler, getCapabilities, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getReifier, getTransactionHandler, graphBaseFind, isEmpty, testGlobalProperty |
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
---|
add, contains, contains, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getEventManager, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, size, toString, toString |
Methods inherited from class java.lang.Object |
---|
equals, 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 |
Methods inherited from interface com.hp.hpl.jena.graph.Graph |
---|
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 |
---|
public static boolean useRETE
public boolean filterFunctors
Constructor Detail |
---|
public FBRuleInfGraph(Reasoner reasoner, Graph schema)
reasoner
- the reasoner which created this inf graph instanceschema
- the (optional) schema graph to be includedpublic FBRuleInfGraph(Reasoner reasoner, java.util.List rules, Graph schema)
reasoner
- the reasoner which created this inf graph instancerules
- the rules to processschema
- the (optional) schema graph to be includedpublic FBRuleInfGraph(Reasoner reasoner, java.util.List rules, Graph schema, Graph data)
reasoner
- the reasoner which created this inf graph instancerules
- the rules to processschema
- the (optional) schema graph to be includeddata
- the data graph to be processedMethod Detail |
---|
public void setUseTGCCache()
public ExtendedIterator findDataMatches(Node subject, Node predicate, Node object)
findDataMatches
in interface ForwardRuleInfGraphI
findDataMatches
in class BasicForwardRuleInfGraph
public ExtendedIterator findDataMatches(TriplePattern pattern)
findDataMatches
in interface BackwardRuleInfGraphI
public boolean processBuiltin(ClauseEntry clause, Rule rule, BindingEnvironment env)
processBuiltin
in interface BackwardRuleInfGraphI
clause
- the Functor representing the callenv
- the BindingEnvironment for this callrule
- the rule which is invoking this call
public void addBRule(Rule brule)
addBRule
in interface ForwardRuleInfGraphI
addBRule
in class BasicForwardRuleInfGraph
public void deleteBRule(Rule brule)
deleteBRule
in interface ForwardRuleInfGraphI
deleteBRule
in class BasicForwardRuleInfGraph
public void addBRules(java.util.List rules)
public java.util.List getBRules()
public java.util.List getRules()
public void setTabled(Node predicate)
public void addDeduction(Triple t)
addDeduction
in interface ForwardRuleInfGraphI
addDeduction
in class BasicForwardRuleInfGraph
public Node getTemp(Node instance, Node prop, Node pclass)
getTemp
in interface BackwardRuleInfGraphI
instance
- the base instance node to which the property appliesprop
- the property node whose value is being inferredpclass
- the (optional, can be null) class for the inferred value.
public void addRuleDuringPrepare(Rule rule)
public void addPreprocessingHook(RulePreprocessHook hook)
public void prepare()
prepare
in interface InfGraph
prepare
in class BasicForwardRuleInfGraph
public void rebind()
rebind
in interface InfGraph
rebind
in class BasicForwardRuleInfGraph
public void setTraceOn(boolean state)
setTraceOn
in class BasicForwardRuleInfGraph
public void setDerivationLogging(boolean recordDerivations)
setDerivationLogging
in interface InfGraph
setDerivationLogging
in class BasicForwardRuleInfGraph
public void setFunctorFiltering(boolean param)
public long getNRulesFired()
getNRulesFired
in class BasicForwardRuleInfGraph
public ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation)
findWithContinuation
in class BasicForwardRuleInfGraph
pattern
- a TriplePattern to be matched against the datacontinuation
- either a Finder or a normal Graph which
will be asked for additional match results if the implementor
may not have completely satisfied the query.public ExtendedIterator findFull(TriplePattern pattern)
pattern
- a TriplePattern to be matched against the datapublic ExtendedIterator graphBaseFind(Node subject, Node property, Node object)
graphBaseFind
in class BasicForwardRuleInfGraph
public ExtendedIterator find(TriplePattern pattern)
find
in class BasicForwardRuleInfGraph
pattern
- a TriplePattern to be matched against the data
public void reset()
reset
in interface InfGraph
reset
in class BaseInfGraph
public void performAdd(Triple t)
performAdd
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performAdd
in class BasicForwardRuleInfGraph
public void performDelete(Triple t)
performDelete
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performDelete
in class BasicForwardRuleInfGraph
public InfGraph cloneWithPremises(Graph premises)
cloneWithPremises
in class BaseInfGraph
public void close()
close
in interface Graph
close
in class BasicForwardRuleInfGraph
public ValidityReport validate()
validate
in interface InfGraph
validate
in class BaseInfGraph
public void hideNode(Node n)
public void resetLPProfile(boolean enable)
enable
- it true then profiling will continue with a new empty profile table,
if false profiling will stop all current data lost.public void printLPProfile()
public boolean accept(java.lang.Object tin)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |