public void setObjectRestriction(boolean isObjectRestriction) { this.isObjectRestriction = Bool.create( isObjectRestriction ); } }
public boolean hasPropertyValue(ATermAppl s, ATermAppl p, ATermAppl o) { 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 ); } boolean isType = isType( s, c ); return isType; }
public Set<ATermAppl> getDifferents(ATermAppl name) { ensureConsistency(); Individual ind = abox.getIndividual( name ); if( ind == null ) { handleUndefinedEntity( name + " is not an individual!" ); return Collections.emptySet(); } boolean isIndependent = true; if( ind.isMerged() ) { isIndependent = ind.getMergeDependency( true ).isIndependent(); ind = ind.getSame(); } ATermAppl c = ATermUtils.makeNot( ATermUtils.makeValue( name ) ); Set<ATermAppl> differents = new HashSet<ATermAppl>(); for( ATermAppl x : individuals ) { Bool isType = abox.isKnownType( x, c ); if( isIndependent && isType.isKnown() ) { if( isType.isTrue() ) differents.add( x ); } else if( isType( x, c ) ) { differents.add( x ); } } return differents; }
public Bool isKnownType(Individual pNode, ATermAppl concept, Collection<ATermAppl> subs) { if( isType.isUnknown() ) { Set<ATermAppl> concepts = ATermUtils.isAnd( concept ) ? ATermUtils.listToSet( (ATermList) concept.getArgument( 0 ) ) Bool type = pNode.hasObviousType( c ); if( type.isUnknown() && pNode.hasObviousType( subs ) ) { type = Bool.TRUE; if( type.isKnown() ) { isType = isType.and( type ); : Collections.singleton( term ).iterator(); Bool knownType = Bool.TRUE; while( i.hasNext() && knownType.isTrue() ) { term = i.next(); knownType = isKnownType( pNode, term, SetUtils.<ATermAppl>emptySet() ); if( knownType.isTrue() ) { isType = Bool.TRUE; break LOOP; if( isType.isUnknown() ) { return Bool.UNKNOWN;
sb.append(negated.isTrue() ? "owl:Nothing" : "owl:Thing"); sb.append(negated.isTrue() ? "owl:Thing" : "owl:Nothing"); if( negated.isTrue() ) { sb.append( "not(" ); if( negated.isTrue() ) { sb.append( ")" ); if( negated.isTrue() ) { sb.append( "not(" ); if( negated.isTrue() ) { sb.append( ")" ); else if( negated.isKnown() && ATermUtils.isNot( term ) ) { toString( (ATermAppl) term.getArgument( 0 ), sb, negated.not(), printLocalName ); if( negated.isTrue() ) { if( fun.equals( ATermUtils.ANDFUN ) ) { sb.append( ATermUtils.ORFUN.getName() ); if( negated.isKnown() && fun.equals( ATermUtils.MINFUN ) || fun.equals( ATermUtils.MAXFUN ) ) { negatedRecurse = Bool.FALSE; negatedRecurse = negated.not(); if( negated.isTrue() ) {
public void visit(OWLEquivalentClassesAxiom axiom) { isEntailed = true; Iterator<OWLClassExpression> i = axiom.getClassExpressions().iterator(); if( i.hasNext() ) { OWLClassExpression first = i.next(); while( i.hasNext() && isEntailed ) { OWLClassExpression next = i.next(); if( !reasoner.isClassified() || first.isAnonymous() || next.isAnonymous() ) isEntailed = reasoner.getReasoner().isEntailed( OWL.equivalentClasses( first, next ) ); else isEntailed = reasoner.getTaxonomy().isEquivalent( (OWLClass) first, (OWLClass) next ).isTrue(); } } }
public boolean isSatisfiable(ATermAppl c) { ensureConsistency(); if( !isClass( c ) ) { handleUndefinedEntity( c + " is not a known class!" ); return false; } c = ATermUtils.normalize( c ); if( isClassified() && !doExplanation() ) { Bool equivToBottom = builder.getTaxonomy().isEquivalent( ATermUtils.BOTTOM, c ); if( equivToBottom.isKnown() ) return equivToBottom.isFalse(); } return abox.isSatisfiable( c ); }
public void getObviousSubjects(ATermAppl p, ATermAppl o, CandidateSet<ATermAppl> candidates) { Iterator<ATermAppl> i = candidates.iterator(); while( i.hasNext() ) { ATermAppl s = i.next(); Bool hasObviousValue = hasObviousPropertyValue( s, p, o ); if( hasObviousValue.isFalse() ) { i.remove(); } else { candidates.update( s, hasObviousValue ); } } }
private Bool isType(CachedNode pNode, ATermAppl c) { Bool isType = Bool.UNKNOWN; boolean isPrimitive = kb.getTBox().isPrimitive( c ); if( isPrimitive && !pNode.isTop() && !pNode.isBottom() && pNode.isComplete() ) { DependencySet ds = pNode.getDepends().get( c ); if( ds == null ) { return Bool.FALSE; } else if( ds.isIndependent() && pNode.isIndependent() ) { return Bool.TRUE; } } ATermAppl notC = ATermUtils.negate( c ); CachedNode cached = getCached( notC ); if( cached != null && cached.isComplete() ) { isType = cache.isMergable( kb, pNode, cached ).not(); } if( PelletOptions.CHECK_NOMINAL_EDGES && isType.isUnknown() ) { CachedNode cNode = getCached( c ); if( cNode != null ) { isType = cache.checkNominalEdges( kb, pNode, cNode ); } } return isType; }
private Bool isCachedSat(Individual x) { if( x.isRoot() ) return Bool.UNKNOWN; ATermAppl c = createConcept( x ); Bool sat = isCachedSat( c ); if( sat.isUnknown() ) { if( log.isLoggable( Level.FINEST ) ) log.finest( "??? Cache miss for " + c ); cachedNodes.put( x, c ); } else if( !cacheSafety.isSafe( c, x ) ) { if( log.isLoggable( Level.FINER ) ) log.finer( "*** Cache unsafe for " + c ); // cacheSafety.isSafe( c, x.getInEdges().edgeAt( 0 ).getRole(), x.getParent() ); // System.err.println( "CACHE " + ++cache ); sat = Bool.UNKNOWN; } else if( log.isLoggable( Level.FINER ) ) log.finer( "*** Cache hit for " + c + " sat = " + sat ); return sat; }
public Bool isMergable(KnowledgeBase kb, CachedNode root1, CachedNode root2) { Bool result = checkTrivialClash( root1, root2 ); if( result != null ) return result.not();
public Set<ATermAppl> getDifferents(ATermAppl name) { ensureConsistency(); Individual ind = abox.getIndividual( name ); if( ind == null ) { handleUndefinedEntity( name + " is not an individual!" ); return Collections.emptySet(); } boolean isIndependent = true; if( ind.isMerged() ) { isIndependent = ind.getMergeDependency( true ).isIndependent(); ind = ind.getSame(); } ATermAppl c = ATermUtils.makeNot( ATermUtils.makeValue( name ) ); Set<ATermAppl> differents = new HashSet<ATermAppl>(); for( ATermAppl x : individuals ) { Bool isType = abox.isKnownType( x, c ); if( isIndependent && isType.isKnown() ) { if( isType.isTrue() ) differents.add( x ); } else if( isType( x, c ) ) { differents.add( x ); } } return differents; }
public Bool isKnownType(Individual pNode, ATermAppl concept, Collection<ATermAppl> subs) { if( isType.isUnknown() ) { Set<ATermAppl> concepts = ATermUtils.isAnd( concept ) ? ATermUtils.listToSet( (ATermList) concept.getArgument( 0 ) ) Bool type = pNode.hasObviousType( c ); if( type.isUnknown() && pNode.hasObviousType( subs ) ) { type = Bool.TRUE; if( type.isKnown() ) { isType = isType.and( type ); : Collections.singleton( term ).iterator(); Bool knownType = Bool.TRUE; while( i.hasNext() && knownType.isTrue() ) { term = i.next(); knownType = isKnownType( pNode, term, SetUtils.<ATermAppl>emptySet() ); if( knownType.isTrue() ) { isType = Bool.TRUE; break LOOP; if( isType.isUnknown() ) { return Bool.UNKNOWN;
public boolean hasPropertyValue(ATermAppl s, ATermAppl p, ATermAppl o) { 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 ); } boolean isType = isType( s, c ); return isType; }
sb.append(negated.isTrue() ? "owl:Nothing" : "owl:Thing"); sb.append(negated.isTrue() ? "owl:Thing" : "owl:Nothing"); if( negated.isTrue() ) { sb.append( "not(" ); if( negated.isTrue() ) { sb.append( ")" ); if( negated.isTrue() ) { sb.append( "not(" ); if( negated.isTrue() ) { sb.append( ")" ); else if( negated.isKnown() && ATermUtils.isNot( term ) ) { toString( (ATermAppl) term.getArgument( 0 ), sb, negated.not(), printLocalName ); if( negated.isTrue() ) { if( fun.equals( ATermUtils.ANDFUN ) ) { sb.append( ATermUtils.ORFUN.getName() ); if( negated.isKnown() && fun.equals( ATermUtils.MINFUN ) || fun.equals( ATermUtils.MAXFUN ) ) { negatedRecurse = Bool.FALSE; negatedRecurse = negated.not(); if( negated.isTrue() ) {
@Override public boolean contains(KnowledgeBase kb, GraphLoader loader, Node s, Node p, Node o) { ATermAppl prop = loader.node2term( p ); if( !kb.isProperty( prop ) ) return false; for( ATermAppl ind : kb.getIndividuals() ) { if( kb.hasKnownPropertyValue( ind, prop, null ).isTrue() ) { return true; } } return false; }