sparqlalchemy.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:sparqlalchemy 作者: gooofy 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号