class ParserDispatcher(object): def __init__(self, sink): self.sink = sink self.realParser = RDFXMLParser() def __call__(self, source, format): self.realParser.parse(source, self.sink)
def create(self, source, with_literals=False, last_modified=None): self.start = time.time() sax_input = URLInputSource(source, last_modified=last_modified) self.last_modified = sax_input.last_modified self.sax_input = sax_input parser = RDFXMLParser() self.data_source_iri = source self.with_literals = with_literals if self.db: self.db_start() self.c = 0 try: parser.parse(sax_input, ScanningSink(self)) except AbortConnection: print "aborted scan." self.end = time.time() print "%d triples in %.3f seconds (%.1f t/s)" % (self.c, self.end-self.start, self.c/(self.end-self.start))
def __init__(self, sink): self.sink = sink self.realParser = RDFXMLParser()