Parse large RDF in Python

前端 未结 6 1511
故里飘歌
故里飘歌 2021-02-02 16:07

I\'d like to parse a very large (about 200MB) RDF file in python. Should I be using sax or some other library? I\'d appreciate some very basic code that I can build on, say to r

6条回答
  •  别跟我提以往
    2021-02-02 16:16

    For RDF processing in Python, consider using an RDF library such as RDFLib. If you also need a triplestore, more heavyweight solutions are available as well, but may not be needed here (PySesame, neo4jrdf with neo4jpy).

    Before writing your own SAX parser for RDF, check out rdfxml.py:

    import rdfxml
    data = open('data.rdf', 'r').read()
    rdfxml.parseRDF(data)
    

提交回复
热议问题