Skip to content

Instantly share code, notes, and snippets.

@acdha
Created May 15, 2012 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acdha/2704123 to your computer and use it in GitHub Desktop.
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/
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