changeset 597:4fa2b135acbc sv-v1.6

* Add rdf-network option to retrieve RDF descriptions from network, since this is no longer done automatically for reasons of cost
author Chris Cannam
date Mon, 29 Jun 2009 13:44:50 +0000
parents c55795627490
children 939ffbc32d50
files rdf/RDFFeatureWriter.cpp rdf/RDFFeatureWriter.h
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/RDFFeatureWriter.cpp	Mon Jun 22 17:06:27 2009 +0000
+++ b/rdf/RDFFeatureWriter.cpp	Mon Jun 29 13:44:50 2009 +0000
@@ -20,6 +20,7 @@
 
 #include "RDFFeatureWriter.h"
 #include "RDFTransformFactory.h"
+#include "PluginRDFIndexer.h"
 
 #include <QTextStream>
 #include <QUrl>
@@ -36,6 +37,8 @@
                       SupportOneFileTotal,
                       "n3"),
     m_plain(false),
+    m_network(false),
+    m_networkRetrieved(false),
     m_count(0)
 {
 }
@@ -69,6 +72,11 @@
     p.description = "Link the track in the output RDF to the given foaf:maker URI.";
     p.hasArg = true;
     pl.push_back(p);
+
+    p.name = "network";
+    p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally";
+    p.hasArg = false;
+    pl.push_back(p);
     
     return pl;
 }
@@ -92,6 +100,9 @@
         if (i->first == "maker-uri") {
             m_userMakerUri = i->second.c_str();
         }
+        if (i->first == "network") {
+            m_network = true;
+        }
     }
 }
 
@@ -120,14 +131,23 @@
 
     if (m_rdfDescriptions.find(pluginId) == m_rdfDescriptions.end()) {
 
+        if (m_network && !m_networkRetrieved) {
+            PluginRDFIndexer::getInstance()->indexConfiguredURLs();
+            m_networkRetrieved = true;
+        }
+
         m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId);
 
         if (m_rdfDescriptions[pluginId].haveDescription()) {
             cerr << "NOTE: Have RDF description for plugin ID \""
                  << pluginId.toStdString() << "\"" << endl;
         } else {
-            cerr << "NOTE: Do not have RDF description for plugin ID \""
+            cerr << "NOTE: No RDF description for plugin ID \""
                  << pluginId.toStdString() << "\"" << endl;
+            if (!m_network) {
+                cerr << "      Consider using the --rdf-network option to retrieve plugin descriptions"  << endl;
+                cerr << "      from the network where possible." << endl;
+            }
         }
     }
 
--- a/rdf/RDFFeatureWriter.h	Mon Jun 22 17:06:27 2009 +0000
+++ b/rdf/RDFFeatureWriter.h	Mon Jun 29 13:44:50 2009 +0000
@@ -120,6 +120,9 @@
 
     bool m_plain;
 
+    bool m_network;
+    bool m_networkRetrieved;
+
     uint64_t m_count;
 };