|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rdf.rules.InferenceEngine
public class InferenceEngine
Flyweight object encapsulates some configuration state and provides methods
to compute or update the closure of the database. An instance of this is
obtained from AbstractTripleStore.getInferenceEngine().
| Nested Class Summary | |
|---|---|
static interface |
InferenceEngine.Options
Options for the InferenceEngine. |
| Constructor Summary | |
|---|---|
InferenceEngine(AbstractTripleStore database)
Configure InferenceEngine using the properties used to configure
the database. |
|
| Method Summary | |
|---|---|
ClosureStats |
computeClosure(AbstractTripleStore focusStore)
Compute the forward closure of a focusStore against the database using the algorithm selected by AbstractTripleStore.Options#CLOSURE_CLASS. |
ClosureStats |
computeClosure(AbstractTripleStore focusStore,
boolean justify)
This variant allows you to explicitly NOT generate Justifications
for the computed entailments. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final boolean INFO
log level is INFO or less.
protected static final boolean DEBUG
log level is DEBUG or less.
public final AbstractTripleStore database
public final DoNotAddFilter doNotAddFilter
InferenceEngine is configured.
DoNotAddFilterprotected final boolean forwardChainRdfTypeRdfsResource
InferenceEngine.Options.FORWARD_CHAIN_RDF_TYPE_RDFS_RESOURCE. When
true the InferenceEngine is configured to forward
chain and store entailments of the form
(x rdf:type rdfs:Resource). When false,
those entailments are computed at query time by
#backchainIterator(long, long, long).
protected final boolean forwardChainOwlSameAsClosure
InferenceEngine.Options.FORWARD_CHAIN_OWL_SAMEAS_CLOSURE. When
true we will forward chain and store the reflexive and
transitive closure of owl:sameAs using
RuleOwlSameAs1 and RuleOwlSameAs2.
Note: When false, NO owl:sameAs processing will be
performed since there is no privision for backward chaining the
owl:sameAs closure.
protected final boolean forwardChainOwlSameAsProperties
InferenceEngine.Options.FORWARD_CHAIN_OWL_SAMEAS_PROPERTIES. When
true, we will forward chain RuleOwlSameAs2 and
RuleOwlSameAs3 which replicate properties on individuals
identified as the "same" by owl:sameAs. When
false, we will compute those entailments at query time in
#backchainIterator(long, long, long).
protected final boolean forwardChainOwlEquivalentProperty
InferenceEngine.Options.FORWARD_CHAIN_OWL_EQUIVALENT_PROPERTY. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
protected final boolean forwardChainOwlEquivalentClass
InferenceEngine.Options.FORWARD_CHAIN_OWL_EQUIVALENT_CLASS. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
protected final boolean forwardChainOwlInverseOf
InferenceEngine.Options.FORWARD_CHAIN_OWL_INVERSE_OF. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
protected final boolean forwardChainOwlTransitiveProperty
InferenceEngine.Options.FORWARD_CHAIN_OWL_TRANSITIVE_PROPERTY. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
protected final boolean forwardChainOwlHasValue
InferenceEngine.Options.FORWARD_CHAIN_OWL_HAS_VALUE. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
protected final boolean forwardChainOwlSymmetricProperty
InferenceEngine.Options.FORWARD_CHAIN_OWL_SYMMETRIC_PROPERTY. When
true, we will forward chain and store those entailments.
When false, those entailments will NOT be available.
| Constructor Detail |
|---|
public InferenceEngine(AbstractTripleStore database)
InferenceEngine using the properties used to configure
the database.
database - The database.AbstractTripleStore.getInferenceEngine()| Method Detail |
|---|
public ClosureStats computeClosure(AbstractTripleStore focusStore)
AbstractTripleStore.Options#CLOSURE_CLASS.
Note: before calling this method with a non-null
focusStore, the caller SHOULD examine the statements in the
focusStore and then database. For each statement in the
focusStore, if this statement exists explicitly in the database then
remove it from the focusStore. If this statement exists implicitly in the
database. Regardless of whether the statement was explicit or inferred in
the database, remove it from the focusStore. This step prevents the
needless (and expensive) reapplication of the rules to data already known
to the database!
Note: If the focusStore is given, then the entailments will be
asserted against the focusStore. Either this method or the caller MUST
copy the focusStore onto the database using
AbstractTripleStore.copyStatements(AbstractTripleStore, IElementFilter, boolean).
If you are loading data from some kind of resource, then see
DataLoader which already knows how to do this.
See TruthMaintenance.assertAll(TempTripleStore), which first
handles statements already in the database, then calls this method, and
finally copies the remaining explicit statements in the focusStore and
the entailments into the database.
focusStore - The data set that will be closed against the database
(optional). When null the store will be closed
against itself.
public ClosureStats computeClosure(AbstractTripleStore focusStore,
boolean justify)
Justifications
for the computed entailments. It is used by the TruthMaintenance
class as part of the algorithm for truth maintenance when retracting
statements from the database. It SHOULD NOT be used for any other purpose
or you may risk failing to generate justifications.
Note: While this is synchronized, there is a stronger constraint on truth maintenance -- only one process can safely update the closure of the database at a time. Concurrent closure updates will result in an incoherent knowledge base (the closure will not be at fixed point but the underlying indices will be coherent). Closure operations MUST be serialized to avoid inconsistency in the knowledge base.
focusStore - The data set that will be closed against the database.justify - Justifications will be generated iff this flag is
true.
computeClosure(AbstractTripleStore)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||