@Override public ContradictionFromNegationRule create(ChainableSubsumerRule tail) { return new ContradictionFromNegationRule(tail); } };
@Override public boolean addTo(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.getCreate(MATCHER_, FACTORY_); if (rule.negation_ != null && rule.negation_ != negation_) { return false; } // else rule.negation_ = negation_; return true; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (positiveOccurrenceNo == 0 && increment.positiveIncrement > 0) { // first positive occurrence of this expression if (!ContradictionFromNegationRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (positiveOccurrenceNo == 0 && increment.positiveIncrement < 0) { // no positive occurrences of this expression left if (!ContradictionFromNegationRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.negativeIncrement); i++) { // for each indexed negative occurrence of this expression index.onIndexing( Occurrence.NEGATIVE_OCCURRENCE_OF_OBJECT_COMPLEMENT_OF); } return true; }
@Override public Void visit(ContradictionFromNegationRule rule, IndexedClassExpression premise, ContextPremises premises, ClassInferenceProducer producer) { iceValidator_.checkNew(rule.getNegation()); return null; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (positiveOccurrenceNo == 0 && increment.positiveIncrement > 0) { // first positive occurrence of this expression if (!ContradictionFromNegationRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (positiveOccurrenceNo == 0 && increment.positiveIncrement < 0) { // no positive occurrences of this expression left if (!ContradictionFromNegationRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.negativeIncrement); i++) { // for each indexed negative occurrence of this expression index.onIndexing( Occurrence.NEGATIVE_OCCURRENCE_OF_OBJECT_COMPLEMENT_OF); } return true; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (positiveOccurrenceNo == 0 && increment.positiveIncrement > 0) { // first positive occurrence of this expression if (!ContradictionFromNegationRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (positiveOccurrenceNo == 0 && increment.positiveIncrement < 0) { // no positive occurrences of this expression left if (!ContradictionFromNegationRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.negativeIncrement); i++) { // for each indexed negative occurrence of this expression index.onIndexing( Occurrence.NEGATIVE_OCCURRENCE_OF_OBJECT_COMPLEMENT_OF); } return true; }
@Override public ContradictionFromNegationRule create(ChainableSubsumerRule tail) { return new ContradictionFromNegationRule(tail); } };
@Override public boolean addTo(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.getCreate(MATCHER_, FACTORY_); if (rule.negation_ != null && rule.negation_ != negation_) { return false; } // else rule.negation_ = negation_; return true; }
@Override public ContradictionFromNegationRule create(ChainableSubsumerRule tail) { return new ContradictionFromNegationRule(tail); } };
@Override public boolean addTo(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.getCreate(MATCHER_, FACTORY_); if (rule.negation_ != null && rule.negation_ != negation_) { return false; } // else rule.negation_ = negation_; return true; }
public static boolean addRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.add(negation.getNegated(), new ContradictionFromNegationRule(negation)); }
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.find(MATCHER_); if (rule == null) { return false; } // else if (rule.negation_ != negation_) { return false; } // else rule.negation_ = null; if (rule.isEmpty()) { ruleChain.remove(MATCHER_); } return true; }
public static boolean removeRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.remove(negation.getNegated(), new ContradictionFromNegationRule(negation)); }
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.find(MATCHER_); if (rule == null) { return false; } // else if (rule.negation_ != negation_) { return false; } // else rule.negation_ = null; if (rule.isEmpty()) { ruleChain.remove(MATCHER_); } return true; }
public static boolean removeRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.remove(negation.getNegated(), new ContradictionFromNegationRule(negation)); }
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ContradictionFromNegationRule rule = ruleChain.find(MATCHER_); if (rule == null) { return false; } // else if (rule.negation_ != negation_) { return false; } // else rule.negation_ = null; if (rule.isEmpty()) { ruleChain.remove(MATCHER_); } return true; }
public static boolean addRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.add(negation.getNegated(), new ContradictionFromNegationRule(negation)); }
public static boolean addRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.add(negation.getNegated(), new ContradictionFromNegationRule(negation)); }
public static boolean removeRulesFor( ModifiableIndexedObjectComplementOf negation, ModifiableOntologyIndex index) { return index.remove(negation.getNegated(), new ContradictionFromNegationRule(negation)); }