Last active
August 29, 2015 13:59
-
-
Save cmarat/10657634 to your computer and use it in GitHub Desktop.
Convert https://raw.githubusercontent.com/cgueret/Harmonize/master/codes/belief.csv to n-triples
This file contains hidden or 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
import csv | |
import rdflib | |
g = rdflib.Graph() | |
label = rdflib.namespace.RDFS['label'] | |
d = csv.reader(open('belief.csv').readlines()) | |
# skip headers | |
d.next() | |
for literal, code in d: | |
g.add((rdflib.URIRef(code), label, rdflib.Literal(literal, lang='nl'))) | |
g.serialize('belief.nt', format='nt') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment