Mercurial > hg > audio-features-catalogue
changeset 14:c68793c3213a
fuxi file share
author | nothing@tehis.net |
---|---|
date | Thu, 04 Apr 2013 16:25:39 +0100 |
parents | 394bd8733074 |
children | 53069717108c |
files | fuxi/af-facts.n3 fuxi/af-rules.n3 fuxi/convertImplicationstoN3.py |
diffstat | 3 files changed, 36 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/fuxi/af-facts.n3 Wed Apr 03 21:26:08 2013 +0100 +++ b/fuxi/af-facts.n3 Thu Apr 04 16:25:39 2013 +0100 @@ -1,4 +1,4 @@ -@prefix af: <http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology/> . +@prefix af: <http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology#> . af:Attack a af:AudioFeature .
--- a/fuxi/af-rules.n3 Wed Apr 03 21:26:08 2013 +0100 +++ b/fuxi/af-rules.n3 Thu Apr 04 16:25:39 2013 +0100 @@ -1,30 +1,29 @@ -@prefix af: <http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology/> . +@prefix af: <http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . -?x a af:AudioFeature . -{ ?x af:domain af:Cepstral } => { ?x af:output af:Dense . ?x af:temporalscale af:Intraframe . ?x af:dimensionality af:MultiDimensional . ?x af:level af:Physical } . -{ ?x af:temporalscale af:Interframe } => { ?x af:domain af:ModulationFrequency . ?x af:dimensionality af:MultiDimensional . ?x af:level af:Perceptual } . -{ ?x af:domain af:ModulationFrequency } => { ?x af:temporalscale af:Interframe . ?x af:dimensionality af:MultiDimensional . ?x af:level af:Perceptual } . -{ ?x af:output af:Dense . ?x af:dimensionality af:MultiDimensional } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:domain af:Frequency . ?x af:dimensionality af:MultiDimensional } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:domain af:Frequency . ?x af:dimensionality af:OneDimensional } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:output af:Dense . ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe . ?x af:dimensionality af:OneDimensional } => { ?x af:level af:Perceptual } . -{ ?x af:output af:Dense . ?x af:level af:Perceptual } => { ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe } . -{ ?x af:domain af:Frequency . ?x af:level af:Perceptual } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:temporalscale af:Intraframe . ?x af:level af:Perceptual } => { ?x af:domain af:Frequency } . -{ ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe . ?x af:dimensionality af:MultiDimensional . ?x af:level af:Perceptual } => { ?x af:output af:Dense } . -{ ?x af:dimensionality af:OneDimensional . ?x af:level af:Perceptual } => { ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe } . -{ ?x af:domain af:Frequency . ?x af:level af:Physical } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:output af:Dense . ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe . ?x af:level af:Physical } => { ?x af:dimensionality af:MultiDimensional } . -{ ?x af:dimensionality af:MultiDimensional . ?x af:level af:Physical } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:model af:Psychoacoustic } => { ?x af:temporalscale af:Intraframe } . -{ ?x af:output af:Dense . ?x af:temporalscale af:Intraframe . ?x af:model af:Psychoacoustic } => { ?x af:domain af:Cepstral . ?x af:dimensionality af:MultiDimensional . ?x af:level af:Physical } . -{ ?x af:domain af:Frequency . ?x af:temporalscale af:Intraframe . ?x af:model af:Psychoacoustic } => { ?x af:dimensionality af:OneDimensional . ?x af:level af:Perceptual } . -{ ?x af:temporalscale af:Intraframe . ?x af:dimensionality af:MultiDimensional . ?x af:model af:Psychoacoustic } => { ?x af:output af:Dense . ?x af:domain af:Cepstral . ?x af:level af:Physical } . -{ ?x af:temporalscale af:Intraframe . ?x af:dimensionality af:OneDimensional . ?x af:model af:Psychoacoustic } => { ?x af:domain af:Frequency . ?x af:level af:Perceptual } . -{ ?x af:temporalscale af:Intraframe . ?x af:level af:Physical . ?x af:model af:Psychoacoustic } => { ?x af:output af:Dense . ?x af:domain af:Cepstral . ?x af:dimensionality af:MultiDimensional } . -{ ?x af:temporalscale af:Intraframe . ?x af:domain af:Time } => { ?x af:output af:Dense } . -{ ?x af:dimensionality af:OneDimensional . ?x af:domain af:Time } => { ?x af:level af:Physical } . -{ ?x af:level af:Physical . ?x af:domain af:Time } => { ?x af:dimensionality af:OneDimensional } . -{ ?x af:output af:Sparse } => { ?x af:domain af:Time } . -{ ?x af:output af:Dense . ?x af:dimensionality af:OneDimensional . ?x af:level af:Physical } => { ?x af:domain af:Time } . +@forSome :x . { :x af:domain af:Cepstral } => { :x af:output af:Dense . :x af:temporalscale af:Intraframe . :x af:dimensionality af:MultiDimensional . :x af:level af:Physical } . +@forSome :x . { :x af:temporalscale af:Interframe } => { :x af:domain af:ModulationFrequency . :x af:dimensionality af:MultiDimensional . :x af:level af:Perceptual } . +@forSome :x . { :x af:domain af:ModulationFrequency } => { :x af:temporalscale af:Interframe . :x af:dimensionality af:MultiDimensional . :x af:level af:Perceptual } . +@forSome :x . { :x af:output af:Dense . :x af:dimensionality af:MultiDimensional } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:domain af:Frequency . :x af:dimensionality af:MultiDimensional } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:domain af:Frequency . :x af:dimensionality af:OneDimensional } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:output af:Dense . :x af:domain af:Frequency . :x af:temporalscale af:Intraframe . :x af:dimensionality af:OneDimensional } => { :x af:level af:Perceptual } . +@forSome :x . { :x af:output af:Dense . :x af:level af:Perceptual } => { :x af:domain af:Frequency . :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:domain af:Frequency . :x af:level af:Perceptual } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:temporalscale af:Intraframe . :x af:level af:Perceptual } => { :x af:domain af:Frequency } . +@forSome :x . { :x af:domain af:Frequency . :x af:temporalscale af:Intraframe . :x af:dimensionality af:MultiDimensional . :x af:level af:Perceptual } => { :x af:output af:Dense } . +@forSome :x . { :x af:dimensionality af:OneDimensional . :x af:level af:Perceptual } => { :x af:domain af:Frequency . :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:domain af:Frequency . :x af:level af:Physical } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:output af:Dense . :x af:domain af:Frequency . :x af:temporalscale af:Intraframe . :x af:level af:Physical } => { :x af:dimensionality af:MultiDimensional } . +@forSome :x . { :x af:dimensionality af:MultiDimensional . :x af:level af:Physical } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:model af:Psychoacoustic } => { :x af:temporalscale af:Intraframe } . +@forSome :x . { :x af:output af:Dense . :x af:temporalscale af:Intraframe . :x af:model af:Psychoacoustic } => { :x af:domain af:Cepstral . :x af:dimensionality af:MultiDimensional . :x af:level af:Physical } . +@forSome :x . { :x af:domain af:Frequency . :x af:temporalscale af:Intraframe . :x af:model af:Psychoacoustic } => { :x af:dimensionality af:OneDimensional . :x af:level af:Perceptual } . +@forSome :x . { :x af:temporalscale af:Intraframe . :x af:dimensionality af:MultiDimensional . :x af:model af:Psychoacoustic } => { :x af:output af:Dense . :x af:domain af:Cepstral . :x af:level af:Physical } . +@forSome :x . { :x af:temporalscale af:Intraframe . :x af:dimensionality af:OneDimensional . :x af:model af:Psychoacoustic } => { :x af:domain af:Frequency . :x af:level af:Perceptual } . +@forSome :x . { :x af:temporalscale af:Intraframe . :x af:level af:Physical . :x af:model af:Psychoacoustic } => { :x af:output af:Dense . :x af:domain af:Cepstral . :x af:dimensionality af:MultiDimensional } . +@forSome :x . { :x af:temporalscale af:Intraframe . :x af:domain af:Time } => { :x af:output af:Dense } . +@forSome :x . { :x af:dimensionality af:OneDimensional . :x af:domain af:Time } => { :x af:level af:Physical } . +@forSome :x . { :x af:level af:Physical . :x af:domain af:Time } => { :x af:dimensionality af:OneDimensional } . +@forSome :x . { :x af:output af:Sparse } => { :x af:domain af:Time } . +@forSome :x . { :x af:output af:Dense . :x af:dimensionality af:OneDimensional . :x af:level af:Physical } => { :x af:domain af:Time } .
--- a/fuxi/convertImplicationstoN3.py Wed Apr 03 21:26:08 2013 +0100 +++ b/fuxi/convertImplicationstoN3.py Thu Apr 04 16:25:39 2013 +0100 @@ -17,7 +17,7 @@ factpath = basedir + 'fuxi/af-facts.n3' ontopath = basedir + 'fuxi/af-ontology.rdf' cataloguePath = '/Users/alo/MusicOntology/features/af-catalogue.rdf' -baseuri = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology/' +baseuri = 'http://sovarr.c4dm.eecs.qmul.ac.uk/features/af-ontology#' def readFile(path): file = open(path) @@ -37,20 +37,23 @@ def convertRules(rows): n3 = addHeader() - n3 += "?x a af:AudioFeature . \n" + #n3 += "?x a af:AudioFeature . \n" + for i in range(len(rows)-1): + row = rows[i] if row != '': count = int(row[row.index("<")+1:row.index(">")-1]) premise = row[row.index(">")+2:row.index("==>")-1].split() conclusion = row[row.index("==>")+4:-1].split() if count > 0: + n3 += "@forSome :x . " n3 += "{ " for pre in premise: prop = "af:"+pre.split("-")[-1] value = "af:"+(" ".join(pre.split("-")[0:-1]).title().replace(" ", "").replace("-", "")) - n3 += " ?x " + prop + " " + value + n3 += " :x " + prop + " " + value n3 += " . " n3 = n3[:-2] + " } => { " @@ -58,7 +61,7 @@ for con in conclusion: prop = "af:"+con.split("-")[-1] value = "af:"+(" ".join(con.split("-")[0:-1]).title().replace(" ", "").replace("-", "")) - n3 += " ?x " + prop + " " + value + n3 += " :x " + prop + " " + value n3 += " . " n3 = n3[:-2] + " } . \n" @@ -126,7 +129,7 @@ def writeFeatures(path): source = Graph() source.parse(cataloguePath) - sourcens = Namespace(baseuri.replace('af-ontology/', '')) + sourcens = Namespace(baseuri.replace('af-ontology#', '')) graph = Graph()