nothing@0: import rdflib, os, fnmatch, urllib2 nothing@0: from rdflib import Graph, RDF, RDFS, plugin, URIRef, Literal, OWL nothing@0: from xml.dom.minidom import parseString nothing@0: nothing@0: ns = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/' nothing@0: nothing@0: basedir = '/Users/alo/MusicOntology/features/' nothing@0: nothing@0: execfile(basedir + 'pdfextract/graphDefs.py') nothing@0: nothing@0: graph = Graph() nothing@0: graph.bind('af', URIRef(ns)) nothing@0: graph.bind('dc', URIRef('http://purl.org/dc/elements/1.1/')) nothing@0: graph.bind('owl', OWL) nothing@0: nothing@0: addBaseTriples(graph, ns) nothing@0: nothing@0: loadBase( graph, basedir + 'rdf/base.rdf' ) nothing@0: nothing@0: for name in os.listdir(basedir+'rdf/'): nothing@0: if fnmatch.fnmatch(name, 'af-*.rdf'): nothing@0: addTriplesFromFile(graph, basedir+'rdf/'+name, ns) nothing@0: nothing@0: compareForSimilarities(graph, ns) nothing@0: nothing@18: graph.serialize(basedir + 'af-catalogue-01.rdf') nothing@18: graph.serialize(basedir + 'af-catalogue-01.n3', format='n3')