Created
May 15, 2012 18:49
-
-
Save acdha/2704123 to your computer and use it in GitHub Desktop.
Quick and dirty viaf conversion script based on http://inkdroid.org/journal/2012/05/15/diving-into-viaf/
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
import sys | |
import rdflib | |
for line in sys.stdin: | |
g = rdflib.Graph() | |
record_number, cluster_xml = line.split("\t", 1) | |
try: | |
g.parse(data=cluster_xml) | |
except Exception as exc: | |
print >>sys.stderr, "Unable to parse record: %s" % exc | |
print >>sys.stderr, line | |
break | |
print g.serialize(format='nt').encode('utf-8'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment