Skip to content

Instantly share code, notes, and snippets.

@mommi84
Created September 30, 2019 10:28
Show Gist options
  • Save mommi84/7614c29e39e410bf3749ee96910eca2c to your computer and use it in GitHub Desktop.
Save mommi84/7614c29e39e410bf3749ee96910eca2c to your computer and use it in GitHub Desktop.
Parse NTriples Quickstart
#!/usr/bin/env python
from rdflib.plugins.parsers.ntriples import NTriplesParser, Sink
filename = 'input.nt'
class MySink(Sink):
def triple(self, s, p, o):
pass
sink = MySink()
parser = NTriplesParser(sink)
with open(filename, "rb") as anons:
parser.parse(anons)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment