@Test
public void testSubPropertyRestore() {
// This test case is to test the restoring of edges with
// subproperties (see ticket 109)
KnowledgeBase kb = new KnowledgeBase();
ATermAppl a = term( "a" );
ATermAppl b = term( "b" );
ATermAppl c = term( "c" );
ATermAppl d = term( "d" );
ATermAppl p = term( "p" );
ATermAppl q = term( "q" );
ATermAppl invP = term( "invP" );
ATermAppl invQ = term( "invQ" );
kb.addIndividual( a );
kb.addIndividual( b );
kb.addIndividual( c );
kb.addIndividual( d );
kb.addObjectProperty( p );
kb.addObjectProperty( q );
kb.addObjectProperty( invP );
kb.addObjectProperty( invQ );
// first add the ABox assertions to make sure none is ignored
kb.addPropertyValue( p, a, b );
kb.addPropertyValue( q, a, b );
// add the subproperty axiom later
kb.addSubProperty( p, q );
kb.addInverseProperty( p, invP );
kb.addInverseProperty( q, invQ );
// force b to be merged to one of c or d
kb.addType( b, or( value( c ), value( d ) ) );
assertTrue( kb.isConsistent() );
// ask a query that will force the merge to be restored. with the bug
// the q would not be restored causing either an internal exception or
// the query to fail
assertTrue( kb.isType( b, and( some( invP, value( a ) ), some( invQ, value( a ) ) ) ) );
}