VIVO-151 remedies missing inverse property inference deletions

This commit is contained in:
brianjlowe 2013-09-13 15:01:57 -04:00
parent a74677dae4
commit 73d54999d4
3 changed files with 14 additions and 3 deletions

View file

@ -30,8 +30,7 @@ public class ReasonerConfiguration {
/** /**
* The default reasoner configuration is designed to provide acceptable performance on larger knowledge bases. * The default reasoner configuration is designed to provide acceptable performance on larger knowledge bases.
* It will classify and realize, and add inferred disjointWith statements. * It will classify and realize, and add inferred disjointWith statements.
* It ignores domain and range "axioms," on the assumption that they are not truly axioms but editing constraints. * It ignores domain and range "axioms," on the assumption that they are not truly axioms but editing constraints.
* It also ignores "owl:inverseOf."
*/ */
public static ReasonerConfiguration DEFAULT; public static ReasonerConfiguration DEFAULT;
@ -78,6 +77,7 @@ public class ReasonerConfiguration {
defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.first,null)); defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.first,null));
defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.rest,null)); defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.rest,null));
defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,OWL.disjointWith,null)); defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,OWL.disjointWith,null));
defaultInferenceDrivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,OWL.inverseOf,null));
DEFAULT.setInferenceDrivingPatternAllowSet(defaultInferenceDrivingPatternAllowSet); DEFAULT.setInferenceDrivingPatternAllowSet(defaultInferenceDrivingPatternAllowSet);
Set<ObjectPropertyStatementPattern> defaultInferenceReceivingPatternAllowSet = new HashSet<ObjectPropertyStatementPattern>(); Set<ObjectPropertyStatementPattern> defaultInferenceReceivingPatternAllowSet = new HashSet<ObjectPropertyStatementPattern>();
defaultInferenceReceivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.type,null)); defaultInferenceReceivingPatternAllowSet.add(ObjectPropertyStatementPatternFactory.getPattern(null,RDF.type,null));

View file

@ -1678,6 +1678,10 @@ public class SimpleReasoner extends StatementListener {
typeURIs = getRemainingAssertedTypeURIs(stmt.getSubject()); typeURIs = getRemainingAssertedTypeURIs(stmt.getSubject());
} }
removedABoxTypeAssertion(stmt, inferenceModel, typeURIs); removedABoxTypeAssertion(stmt, inferenceModel, typeURIs);
} else if (doSameAs && stmt.getPredicate().equals(OWL.sameAs)) {
removedABoxSameAsAssertion(stmt, inferenceModel);
} else {
removedABoxAssertion(stmt, inferenceModel);
} }
doPlugins(ModelUpdate.Operation.RETRACT,stmt); doPlugins(ModelUpdate.Operation.RETRACT,stmt);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {

View file

@ -81,7 +81,14 @@ public class SimpleReasonerInversePropertyTest extends AbstractTestClass {
aBox.add(a,P,b); aBox.add(a,P,b);
Assert.assertTrue(inf.contains(b,Q,a)); Assert.assertTrue(inf.contains(b,Q,a));
aBox.add(c,Q,d); aBox.add(c,Q,d);
Assert.assertTrue(inf.contains(d,P,c)); Assert.assertTrue(inf.contains(d,P,c));
// delete assertions and verify that inferences go away
aBox.remove(c,Q,d);
Assert.assertFalse(inf.contains(d,P,c));
aBox.remove(a,P,b);
Assert.assertFalse(inf.contains(b,Q,a));
} }
@Test @Test