public void setObjectRestriction(final boolean isObjectRestriction) { this._isObjectRestriction = Bool.create(isObjectRestriction); } }
@Override public boolean hasPropertyValue(final ATermAppl s, final ATermAppl p, final ATermAppl o) { final Bool hasObviousValue = hasObviousPropertyValue(s, p, o); if (hasObviousValue.isKnown()) if (hasObviousValue.isFalse() || !doExplanation()) return hasObviousValue.isTrue(); ATermAppl c = null; if (o == null) { if (_kb.isDatatypeProperty(p)) c = ATermUtils.makeMin(p, 1, ATermUtils.TOP_LIT); else c = ATermUtils.makeMin(p, 1, ATermUtils.TOP); } else c = ATermUtils.makeHasValue(p, o); final boolean isType = isType(s, c); return isType; }
@Override public boolean isSubClassOf(final ATermAppl c1, final ATermAppl c2) { if (!_doExplanation) { final Bool isKnownSubClass = isKnownSubClassOf(c1, c2); if (isKnownSubClass.isKnown()) return isKnownSubClass.isTrue(); } if (_logger.isLoggable(Level.FINE)) { final long count = _kb.getTimers().getTimer("subClassSat").map(t -> t.getCount()).orElse(0L); _logger.fine(count + ") Checking subclass [" + ATermUtils.toString(c1) + " " + ATermUtils.toString(c2) + "]"); } final ATermAppl notC2 = ATermUtils.negate(c2); final ATermAppl c = ATermUtils.makeAnd(c1, notC2); final Optional<Timer> timer = _kb.getTimers().startTimer("subClassSat"); final boolean sub = !isSatisfiable(c, false); timer.ifPresent(t -> t.stop()); _logger.fine(() -> " Result: " + sub + timer.map(t -> " (" + t.getLast() + "ms)").orElse("")); return sub; }
if (isType.isUnknown()) if (type.isUnknown() && pNode.hasObviousType(subs)) type = Bool.TRUE; if (type.isKnown()) isType = isType.and(type); else Collections.singleton(term).iterator(); Bool knownType = Bool.TRUE; while (i.hasNext() && knownType.isTrue()) if (knownType.isTrue()) if (isType.isUnknown()) return Bool.UNKNOWN;
@Override public boolean contains(final KnowledgeBase kb, final GraphLoader loader, final Node s, final Node p, final Node o) { final ATermAppl prop = loader.node2term(p); if (!kb.isProperty(prop)) return false; for (final ATermAppl ind : kb.getIndividuals()) if (kb.hasKnownPropertyValue(ind, prop, null).isTrue()) return true; return false; }
sb.append(negated.isTrue() ? "owl:Nothing" : "owl:Thing"); else if (BOTTOM.equals(term)) sb.append(negated.isTrue() ? "owl:Thing" : "owl:Nothing"); else if (isVar(term)) if (negated.isTrue()) sb.append("not("); final String name = term.getName(); sb.append(URIUtils.getLocalName(name)); if (negated.isTrue()) sb.append(")"); if (negated.isTrue()) sb.append("not("); toString((ATermAppl) term.getArgument(0), sb, Bool.FALSE, printLocalName); if (negated.isTrue()) sb.append(")"); if (negated.isKnown() && isNot(term)) toString((ATermAppl) term.getArgument(0), sb, negated.not(), printLocalName); else if (negated.isTrue()) if (negated.isKnown() && MINFUN.equals(fun) || MAXFUN.equals(fun)) negatedRecurse = Bool.FALSE;
@Override public boolean isSatisfiable(final ATermAppl c) { if (null == c) return false; ensureConsistency(); if (!isClass(c)) { Base.handleUndefinedEntity(c + _isNotAnKnowClass); return false; } final ATermAppl normalClass = ATermUtils.normalize(c); if (isClassified() && !doExplanation()) { final Bool equivToBottom = getTaxonomyBuilder().getTaxonomy().isEquivalent(ATermUtils.BOTTOM, normalClass); if (equivToBottom.isKnown()) return equivToBottom.isFalse(); } return _abox.isSatisfiable(normalClass); }
@Override public void getObviousSubjects(final ATermAppl p, final ATermAppl o, final CandidateSet<ATermAppl> candidates) { final Iterator<ATermAppl> i = candidates.iterator(); while (i.hasNext()) { final ATermAppl s = i.next(); final Bool hasObviousValue = hasObviousPropertyValue(s, p, o); if (hasObviousValue.isFalse()) i.remove(); else candidates.update(s, hasObviousValue); } }
private Bool isType(final CachedNode pNode, final ATermAppl c) { Bool isType = Bool.UNKNOWN; final boolean isPrimitive = _kb.getTBox().isPrimitive(c); if (isPrimitive && !pNode.isTop() && !pNode.isBottom() && pNode.isComplete()) { final DependencySet ds = pNode.getDepends().get(c); if (ds == null) return Bool.FALSE; else if (ds.isIndependent() && pNode.isIndependent()) return Bool.TRUE; } final ATermAppl notC = ATermUtils.negate(c); final CachedNode cached = getCached(notC); if (cached != null && cached.isComplete()) isType = _cache.isMergable(_kb, pNode, cached).not(); if (OpenlletOptions.CHECK_NOMINAL_EDGES && isType.isUnknown()) { final CachedNode cNode = getCached(c); if (cNode != null) isType = _cache.checkNominalEdges(_kb, pNode, cNode); } return isType; }
private Bool isCachedSat(final Individual x) { if (x.isRoot()) return Bool.UNKNOWN; final ATermAppl c = createConcept(x); final Bool sat = isCachedSat(c); if (sat.isUnknown()) { _logger.finest(() -> "??? Cache miss for " + c); _cachedNodes.put(x, c); } else if (!_cacheSafety.isPresent() || !_cacheSafety.get().isSafe(c, x)) { _logger.finer(() -> "*** Cache unsafe for " + c); return Bool.UNKNOWN; } else _logger.finer(() -> "*** Cache hit for " + c + " sat = " + sat); return sat; }
return result.not();
@Override public boolean isSubClassOf(final ATermAppl c1, final ATermAppl c2) { if (!_doExplanation) { final Bool isKnownSubClass = isKnownSubClassOf(c1, c2); if (isKnownSubClass.isKnown()) return isKnownSubClass.isTrue(); } if (_logger.isLoggable(Level.FINE)) { final long count = _kb.getTimers().getTimer("subClassSat").map(t -> t.getCount()).orElse(0L); _logger.fine(count + ") Checking subclass [" + ATermUtils.toString(c1) + " " + ATermUtils.toString(c2) + "]"); } final ATermAppl notC2 = ATermUtils.negate(c2); final ATermAppl c = ATermUtils.makeAnd(c1, notC2); final Optional<Timer> timer = _kb.getTimers().startTimer("subClassSat"); final boolean sub = !isSatisfiable(c, false); timer.ifPresent(t -> t.stop()); _logger.fine(() -> " Result: " + sub + timer.map(t -> " (" + t.getLast() + "ms)").orElse("")); return sub; }
if (isType.isUnknown()) if (type.isUnknown() && pNode.hasObviousType(subs)) type = Bool.TRUE; if (type.isKnown()) isType = isType.and(type); else Collections.singleton(term).iterator(); Bool knownType = Bool.TRUE; while (i.hasNext() && knownType.isTrue()) if (knownType.isTrue()) if (isType.isUnknown()) return Bool.UNKNOWN;
@Override public boolean contains(final KnowledgeBase kb, final GraphLoader loader, final Node s, final Node p, final Node o) { final ATermAppl prop = loader.node2term(p); if (!kb.isProperty(prop)) return false; for (final ATermAppl ind : kb.getIndividuals()) if (kb.hasKnownPropertyValue(ind, prop, null).isTrue()) return true; return false; }