Skip to content

Instantly share code, notes, and snippets.

@pebbie
Created September 12, 2014 22:53
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 pebbie/6d4e95052e2e9291e97a to your computer and use it in GitHub Desktop.
Save pebbie/6d4e95052e2e9291e97a to your computer and use it in GitHub Desktop.
rdf-to-rdf format conversion in one line of python code
import sys, rdflib; print rdflib.Graph().parse(sys.argv[1], format=sys.argv[2] if len(sys.argv)>2 else "json-ld").serialize(format=sys.argv[3] if len(sys.argv)>3 else "n3") if len(sys.argv)>1 else "%s <input-file> [<input-format> <output-format>]" % sys.argv[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment