Mercurial > hg > dml-open-backendtools
comparison ipcluster/tools/turtle2rdf.py @ 0:e34cf1b6fe09 tip
commit
| author | Daniel Wolff |
|---|---|
| date | Sat, 20 Feb 2016 18:14:24 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:e34cf1b6fe09 |
|---|---|
| 1 # this file transforms an n3 file to rdf | |
| 2 | |
| 3 import rdflib | |
| 4 | |
| 5 def rdf2n3(in,out): | |
| 6 # create empty graph | |
| 7 g = rdflib.Graph | |
| 8 | |
| 9 # import data | |
| 10 result = g.parse(in, format="n3") | |
| 11 result = g.serialise(out) | |
| 12 return result | |
| 13 | |
| 14 if __name__ == "__main__": | |
| 15 if len(sys.argv) >= 3: | |
| 16 rdf2n3(sys.argv[1],sys.argv[2]) | |
| 17 else: | |
| 18 print "Usage: rdf2n3 filein.n3 fileout.rdf" | |
| 19 |
