Created
September 30, 2019 10:28
-
-
Save mommi84/7614c29e39e410bf3749ee96910eca2c to your computer and use it in GitHub Desktop.
Parse NTriples Quickstart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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