def merge(self, ontologies):
        """
        Merges specified ontology into current ontology
        """
        if self.xref_graph is None:
            self.xref_graph = nx.MultiGraph()
        logger.info("Merging source: {} xrefs: {}".format(self, len(self.xref_graph.edges())))
        for ont in ontologies:
            logger.info("Merging {} into {}".format(ont, self))
            g = self.get_graph()
            srcg = ont.get_graph()
            for n in srcg.nodes():
                g.add_node(n, **srcg.node[n])
            for (o,s,m) in srcg.edges(data=True):
                g.add_edge(o,s,**m)
            if ont.xref_graph is not None:
                for (o,s,m) in ont.xref_graph.edges(data=True):
                    self.xref_graph.add_edge(o,s,**m)
def merge ( self , ontologies ) : if self . xref_graph is None : self . xref_graph = nx . MultiGraph ( ) logger . info ( "Merging source: {} xrefs: {}" . format ( self , len ( self . xref_graph . edges ( ) ) ) ) for ont in ontologies : logger . info ( "Merging {} into {}" . format ( ont , self ) ) g = self . get_graph ( ) srcg = ont . get_graph ( ) for n in srcg . nodes ( ) : g . add_node ( n , ** srcg . node [ n ] ) for ( o , s , m ) in srcg . edges ( data = True ) : g . add_edge ( o , s , ** m ) if ont . xref_graph is not None : for ( o , s , m ) in ont . xref_graph . edges ( data = True ) : self . xref_graph . add_edge ( o , s , ** m )
Merges specified ontology into current ontology