'Create the semantic types index.'

def _loadsemtypes(self):

    self._semtypes = AttrDict()
    semtypeXML = [x for x in XMLCorpusView(self.abspath(u'semTypes.xml'), u'semTypes/semType', self._handle_semtype_elt)]
    for st in semtypeXML:
        n = st[u'name']
        a = st[u'abbrev']
        i = st[u'ID']
        self._semtypes[n] = i
        self._semtypes[a] = i
        self._semtypes[i] = st
    roots = []
    for st in self.semtypes():
        if st.superType:
            st.superType = self.semtype(st.superType.supID)
            st.superType.subTypes.append(st)
        else:
            if (st not in roots):
                roots.append(st)
            st.rootType = st
    queue = list(roots)
    assert queue
    while queue:
        st = queue.pop(0)
        for child in st.subTypes:
            child.rootType = st.rootType
            queue.append(child)
