|
||||||||||
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
public class BasicForwardRuleInfGraph
An inference graph interface that runs a set of forward chaining rules to conclusion on each added triple and stores the entire result set.
This implementation has a horribly inefficient rule chainer built in. Once we have this working generalize this to an interface than can call out to a rule engine and build a real rule engine (e.g. Rete style).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
---|
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities |
Field Summary |
---|
Fields inherited from interface com.hp.hpl.jena.graph.Graph |
---|
emptyGraph |
Constructor Summary | |
---|---|
BasicForwardRuleInfGraph(Reasoner reasoner,
Graph schema)
Constructor. |
|
BasicForwardRuleInfGraph(Reasoner reasoner,
List rules,
Graph schema)
Constructor. |
|
BasicForwardRuleInfGraph(Reasoner reasoner,
List rules,
Graph schema,
Graph data)
Constructor. |
Method Summary | |
---|---|
void |
addBRule(Rule brule)
Adds a new Backward rule as a rules of a forward rule process. |
void |
addDeduction(Triple t)
Add a new deduction to the deductions graph. |
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 |
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. |
Graph |
getDeductionsGraph()
Return the Graph containing all the static deductions available so far. |
Iterator |
getDerivation(Triple t)
Return the derivation of at triple. |
long |
getNRulesFired()
Return the number of rules fired since this rule engine instance was created and initialized |
Graph |
getSchemaGraph()
Return the schema graph, if any, bound into this inference graph. |
ExtendedIterator |
graphBaseFind(Node subject,
Node property,
Node object)
Returns an iterator over Triples. |
int |
graphBaseSize()
Return the number of triples in the inferred graph |
void |
logDerivation(Triple t,
Object derivation)
Log a dervivation record against the given triple. |
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 |
rebind()
Cause the inference graph to reconsult the underlying graph to take into account changes. |
void |
rebind(Graph data)
Replace the underlying data graph for this inference graph and start any inferences over again. |
void |
setDerivationLogging(boolean recordDerivations)
Set to true to enable derivation caching |
void |
setRuleStore(Object ruleStore)
Attach a compiled rule set to this inference graph. |
void |
setTraceOn(boolean state)
Set the state of the trace flag. |
boolean |
shouldLogDerivations()
Return true if derivation logging is enabled. |
boolean |
shouldTrace()
Return true if tracing should be acted on - i.e. if traceOn is true and we are past the bootstrap phase. |
void |
silentAdd(Triple t)
Assert a new triple in the deduction graph, bypassing any processing machinery. |
Methods inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph |
---|
cloneWithPremises, find, getBulkUpdateHandler, getCapabilities, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getReifier, graphBaseFind, isEmpty, reset, testGlobalProperty, validate |
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
---|
add, contains, contains, delete, dependsOn, find, find, getEventManager, getTransactionHandler, 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.InfGraph |
---|
find, getGlobalProperty, getRawGraph, getReasoner, reset, testGlobalProperty, validate |
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 |
Constructor Detail |
---|
public BasicForwardRuleInfGraph(Reasoner reasoner, Graph schema)
rebind
then any operations
like add, remove, find will result in errors.
reasoner
- the parent reasonerschema
- the (optional) schema data which is being processedpublic BasicForwardRuleInfGraph(Reasoner reasoner, List rules, Graph schema)
rebind
then any operations
like add, remove, find will result in errors.
reasoner
- the parent reasonerrules
- the list of rules to use this timeschema
- the (optional) schema or preload data which is being processedpublic BasicForwardRuleInfGraph(Reasoner reasoner, List rules, Graph schema, Graph data)
reasoner
- the parent reasonerrules
- the list of rules to use this timeschema
- the (optional) schema or preload data which is being processeddata
- the data graph to be processedMethod Detail |
---|
public void setRuleStore(Object ruleStore)
ruleStore
- a compiled set of rules (i.e. the result of an FRuleEngine.compile).public void rebind(Graph data)
rebind
in interface InfGraph
rebind
in class BaseInfGraph
data
- the new raw data graphpublic void rebind()
rebind
in interface InfGraph
rebind
in class BaseInfGraph
public Graph getSchemaGraph()
getSchemaGraph
in class BaseInfGraph
public void prepare()
prepare
in interface InfGraph
prepare
in class BaseInfGraph
public void addDeduction(Triple t)
addDeduction
in interface ForwardRuleInfGraphI
public ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation)
findWithContinuation
in class BaseInfGraph
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 graphBaseFind(Node subject, Node property, Node object)
graphBaseFind
in class BaseInfGraph
public ExtendedIterator find(TriplePattern pattern)
find
in class BaseInfGraph
pattern
- a TriplePattern to be matched against the data
public void performAdd(Triple t)
performAdd
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performAdd
in class BaseInfGraph
public int graphBaseSize()
graphBaseSize
in class BaseInfGraph
public void performDelete(Triple t)
performDelete
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performDelete
in class BaseInfGraph
public void close()
close
in interface Graph
close
in class BaseInfGraph
public void addBRule(Rule brule)
addBRule
in interface ForwardRuleInfGraphI
public void deleteBRule(Rule brule)
deleteBRule
in interface ForwardRuleInfGraphI
public Graph getDeductionsGraph()
getDeductionsGraph
in interface InfGraph
getDeductionsGraph
in interface ForwardRuleInfGraphI
getDeductionsGraph
in class BaseInfGraph
public ExtendedIterator findDataMatches(Node subject, Node predicate, Node object)
findDataMatches
in interface ForwardRuleInfGraphI
public void logDerivation(Triple t, Object derivation)
logDerivation
in interface ForwardRuleInfGraphI
public void silentAdd(Triple t)
silentAdd
in interface SilentAddI
public void setDerivationLogging(boolean recordDerivations)
setDerivationLogging
in interface InfGraph
setDerivationLogging
in class BaseInfGraph
public boolean shouldLogDerivations()
shouldLogDerivations
in interface ForwardRuleInfGraphI
public Iterator getDerivation(Triple t)
getDerivation
in interface InfGraph
getDerivation
in class BaseInfGraph
public void setTraceOn(boolean state)
public boolean shouldTrace()
shouldTrace
in interface ForwardRuleInfGraphI
public long getNRulesFired()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |