I have a big n-quads file with a lot of statements included in a big number of different graphs The lines of the file are as follow :
<http://voag.linkedmodel.org/voag#useGuidelines> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://voag.linkedmodel.org/schema/voag> .
The fourth element correspond to the graph's URI.
I would like to parse this file and split all the different graphs in new files or datastructures, one object per graph, preferably with RDFlib. I really don't know how to tackle this problem, so any help would be appreciated.
ConjunctiveGraph
in which you load the file, and you're basically done or can just do whatever you want with each graph based on the N-Quads filecontexts()
which returns all contexts aka named graphs and with thetriples()
method you have access to all triples of a given context