comparison rdf/PluginRDFIndexer.cpp @ 1844:5b1b03c1d8d4

Accept more than one library URI for a plugin; consistency checks for packs
author Chris Cannam
date Mon, 20 Apr 2020 15:42:51 +0100
parents 70e172e6cc59
children
comparison
equal deleted inserted replaced
1843:3ec563af0a4f 1844:5b1b03c1d8d4
179 pullURL(urls[i]); 179 pullURL(urls[i]);
180 } 180 }
181 181
182 settings.endGroup(); 182 settings.endGroup();
183 reindex(); 183 reindex();
184
184 return true; 185 return true;
186 }
187
188 void
189 PluginRDFIndexer::performConsistencyChecks()
190 {
191 // Add more here!
192
193 Triples packs = m_index->match
194 (Triple(Node(), m_index->expand("vamp:available_library"), Node()));
195
196 for (Triple packt: packs) {
197 Triples libraries = m_index->match
198 (Triple(packt.object(), m_index->expand("a"),
199 m_index->expand("vamp:PluginLibrary")));
200 if (libraries.empty()) {
201 SVCERR << "WARNING: Plugin pack " << packt.subject()
202 << " claims to contain library " << packt.object()
203 << " which is not known to us as a vamp:PluginLibrary"
204 << endl;
205 }
206 }
185 } 207 }
186 208
187 QString 209 QString
188 PluginRDFIndexer::getURIForPluginId(QString pluginId) 210 PluginRDFIndexer::getURIForPluginId(QString pluginId)
189 { 211 {
286 308
287 local = QUrl::fromLocalFile(urlString); 309 local = QUrl::fromLocalFile(urlString);
288 } 310 }
289 311
290 try { 312 try {
291 m_index->import(local, BasicStore::ImportFailOnDuplicates); 313 m_index->import(local, BasicStore::ImportIgnoreDuplicates);
292 } catch (RDFDuplicateImportException &e) {
293 SVDEBUG << e.what() << endl;
294 SVDEBUG << "PluginRDFIndexer::pullURL: Document at " << urlString
295 << " duplicates triples found in earlier loaded document -- skipping it" << endl;
296 return false;
297 } catch (RDFException &e) { 314 } catch (RDFException &e) {
298 SVDEBUG << e.what() << endl; 315 SVDEBUG << e.what() << endl;
299 SVDEBUG << "PluginRDFIndexer::pullURL: Failed to import document from " 316 SVDEBUG << "PluginRDFIndexer::pullURL: Failed to import document from "
300 << urlString << ": " << e.what() << endl; 317 << urlString << ": " << e.what() << endl;
301 return false; 318 return false;