final StringBuilder result = new StringBuilder();
final Tuple tuple = activation.getTuple();
final Map<?, ?> declarations = activation.getSubRule().getOuterDeclarations();
for ( Iterator<?> it = declarations.values().iterator(); it.hasNext(); ) {
final Declaration declaration = (Declaration) it.next();
final FactHandle handle = tuple.get( declaration );
if ( handle instanceof InternalFactHandle ) {
final InternalFactHandle handleImpl = (InternalFactHandle) handle;
if ( handleImpl.getId() == -1 ) {
// This handle is now invalid, probably due to an fact retraction
continue;