def parse(self, source=None, publicID=None, format="xml",
location=None, file=None, data=None, context=u'http://example.com', **args):
# parse to memory first, then do a bulk insert into our DB
logging.debug('parsing to memory...')
cj = rdflib.ConjunctiveGraph()
memg = cj.get_context(context)
memg.parse(source=source, publicID=publicID, format=format, location=location,
file=file, data=data, **args)
# for s, p, o in memg:
# if not isinstance (o, rdflib.Literal):
# continue
# if not 'dateTime' in o.datatype:
# continue
# # import pdb; pdb.set_trace()
# s = unicode(o)
# print u"Got one!! %s" % s
quads = cj.quads()
logging.debug('addN ...')
self.addN(quads)
评论列表
文章目录