Using collected module definitions extend linkages

def _extend_module_definitions(self, graph):
        """
        Using collected module definitions extend linkages
        """
        for mod_id in self._modules:
            mod_identity = self._get_triplet_value(graph, URIRef(mod_id), SBOL.module)
            modules = []
            for mod in graph.triples((mod_identity, SBOL.module, None)):
                md = self._get_rdf_identified(graph, mod[2])
                definition_id = self._get_triplet_value(graph, mod[2], SBOL.definition)
                md['definition'] = self._modules[definition_id]
                maps_to = []
                for m in graph.triples((mod[2], SBOL.mapsTo, None)):
                    mt = self._get_rdf_identified(graph, m[2])
                    mt['refinement'] = self._get_triplet_value(graph, m[2], SBOL.refinement)
                    local_id = self._get_triplet_value(graph, m[2], SBOL.local)
                    remote_id = self._get_triplet_value(graph, m[2], SBOL.remote)
                    mt['local'] = self._functional_component_store[local_id]
                    mt['remote'] = self._functional_component_store[remote_id]
                    maps_to.append(MapsTo(**mt))
                modules.append(Module(maps_to=maps_to, **md))
            self._modules[mod_id].modules = modules