diff rdf/RDFImporter.cpp @ 588:d04b8674b710

* Try to identify the properly conformant audio file structure written out by Sonic Annotator (but we still don't actually import it yet)
author Chris Cannam
date Wed, 13 May 2009 13:30:08 +0000
parents 2e0c987a12bd
children a03aafaacb5a
line wrap: on
line diff
--- a/rdf/RDFImporter.cpp	Wed May 13 12:59:07 2009 +0000
+++ b/rdf/RDFImporter.cpp	Wed May 13 13:30:08 2009 +0000
@@ -947,18 +947,41 @@
         return NotRDF;
     }
 
+    // "MO-conformant" structure for audio files
+
     SimpleSPARQLQuery::Value value =
         SimpleSPARQLQuery::singleResultQuery
         (SimpleSPARQLQuery::QueryFromSingleSource,
          QString
          (" PREFIX mo: <http://purl.org/ontology/mo/> "
           " SELECT ?url FROM <%1> "
-          " WHERE { ?signal a mo:Signal ; mo:available_as ?url } "
+          " WHERE { ?url a mo:AudioFile } "
              ).arg(url),
          "url");
 
     if (value.type == SimpleSPARQLQuery::URIValue) {
+
         haveAudio = true;
+
+    } else {
+
+        // Sonic Annotator v0.2 and below used to write this structure
+        // (which is not properly in conformance with the Music
+        // Ontology)
+
+        value =
+            SimpleSPARQLQuery::singleResultQuery
+            (SimpleSPARQLQuery::QueryFromSingleSource,
+             QString
+             (" PREFIX mo: <http://purl.org/ontology/mo/> "
+              " SELECT ?url FROM <%1> "
+              " WHERE { ?signal a mo:Signal ; mo:available_as ?url } "
+                 ).arg(url),
+             "url");
+
+        if (value.type == SimpleSPARQLQuery::URIValue) {
+            haveAudio = true;
+        }
     }
 
     value =