public class LPBackwardRuleInfGraph extends BaseInfGraph implements BackwardRuleInfGraphI
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities, BaseInfGraph.InfTransactionHandler
TOSTRING_TRIPLE_BASE, TOSTRING_TRIPLE_LIMIT
emptyGraph
Constructor and Description |
---|
LPBackwardRuleInfGraph(Reasoner reasoner,
LPRuleStore ruleStore,
Graph data,
Graph schema)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ExtendedIterator<Triple> |
find(TriplePattern pattern)
Basic pattern lookup interface.
|
ExtendedIterator<Triple> |
findDataMatches(TriplePattern pattern)
Match a pattern just against the stored data (raw data, schema,
axioms) but no derivation.
|
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.
|
Iterator<Derivation> |
getDerivation(Triple t)
Return the derivation of at triple.
|
Graph |
getSchemaGraph()
Return the schema graph, if any, bound into this inference graph.
|
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.
|
boolean |
isTraceOn()
Return true if tracing is switched on
|
void |
logDerivation(Triple t,
Derivation derivation)
Log a derivation 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.
|
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 |
rebind(Graph data)
Replace the underlying data graph for this inference graph and start any
inferences over again.
|
void |
reset()
Flush out all cached results.
|
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 |
silentAdd(Triple t)
Assert a new triple in the deduction graph, bypassing any processing machinery.
|
clear, cloneWithPremises, close, find, getCapabilities, getDeductionsGraph, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getTransactionHandler, getVersion, graphBaseSize, isEmpty, isPrepared, remove, testGlobalProperty, validate
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
find, getDeductionsGraph, getGlobalProperty, getRawGraph, getReasoner, testGlobalProperty, validate
add, clear, close, contains, contains, delete, dependsOn, find, find, find, getCapabilities, getEventManager, getPrefixMapping, getStatisticsHandler, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, remove, size
public LPBackwardRuleInfGraph(Reasoner reasoner, LPRuleStore ruleStore, Graph data, Graph schema)
reasoner
- the parent reasonerruleStore
- the indexed set of rules to usedata
- the data graph to be processedschema
- optional precached schema (use null if not required)public Graph getSchemaGraph()
getSchemaGraph
in class BaseInfGraph
public void prepare()
prepare
in interface InfGraph
prepare
in class BaseInfGraph
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 void reset()
reset
in interface InfGraph
reset
in class BaseInfGraph
public ExtendedIterator<Triple> 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<Triple> graphBaseFind(Node subject, Node property, Node object)
public ExtendedIterator<Triple> find(TriplePattern pattern)
find
in class BaseInfGraph
pattern
- a TriplePattern to be matched against the datapublic void performAdd(Triple t)
performAdd
in interface GraphWithPerform
performAdd
in class BaseInfGraph
public void performDelete(Triple t)
performDelete
in interface GraphWithPerform
performDelete
in class BaseInfGraph
public void setTabled(Node predicate)
public void setDerivationLogging(boolean recordDerivations)
setDerivationLogging
in interface InfGraph
setDerivationLogging
in class BaseInfGraph
public Iterator<Derivation> getDerivation(Triple t)
getDerivation
in interface InfGraph
getDerivation
in class BaseInfGraph
public void setTraceOn(boolean state)
public boolean isTraceOn()
public void logDerivation(Triple t, Derivation derivation)
logDerivation
in interface BackwardRuleInfGraphI
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 silentAdd(Triple t)
silentAdd
in interface SilentAddI
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.Licenced under the Apache License, Version 2.0