Mercurial > hg > svcore
comparison rdf/PluginRDFIndexer.cpp @ 718:f3fd2988fc9b
Fix incorrect query structure for output type URIs. This led to some output RDF features being written with type URIs intended for different outputs. Also revert some SVDEBUGs to cerrs -- they are intended as user-visible errors or warnings rather than debug
author | Chris Cannam |
---|---|
date | Mon, 09 Jan 2012 16:28:54 +0000 |
parents | 1424aa29ae95 |
children | c789deb83bd4 |
comparison
equal
deleted
inserted
replaced
712:7f76499ef4f2 | 718:f3fd2988fc9b |
---|---|
78 // name "soname", "soname:label" or "soname/label" plus RDF | 78 // name "soname", "soname:label" or "soname/label" plus RDF |
79 // extension. Use that order of preference, and prefer n3 over | 79 // extension. Use that order of preference, and prefer n3 over |
80 // rdf extension. | 80 // rdf extension. |
81 | 81 |
82 for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { | 82 for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { |
83 | 83 |
84 QDir dir(i->c_str()); | 84 QDir dir(i->c_str()); |
85 if (!dir.exists()) continue; | 85 if (!dir.exists()) continue; |
86 | 86 |
87 QStringList entries = dir.entryList | 87 QStringList entries = dir.entryList |
88 (filters, QDir::Files | QDir::Readable); | 88 (filters, QDir::Files | QDir::Readable); |
89 | 89 |
90 for (QStringList::const_iterator j = entries.begin(); | 90 for (QStringList::const_iterator j = entries.begin(); |
91 j != entries.end(); ++j) { | 91 j != entries.end(); ++j) { |
92 | |
92 QFileInfo fi(dir.filePath(*j)); | 93 QFileInfo fi(dir.filePath(*j)); |
93 pullFile(fi.absoluteFilePath()); | 94 pullFile(fi.absoluteFilePath()); |
94 } | 95 } |
95 | 96 |
96 QStringList subdirs = dir.entryList | 97 QStringList subdirs = dir.entryList |
97 (QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable); | 98 (QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable); |
98 | 99 |
99 for (QStringList::const_iterator j = subdirs.begin(); | 100 for (QStringList::const_iterator j = subdirs.begin(); |
100 j != subdirs.end(); ++j) { | 101 j != subdirs.end(); ++j) { |
102 | |
101 QDir subdir(dir.filePath(*j)); | 103 QDir subdir(dir.filePath(*j)); |
102 if (subdir.exists()) { | 104 if (subdir.exists()) { |
103 entries = subdir.entryList | 105 entries = subdir.entryList |
104 (filters, QDir::Files | QDir::Readable); | 106 (filters, QDir::Files | QDir::Readable); |
105 for (QStringList::const_iterator k = entries.begin(); | 107 for (QStringList::const_iterator k = entries.begin(); |
291 << query.getErrorString() << endl; | 293 << query.getErrorString() << endl; |
292 return false; | 294 return false; |
293 } | 295 } |
294 | 296 |
295 if (results.empty()) { | 297 if (results.empty()) { |
296 SVDEBUG << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl; | 298 cerr << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl; |
297 return false; | 299 return false; |
298 } | 300 } |
299 | 301 |
300 bool foundSomething = false; | 302 bool foundSomething = false; |
301 bool addedSomething = false; | 303 bool addedSomething = false; |
306 QString pluginUri = (*i)["plugin"].value; | 308 QString pluginUri = (*i)["plugin"].value; |
307 QString soUri = (*i)["library"].value; | 309 QString soUri = (*i)["library"].value; |
308 QString identifier = (*i)["plugin_id"].value; | 310 QString identifier = (*i)["plugin_id"].value; |
309 | 311 |
310 if (identifier == "") { | 312 if (identifier == "") { |
311 SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <" | 313 cerr << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <" |
312 << pluginUri << ">" | 314 << pluginUri << ">" |
313 << endl; | 315 << endl; |
314 continue; | 316 continue; |
315 } | 317 } |
316 if (soUri == "") { | 318 if (soUri == "") { |
317 SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <" | 319 cerr << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <" |
318 << pluginUri << ">" | 320 << pluginUri << ">" |
319 << endl; | 321 << endl; |
320 continue; | 322 continue; |
321 } | 323 } |
322 | 324 |
332 | 334 |
333 SimpleSPARQLQuery::Value sonameValue = | 335 SimpleSPARQLQuery::Value sonameValue = |
334 SimpleSPARQLQuery::singleResultQuery(m, sonameQuery, "library_id"); | 336 SimpleSPARQLQuery::singleResultQuery(m, sonameQuery, "library_id"); |
335 QString soname = sonameValue.value; | 337 QString soname = sonameValue.value; |
336 if (soname == "") { | 338 if (soname == "") { |
337 SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No identifier for library <" | 339 cerr << "PluginRDFIndexer::reindex: NOTE: No identifier for library <" |
338 << soUri << ">" | 340 << soUri << ">" |
339 << endl; | 341 << endl; |
340 continue; | 342 continue; |
341 } | 343 } |
342 | 344 |
353 | 355 |
354 addedSomething = true; | 356 addedSomething = true; |
355 | 357 |
356 if (pluginUri != "") { | 358 if (pluginUri != "") { |
357 if (m_uriToIdMap.find(pluginUri) != m_uriToIdMap.end()) { | 359 if (m_uriToIdMap.find(pluginUri) != m_uriToIdMap.end()) { |
358 SVDEBUG << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl; | 360 cerr << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl; |
359 cerr << " 1. Plugin id \"" << m_uriToIdMap[pluginUri] << "\"" << endl; | 361 cerr << " 1. Plugin id \"" << m_uriToIdMap[pluginUri] << "\"" << endl; |
360 cerr << " 2. Plugin id \"" << pluginId << "\"" << endl; | 362 cerr << " 2. Plugin id \"" << pluginId << "\"" << endl; |
361 cerr << "both claim URI <" << pluginUri << ">" << endl; | 363 cerr << "both claim URI <" << pluginUri << ">" << endl; |
362 } else { | 364 } else { |
363 m_uriToIdMap[pluginUri] = pluginId; | 365 m_uriToIdMap[pluginUri] = pluginId; |
364 } | 366 } |
365 } | 367 } |
366 } | 368 } |
367 | 369 |
368 if (!foundSomething) { | 370 if (!foundSomething) { |
369 SVDEBUG << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl; | 371 cerr << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl; |
370 } | 372 } |
371 | 373 |
372 return addedSomething; | 374 return addedSomething; |
373 } | 375 } |
374 | 376 |