Mercurial > hg > dml-open-backendtools
diff ipcluster/tools/turtle2rdf.py @ 0:e34cf1b6fe09 tip
commit
author | Daniel Wolff |
---|---|
date | Sat, 20 Feb 2016 18:14:24 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipcluster/tools/turtle2rdf.py Sat Feb 20 18:14:24 2016 +0100 @@ -0,0 +1,19 @@ +# this file transforms an n3 file to rdf + +import rdflib + +def rdf2n3(in,out): + # create empty graph + g = rdflib.Graph + + # import data + result = g.parse(in, format="n3") + result = g.serialise(out) + return result + +if __name__ == "__main__": + if len(sys.argv) >= 3: + rdf2n3(sys.argv[1],sys.argv[2]) + else: + print "Usage: rdf2n3 filein.n3 fileout.rdf" + \ No newline at end of file