@Override public boolean removeRange(final ATermAppl a, final DependencySet ds) { final DependencySet existing = _ranges.get(a); if (existing != null) if (ds.getExplain().equals(existing.getExplain())) { _ranges.remove(a); return true; } return false; }
@Override public boolean removeDomain(final ATermAppl a, final DependencySet ds) { final DependencySet existing = _domains.get(a); if (existing != null) if (ds.getExplain().equals(existing.getExplain())) { _domains.remove(a); return true; } return false; }
@Override public boolean removeRange(final ATermAppl a, final DependencySet ds) { final DependencySet existing = _ranges.get(a); if (existing != null) if (ds.getExplain().equals(existing.getExplain())) { _ranges.remove(a); return true; } return false; }
@Override public boolean removeDomain(final ATermAppl a, final DependencySet ds) { final DependencySet existing = _domains.get(a); if (existing != null) if (ds.getExplain().equals(existing.getExplain())) { _domains.remove(a); return true; } return false; }
@Override public boolean addRange(final ATermAppl a, final DependencySet ds) { if (_ranges.isEmpty()) _ranges = CollectionUtils.makeMap(); final DependencySet existing = _ranges.put(a, ds); if (existing != null && existing.getExplain().equals(ds.getExplain())) return false; return true; }
@Override public boolean addDomain(final ATermAppl a, final DependencySet ds) { if (_domains.isEmpty()) _domains = CollectionUtils.makeMap(); final DependencySet existing = _domains.put(a, ds); return existing == null || !existing.getExplain().equals(ds.getExplain()); }
@Override public boolean addDomain(final ATermAppl a, final DependencySet ds) { if (_domains.isEmpty()) _domains = CollectionUtils.makeMap(); final DependencySet existing = _domains.put(a, ds); return existing == null || !existing.getExplain().equals(ds.getExplain()); }
@Override public boolean addRange(final ATermAppl a, final DependencySet ds) { if (_ranges.isEmpty()) _ranges = CollectionUtils.makeMap(); final DependencySet existing = _ranges.put(a, ds); if (existing != null && existing.getExplain().equals(ds.getExplain())) return false; return true; }
/** * Remove explanation sets which contain references to a syntactic assertion * * @param assertion */ public void removeExplain(final ATermAppl assertion) { if (getExplain().contains(assertion)) { setExplain(new HashSet<ATermAppl>()); DependencyIndex._logger.fine(" Explain: removed "); } }
/** * Remove explanation sets which contain references to a syntactic assertion * * @param assertion */ public void removeExplain(final ATermAppl assertion) { if (getExplain().contains(assertion)) { setExplain(new HashSet<ATermAppl>()); DependencyIndex._logger.fine(" Explain: removed "); } }
/** * Add a new merge dependency * * @param ind * @param mergedTo * @param ds */ public void addMergeDependency(final ATermAppl ind, final ATermAppl mergedTo, final DependencySet ds) { for (final ATermAppl nextAtom : ds.getExplain()) //loop over ds if (_kb.getSyntacticAssertions().contains(nextAtom)) //check if this assertion exists { if (!_dependencies.containsKey(nextAtom)) //if this entry does not exist then create it _dependencies.put(nextAtom, new DependencyEntry()); _dependencies.get(nextAtom).addMergeDependency(ind, mergedTo); //add the dependency } }
@Override public Set<ATermAppl> getExplanationSet() { if (_lastClash == null) throw new OpenError("No clashExplanation was generated!"); return _lastClash.getDepends().getExplain(); }
@Override public Set<ATermAppl> getExplanationSet() { if (_lastClash == null) throw new OpenError("No clashExplanation was generated!"); return _lastClash.getDepends().getExplain(); }
/** * Add a new edge dependency * * @param edge * @param ds */ public void addEdgeDependency(final Edge edge, final DependencySet ds) { for (final ATermAppl nextAtom : ds.getExplain()) //loop over ds if (_kb.getSyntacticAssertions().contains(nextAtom)) //check if this assertion exists { if (!_dependencies.containsKey(nextAtom)) //if this entry does not exist then create it _dependencies.put(nextAtom, new DependencyEntry()); _dependencies.get(nextAtom).addEdgeDependency(edge); //add the dependency } }
/** * Add a new edge dependency * * @param edge * @param ds */ public void addEdgeDependency(final Edge edge, final DependencySet ds) { for (final ATermAppl nextAtom : ds.getExplain()) //loop over ds if (_kb.getSyntacticAssertions().contains(nextAtom)) //check if this assertion exists { if (!_dependencies.containsKey(nextAtom)) //if this entry does not exist then create it _dependencies.put(nextAtom, new DependencyEntry()); _dependencies.get(nextAtom).addEdgeDependency(edge); //add the dependency } }
/** * Add a new type dependency * * @param ind * @param type * @param ds */ public void addTypeDependency(final ATermAppl ind, final ATermAppl type, final DependencySet ds) { for (final ATermAppl nextAtom : ds.getExplain()) //loop over ds if (_kb.getSyntacticAssertions().contains(nextAtom)) //check if this assertion exists { if (!_dependencies.containsKey(nextAtom)) //if this entry does not exist then create it _dependencies.put(nextAtom, new DependencyEntry()); _dependencies.get(nextAtom).addTypeDependency(ind, type); //add the dependency } }
/** * 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); } }
protected WME createEdge(final Edge edge, final EdgeDirection dir) { if (_doExplanation) { final DependencySet ds = dir == EdgeDirection.FORWARD ? _role.getExplainSub(edge.getRole().getName()) : _role.getInverse().getExplainSub(edge.getRole().getName()); if (!ds.getExplain().isEmpty()) return WME.createEdge(new DefaultEdge(edge.getRole(), edge.getFrom(), edge.getTo(), edge.getDepends().union(ds, _doExplanation)), dir); } return WME.createEdge(edge, dir); }
protected WME createEdge(final Edge edge, final EdgeDirection dir) { if (_doExplanation) { final DependencySet ds = dir == EdgeDirection.FORWARD ? _role.getExplainSub(edge.getRole().getName()) : _role.getInverse().getExplainSub(edge.getRole().getName()); if (!ds.getExplain().isEmpty()) return WME.createEdge(new DefaultEdge(edge.getRole(), edge.getFrom(), edge.getTo(), edge.getDepends().union(ds, _doExplanation)), dir); } return WME.createEdge(edge, dir); }