comparison rdfpy/writeCatalogue.py @ 0:62d2c72e4223

initial commit
author nothing@tehis.net
date Mon, 25 Feb 2013 14:40:54 +0000
parents
children d5012016bf64
comparison
equal deleted inserted replaced
-1:000000000000 0:62d2c72e4223
1 import rdflib, os, fnmatch, urllib2
2 from rdflib import Graph, RDF, RDFS, plugin, URIRef, Literal, OWL
3 from xml.dom.minidom import parseString
4
5 ns = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/'
6
7 basedir = '/Users/alo/MusicOntology/features/'
8
9 execfile(basedir + 'pdfextract/graphDefs.py')
10
11 graph = Graph()
12 graph.bind('af', URIRef(ns))
13 graph.bind('dc', URIRef('http://purl.org/dc/elements/1.1/'))
14 graph.bind('owl', OWL)
15
16 addBaseTriples(graph, ns)
17
18 loadBase( graph, basedir + 'rdf/base.rdf' )
19
20 for name in os.listdir(basedir+'rdf/'):
21 if fnmatch.fnmatch(name, 'af-*.rdf'):
22 addTriplesFromFile(graph, basedir+'rdf/'+name, ns)
23
24 compareForSimilarities(graph, ns)
25
26 graph.serialize(basedir + 'af-catalogue.rdf')
27 graph.serialize(basedir + 'af-catalogue.n3', format='n3')