public void add( T obj, Bool isKnown ) { if( isKnown.isTrue() ) { knowns.add( obj ); } else if( isKnown.isUnknown() ) { unknowns.add( obj ); } }
public void add( T obj, Bool isKnown ) { if( isKnown.isTrue() ) { knowns.add( obj ); } else if( isKnown.isUnknown() ) { unknowns.add( obj ); } }
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; }
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; }
/** * Returns true if there is at least one named individual that belongs to * the given class * * @param c * @return */ public boolean hasInstance(ATerm d) { if( !isClass( d ) ) { handleUndefinedEntity( d + " is not a class!" ); return false; } ensureConsistency(); ATermAppl c = ATermUtils.normalize( (ATermAppl) d ); List<ATermAppl> unknowns = new ArrayList<ATermAppl>(); Iterator<Individual> i = new IndividualIterator( abox ); while( i.hasNext() ) { ATermAppl x = i.next().getName(); Bool knownType = abox.isKnownType( x, c ); if( knownType.isTrue() ) return true; else if( knownType.isUnknown() ) unknowns.add( x ); } boolean hasInstance = !unknowns.isEmpty() && abox.isType( unknowns, c ); return hasInstance; }
public Bool checkNominalEdges(KnowledgeBase kb, CachedNode pNode, CachedNode cNode) { Bool result = Bool.UNKNOWN; if( pNode.isComplete() && cNode.isComplete() && cNode.isIndependent() ) { result = checkNominalEdges( kb, pNode, cNode, false ); if( result.isUnknown() ) result = checkNominalEdges( kb, pNode, cNode, true ); } return result; }
public Bool checkNominalEdges(KnowledgeBase kb, CachedNode pNode, CachedNode cNode) { Bool result = Bool.UNKNOWN; if( pNode.isComplete() && cNode.isComplete() && cNode.isIndependent() ) { result = checkNominalEdges( kb, pNode, cNode, false ); if( result.isUnknown() ) result = checkNominalEdges( kb, pNode, cNode, true ); } return result; }
/** * Returns true if there is at least one named individual that belongs to * the given class * * @param c * @return */ public boolean hasInstance(ATerm d) { if( !isClass( d ) ) { handleUndefinedEntity( d + " is not a class!" ); return false; } ensureConsistency(); ATermAppl c = ATermUtils.normalize( (ATermAppl) d ); List<ATermAppl> unknowns = new ArrayList<ATermAppl>(); Iterator<Individual> i = new IndividualIterator( abox ); while( i.hasNext() ) { ATermAppl x = i.next().getName(); Bool knownType = abox.isKnownType( x, c ); if( knownType.isTrue() ) return true; else if( knownType.isUnknown() ) unknowns.add( x ); } boolean hasInstance = !unknowns.isEmpty() && abox.isType( unknowns, c ); return hasInstance; }
|| (CHECK_CONCEPT_SAT && isKnownType.isUnknown() && (randomGen .nextFloat() < UNKNOWN_PROB)) ) {
|| (CHECK_CONCEPT_SAT && isKnownType.isUnknown() && (randomGen .nextFloat() < UNKNOWN_PROB)) ) {
if( isType.isTrue() ) knowns.add( x ); else if( isType.isUnknown() ) unknowns.add( x );
if( isType.isTrue() ) knowns.add( x ); else if( isType.isUnknown() ) unknowns.add( x );
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( isType.isUnknown() ) { return Bool.UNKNOWN;
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( isType.isUnknown() ) { return Bool.UNKNOWN;
if( tripleSatisfied.isUnknown() ) allTriplesSatisfied = Bool.UNKNOWN; else if( tripleSatisfied.isFalse() ) {
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 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; }
isEquivalent = builder.getTaxonomy().isEquivalent( c1, c2 ); if( isEquivalent.isUnknown() ) isEquivalent = abox.isKnownSubClassOf( c1, c2 ).and( abox.isKnownSubClassOf( c2, c1 ) );
isEquivalent = builder.getTaxonomy().isEquivalent( c1, c2 ); if( isEquivalent.isUnknown() ) isEquivalent = abox.isKnownSubClassOf( c1, c2 ).and( abox.isKnownSubClassOf( c2, c1 ) );