binding );
break;
case UndistVarCore:
// TODO Core IF
final CoreNewImpl core = (CoreNewImpl) current.apply( binding );
final Collection<ATermAppl> distVars = core.getDistVars();
if( distVars.isEmpty() ) {
final Collection<ATermAppl> constants = core.getConstants();
if( constants.isEmpty() ) {
if( QueryEngine.execBooleanABoxQuery( core.getQuery() ) ) {
result.add( binding );
// throw new RuntimeException(
// "The query contains neither dist vars, nor constants,
// yet evaluated by the CombinedQueryEngine !!! ");
}
}
else {
final ATermAppl c = constants.iterator().next();
final ATermAppl clazz = core.getQuery().rollUpTo( c,
Collections.<ATermAppl>emptySet(), STOP_ROLLING_ON_CONSTANTS );
if( kb.isType( c, clazz ) ) {
exec( binding );
}
}
}
else if( distVars.size() == 1 ) {
final ATermAppl var = distVars.iterator().next();
final ATermAppl c = core.getQuery().rollUpTo( var, Collections.<ATermAppl>emptySet(),
STOP_ROLLING_ON_CONSTANTS );
final Collection<ATermAppl> instances = kb.getInstances( c );
for( final ATermAppl a : instances ) {
final ResultBinding candidateBinding = binding.duplicate();
candidateBinding.setValue( var, a );
exec( candidateBinding );
}
}
else {
// TODO
// if (distVars.size() == 2
// && core.getUndistVars().size() == 1
// && !kb.getExpressivity().hasNominal()
// && !kb.getExpressivity().hasTransitivity()) {
// // TODO 1. undist. var. in distinguished manner
// // TODO 2. identify both DV's
// }
final CoreStrategy s = QueryEngine.getStrategy( current );
switch ( s ) {
case SIMPLE:
execSimpleCore( oldQuery, binding, distVars );
break;
case ALLFAST:
execAllFastCore( oldQuery, binding, distVars, core.getUndistVars() );
break;
default:
throw new InternalReasonerException( "Unknown core strategy." );
}
}