Ejemplo n.º 1
0
    def ondtnan(self, mo):
        dt_N=mo.group(1)
        dt_attr_name=mo.group(2)

        # check for self.sequence
        if hasattr(self, 'sequence') and len(self.sequence) > 0:
            self.add_seq()

        # init new dt if necessary:
#        if not hasattr(self, 'current_target') or self.current_target.N != dt_N:
        if not hasattr(self.current_graph, 'N') or self.current_graph.N != dt_N:
            target=rdf.graph()
            target.N=dt_N
            self.dc.add_triple(rdf.triple(sub=self.id, pred='has_target', obj=target))
            self.current_graph=target
            
        self.current_attr_name=dt_attr_name
Ejemplo n.º 2
0
 def onbegin_dc(self, mo):
     self.id=mo.group(1)
     self.dc=rdf.graph(id=self.id)
     self.current_sub=self.id
     self.current_graph=self.dc