view 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 source
# 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"