python - How to parse N3 in RDFlib -


i trying convert file xml using n3 parser in rdflib not sure if doing right or if have n3 plugin installed. have far:

import rdflib rdflib import uriref, graph, namespace rdflib.plugins.parsers.notation3 import n3parser  g = graph() result = g.parse(file=open("lemon_example_fear.txt", "r"), format="application/n3") print (g.serialize(format='xml')) 

this not working if reverse order working xml file works fine

this error get:

rdflib.plugin.pluginexception: no plugin registered (application/n3, <class 'rdflib.parser.parser'>) 

if has link download n3 plugin or fix doing wrong great!

i running rdflib 4.0.1 should included shouldn't it?

according this answer 1 of questions (in particular, check list of available parsers link), format argument n3, not application/n3. if need use mime type argument, n3 spec says mime type should text/n3, not application/n3.


Comments