public class FBRuleInfGraph extends BasicForwardRuleInfGraph implements BackwardRuleInfGraphI
Modifier and Type | Class and Description |
---|---|
static class |
FBRuleInfGraph.RuleStore
Structure used to wrap up pre-processed/compiled rule sets.
|
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities, BaseInfGraph.InfTransactionHandler
Modifier and Type | Field and Description |
---|---|
static boolean |
useRETE
Static switch from Basic to RETE implementation of the forward component
|
filterFunctors
TOSTRING_TRIPLE_BASE, TOSTRING_TRIPLE_LIMIT
emptyGraph
Constructor and Description |
---|
FBRuleInfGraph(Reasoner reasoner,
Graph schema)
Constructor.
|
FBRuleInfGraph(Reasoner reasoner,
List<Rule> rules,
Graph schema)
Constructor.
|
FBRuleInfGraph(Reasoner reasoner,
List<Rule> rules,
Graph schema,
Graph data)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(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 result of a forward rule process.
|
void |
addBRules(List<Rule> 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.
|
ValidityReport.Report |
checkLiteral(Node prop,
Triple triple)
Check a given literal value for a property against the set of
known range constraints for it.
|
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<Triple> |
find(TriplePattern pattern)
Basic pattern lookup interface.
|
ExtendedIterator<Triple> |
findDataMatches(Node subject,
Node predicate,
Node object)
Search the combination of data and deductions graphs for the given triple pattern.
|
ExtendedIterator<Triple> |
findDataMatches(TriplePattern pattern)
Search the combination of data and deductions graphs for the given triple pattern.
|
ExtendedIterator<Triple> |
findFull(TriplePattern pattern)
Internal variant of find which omits the filters which block illegal RDF data.
|
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.
|
List<Rule> |
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.
|
List<Rule> |
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<Triple> |
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 |
rebindAll()
Cause the inference graph to reconsult both the underlying graph and
the reasoner ruleset, permits the forward rule set to be dynamically changed.
|
void |
reset()
Flush out all cached results.
|
void |
resetLPProfile(boolean enable)
Reset the LP engine profile.
|
void |
setDatatypeRangeValidation(boolean on)
Switch on/off datatype range validation
|
void |
setDerivationLogging(boolean recordDerivations)
Set to true to enable derivation caching
|
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.
|
getCurrentDeductionsGraph, getDeductionsGraph, getDerivation, getSchemaGraph, graphBaseSize, logDerivation, rebind, setFunctorFiltering, setRuleStore, shouldLogDerivations, shouldTrace, silentAdd
clear, cloneWithPremises, find, getCapabilities, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getTransactionHandler, getVersion, isEmpty, isPrepared, remove, testGlobalProperty
add, contains, contains, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getEventManager, getStatisticsHandler, isClosed, isIsomorphicWith, notifyAdd, notifyDelete, size, toString, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getVersion, logDerivation
silentAdd
find, getDeductionsGraph, getDerivation, getGlobalProperty, getRawGraph, getReasoner, rebind, testGlobalProperty
add, clear, contains, contains, delete, dependsOn, find, find, find, getCapabilities, getEventManager, getPrefixMapping, getStatisticsHandler, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, remove, size
public static boolean useRETE
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, List<Rule> 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, List<Rule> 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 processedpublic void setUseTGCCache()
public ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object)
findDataMatches
in interface ForwardRuleInfGraphI
findDataMatches
in class BasicForwardRuleInfGraph
public ExtendedIterator<Triple> 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 callpublic 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 List<Rule> getBRules()
public List<Rule> 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 rebindAll()
public void setTraceOn(boolean state)
setTraceOn
in class BasicForwardRuleInfGraph
public void setDerivationLogging(boolean recordDerivations)
setDerivationLogging
in interface InfGraph
setDerivationLogging
in class BasicForwardRuleInfGraph
public long getNRulesFired()
getNRulesFired
in class BasicForwardRuleInfGraph
public ExtendedIterator<Triple> 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<Triple> findFull(TriplePattern pattern)
pattern
- a TriplePattern to be matched against the datapublic ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object)
public ExtendedIterator<Triple> find(TriplePattern pattern)
find
in class BasicForwardRuleInfGraph
pattern
- a TriplePattern to be matched against the datapublic void reset()
reset
in interface InfGraph
reset
in class BaseInfGraph
public void performAdd(Triple t)
performAdd
in interface GraphWithPerform
performAdd
in class BasicForwardRuleInfGraph
public void performDelete(Triple t)
performDelete
in interface GraphWithPerform
performDelete
in class BasicForwardRuleInfGraph
public void close()
close
in interface Graph
close
in class BasicForwardRuleInfGraph
public ValidityReport validate()
validate
in interface InfGraph
validate
in class BaseInfGraph
public void setDatatypeRangeValidation(boolean on)
public ValidityReport.Report checkLiteral(Node prop, Triple triple)
prop
- the property node whose range is under scrutinytriple
- the statement whose object value is to be checked.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(Object tin)
Licenced under the Apache License, Version 2.0