Mercurial > hg > svcore
comparison rdf/RDFFeatureWriter.cpp @ 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 | f3bb7a3ffd89 |
children | f3211e01b315 |
comparison
equal
deleted
inserted
replaced
596:c55795627490 | 597:4fa2b135acbc |
---|---|
18 #include "vamp-hostsdk/PluginHostAdapter.h" | 18 #include "vamp-hostsdk/PluginHostAdapter.h" |
19 #include "vamp-hostsdk/PluginLoader.h" | 19 #include "vamp-hostsdk/PluginLoader.h" |
20 | 20 |
21 #include "RDFFeatureWriter.h" | 21 #include "RDFFeatureWriter.h" |
22 #include "RDFTransformFactory.h" | 22 #include "RDFTransformFactory.h" |
23 #include "PluginRDFIndexer.h" | |
23 | 24 |
24 #include <QTextStream> | 25 #include <QTextStream> |
25 #include <QUrl> | 26 #include <QUrl> |
26 #include <QFileInfo> | 27 #include <QFileInfo> |
27 #include <QRegExp> | 28 #include <QRegExp> |
34 FileFeatureWriter(SupportOneFilePerTrackTransform | | 35 FileFeatureWriter(SupportOneFilePerTrackTransform | |
35 SupportOneFilePerTrack | | 36 SupportOneFilePerTrack | |
36 SupportOneFileTotal, | 37 SupportOneFileTotal, |
37 "n3"), | 38 "n3"), |
38 m_plain(false), | 39 m_plain(false), |
40 m_network(false), | |
41 m_networkRetrieved(false), | |
39 m_count(0) | 42 m_count(0) |
40 { | 43 { |
41 } | 44 } |
42 | 45 |
43 RDFFeatureWriter::~RDFFeatureWriter() | 46 RDFFeatureWriter::~RDFFeatureWriter() |
67 | 70 |
68 p.name = "maker-uri"; | 71 p.name = "maker-uri"; |
69 p.description = "Link the track in the output RDF to the given foaf:maker URI."; | 72 p.description = "Link the track in the output RDF to the given foaf:maker URI."; |
70 p.hasArg = true; | 73 p.hasArg = true; |
71 pl.push_back(p); | 74 pl.push_back(p); |
75 | |
76 p.name = "network"; | |
77 p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally"; | |
78 p.hasArg = false; | |
79 pl.push_back(p); | |
72 | 80 |
73 return pl; | 81 return pl; |
74 } | 82 } |
75 | 83 |
76 void | 84 void |
89 if (i->first == "track-uri") { | 97 if (i->first == "track-uri") { |
90 m_userTrackUri = i->second.c_str(); | 98 m_userTrackUri = i->second.c_str(); |
91 } | 99 } |
92 if (i->first == "maker-uri") { | 100 if (i->first == "maker-uri") { |
93 m_userMakerUri = i->second.c_str(); | 101 m_userMakerUri = i->second.c_str(); |
102 } | |
103 if (i->first == "network") { | |
104 m_network = true; | |
94 } | 105 } |
95 } | 106 } |
96 } | 107 } |
97 | 108 |
98 void | 109 void |
118 { | 129 { |
119 QString pluginId = transform.getPluginIdentifier(); | 130 QString pluginId = transform.getPluginIdentifier(); |
120 | 131 |
121 if (m_rdfDescriptions.find(pluginId) == m_rdfDescriptions.end()) { | 132 if (m_rdfDescriptions.find(pluginId) == m_rdfDescriptions.end()) { |
122 | 133 |
134 if (m_network && !m_networkRetrieved) { | |
135 PluginRDFIndexer::getInstance()->indexConfiguredURLs(); | |
136 m_networkRetrieved = true; | |
137 } | |
138 | |
123 m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId); | 139 m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId); |
124 | 140 |
125 if (m_rdfDescriptions[pluginId].haveDescription()) { | 141 if (m_rdfDescriptions[pluginId].haveDescription()) { |
126 cerr << "NOTE: Have RDF description for plugin ID \"" | 142 cerr << "NOTE: Have RDF description for plugin ID \"" |
127 << pluginId.toStdString() << "\"" << endl; | 143 << pluginId.toStdString() << "\"" << endl; |
128 } else { | 144 } else { |
129 cerr << "NOTE: Do not have RDF description for plugin ID \"" | 145 cerr << "NOTE: No RDF description for plugin ID \"" |
130 << pluginId.toStdString() << "\"" << endl; | 146 << pluginId.toStdString() << "\"" << endl; |
147 if (!m_network) { | |
148 cerr << " Consider using the --rdf-network option to retrieve plugin descriptions" << endl; | |
149 cerr << " from the network where possible." << endl; | |
150 } | |
131 } | 151 } |
132 } | 152 } |
133 | 153 |
134 // Need to select appropriate output file for our track/transform | 154 // Need to select appropriate output file for our track/transform |
135 // combination | 155 // combination |