protected boolean implicitNominals() { final Collection<Rule> rules = _abox.getKB().getNormalizedRules().values(); for (final Rule rule : rules) { if (rule == null) continue; for (final RuleAtom atom : rule.getBody()) if (atom instanceof DifferentIndividualsAtom) return true; for (final RuleAtom atom : rule.getHead()) if (atom instanceof SameIndividualAtom) return true; } return false; }
protected boolean implicitNominals() { final Collection<Rule> rules = _abox.getKB().getNormalizedRules().values(); for (final Rule rule : rules) { if (rule == null) continue; for (final RuleAtom atom : rule.getBody()) if (atom instanceof DifferentIndividualsAtom) return true; for (final RuleAtom atom : rule.getHead()) if (atom instanceof SameIndividualAtom) return true; } return false; }
public CompletionStrategy(final ABox abox) { _abox = abox; _tbox = abox.getTBox(); _timers = abox.getKB().getTimers(); _completionTimer = _timers.getTimer("complete"); }
public CompletionStrategy(final ABox abox) { _abox = abox; _tbox = abox.getTBox(); _timers = abox.getKB().getTimers(); _completionTimer = _timers.getTimer("complete"); }
@Override public void visit(final ClassAtom atom) { final ATermAppl c = atom.getPredicate(); result = _abox.getKB().getTBox().isPrimitive(c); }
@Override public void visit(final ClassAtom atom) { final ATermAppl c = atom.getPredicate(); result = _abox.getKB().getTBox().isPrimitive(c); }
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); }
public boolean isDirectlyBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("dBlocking"); try { return isDirectlyBlockedInt(blocked); } finally { timer.ifPresent(t -> t.stop()); } }
public boolean isDirectlyBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("dBlocking"); try { return isDirectlyBlockedInt(blocked); } finally { timer.ifPresent(t -> t.stop()); } }
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); }
public void setLastClash(final DependencySet ds) { if (getTryNext() >= 0) { _combinedClash = _combinedClash.union(ds, _abox.doExplanation()); if (OpenlletOptions.USE_INCREMENTAL_DELETION) //CHW - added for incremental deletions support THIS SHOULD BE MOVED TO SUPER _abox.getKB().getDependencyIndex().addCloseBranchDependency(this, ds); } }
public boolean isBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("blocking"); try { return !blocked.isRoot() && (isIndirectlyBlocked(blocked) || isDirectlyBlockedInt(blocked)); } finally { timer.ifPresent(t -> t.stop()); } }
public boolean isBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("blocking"); try { return !blocked.isRoot() && (isIndirectlyBlocked(blocked) || isDirectlyBlockedInt(blocked)); } finally { timer.ifPresent(t -> t.stop()); } }
public void setLastClash(final DependencySet ds) { if (getTryNext() >= 0) { _combinedClash = _combinedClash.union(ds, _abox.doExplanation()); if (OpenlletOptions.USE_INCREMENTAL_DELETION) //CHW - added for incremental deletions support THIS SHOULD BE MOVED TO SUPER _abox.getKB().getDependencyIndex().addCloseBranchDependency(this, ds); } }
@Override public void visit(final AtomDConstant constant) { ATermAppl canonical; final ATermAppl literal = constant.getValue(); try { canonical = _translatorAbox.getKB().getDatatypeReasoner().getCanonicalRepresentation(literal); } catch (final InvalidLiteralException e) { final String msg = format("Invalid literal (%s) in SWRL _data constant: %s", literal, e.getMessage()); if (OpenlletOptions.INVALID_LITERAL_AS_INCONSISTENCY) canonical = literal; else throw new InternalReasonerException(msg, e); } catch (final UnrecognizedDatatypeException e) { final String msg = format("Unrecognized datatype in literal appearing (%s) in SWRL _data constant: %s", literal, e.getMessage()); throw new InternalReasonerException(msg, e); } _result = new ConstantNodeProvider(_translatorAbox.addLiteral(canonical)); }
@Override public void visit(final AtomDConstant constant) { ATermAppl canonical; final ATermAppl literal = constant.getValue(); try { canonical = _translatorAbox.getKB().getDatatypeReasoner().getCanonicalRepresentation(literal); } catch (final InvalidLiteralException e) { final String msg = format("Invalid literal (%s) in SWRL _data constant: %s", literal, e.getMessage()); if (OpenlletOptions.INVALID_LITERAL_AS_INCONSISTENCY) canonical = literal; else throw new InternalReasonerException(msg, e); } catch (final UnrecognizedDatatypeException e) { final String msg = format("Unrecognized datatype in literal appearing (%s) in SWRL _data constant: %s", literal, e.getMessage()); throw new InternalReasonerException(msg, e); } _result = new ConstantNodeProvider(_translatorAbox.addLiteral(canonical)); }
/** * @param name * @param nodeParam */ public CachedConceptNode(final ATermAppl name, final Individual nodeParam) { _name = name; Individual node = nodeParam; // if the _node is merged, get the representative _node and check // also if the merge depends on a _branch _isIndependent = node.getMergeDependency(true).isIndependent(); node = node.getSame(); _outEdges = copyEdgeList(node, true); _inEdges = copyEdgeList(node, false); // collect all transitive property values if (node.getABox().getKB().getExpressivity().hasNominal()) collectComplexPropertyValues(node); _types = CollectionUtils.makeIdentityMap(node.getDepends()); for (final Map.Entry<ATermAppl, DependencySet> e : _types.entrySet()) e.setValue(e.getValue().cache()); }
/** * @param name * @param nodeParam */ public CachedConceptNode(final ATermAppl name, final Individual nodeParam) { _name = name; Individual node = nodeParam; // if the _node is merged, get the representative _node and check // also if the merge depends on a _branch _isIndependent = node.getMergeDependency(true).isIndependent(); node = node.getSame(); _outEdges = copyEdgeList(node, true); _inEdges = copyEdgeList(node, false); // collect all transitive property values if (node.getABox().getKB().getExpressivity().hasNominal()) collectComplexPropertyValues(node); _types = CollectionUtils.makeIdentityMap(node.getDepends()); for (final Map.Entry<ATermAppl, DependencySet> e : _types.entrySet()) e.setValue(e.getValue().cache()); }
public void applyUniversalRestrictions(final Individual node) { addType(node, ATermUtils.TOP, DependencySet.INDEPENDENT); final Set<Role> reflexives = _abox.getKB().getRBox().getReflexiveRoles(); for (final Role r : reflexives) { _logger.fine(() -> "REF : " + node + " " + r); addEdge(node, r, node, r.getExplainReflexive()); if (node.isMerged()) return; } final Role topObjProp = _abox.getKB().getRole(ATermUtils.TOP_OBJECT_PROPERTY); for (final ATermAppl domain : topObjProp.getDomains()) { addType(node, domain, topObjProp.getExplainDomain(domain)); if (node.isMerged()) continue; } for (final ATermAppl range : topObjProp.getRanges()) { addType(node, range, topObjProp.getExplainRange(range)); if (node.isMerged()) continue; } }
@Test public void test553() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final KnowledgeBase copyKB = kb.copy(); assertTrue(copyKB != kb); assertTrue(copyKB.getABox().getKB() == copyKB); }