1

I have a couple of files out of which I have to make an RDF graph. Instead of parsing each file again and again by having to write the name of the files, I tried to use the following code:

from rdflib import Graph
g = Graph()
import os

directory = r'/content'
for filename in os.listdir(directory):
   if filename.endswith(".ttl"):
     name = os.path.join(directory, filename)
     g.parse(name, format='turtle')

I get an error:

File "<string>", line unknown
BadSyntax

Can anyone please point out my mistake here and correct my code so that I can accomplish my target

K C
  • 413
  • 4
  • 15
  • It's an issue with RDFLib but not sure what the deal is... certainly goes down as one of the worst error messages in history! – There Dec 01 '21 at 20:25

0 Answers0