public class InferenceEngine extends Object
AbstractTripleStore.getInferenceEngine()
.Modifier and Type | Class and Description |
---|---|
static interface |
InferenceEngine.Options
Options for the
InferenceEngine . |
Modifier and Type | Field and Description |
---|---|
AbstractTripleStore |
database
The database whose closure is being maintained.
|
protected static boolean |
DEBUG
True iff the
log level is DEBUG or less. |
DoNotAddFilter |
doNotAddFilter
A filter for keeping certain entailments out of the database.
|
protected boolean |
enableOwlFunctionalAndInverseFunctionalProperty
|
protected boolean |
forwardChainOwlEquivalentClass
|
protected boolean |
forwardChainOwlEquivalentProperty
|
protected boolean |
forwardChainOwlHasValue
Set based on
InferenceEngine.Options.FORWARD_CHAIN_OWL_HAS_VALUE . |
protected boolean |
forwardChainOwlInverseOf
Set based on
InferenceEngine.Options.FORWARD_CHAIN_OWL_INVERSE_OF . |
protected boolean |
forwardChainOwlSameAsClosure
Set based on
InferenceEngine.Options.FORWARD_CHAIN_OWL_SAMEAS_CLOSURE . |
protected boolean |
forwardChainOwlSameAsProperties
|
protected boolean |
forwardChainOwlSymmetricProperty
|
protected boolean |
forwardChainOwlTransitiveProperty
|
protected boolean |
forwardChainRdfTypeRdfsResource
|
protected static boolean |
INFO
True iff the
log level is INFO or less. |
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
InferenceEngine(AbstractTripleStore database)
Configure
InferenceEngine using the properties used to configure
the database. |
Modifier and Type | Method and Description |
---|---|
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
Justification s
for the computed entailments. |
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.DoNotAddFilter
protected 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.protected final boolean enableOwlFunctionalAndInverseFunctionalProperty
InferenceEngine.Options.ENABLE_OWL_FUNCTIONAL_AND_INVERSE_FUNCTIONAL_PROPERTY
. When
true
, we will test for violations of owl:FunctionalProperty and
owl:InverseFunctionalProperty.public InferenceEngine(AbstractTripleStore database)
InferenceEngine
using the properties used to configure
the database.database
- The database.AbstractTripleStore.getInferenceEngine()
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)
Justification
s
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
- Justification
s will be generated iff this flag is
true
.computeClosure(AbstractTripleStore)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.