public void reportClash(final Clash clash) { _clashed = true; _abox.setClash(clash); }
public void reportClash(final Clash clash) { _clashed = true; _abox.setClash(clash); }
@Override public void activate(final Token token) { resetDependencySet(token); _strategy.getABox().setClash(Clash.unexplained(null, _ds)); }
public void restoreLocal(final Individual ind, final Branch br) { _abox.getStats()._localRestores++; _abox.setClash(null); _abox.setBranchIndex(br.getBranchIndexInABox()); final Map<Node, Boolean> visited = new HashMap<>(); restoreLocal(ind, br.getBranchIndexInABox(), visited); for (final Map.Entry<Node, Boolean> entry : visited.entrySet()) { final boolean restored = entry.getValue(); if (restored) _allValuesRule.apply((Individual) entry.getKey()); } }
public void restoreLocal(final Individual ind, final Branch br) { _abox.getStats()._localRestores++; _abox.setClash(null); _abox.setBranchIndex(br.getBranchIndexInABox()); final Map<Node, Boolean> visited = new HashMap<>(); restoreLocal(ind, br.getBranchIndexInABox(), visited); for (final Map.Entry<Node, Boolean> entry : visited.entrySet()) { final boolean restored = entry.getValue(); if (restored) _allValuesRule.apply((Individual) entry.getKey()); } }
@Override public void activate(final Token token) { resetDependencySet(token); _strategy.getABox().setClash(Clash.unexplained(null, _ds)); }
/** * Restore a clash dependency * * @param assertion * @param clash */ private void restoreClash(final ATermAppl assertion, final ClashDependency clash) { DependencyIndex._logger.fine(() -> " Restoring clash dependency clash: " + clash.getClash()); clash.getClash().getDepends().removeExplain(assertion); // remove the dependency if (clash.getClash().getDepends().getExplain().isEmpty() && clash.getClash().getDepends().isIndependent()) // undo clash if empty and is independent { DependencyIndex._logger.fine(() -> " Actually removing clash!"); _kb.getABox().setClash(null); } }
/** * Restore a clash dependency * * @param assertion * @param clash */ private void restoreClash(final ATermAppl assertion, final ClashDependency clash) { DependencyIndex._logger.fine(() -> " Restoring clash dependency clash: " + clash.getClash()); clash.getClash().getDepends().removeExplain(assertion); // remove the dependency if (clash.getClash().getDepends().getExplain().isEmpty() && clash.getClash().getDepends().isIndependent()) // undo clash if empty and is independent { DependencyIndex._logger.fine(() -> " Actually removing clash!"); _kb.getABox().setClash(null); } }
public boolean setSame(final Node node, final DependencySet ds) { if (isSame(node)) return false; if (isDifferent(node)) { //CHW - added for incremental reasoning support - this is needed as we will need to backjump if possible if (OpenlletOptions.USE_INCREMENTAL_CONSISTENCY) _abox.setClash(Clash.nominal(this, ds.union(_mergeDepends, _abox.doExplanation()).union(node._mergeDepends, _abox.doExplanation()), node.getName())); else _abox.setClash(Clash.nominal(this, ds, node.getName())); return false; } _mergedTo = node; _mergeDepends = ds.copy(_abox.getBranchIndex()); node.addMerged(this); return true; }
public boolean setSame(final Node node, final DependencySet ds) { if (isSame(node)) return false; if (isDifferent(node)) { //CHW - added for incremental reasoning support - this is needed as we will need to backjump if possible if (OpenlletOptions.USE_INCREMENTAL_CONSISTENCY) _abox.setClash(Clash.nominal(this, ds.union(_mergeDepends, _abox.doExplanation()).union(node._mergeDepends, _abox.doExplanation()), node.getName())); else _abox.setClash(Clash.nominal(this, ds, node.getName())); return false; } _mergedTo = node; _mergeDepends = ds.copy(_abox.getBranchIndex()); node.addMerged(this); return true; }
protected void addOutEdge(final Edge edge) { setChanged(ALL); setChanged(MAX); _applyNext[MAX] = 0; if (edge.getRole().isBottom()) _abox.setClash(Clash.bottomProperty(edge.getFrom(), edge.getDepends(), edge.getRole().getName())); else _outEdges.add(edge); }
protected void addOutEdge(final Edge edge) { setChanged(ALL); setChanged(MAX); _applyNext[MAX] = 0; if (edge.getRole().isBottom()) _abox.setClash(Clash.bottomProperty(edge.getFrom(), edge.getDepends(), edge.getRole().getName())); else _outEdges.add(edge); }
private void applyDisjointness(final Individual subj, final Role pred, final Node obj, final DependencySet dsParam) { DependencySet ds = dsParam; // TODO what about inv edges? // TODO improve this check final Set<Role> disjoints = pred.getDisjointRoles(); if (disjoints.isEmpty()) return; final EdgeList edges = subj.getEdgesTo(obj); for (int i = 0, n = edges.size(); i < n; i++) { final Edge otherEdge = edges.get(i); if (disjoints.contains(otherEdge.getRole())) { ds = ds.union(otherEdge.getDepends(), _abox.doExplanation()); ds = ds.union(pred.getExplainDisjointRole(otherEdge.getRole()), _abox.doExplanation()); _abox.setClash(Clash.disjointProps(subj, ds, pred.getName(), otherEdge.getRole().getName())); return; } } }
public void checkReflexivitySymmetry(final Individual subj, final Role pred, final Individual obj, final DependencySet dsParam) { DependencySet ds = dsParam; if (pred.isAsymmetric() && obj.hasRSuccessor(pred, subj)) { final EdgeList edges = obj.getEdgesTo(subj, pred); ds = ds.union(edges.get(0).getDepends(), _abox.doExplanation()); if (OpenlletOptions.USE_TRACING) ds = ds.union(pred.getExplainAsymmetric(), _abox.doExplanation()); _abox.setClash(Clash.unexplained(subj, ds, "Antisymmetric property " + pred)); } else if (subj.equals(obj)) if (pred.isIrreflexive()) _abox.setClash(Clash.unexplained(subj, ds.union(pred.getExplainIrreflexive(), _abox.doExplanation()), "Irreflexive property " + pred)); else { final ATerm notSelfP = ATermUtils.makeNot(ATermUtils.makeSelf(pred.getName())); if (subj.hasType(notSelfP)) _abox.setClash(Clash.unexplained(subj, ds.union(subj.getDepends(notSelfP), _abox.doExplanation()), "Local irreflexive property " + pred)); } }
public void checkReflexivitySymmetry(final Individual subj, final Role pred, final Individual obj, final DependencySet dsParam) { DependencySet ds = dsParam; if (pred.isAsymmetric() && obj.hasRSuccessor(pred, subj)) { final EdgeList edges = obj.getEdgesTo(subj, pred); ds = ds.union(edges.get(0).getDepends(), _abox.doExplanation()); if (OpenlletOptions.USE_TRACING) ds = ds.union(pred.getExplainAsymmetric(), _abox.doExplanation()); _abox.setClash(Clash.unexplained(subj, ds, "Antisymmetric property " + pred)); } else if (subj.equals(obj)) if (pred.isIrreflexive()) _abox.setClash(Clash.unexplained(subj, ds.union(pred.getExplainIrreflexive(), _abox.doExplanation()), "Irreflexive property " + pred)); else { final ATerm notSelfP = ATermUtils.makeNot(ATermUtils.makeSelf(pred.getName())); if (subj.hasType(notSelfP)) _abox.setClash(Clash.unexplained(subj, ds.union(subj.getDepends(notSelfP), _abox.doExplanation()), "Local irreflexive property " + pred)); } }
private void applyDisjointness(final Individual subj, final Role pred, final Node obj, final DependencySet dsParam) { DependencySet ds = dsParam; // TODO what about inv edges? // TODO improve this check final Set<Role> disjoints = pred.getDisjointRoles(); if (disjoints.isEmpty()) return; final EdgeList edges = subj.getEdgesTo(obj); for (int i = 0, n = edges.size(); i < n; i++) { final Edge otherEdge = edges.get(i); if (disjoints.contains(otherEdge.getRole())) { ds = ds.union(otherEdge.getDepends(), _abox.doExplanation()); ds = ds.union(pred.getExplainDisjointRole(otherEdge.getRole()), _abox.doExplanation()); _abox.setClash(Clash.disjointProps(subj, ds, pred.getName(), otherEdge.getRole().getName())); return; } } }
public boolean setDifferent(final Node node, final DependencySet dsParam) { DependencySet ds = dsParam; // add to effected list if (_abox.getBranchIndex() >= 0 && OpenlletOptions.TRACK_BRANCH_EFFECTS) _abox.getBranchEffectTracker().add(_abox.getBranchIndex(), node.getName()); if (isDifferent(node)) return false; if (isSame(node)) { ds = ds.union(getMergeDependency(true), _abox.doExplanation()); ds = ds.union(node.getMergeDependency(true), _abox.doExplanation()); _abox.setClash(Clash.nominal(this, ds, node.getName())); if (!ds.isIndependent()) return false; } ds = ds.copy(_abox.getBranchIndex()); _differents.put(node, ds); node.setDifferent(this, ds); _abox.setChanged(true); return true; }
public boolean setDifferent(final Node node, final DependencySet dsParam) { DependencySet ds = dsParam; // add to effected list if (_abox.getBranchIndex() >= 0 && OpenlletOptions.TRACK_BRANCH_EFFECTS) _abox.getBranchEffectTracker().add(_abox.getBranchIndex(), node.getName()); if (isDifferent(node)) return false; if (isSame(node)) { ds = ds.union(getMergeDependency(true), _abox.doExplanation()); ds = ds.union(node.getMergeDependency(true), _abox.doExplanation()); _abox.setClash(Clash.nominal(this, ds, node.getName())); if (!ds.isIndependent()) return false; } ds = ds.copy(_abox.getBranchIndex()); _differents.put(node, ds); node.setDifferent(this, ds); _abox.setChanged(true); return true; }
public boolean tryNext() { // nothing more to try, update the clash dependency if (getTryNext() == getTryCount()) if (!_abox.isClosed()) _abox.setClash(Clash.unexplained(getNode(), _termDepends)); else _abox.getClash().setDepends(getCombinedClash()); // if there is no clash try next possibility if (!_abox.isClosed()) tryBranch(); // there is a clash so there is no point in trying this // _branch again. remove this _branch from clash dependency if (_abox.isClosed()) if (!OpenlletOptions.USE_INCREMENTAL_DELETION) _abox.getClash().getDepends().remove(getBranchIndexInABox()); return !_abox.isClosed(); }
public boolean tryNext() { // nothing more to try, update the clash dependency if (getTryNext() == getTryCount()) if (!_abox.isClosed()) _abox.setClash(Clash.unexplained(getNode(), _termDepends)); else _abox.getClash().setDepends(getCombinedClash()); // if there is no clash try next possibility if (!_abox.isClosed()) tryBranch(); // there is a clash so there is no point in trying this // _branch again. remove this _branch from clash dependency if (_abox.isClosed()) if (!OpenlletOptions.USE_INCREMENTAL_DELETION) _abox.getClash().getDepends().remove(getBranchIndexInABox()); return !_abox.isClosed(); }