changeset 366:aede6e90a6b8

Merge (but taking everything from the more recent default)
author Chris Cannam
date Wed, 25 Jun 2014 12:38:37 +0100
parents feac60b5d82b (current diff) bca93a149bd7 (diff)
children 57cc0f0c20ff
files rdf/generator/vamp-rdf-template-generator.cpp
diffstat 3 files changed, 73 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/README	Thu Jun 05 15:40:04 2014 +0100
+++ b/README	Wed Jun 25 12:38:37 2014 +0100
@@ -237,7 +237,7 @@
 Vamp and the Vamp SDK were designed and made at the Centre for Digital
 Music at Queen Mary, University of London.
 
-The SDK was written by Chris Cannam, copyright (c) 2005-2009
+The SDK was written by Chris Cannam, copyright (c) 2005-2014
 Chris Cannam and QMUL.
 
 Mark Sandler and Christian Landone provided ideas and direction, and
--- a/host/vamp-simple-host.cpp	Thu Jun 05 15:40:04 2014 +0100
+++ b/host/vamp-simple-host.cpp	Wed Jun 25 12:38:37 2014 +0100
@@ -114,6 +114,7 @@
         "  " << name << " --list\n\n"
         "    -- List the plugin libraries and Vamp plugins in the library search path\n"
         "       in a verbose human-readable format.\n\n"
+        "  " << name << " -L\n"
         "  " << name << " --list-full\n\n"
         "    -- List all data reported by all the Vamp plugins in the library search\n"
         "       path in a very verbose human-readable format.\n\n"
@@ -161,7 +162,7 @@
             enumeratePlugins(PluginInformation);
             return 0;
 
