<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_triples(self, ontol):
 """ Adds triples to an ontology object. Currently assumes gocam/lego-style """

        rg = self.rdfgraph
        g = ontol.get_graph()
        typemap = {}
        inds = rg.subjects(RDF.type, OWL.NamedIndividual)
        for s in inds:
            for (s,p,o) in rg.triples((s,None,None)):
                s_id = id(s)
                p_id = id(p)
                g.add_node(s_id)
                if isinstance(o,URIRef):
                    o_id = id(o)
                    if p == RDF.type:
                        if o != OWL.NamedIndividual:
                            if s_id not in typemap:
                                typemap[s_id] = []
                            typemap[s_id].append(o_id)
                    else:
                        g.add_edge(o_id,s_id,pred=p_id)

        # propagate label from type
        for s in typemap.keys():
            g.nodes[s]['types'] = typemap[s]
            if self.tbox_ontology is not None:
                if 'label' not in g.nodes[s]:
                    g.nodes[s]['label'] = ";".join([self.tbox_ontology.label(x) for x in typemap[s] if self.tbox_ontology.label(x) is not None])