Mercurial > hg > may
changeset 79:e47d5adb6564
Use RDF description in inferred structure; also report whether it was found in plugin data
author | Chris Cannam |
---|---|
date | Mon, 04 Mar 2013 17:53:42 +0000 |
parents | 49563d091790 |
children | a4b93d6ad02e |
files | vamp.yeti vamprdf.yeti |
diffstat | 2 files changed, 36 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp.yeti Mon Mar 04 17:20:31 2013 +0000 +++ b/vamp.yeti Mon Mar 04 17:53:42 2013 +0000 @@ -41,21 +41,21 @@ featureSet fs is ~Map -> 'a = (s = [:]; - kk = list fs#keySet()#toArray(); //!!! ugh + kk = list fs#keySet()#toArray(); for kk do k: s[numberOf k] := featureList fs#get(k) done; s); -standardStore = store.newRdfStore (); -var standardStoreLoaded = false; - -getStandardStore () = - (synchronized standardStore do: - if not standardStoreLoaded then - vamprdf.loadSystemVampRdf standardStore; - standardStoreLoaded := true - fi; - standardStore - done); +getStandardStore = + (s = store.newRdfStore (); + var loaded = false; + \(synchronized s do: + if not loaded then + vamprdf.loadSystemVampRdf s; + loaded := true + fi; + s + done) + ); getPluginPath () = (try @@ -104,29 +104,38 @@ VariableSampleRate () fi; -structureOf od is ~OutputDescriptor -> 'a = +structureOf rdfOutputData od is 'a -> ~OutputDescriptor -> 'b = + (computes = case rdfOutputData of Some d: d.computes; None (): Unknown () esac; + s = getStandardStore (); + noteIRI = case s.expand "af:Note" of IRI iri: iri; _: "" esac; if od#hasFixedBinCount and od#binCount == 0 then Instants (); elif od#hasDuration then - if od#hasFixedBinCount then - if od#binCount > 1 then - Notes (); - elif od#unit == "Hz" or strIndexOf (strLower od#unit) "midi" 0 >= 0 then - Notes (); - else - Regions (); + if computes != Unknown () then + if computes == Event noteIRI then Notes (); + else Regions (); + fi + elif od#hasFixedBinCount then + if od#binCount > 1 then Notes (); + elif od#unit == "Hz" or strIndexOf (strLower od#unit) "midi" 0 >= 0 then Notes (); + else Regions (); fi else Unknown (); fi elif od#hasFixedBinCount and od#binCount == 1 then - //!!! Could be a segmentation -- how do we tell? - Curve (); + case computes of + Event e: + if strEnds? e "Segment" then Segmentation (); + else Curve (); + fi; + _: Curve (); + esac; elif od#sampleType != OutputDescriptor$SampleType#VariableSampleRate then Grid (); else Unknown (); - fi; + fi); outputDescriptor rdfOutputData od is 'a -> ~OutputDescriptor -> 'b = { identifier = od#identifier, @@ -141,7 +150,7 @@ sampleRate = od#sampleRate, hasDuration = od#hasDuration, get computes () = case rdfOutputData of Some data: data.computes; None (): Unknown () esac, - get inferredStructure () = structureOf od, + get inferredStructure () = structureOf rdfOutputData od, }; plugin key p is string -> ~Plugin -> 'a = @@ -157,6 +166,7 @@ get copyright () = p#getCopyright(), get version () = p#getPluginVersion(), get category () = PluginLoader#getInstance()#getPluginCategory(key), + get hasRdfDescription () = (rdfData != None ()), get infoURL () = case rdfData of Some data: data.infoURL; None (): "" esac, get parameters () = array (map parameterDescriptor p#getParameterDescriptors()), parameter identifier = p#getParameter(identifier),
--- a/vamprdf.yeti Mon Mar 04 17:20:31 2013 +0000 +++ b/vamprdf.yeti Mon Mar 04 17:53:42 2013 +0000 @@ -32,7 +32,8 @@ (store.addPrefix "vamp" "http://purl.org/ontology/vamp/"; store.addPrefix "dc" "http://purl.org/dc/elements/1.1/"; store.addPrefix "foaf" "http://xmlns.com/foaf/0.1/"; - store.addPrefix "owl" "http://www.w3.org/2002/07/owl#"); + store.addPrefix "owl" "http://www.w3.org/2002/07/owl#"; + store.addPrefix "af" "http://purl.org/ontology/af/"); loadSystemVampRdf store = (addVampPrefixes store;