* @param individuals
* @param c
* @return
*/
private boolean isConsistent(Collection<ATermAppl> individuals, ATermAppl c, boolean cacheModel) {
Timer t = kb.timers.startTimer( "isConsistent" );
if( log.isLoggable( Level.FINE ) ) {
if( c == null ) {
log.fine( "ABox consistency for " + individuals.size() + " individuals" );
}
else {
StringBuilder sb = new StringBuilder();
sb.append("[");
Iterator<ATermAppl> it = individuals.iterator();
for( int i = 0; i < 100 && it.hasNext(); i++ ) {
if( i > 0 ) {
sb.append( ", " );
}
sb.append( ATermUtils.toString( it.next() ) );
}
if( it.hasNext() ) {
sb.append( ", ..." );
}
sb.append("]");
log.fine( "Consistency " + ATermUtils.toString( c ) + " for " + individuals.size() + " individuals "
+ sb );
}
}
Expressivity expr = kb.getExpressivityChecker().getExpressivityWith( c );
// if c is null we are checking the consistency of this ABox as
// it is and we will not add anything extra
boolean initialConsistencyCheck = (c == null);
boolean emptyConsistencyCheck = initialConsistencyCheck && isEmpty();
// if individuals is empty and we are not building the pseudo
// model then this is concept satisfiability
boolean conceptSatisfiability = individuals.isEmpty()
&& (!initialConsistencyCheck || emptyConsistencyCheck);
// Check if there are any nominals in the KB or nominal
// reasoning is disabled
boolean hasNominal = expr.hasNominal() && !PelletOptions.USE_PSEUDO_NOMINALS;
// Use empty model only if this is concept satisfiability for a KB
// where there are no nominals
boolean canUseEmptyABox = conceptSatisfiability && !hasNominal;
ATermAppl x = null;
if( conceptSatisfiability ) {
x = ATermUtils.CONCEPT_SAT_IND;
individuals = SetUtils.singleton( x );
}
if( emptyConsistencyCheck ) {
c = ATermUtils.TOP;
}
ABox abox = canUseEmptyABox
? this.copy( x, false )
: initialConsistencyCheck
? this
: this.copy( x, true );
for( ATermAppl ind : individuals ) {
abox.setSyntacticUpdate( true );
abox.addType( ind, c );
abox.setSyntacticUpdate( false );
}
if( log.isLoggable( Level.FINE ) ) {
log.fine( "Consistency check starts" );
}
CompletionStrategy strategy = kb.chooseStrategy( abox, expr );
if( log.isLoggable( Level.FINE ) ) {
log.fine( "Strategy: " + strategy.getClass().getName() );
}
Timer completionTimer = kb.timers.getTimer( "complete" );
completionTimer.start();
try {
strategy.complete( expr );
}
finally {
completionTimer.stop();
}
boolean consistent = !abox.isClosed();
if( x != null && c != null && cacheModel ) {