Mercurial > hg > audio-features-catalogue
diff rdfpy/convertXMLtoN3.py @ 0:62d2c72e4223
initial commit
author | nothing@tehis.net |
---|---|
date | Mon, 25 Feb 2013 14:40:54 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rdfpy/convertXMLtoN3.py Mon Feb 25 14:40:54 2013 +0000 @@ -0,0 +1,16 @@ +import rdflib, os, fnmatch +from rdflib import Graph, RDF, RDFS, plugin, URIRef, Literal, OWL + +basedir = '/Users/alo/MusicOntology/features/' + +local = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/' + +for name in os.listdir(basedir+'rdf/'): + if fnmatch.fnmatch(name, '*.rdf'): + graph = Graph() + graph.parse(basedir+'rdf/'+name) + graph.bind(name[3:-4], URIRef('file://'+basedir+"rdf/")) + graph.bind('owl', 'http://www.w3.org/2002/07/owl#') + + graph.serialize(basedir+'rdfn3/'+name.split('.')[0]+'.n3', format='n3') + print "Serialized graph to " + basedir+'rdfn3/'+name.split('.')[0]+'.n3' \ No newline at end of file