Mercurial > hg > audio-features-catalogue
comparison rdfpy/convertXMLtoN3.py @ 0:62d2c72e4223
initial commit
author | nothing@tehis.net |
---|---|
date | Mon, 25 Feb 2013 14:40:54 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:62d2c72e4223 |
---|---|
1 import rdflib, os, fnmatch | |
2 from rdflib import Graph, RDF, RDFS, plugin, URIRef, Literal, OWL | |
3 | |
4 basedir = '/Users/alo/MusicOntology/features/' | |
5 | |
6 local = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/' | |
7 | |
8 for name in os.listdir(basedir+'rdf/'): | |
9 if fnmatch.fnmatch(name, '*.rdf'): | |
10 graph = Graph() | |
11 graph.parse(basedir+'rdf/'+name) | |
12 graph.bind(name[3:-4], URIRef('file://'+basedir+"rdf/")) | |
13 graph.bind('owl', 'http://www.w3.org/2002/07/owl#') | |
14 | |
15 graph.serialize(basedir+'rdfn3/'+name.split('.')[0]+'.n3', format='n3') | |
16 print "Serialized graph to " + basedir+'rdfn3/'+name.split('.')[0]+'.n3' |