public class TestTruthMaintenance extends AbstractInferenceEngineTestCase
TruthMaintenance
.AbstractTestCase.StatementVerifier
TestCase2.MyProperties, TestCase2.RandomType
NULL
_randomType, log
Constructor and Description |
---|
TestTruthMaintenance() |
TestTruthMaintenance(String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertSameGraphs(TempTripleStore expected,
AbstractTripleStore actual)
This is a specialized test for equality in the graphs that simply compare
scans on the SPO index.
|
void |
doStressTest(TempTripleStore tmp,
InferenceEngine inf,
int ntrials,
int D,
int N)
A stress test for truth maintenance using an arbitrary data set.
|
SPO[] |
selectRandomExplicitStatements(AbstractTripleStore db,
int N)
Select N explicit statements from the graph at random.
|
void |
test_assertAll_01()
A simple test of
TruthMaintenance in which some statements are
asserted and their closure is computed and aspects of that closure are
verified (this is based on rdfs11). |
void |
test_closurecorrectness()
This test demonstrates TM incorrectness (since fixed of course).
|
void |
test_downgradeExplicitToInference()
A simple test of
TruthMaintenance in which some statements are
asserted, including one statement which is also produced as an inference,
and their closure is computed and aspects of that closure are verified
(this is based on rdfs11). |
void |
test_filter_01()
|
void |
test_infiniteloop()
This test demonstrates an infinite loop in TM arising from owl:sameAs.
|
void |
test_retractAll_01()
A simple test of
TruthMaintenance in which some statements are
asserted, their closure is computed and aspects of that closure are
verified, and then an explicit statement is removed and the closure is
updated and we verify that an entailment known to depend on the remove
statement has also been removed (this is based on rdfs11). |
void |
test_retractWhenStatementSupportsExplicitStatement()
Given three explicit statements:
|
void |
test_stress()
This is a stress test for truth maintenance.
|
getValue
getDelegate, getOurDelegate, getProperties, getStore, getStore, reopenStore, setDelegate, setUp, tearDown
assertEquals, assertEquals, assertEquals, assertEquals, assertLexiconIndicesConsistent, assertSameSPOs, assertSameSPOs, assertSameSPOsAnyOrder, assertSameSPOsAnyOrder, assertSameStatements, assertSameStatements, assertStatementIndicesConsistent, checkIfProxy, recursiveDelete, setUp, tearDown
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logProperties
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public TestTruthMaintenance()
public TestTruthMaintenance(String name)
name
- public void test_filter_01()
public void test_assertAll_01()
TruthMaintenance
in which some statements are
asserted and their closure is computed and aspects of that closure are
verified (this is based on rdfs11).public void test_retractAll_01()
TruthMaintenance
in which some statements are
asserted, their closure is computed and aspects of that closure are
verified, and then an explicit statement is removed and the closure is
updated and we verify that an entailment known to depend on the remove
statement has also been removed (this is based on rdfs11).public void test_downgradeExplicitToInference()
TruthMaintenance
in which some statements are
asserted, including one statement which is also produced as an inference,
and their closure is computed and aspects of that closure are verified
(this is based on rdfs11). After we verify the closure, we retract the
explicit statement and then verify that the closure was updated such that
the statement was downgraded to an inference.public void test_retractWhenStatementSupportsExplicitStatement()
stmt a: #user #currentGraph #foo stmt b: #currentGraph rdfs:range #Graph stmt c: #foo rdf:type #Grapha+b implies c
Delete a and verify that c is NOT gone since it is an explicit statement.
public void test_closurecorrectness()
public void test_infiniteloop()
public void test_stress()
public void doStressTest(TempTripleStore tmp, InferenceEngine inf, int ntrials, int D, int N)
Note: this test by itself does not guarentee that any entailments of those explicit statements were removed - we need to write other tests for that. repeat several times on the dataset, potentially doing multiple retractions before we back out of them.
tmp
- Ground truth (the state that must be recovered in order for
truth maintenance to be symmetric).inf
- The InferenceEngine
to use in the test. This reads and
writes on the database whose closure is being maintained.ntrials
- The #of times that we will run the test.D
- The recursive depth of the retractions. A depth of ONE (1)
means that one set of N statements will be retracted, closure
updated, and the re-asserted and closure updated and compared
against ground truth (the initial conditions). When the depth
is greater than ONE (1) we will recursively retract a set of N
statements D times. The statements will be reasserted as we
back out of the recursion and the graph compared with ground
truth when we return from the top level of the recursion.N
- The #of explicit statements to be randomly selected and
retracted on each recursive pass.public SPO[] selectRandomExplicitStatements(AbstractTripleStore db, int N)
db
- The graph.N
- The #of statements to select.protected void assertSameGraphs(TempTripleStore expected, AbstractTripleStore actual)
Pre-condition: The term identifiers for the graphs MUST be consistently
assigned since the statements are not being materialized as RDF
Value
objects.
expected
- A copy of the statements made after the data set was loaded
and its closure computed and before we began to retract and
assert stuff.actual
- Note that this is used by both graphs to resolve the term
identifiers.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.