@Override public ObjectUnionFromDisjunctRule create(ChainableSubsumerRule tail) { return new ObjectUnionFromDisjunctRule(tail); } };
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }
@Override public Void visit(ObjectUnionFromDisjunctRule rule, IndexedClassExpression premise, ContextPremises premises, ClassInferenceProducer producer) { for (IndexedClassExpression ice : rule.getDisjunctions()) { iceValidator_.checkNew(ice); } return null; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }
@Override public ObjectUnionFromDisjunctRule create(ChainableSubsumerRule tail) { return new ObjectUnionFromDisjunctRule(tail); } };
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ObjectUnionFromDisjunctRule rule = ruleChain.find(MATCHER_); disjunction, NAME, position); int j = rule.indexOf(disjunction, position); if (j >= 0) { rule.disjunctions_.remove(j); if (rule.isEmpty()) { ruleChain.remove(MATCHER_); LOGGER_.trace("{}: removed ", NAME);
@Override public ObjectUnionFromDisjunctRule create(ChainableSubsumerRule tail) { return new ObjectUnionFromDisjunctRule(tail); } };
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ObjectUnionFromDisjunctRule rule = ruleChain.find(MATCHER_); disjunction, NAME, position); int j = rule.indexOf(disjunction, position); if (j >= 0) { rule.disjunctions_.remove(j); if (rule.isEmpty()) { ruleChain.remove(MATCHER_); LOGGER_.trace("{}: removed ", NAME);
public static boolean addRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int added = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.add(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { added++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (added == 0) break; // else added--; index.remove(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }
@Override public boolean removeFrom(Chain<ChainableSubsumerRule> ruleChain) { if (isEmpty()) return true; ObjectUnionFromDisjunctRule rule = ruleChain.find(MATCHER_); disjunction, NAME, position); int j = rule.indexOf(disjunction, position); if (j >= 0) { rule.disjunctions_.remove(j); if (rule.isEmpty()) { ruleChain.remove(MATCHER_); LOGGER_.trace("{}: removed ", NAME);
public static boolean removeRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int removed = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.remove(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { removed++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (removed == 0) break; // else removed--; index.add(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }
public static boolean addRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int added = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.add(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { added++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (added == 0) break; // else added--; index.remove(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }
public static boolean removeRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int removed = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.remove(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { removed++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (removed == 0) break; // else removed--; index.add(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }
public static boolean addRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int added = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.add(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { added++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (added == 0) break; // else added--; index.remove(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }
public static boolean removeRulesFor( ModifiableIndexedObjectUnionOf disjunction, ModifiableOntologyIndex index) { boolean success = true; int removed = 0; List<? extends ModifiableIndexedClassExpression> disjuncts = disjunction .getDisjuncts(); for (int pos = 0; pos < disjuncts.size(); pos++) { ModifiableIndexedClassExpression disjunct = disjuncts.get(pos); if (index.remove(disjunct, new ObjectUnionFromDisjunctRule(disjunction, pos))) { removed++; } else { success = false; break; } } if (success) return true; // else revert the changes made for (int pos = 0; pos < disjuncts.size(); pos++) { if (removed == 0) break; // else removed--; index.add(disjuncts.get(pos), new ObjectUnionFromDisjunctRule(disjunction, pos)); } return false; }