changeset 720:685e0234c4cd

Merge
author Chris Cannam
date Fri, 13 Jan 2012 17:21:31 +0000 (2012-01-13)
parents d6d76088e632 (current diff) f3fd2988fc9b (diff)
children 0696d02f0f3f
files
diffstat 5 files changed, 68 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/PluginRDFDescription.cpp	Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/PluginRDFDescription.cpp	Fri Jan 13 17:21:31 2012 +0000
@@ -278,19 +278,10 @@
          (
              " PREFIX vamp: <http://purl.org/ontology/vamp/> "
 
-             " SELECT ?output ?output_id ?output_type ?unit "
+             " SELECT ?output "
 
              " WHERE { "
-
              "   <%1> vamp:output ?output . "
-
-             "   ?output vamp:identifier ?output_id ; "
-             "           a ?output_type . "
-
-             "   OPTIONAL { "
-             "     ?output vamp:unit ?unit "
-             "   } . "
-
              " } "
              )
          .arg(m_pluginUri));
@@ -305,7 +296,7 @@
     }
 
     if (results.empty()) {
-        SVDEBUG << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <"
+        cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <"
              << m_pluginUri << ">" << endl;
         return false;
     }
@@ -316,9 +307,48 @@
 
     for (int i = 0; i < results.size(); ++i) {
 
+        if (results[i]["output"].type != SimpleSPARQLQuery::URIValue ||
+            results[i]["output"].value == "") {
+            cerr << "ERROR: PluginRDFDescription::indexURL: No valid URI for output " << i << " of plugin <" << m_pluginUri << ">" << endl;
+            return false;
+        }
+
         QString outputUri = results[i]["output"].value;
-        QString outputId = results[i]["output_id"].value;
-        QString outputType = results[i]["output_type"].value;
+
+        SimpleSPARQLQuery::Value v;
+
+        v = SimpleSPARQLQuery::singleResultQuery
+            (m, 
+             QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
+                     " SELECT ?output_id "
+                     " WHERE { <%1> vamp:identifier ?output_id } ")
+             .arg(outputUri), "output_id");
+
+        if (v.type != SimpleSPARQLQuery::LiteralValue || v.value == "") {
+            cerr << "ERROR: PluginRDFDescription::indexURL: No identifier for output <" << outputUri << ">" << endl;
+            return false;
+        }
+        QString outputId = v.value;
+
+        v = SimpleSPARQLQuery::singleResultQuery
+            (m, 
+             QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
+                     " SELECT ?output_type "
+                     " WHERE { <%1> a ?output_type } ")
+             .arg(outputUri), "output_type");
+
+        QString outputType;
+        if (v.type == SimpleSPARQLQuery::URIValue) outputType = v.value;
+
+        v = SimpleSPARQLQuery::singleResultQuery
+            (m, 
+             QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
+                     " SELECT ?unit "
+                     " WHERE { <%1> vamp:unit ?unit } ")
+             .arg(outputUri), "unit");
+
+        QString outputUnit;
+        if (v.type == SimpleSPARQLQuery::LiteralValue) outputUnit = v.value;
 
         m_outputUriMap[outputId] = outputUri;
 
@@ -332,23 +362,16 @@
             m_outputDispositions[outputId] = OutputDispositionUnknown;
         }
             
-        if (results[i]["unit"].type == SimpleSPARQLQuery::LiteralValue) {
-
-            QString unit = results[i]["unit"].value;
-            
-            if (unit != "") {
-                m_outputUnitMap[outputId] = unit;
-            }
+        if (outputUnit != "") {
+            m_outputUnitMap[outputId] = outputUnit;
         }
 
-        SimpleSPARQLQuery::Value v;
-
         v = SimpleSPARQLQuery::singleResultQuery
             (m, 
              QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
                      " PREFIX dc: <http://purl.org/dc/elements/1.1/> "
                      " SELECT ?title "
-                     " WHERE { <%2> dc:title ?title } ")
+                     " WHERE { <%1> dc:title ?title } ")
              .arg(outputUri), "title");
 
         if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") {
@@ -357,8 +380,8 @@
 
         QString queryTemplate = 
             QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
-                    " SELECT ?%3 "
-                    " WHERE { <%2> vamp:computes_%3 ?%3 } ")
+                    " SELECT ?%2 "
+                    " WHERE { <%1> vamp:computes_%2 ?%2 } ")
             .arg(outputUri);
 
         v = SimpleSPARQLQuery::singleResultQuery
--- a/rdf/PluginRDFIndexer.cpp	Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/PluginRDFIndexer.cpp	Fri Jan 13 17:21:31 2012 +0000
@@ -80,7 +80,7 @@
     // rdf extension.
 
     for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
-        
+
         QDir dir(i->c_str());
         if (!dir.exists()) continue;
 
@@ -89,6 +89,7 @@
 
         for (QStringList::const_iterator j = entries.begin();
              j != entries.end(); ++j) {
+
             QFileInfo fi(dir.filePath(*j));
             pullFile(fi.absoluteFilePath());
         }