-        } else if (!strcmp(argv[1], "--list-full")) {
+        } else if (!strcmp(argv[1], "-L") || !strcmp(argv[1], "--list-full")) {
 
             enumeratePlugins(PluginInformationDetailed);
             return 0;
--- a/rdf/generator/vamp-rdf-template-generator.cpp	Thu Jun 05 15:40:04 2014 +0100
+++ b/rdf/generator/vamp-rdf-template-generator.cpp	Wed Jun 25 12:38:37 2014 +0100
@@ -30,8 +30,7 @@
 using Vamp::HostExt::PluginLoader;
 using Vamp::Plugin;
 
-//???
-string programURI = "http://www.vamp-plugins.org/doap.rdf#template-generator";
+string programURI = "http://vamp-plugins.org/rdf/template-generator";
 
 void usage()
 {
@@ -68,6 +67,7 @@
 @prefix dc:       <http://purl.org/dc/elements/1.1/> .\n\
 @prefix af:       <http://purl.org/ontology/af/> .\n\
 @prefix foaf:     <http://xmlns.com/foaf/0.1/> .\n\
+@prefix doap:     <http://usefulinc.com/ns/doap#> .\n\
 @prefix cc:       <http://web.resource.org/cc/> .\n\
 @prefix :         <#> .\n\n";
 	
@@ -77,44 +77,93 @@
 string describe_doc(string describerURI, string pluginBundleBaseURI,
                     string libname)
 {
-    string res=\
-        "<>  a   vamp:PluginDescription ;\n";
+    string res = "\n## Properties of this document\n\n\
+<> a vamp:PluginDescription ;\n";
+
     if (describerURI != "") {
         res += "    foaf:maker          <"+describerURI+"> ;\n";
     }
+
     res += "\
-    foaf:maker          <"+programURI+"> ;\n\
-    foaf:primaryTopic   <"+pluginBundleBaseURI+libname+"> .\n\n";
+    foaf:maker         <"+programURI+"> ;\n\
+    foaf:primaryTopic  <"+pluginBundleBaseURI+libname+"> .\n\n";
     return res;
 }
 
+bool have_multiple_makers(vector<Plugin *> plugins)
+{
+    string firstMaker = "";
+    for (size_t i = 0; i < plugins.size(); ++i) {
+        if (i == 0) {
+            firstMaker = plugins[i]->getMaker();
+        } else if (plugins[i]->getMaker() != firstMaker) {
+            return true;
+        }
+    }
+    return false;
+}
+
+string describe_maker(vector<Plugin *> plugins, bool multipleMakers)
+{
+    string res = "\n## Maker of the whole plugin library\n\n\
+:library_maker\n";
+
+    if (!multipleMakers) {
+        string name;
+        if (!plugins.empty()) {
+            name = plugins[0]->getMaker();
+        }
+        res += "\
+    foaf:name  \"" + name + "\" ;\n\
+#   foaf:page  <> ;  # Place maker's homepage URL in here and uncomment\n\
+#   foaf:logo  <> ;  # URL of an image here, if you happen to have a logo\n";
+
+    } else {
+        res += "\
+    foaf:name  \"Multiple makers\" ;\n";
+    }
+
+    res += "    .\n\n";
+    return res;
+}
 
 string describe_library(string libname, vector<Plugin *> plugins)
 {
-    string res=\
-        ":"+libname+" a  vamp:PluginLibrary ;\n\
-    vamp:identifier \""+libname+"\"";
+    string res = "\n## Properties of the plugin library, and references to the plugins it contains\n\n\
+plugbase:library a vamp:PluginLibrary ;\n\
+    vamp:identifier        \""+libname+"\" ;\n\
+    foaf:maker             :library_maker";
 
     for (size_t i = 0; i < plugins.size(); ++i) {
         res += " ; \n\
-    vamp:available_plugin plugbase:"+plugins[i]->getIdentifier();
+    vamp:available_plugin  plugbase:"+plugins[i]->getIdentifier();
     }
 
     res += " ; \n\
-#   dc:title \"\" ; # Place a descriptive name for the plugin library here and uncomment\n\
-#   foaf:page <Place more-information HTML page URL here and uncomment> ;\n\
+#   dc:title               \"\" ;  # Place library name here and uncomment\n\
+#   dc:description         \"\" ;  # Place library description here and uncomment\n\
+#   foaf:page              <> ;  # Place more-info HTML page URL here and uncomment\n\
+#   doap:download-page     <> ;  # Place download HTML page URL here and uncomment\n\
     .\n\n";
     return res;
 }
 
-string describe_plugin(Plugin* plugin)
+string describe_plugin(Plugin* plugin, bool multipleMakers)
 {
-    string res=\
-        "plugbase:"+plugin->getIdentifier()+" a   vamp:Plugin ;\n\
+    string res = "\n## Properties of the " + plugin->getName() + " plugin\n\n\
+plugbase:"+plugin->getIdentifier()+" a vamp:Plugin ;\n\
     dc:title              \""+plugin->getName()+"\" ;\n\
     vamp:name             \""+plugin->getName()+"\" ;\n\
     dc:description        \"\"\""+plugin->getDescription()+"\"\"\" ;\n\
-    foaf:maker            [ foaf:name \""+plugin->getMaker()+"\" ] ; # FIXME could give plugin author's URI here\n\
+    foaf:maker            ";
+
+    if (multipleMakers) {
+        res += "[ foaf:name \""+plugin->getMaker()+"\" ] ;\n";
+    } else {
+        res += ":library_maker ;\n";
+    }
+
+    res += "\
     dc:rights             \"\"\""+plugin->getCopyright()+"\"\"\" ;\n\
 #   cc:license            <Place plugin license URI here and uncomment> ; \n\
     vamp:identifier       \""+plugin->getIdentifier()+"\" ;\n\
@@ -125,9 +174,7 @@
     else
         res+="    vamp:input_domain     vamp:TimeDomain ;\n";
 	
-
     Plugin::ParameterList params = plugin->getParameterDescriptors();
-    if (!params.empty()) res+="\n";
     for (Plugin::ParameterList::const_iterator i = params.begin(); i != params.end(); i++)
         res+="    vamp:parameter   plugbase:"+plugin->getIdentifier()+"_param_"+(*i).identifier+" ;\n";
     if (!params.empty()) res+="\n";
@@ -355,17 +402,21 @@
 string describe(vector<Plugin *> plugins, string pluginBundleBaseURI,
                 string describerURI, string libname)
 {
+    bool multipleMakers = have_multiple_makers(plugins);
+
     string res = describe_namespaces(pluginBundleBaseURI, libname);
 	
     res += describe_doc(describerURI, pluginBundleBaseURI, libname);
 	
+    res += describe_maker(plugins, multipleMakers);
+	
     res += describe_library(libname, plugins);
 
     for (size_t i = 0; i < plugins.size(); ++i) {
 
         Plugin *plugin = plugins[i];
 
-        res += describe_plugin(plugin);
+        res += describe_plugin(plugin, multipleMakers);
 	
         Plugin::ParameterList params = plugin->getParameterDescriptors();
         for (Plugin::ParameterList::const_iterator i = params.begin(); i != params.end(); i++)