def aggregate(iterator, only_no_facts = False):
    """ Aggregates the records of this iterator.
    
    Returns a 3-tuple (dict, int, float) with predicate->time, count and total.
    """
    predicates = dict()
    count = 0
    total = float(0)
    for (pred, time, facts) in iterator:
        if facts == 0 or not only_no_facts:
            if not pred in predicates:
                predicates[pred] = 0
            predicates[pred] += time
            count += 1
            total += time
    return (predicates, count, total)