<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def index(self):
 """ Creates indexes based on inferred terms. You do not need to call this yourself; called on initialization """

        self.subjects = list(self.association_map.keys())

        # ensure annotations unique
        for (subj,terms) in self.association_map.items():
            self.association_map[subj] = list(set(self.association_map[subj]))
            
        logging.info("Indexing {} items".format(len(self.subjects)))
        n = 0
        all_objs = set()
        for (subj,terms) in self.association_map.items():
            ancs = self.termset_ancestors(terms)
            all_objs.update(ancs)
            self.subject_to_inferred_map[subj] = ancs
            n = n+1
            if n<5:
                logging.info(" Indexed: {} -> {}".format(subj, ancs))
            elif n == 6:
                logging.info("[TRUNCATING>5]....")
        self.objects = all_objs