private void findNext() { for (; _index < _stop; _index++) { final Node node = _abox.getNode(_nodeList.get(_index)); if (!node.isPruned() && node.isIndividual()) break; } }
private void findNext() { for (; _index < _stop; _index++) { final Node node = _abox.getNode(_nodeList.get(_index)); if (!node.isPruned() && node.isIndividual()) break; } }
public Stream<Individual> nodes() { return new ArrayList<>(_nodeList) //.stream() .parallelStream()// .filter(term -> { final Node node = _abox.getNode(term); return !node.isPruned() && node.isIndividual(); })// .map(_abox::getIndividual); }
public Stream<Individual> nodes() { return new ArrayList<>(_nodeList) //.stream() .parallelStream()// .filter(term -> { final Node node = _abox.getNode(term); return !node.isPruned() && node.isIndividual(); })// .map(_abox::getIndividual); }
protected void applyAllValues(final Individual subj, final Role pred, final Node obj, final ATermAppl c, final DependencySet ds) { if (!obj.hasType(c)) { _logger.fine(() -> "ALL : " + subj + " -> " + pred + " -> " + obj + " : " + ATermUtils.toString(c) + " - " + ds); // because we do not maintain the _queue it could be the case that this _node is pruned, so return if (obj.isPruned()) return; _strategy.addType(obj, c, ds); } }
protected void applyAllValues(final Individual subj, final Role pred, final Node obj, final ATermAppl c, final DependencySet ds) { if (!obj.hasType(c)) { _logger.fine(() -> "ALL : " + subj + " -> " + pred + " -> " + obj + " : " + ATermUtils.toString(c) + " - " + ds); // because we do not maintain the _queue it could be the case that this _node is pruned, so return if (obj.isPruned()) return; _strategy.addType(obj, c, ds); } }
public void addType(final ATermAppl c, final DependencySet ds) { if (isPruned()) throw new InternalReasonerException("Adding type to a pruned node " + this + " " + c + "\t" + getPruned()); else if (isMerged()) return; forceAddType(c, ds); }
/** * Find the next _individual in a given _queue * * @param type */ @Override protected void findNext(final int type) { for (; _current[type] < _cutOff[type]; _current[type]++) { Node node = _abox.getNode(_queue[type].get(_current[type])); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if (node != null) if ((node instanceof Literal && isAllowLiterals() || node instanceof Individual && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Find the next _individual in a given _queue * * @param type */ @Override protected void findNext(final int type) { for (; _current[type] < _cutOff[type]; _current[type]++) { Node node = _abox.getNode(_queue[type].get(_current[type])); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if (node != null) if ((node instanceof Literal && isAllowLiterals() || node instanceof Individual && !isAllowLiterals()) && !node.isPruned()) break; } }
public void addType(final ATermAppl c, final DependencySet ds) { if (isPruned()) throw new InternalReasonerException("Adding type to a pruned node " + this + " " + c + "\t" + getPruned()); else if (isMerged()) return; forceAddType(c, ds); }
/** * Find the next _individual in a given queue * * @param type */ @Override protected void findNext(final int type) { for (; _current < _cutOff; _current++) { Node node = _abox.getNode(_queue.get(_current)); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if ((node.isLiteral() && isAllowLiterals() || node.isIndividual() && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Find the next _individual in a given queue * * @param type */ @Override protected void findNext(final int type) { for (; _current < _cutOff; _current++) { Node node = _abox.getNode(_queue.get(_current)); //because we do not maitain the _queue during restore this _node could be non-existent if (node == null) continue; node = node.getSame(); if ((node.isLiteral() && isAllowLiterals() || node.isIndividual() && !isAllowLiterals()) && !node.isPruned()) break; } }
/** * Sets the _blocker to the specified child of the _current _blocker and returns if the new _blocker candidate is allowed to block. The child is not allowed * to block if it is a literal, or a root, or pruned/merged, or is _blocked itself. * * @param child child of the _current _blocker * @return <code>true</code> if the new _blocker candidate is allowed to block */ public boolean moveBlockerDown(final Node child) { if (child.isLiteral() || child.isRoot() || child.isPruned() || child.isMerged() || ((Individual) child).isBlocked() || child.equals(_blocker)) return false; _blocker = (Individual) child; _rolesToBlocked = null; return true; }
/** * Sets the _blocker to the specified child of the _current _blocker and returns if the new _blocker candidate is allowed to block. The child is not allowed * to block if it is a literal, or a root, or pruned/merged, or is _blocked itself. * * @param child child of the _current _blocker * @return <code>true</code> if the new _blocker candidate is allowed to block */ public boolean moveBlockerDown(final Node child) { if (child.isLiteral() || child.isRoot() || child.isPruned() || child.isMerged() || ((Individual) child).isBlocked() || child.equals(_blocker)) return false; _blocker = (Individual) child; _rolesToBlocked = null; return true; }
public void applyDomainRange(final Individual subj, final Role pred, final Node obj, final DependencySet ds) { final Set<ATermAppl> domains = pred.getDomains(); final Set<ATermAppl> ranges = pred.getRanges(); for (final ATermAppl domain : domains) { if (_logger.isLoggable(Level.FINE) && !subj.hasType(domain)) _logger.fine("DOM : " + obj + " <- " + pred + " <- " + subj + " : " + ATermUtils.toString(domain)); addType(subj, domain, ds.union(pred.getExplainDomain(domain), _abox.doExplanation())); if (subj.isPruned() || obj.isPruned()) return; } for (final ATermAppl range : ranges) { if (_logger.isLoggable(Level.FINE) && !obj.hasType(range)) _logger.fine("RAN : " + subj + " -> " + pred + " -> " + obj + " : " + ATermUtils.toString(range)); addType(obj, range, ds.union(pred.getExplainRange(range), _abox.doExplanation())); if (subj.isPruned() || obj.isPruned()) return; } }
public void applyDomainRange(final Individual subj, final Role pred, final Node obj, final DependencySet ds) { final Set<ATermAppl> domains = pred.getDomains(); final Set<ATermAppl> ranges = pred.getRanges(); for (final ATermAppl domain : domains) { if (_logger.isLoggable(Level.FINE) && !subj.hasType(domain)) _logger.fine("DOM : " + obj + " <- " + pred + " <- " + subj + " : " + ATermUtils.toString(domain)); addType(subj, domain, ds.union(pred.getExplainDomain(domain), _abox.doExplanation())); if (subj.isPruned() || obj.isPruned()) return; } for (final ATermAppl range : ranges) { if (_logger.isLoggable(Level.FINE) && !obj.hasType(range)) _logger.fine("RAN : " + subj + " -> " + pred + " -> " + obj + " : " + ATermUtils.toString(range)); addType(obj, range, ds.union(pred.getExplainRange(range), _abox.doExplanation())); if (subj.isPruned() || obj.isPruned()) return; } }
public void applyPropertyRestrictions(final Individual subj, final Role pred, final Node obj, final DependencySet ds) { applyDomainRange(subj, pred, obj, ds); if (subj.isPruned() || obj.isPruned()) return; applyFunctionality(subj, pred, obj); if (subj.isPruned() || obj.isPruned()) return; applyDisjointness(subj, pred, obj, ds); _allValuesRule.applyAllValues(subj, pred, obj, ds); if (subj.isPruned() || obj.isPruned()) return; if (pred.isObjectRole()) { final Individual o = (Individual) obj; _allValuesRule.applyAllValues(o, pred.getInverse(), subj, ds); checkReflexivitySymmetry(subj, pred, o, ds); checkReflexivitySymmetry(o, pred.getInverse(), subj, ds); applyDisjointness(o, pred.getInverse(), subj, ds); } }
/** * Apply all values restriction for the Top object role * * @param allTopC * @param c * @param ds */ public void applyAllValuesTop(final ATermAppl allTopC, final ATermAppl c, final DependencySet ds) { for (final Node node : _strategy.getABox().getNodes().values()) if (node.isIndividual() && !node.isPruned() && !node.hasType(c)) { node.addType(c, ds); node.addType(allTopC, ds); if (_strategy.getABox().isClosed()) break; } } }
/** * Apply all values restriction for the Top object role * * @param allTopC * @param c * @param ds */ public void applyAllValuesTop(final ATermAppl allTopC, final ATermAppl c, final DependencySet ds) { for (final Node node : _strategy.getABox().getNodes().values()) if (node.isIndividual() && !node.isPruned() && !node.hasType(c)) { node.addType(c, ds); node.addType(allTopC, ds); if (_strategy.getABox().isClosed()) break; } } }
/** * Prune the given _node by removing all links going to nominal _nodes and recurse through all successors. No need to remove incoming edges because either * the _node is the first one being pruned so the merge function already handled it or this is a successor _node and its successor is also being pruned * * @param ds */ @Override public void prune(final DependencySet ds) { // add to effected list if (_abox.getBranchIndex() >= 0 && OpenlletOptions.TRACK_BRANCH_EFFECTS) _abox.getBranchEffectTracker().add(_abox.getBranchIndex(), getName()); _pruned = ds; for (int i = 0; i < _outEdges.size(); i++) { final Edge edge = _outEdges.get(i); final Node succ = edge.getTo(); if (succ.isPruned()) continue; else if (succ.isNominal()) succ.removeInEdge(edge); else succ.prune(ds); } }