public class BasicForwardRuleInfGraph extends BaseInfGraph implements ForwardRuleInfGraphI
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).
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities, BaseInfGraph.InfTransactionHandler| Modifier and Type | Field and Description |
|---|---|
boolean |
filterFunctors
Flag, if true then find results will be filtered to remove functors and illegal RDF
|
TOSTRING_TRIPLE_BASE, TOSTRING_TRIPLE_LIMITemptyGraph| Constructor and Description |
|---|
BasicForwardRuleInfGraph(Reasoner reasoner,
Graph schema)
Constructor.
|
BasicForwardRuleInfGraph(Reasoner reasoner,
List<Rule> rules,
Graph schema)
Constructor.
|
BasicForwardRuleInfGraph(Reasoner reasoner,
List<Rule> rules,
Graph schema,
Graph data)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> |
find(TriplePattern pattern)
Basic pattern lookup interface.
|
com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> |
findDataMatches(Node subject,
Node predicate,
Node object)
Search the combination of data and deductions graphs for the given triple pattern.
|
com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> |
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 |
getCurrentDeductionsGraph()
Return the Graph containing all the static deductions available so far.
|
Graph |
getDeductionsGraph()
Return the Graph containing all the static deductions available so far.
|
Iterator<Derivation> |
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.
|
int |
graphBaseSize()
Return the number of triples in the inferred graph
|
void |
logDerivation(Triple t,
Derivation 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 |
setFunctorFiltering(boolean param)
Set to true to cause functor-valued literals to be dropped from rule output.
|
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.
|
void |
silentAdd(Triple t)
Assert a new triple in the deduction graph, bypassing any processing machinery.
|
clear, cloneWithPremises, find, getBulkUpdateHandler, getCapabilities, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getTransactionHandler, getVersion, isEmpty, isPrepared, remove, reset, testGlobalProperty, validateadd, contains, contains, delete, dependsOn, find, find, find, forTestingOnly_graphBaseFind, getEventManager, getStatisticsHandler, isClosed, isIsomorphicWith, notifyAdd, notifyDelete, size, toString, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitfind, getGlobalProperty, getRawGraph, getReasoner, reset, testGlobalProperty, validateadd, clear, contains, contains, delete, dependsOn, find, find, find, getBulkUpdateHandler, getCapabilities, getEventManager, getPrefixMapping, getStatisticsHandler, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, remove, sizepublic boolean filterFunctors
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<Rule> 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<Rule> 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 processedpublic 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 InfGraphrebind in class BaseInfGraphdata - the new raw data graphpublic void rebind()
rebind in interface InfGraphrebind in class BaseInfGraphpublic Graph getSchemaGraph()
getSchemaGraph in class BaseInfGraphpublic void prepare()
prepare in interface InfGraphprepare in class BaseInfGraphpublic void addDeduction(Triple t)
addDeduction in interface ForwardRuleInfGraphIpublic void setFunctorFiltering(boolean param)
setFunctorFiltering in interface ForwardRuleInfGraphIpublic com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation)
findWithContinuation in class BaseInfGraphpattern - 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 com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> find(TriplePattern pattern)
find in class BaseInfGraphpattern - a TriplePattern to be matched against the datapublic void performAdd(Triple t)
performAdd in interface com.hp.hpl.jena.graph.impl.GraphWithPerformperformAdd in class BaseInfGraphpublic int graphBaseSize()
graphBaseSize in class BaseInfGraphpublic void performDelete(Triple t)
performDelete in interface com.hp.hpl.jena.graph.impl.GraphWithPerformperformDelete in class BaseInfGraphpublic void close()
close in interface Graphclose in class BaseInfGraphpublic void addBRule(Rule brule)
addBRule in interface ForwardRuleInfGraphIpublic void deleteBRule(Rule brule)
deleteBRule in interface ForwardRuleInfGraphIpublic Graph getDeductionsGraph()
getDeductionsGraph in interface InfGraphgetDeductionsGraph in interface ForwardRuleInfGraphIgetDeductionsGraph in class BaseInfGraphpublic Graph getCurrentDeductionsGraph()
getCurrentDeductionsGraph in interface ForwardRuleInfGraphIpublic com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object)
findDataMatches in interface ForwardRuleInfGraphIpublic void logDerivation(Triple t, Derivation derivation)
logDerivation in interface ForwardRuleInfGraphIpublic void silentAdd(Triple t)
silentAdd in interface SilentAddIpublic void setDerivationLogging(boolean recordDerivations)
setDerivationLogging in interface InfGraphsetDerivationLogging in class BaseInfGraphpublic boolean shouldLogDerivations()
shouldLogDerivations in interface ForwardRuleInfGraphIpublic Iterator<Derivation> getDerivation(Triple t)
getDerivation in interface InfGraphgetDerivation in class BaseInfGraphpublic void setTraceOn(boolean state)
public boolean shouldTrace()
shouldTrace in interface ForwardRuleInfGraphIpublic long getNRulesFired()
Licenced under the Apache License, Version 2.0