Python library/code to parse .nt files from dbpedia
dbpedia, python, rdf
Solution
From the rdflib docs.:
>>> from rdflib.graph import Graph
>>> g = Graph()
>>> g.parse("demo.nt", format="nt")
your just needed the `format=` kwarg.
Problem
I want to parse the dbpedia data which is present in .nt format(N-Tuples). I have downloaded the .nt file and is there in my local disk. For example, I want to find out all entities and their homepages. I want to do it python. Right now the only way I could do is to do a grep, or iterate over all lines and select the ones which I want. Are there any good libraries which will allow me to do this? I looked at RDFLib. But all the examples tell you how to write or create .nt format and not read from them.