@@ -98,6 +99,7 @@
 
         for (QStringList::const_iterator j = subdirs.begin();
              j != subdirs.end(); ++j) {
+
             QDir subdir(dir.filePath(*j));
             if (subdir.exists()) {
                 entries = subdir.entryList
@@ -293,7 +295,7 @@
     }
 
     if (results.empty()) {
-        SVDEBUG << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl;
+        cerr << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl;
         return false;
     }
 
@@ -308,13 +310,13 @@
         QString identifier = (*i)["plugin_id"].value;
 
         if (identifier == "") {
-            SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <"
+            cerr << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <"
                  << pluginUri << ">"
                  << endl;
             continue;
         }
         if (soUri == "") {
-            SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <"
+            cerr << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <"
                  << pluginUri << ">"
                  << endl;
             continue;
@@ -334,7 +336,7 @@
             SimpleSPARQLQuery::singleResultQuery(m, sonameQuery, "library_id");
         QString soname = sonameValue.value;
         if (soname == "") {
-            SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No identifier for library <"
+            cerr << "PluginRDFIndexer::reindex: NOTE: No identifier for library <"
                  << soUri << ">"
                  << endl;
             continue;
@@ -355,7 +357,7 @@
 
         if (pluginUri != "") {
             if (m_uriToIdMap.find(pluginUri) != m_uriToIdMap.end()) {
-                SVDEBUG << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl;
+                cerr << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl;
                 cerr << "  1. Plugin id \"" << m_uriToIdMap[pluginUri] << "\"" << endl;
                 cerr << "  2. Plugin id \"" << pluginId << "\"" << endl;
                 cerr << "both claim URI <" << pluginUri << ">" << endl;
@@ -366,7 +368,7 @@
     }
 
     if (!foundSomething) {
-        SVDEBUG << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl;
+        cerr << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl;
     }
     
     return addedSomething;
--- a/rdf/RDFFeatureWriter.cpp	Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/RDFFeatureWriter.cpp	Fri Jan 13 17:21:31 2012 +0000
@@ -141,10 +141,10 @@
         m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId);
 
         if (m_rdfDescriptions[pluginId].haveDescription()) {
-            SVDEBUG << "NOTE: Have RDF description for plugin ID \""
+            cerr << "NOTE: Have RDF description for plugin ID \""
                  << pluginId << "\"" << endl;
         } else {
-            SVDEBUG << "NOTE: No RDF description for plugin ID \""
+            cerr << "NOTE: No RDF description for plugin ID \""
                  << pluginId << "\"" << endl;
             if (!m_network) {
                 cerr << "      Consider using the --rdf-network option to retrieve plugin descriptions"  << endl;
--- a/rdf/SimpleSPARQLQuery.cpp	Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/SimpleSPARQLQuery.cpp	Fri Jan 13 17:21:31 2012 +0000
@@ -619,7 +619,7 @@
     SimpleSPARQLQuery q(type, query);
     ResultList results = q.execute();
     if (!q.isOK()) {
-        SVDEBUG << "SimpleSPARQLQuery::singleResultQuery: ERROR: "
+        cerr << "SimpleSPARQLQuery::singleResultQuery: ERROR: "
              << q.getErrorString() << endl;
         return Value();
     }
--- a/transform/FeatureExtractionModelTransformer.cpp	Fri Jan 13 17:21:18 2012 +0000
+++ b/transform/FeatureExtractionModelTransformer.cpp	Fri Jan 13 17:21:31 2012 +0000
@@ -176,9 +176,8 @@
 {
     DenseTimeValueModel *input = getConformingInput();
 
-//    std::cerr << "FeatureExtractionModelTransformer: output sample type "
-//	      << m_descriptor->sampleType << std::endl;
-
+//    std::cerr << "FeatureExtractionModelTransformer::createOutputModel: sample type " << m_descriptor->sampleType << ", rate " << m_descriptor->sampleRate << std::endl;
+    
     PluginRDFDescription description(m_transform.getPluginIdentifier());
     QString outputId = m_transform.getOutput();
 
@@ -201,7 +200,7 @@
 
     size_t modelRate = input->getSampleRate();
     size_t modelResolution = 1;
-    
+
     switch (m_descriptor->sampleType) {
 
     case Vamp::Plugin::OutputDescriptor::VariableSampleRate:
@@ -636,8 +635,11 @@
 {
     size_t inputRate = m_input.getModel()->getSampleRate();
 
-//    SVDEBUG << "FeatureExtractionModelTransformer::addFeature("
-//	      << blockFrame << ")" << endl;
+//    std::cerr << "FeatureExtractionModelTransformer::addFeature: blockFrame = "
+//              << blockFrame << ", hasTimestamp = " << feature.hasTimestamp
+//              << ", timestamp = " << feature.timestamp << ", hasDuration = "
+//              << feature.hasDuration << ", duration = " << feature.duration
+//              << std::endl;
 
     int binCount = 1;
     if (m_descriptor->hasFixedBinCount) {