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