예제 #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
예제 #2
0
 def add_seq(self):
     edge=rdf.triple(sub=self.current_attr_name, pred=self.sequence_desc, obj=self.sequence)
     self.current_graph.add_triple(edge)
예제 #3
0
 def onvalue(self, mo):
     value=mo.group(1)
     trip=rdf.triple(sub=self.current_sub, pred=self.current_attr_name, obj=value)
     self.current_graph.add_triple(trip)
예제 #4
0
 def on_line3(self, row):
     self.g.add_triple(rdf.triple(sub=row[0], pred=row[1], obj=row[2]))
예제 #5
0
 def on_line6(self, row):
     drug=rdf.triple(sub=row[3], pred=row[4], obj=row[5])
     target=rdf.triple(sub=row[0], pred=row[1], obj=drug)
     g.add_triple(target)
예제 #6
0
 def on_line4(self, row):
     self.g.add_triple(rdf.triple(sub=row[0], pred=row[1], obj=row[3]))
     self.g.add_triple(rdf.triple(sub=row[3], pred='name', obj=row[2]))