diff 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
line wrap: on
line diff
--- a/rdf/PluginRDFIndexer.cpp	Fri Apr 17 17:45:34 2020 +0100
+++ b/rdf/PluginRDFIndexer.cpp	Mon Apr 20 15:42:51 2020 +0100
@@ -181,9 +181,31 @@
     
     settings.endGroup();
     reindex();
+
     return true;
 }
 
+void
+PluginRDFIndexer::performConsistencyChecks()
+{
+    // Add more here!
+    
+    Triples packs = m_index->match
+        (Triple(Node(), m_index->expand("vamp:available_library"), Node()));
+
+    for (Triple packt: packs) {
+        Triples libraries = m_index->match
+            (Triple(packt.object(), m_index->expand("a"),
+                    m_index->expand("vamp:PluginLibrary")));
+        if (libraries.empty()) {
+            SVCERR << "WARNING: Plugin pack " << packt.subject()
+                   << " claims to contain library " << packt.object()
+                   << " which is not known to us as a vamp:PluginLibrary"
+                   << endl;
+        }
+    }
+}
+
 QString
 PluginRDFIndexer::getURIForPluginId(QString pluginId)
 {
@@ -288,12 +310,7 @@
     }
 
     try {
-        m_index->import(local, BasicStore::ImportFailOnDuplicates);
-    } catch (RDFDuplicateImportException &e) {
-        SVDEBUG << e.what() << endl;
-        SVDEBUG << "PluginRDFIndexer::pullURL: Document at " << urlString
-                 << " duplicates triples found in earlier loaded document -- skipping it" << endl;
-        return false;
+        m_index->import(local, BasicStore::ImportIgnoreDuplicates);
     } catch (RDFException &e) {
         SVDEBUG << e.what() << endl;
         SVDEBUG << "PluginRDFIndexer::pullURL: Failed to import document from "