comparison 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
comparison
equal deleted inserted replaced
587:94054c97c76a 588:d04b8674b710
945 if (!q.isOK()) { 945 if (!q.isOK()) {
946 SimpleSPARQLQuery::closeSingleSource(url); 946 SimpleSPARQLQuery::closeSingleSource(url);
947 return NotRDF; 947 return NotRDF;
948 } 948 }
949 949
950 // "MO-conformant" structure for audio files
951
950 SimpleSPARQLQuery::Value value = 952 SimpleSPARQLQuery::Value value =
951 SimpleSPARQLQuery::singleResultQuery 953 SimpleSPARQLQuery::singleResultQuery
952 (SimpleSPARQLQuery::QueryFromSingleSource, 954 (SimpleSPARQLQuery::QueryFromSingleSource,
953 QString 955 QString
954 (" PREFIX mo: <http://purl.org/ontology/mo/> " 956 (" PREFIX mo: <http://purl.org/ontology/mo/> "
955 " SELECT ?url FROM <%1> " 957 " SELECT ?url FROM <%1> "
956 " WHERE { ?signal a mo:Signal ; mo:available_as ?url } " 958 " WHERE { ?url a mo:AudioFile } "
957 ).arg(url), 959 ).arg(url),
958 "url"); 960 "url");
959 961
960 if (value.type == SimpleSPARQLQuery::URIValue) { 962 if (value.type == SimpleSPARQLQuery::URIValue) {
963
961 haveAudio = true; 964 haveAudio = true;
965
966 } else {
967
968 // Sonic Annotator v0.2 and below used to write this structure
969 // (which is not properly in conformance with the Music
970 // Ontology)
971
972 value =
973 SimpleSPARQLQuery::singleResultQuery
974 (SimpleSPARQLQuery::QueryFromSingleSource,
975 QString
976 (" PREFIX mo: <http://purl.org/ontology/mo/> "
977 " SELECT ?url FROM <%1> "
978 " WHERE { ?signal a mo:Signal ; mo:available_as ?url } "
979 ).arg(url),
980 "url");
981
982 if (value.type == SimpleSPARQLQuery::URIValue) {
983 haveAudio = true;
984 }
962 } 985 }
963 986
964 value = 987 value =
965 SimpleSPARQLQuery::singleResultQuery 988 SimpleSPARQLQuery::singleResultQuery
966 (SimpleSPARQLQuery::QueryFromSingleSource, 989 (SimpleSPARQLQuery::QueryFromSingleSource,