while (!_abox.isComplete()) while (_abox.isChanged() && !_abox.isClosed()) _abox.setChanged(false); _logger.fine("Branch: " + _abox.getBranchIndex() + ", Depth: " + _abox.getStats()._treeDepth + ", Size: " + _abox.getNodes().size() + ", Mem: " + Runtime.getRuntime().freeMemory() / 1000 + "kb"); _abox.validate(); printBlocked(); _abox.printTree(); final IndividualIterator i = OpenlletOptions.USE_COMPLETION_QUEUE ? _abox.getCompletionQueue() : _abox.getIndIterator(); _abox.getCompletionQueue().flushQueue(); _abox.getCompletionQueue().setClosed(_abox.isClosed()); if (_abox.isClosed()) _logger.fine("Clash at Branch (" + _abox.getBranchIndex() + ") " + _abox.getClash()); _abox.setClash(null); _abox.getCompletionQueue().setClosed(false); _abox.setComplete(true); _abox.getCompletionQueue().flushQueue();
try canonical = _abox.getKB().getDatatypeReasoner().getCanonicalRepresentation(literal); _abox.copyOnWrite(); _value = _abox.getLiteral(canonical); if (_value == null) _value = _abox.addLiteral(canonical);
return null; final Node node = _abox.getNode(i); if (node != null) final int remember = _abox.getBranchIndex(); _abox.setBranchIndex(DependencySet.NO_BRANCH); _abox.setSyntacticUpdate(true); final Individual ind = _abox.addIndividual(i, DependencySet.INDEPENDENT); _individuals.add(i); _abox.setSyntacticUpdate(false); _abox.addType(i, nominal, DependencySet.INDEPENDENT); _abox.setSyntacticUpdate(true); for (int j = 0; j < _abox.getBranches().size(); j++) final Branch branch = _abox.getBranches().get(j); branch.setNodeCount(branch.getNodeCount() + 1); _abox.getIncrementalChangeTracker().addUpdatedIndividual(_abox.getIndividual(i)); _abox.getIncrementalChangeTracker().addNewIndividual(_abox.getIndividual(i)); _abox.setSyntacticUpdate(false); _abox.setBranchIndex(remember);
protected Node initNode(final ATermAppl name) { if (ATermUtils.isLiteral(name)) return _abox.addLiteral(name); else { _abox.copyOnWrite(); return _abox.getIndividual(name); } }
@Override public void visit(final AtomIConstant constant) { _abox.copyOnWrite(); value = _abox.getIndividual(constant.getValue()); }
@Override public void initialize(final Expressivity expressivity) { _mergeList.clear(); _mnx.add(null); // add a null entry so Branch._branch _index will match with the _index in this array assert _abox.size() == 1 : "This strategy can only be used with originally empty ABoxes"; _blocking = BlockingFactory.createBlocking(expressivity); final Individual root = _abox.getIndIterator().next(); applyUniversalRestrictions(root); _selfRule.apply(root); _mayNeedExpanding.add(root); _abox.setBranchIndex(1); _abox.getStats()._treeDepth = 1; _abox.setChanged(true); _abox.setComplete(false); _abox.setInitialized(true); }
if (_abox.getNodes().isEmpty()) _abox.setComplete(true); return; if (_abox.getNodes().size() > 1) throw new OpenError("This _strategy can only be used with an ABox that has a single _individual."); _cacheSafety = Optional.of(_abox.getCache().getSafety().canSupport(expr) ? _abox.getCache().getSafety() : CacheSafetyFactory.createCacheSafety(expr)); while (!_abox.isComplete() && !_abox.isClosed()) _abox.setComplete(true); break; _abox.printTree(); _abox.validate(); if (_abox.isClosed()) _logger.fine(() -> "Clash at Branch (" + _abox.getBranchIndex() + ") " + _abox.getClash()); _abox.setClash(null); else _abox.setComplete(true); _abox.printTree();
return; final boolean explain = _abox.doExplanation(); _abox.setDoExplanation(true); if (_abox.isComplete()) if (_changes.contains(ChangeType.TBOX_DEL) || _changes.contains(ChangeType.RBOX_DEL) || !_canUseIncConsistency && _changes.contains(ChangeType.ABOX_DEL)) _abox.reset(); else if (_changes.contains(ChangeType.TBOX_ADD) || _changes.contains(ChangeType.RBOX_ADD)) _abox.resetQueue(); else if (_canUseIncConsistency && _changes.contains(ChangeType.ABOX_DEL)) _abox.setDoExplanation(explain); _abox.clearCaches(!reuseTaxonomy); _abox.getCache().setMaxSize(OpenlletOptions.MAX_ANONYMOUS_CACHE);
if (_abox.doExplanation()) System.out.println("1) Literal clash dependency = " + _abox.getClash()); return; final DatatypeReasoner dtReasoner = _abox.getDatatypeReasoner(); for (final ATermAppl element : dt) ds = ds.union(getDepends(element), _abox.doExplanation()); if (_abox.doExplanation()) Literal valueLiteral = _abox.getLiteral(valueTerm); if (valueLiteral == null) valueLiteral = _abox.addLiteral(valueTerm); DependencySet mergeDs = DependencySet.INDEPENDENT; for (final DependencySet ds : _depends.values()) mergeDs = mergeDs.union(ds, _abox.doExplanation()); _merge = new NodeMerge(this, valueLiteral, mergeDs); for (final ATermAppl element : dt) ds = ds.union(getDepends(element), _abox.doExplanation()); if (_abox.doExplanation())
final boolean added = topObjectRole.addDomain(newUC, DependencySet.INDEPENDENT); final ABox copy = kb.getABox().copy(); copy.setInitialized(false); querySatisfied = !copy.isConsistent();
final int nodeCount = getSourceABox().getNodes().size(); final ATermAppl x = getSourceABox().getNodeList().get(i); final Node node = _sourceABox.getNode(x); final Node copyNode = node.copyTo(this); _nodes.put(x, copyNode); if (getSourceABox().getNodes().containsKey(node.getName())) node.updateNodeReferences(); _branches.set(i, copy); if (i >= _sourceABox.getBranches().size()) copy.setNodeCount(copy.getNodeCount() + nodeCount); else
_abox.getStats()._backtracks++; final int lastBranch = _abox.getClash().getDepends().max(); final List<Branch> branches = _abox.getBranches(); _abox.getStats()._backjumps += branches.size() - lastBranch; Branch newBranch = null; if (lastBranch <= branches.size()) newBranch.setLastClash(_abox.getClash().getDepends()); _abox.getClash().getDepends().remove(lastBranch); if (_logger.isLoggable(Level.FINE)) _logger.fine("FAIL: " + lastBranch); _abox.validate();
if (_abox.isClosed()) return; final Literal mergeTo = _abox.getLiteral(mtc.getTarget()); mergeTo(l, mergeTo, mtc.getDepends()); node = mergeTo; _abox.getKB().getDependencyIndex().addTypeDependency(node.getName(), c, ds); final Role role = _abox.getRole(pred); if (_logger.isLoggable(Level.FINE) && !((Individual) node).hasRSuccessor(role, node)) _logger.fine("SELF: " + node + " " + role + " " + node.getDepends(c));
final Role r = _strategy.getABox().getRole(max.getArgument(0)); final int n = ((ATermInt) max.getArgument(1)).getInt() - 1; final ATermAppl c = (ATermAppl) max.getArgument(2); if (_strategy.getABox().isClosed()) return; if (_strategy.getABox().isClosed()) return; ds = ds.union(new DependencySet(_strategy.getABox().getBranches().size()), _strategy.getABox().doExplanation());
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()); } }
final Individual ind = getABox().getIndividual(x); final Role role = getRBox().getRole(r); for (final Node node : getABox().getNodes().values()) if (node.isLiteral() && node.getTerm() != null) literals.add(node.getTerm()); return Collections.emptyList(); else return getABox().getDataPropertyValues(x, role, datatype);
public DisjunctionBranch(final DisjunctionBranch dr, final ABox abox) { super(abox, dr._allDisjonctions.length, dr); _node = abox.getNode(dr._node.getName()); _disjunction = dr._disjunction; _allDisjonctions = dr._allDisjonctions; _prevDS = new DependencySet[dr._allDisjonctions.length]; System.arraycopy(dr._prevDS, 0, _prevDS, 0, dr._allDisjonctions.length); _order = new int[dr._allDisjonctions.length]; System.arraycopy(dr._order, 0, _order, 0, dr._allDisjonctions.length); }
@Override public QueryResult execABoxQuery(final Query q) { _results = new QueryResultImpl(q); _kb = q.getKB(); final long satCount = _kb.getABox().getStats()._satisfiabilityCount; final long consCount = _kb.getABox().getStats()._consistencyCount; exec(q, new ResultBindingImpl(), true); if (_logger.isLoggable(Level.FINE)) { _logger.fine("Total satisfiability operations: " + (_kb.getABox().getStats()._satisfiabilityCount - satCount)); _logger.fine("Total consistency operations: " + (_kb.getABox().getStats()._consistencyCount - consCount)); _logger.fine("Results of ABox query : " + _results); } return _results; } }
private static Literal createInteger(final ABox abox, final Number val) { final ATermAppl term = ATermUtils.makeTypedLiteral(val.toString(), XSD + "integer"); return abox.addLiteral(term); }
public void addBranch(final Branch newBranch) { _abox.getBranches().add(newBranch); if (newBranch.getBranchIndexInABox() != _abox.getBranches().size()) throw new OpenError("Invalid branch created: " + newBranch.getBranchIndexInABox() + " != " + _abox.getBranches().size()); _completionTimer.ifPresent(t -> t.check()); // CHW - added for incremental deletion support if (OpenlletOptions.USE_INCREMENTAL_DELETION) _abox.getKB().getDependencyIndex().addBranchAddDependency(newBranch); }