# HG changeset patch
# User Chris Cannam
# Date 1326475291 0
# Node ID 685e0234c4cdc22897fa6928c6dd413484a4cf55
# Parent d6d76088e632f4b08994f4c1b7ad0bfff1866fbb# Parent f3fd2988fc9b2e871cd3f44b61cfe5e3ed36c7e2
Merge
diff -r d6d76088e632 -r 685e0234c4cd rdf/PluginRDFDescription.cpp
--- a/rdf/PluginRDFDescription.cpp Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/PluginRDFDescription.cpp Fri Jan 13 17:21:31 2012 +0000
@@ -278,19 +278,10 @@
(
" PREFIX vamp: "
- " SELECT ?output ?output_id ?output_type ?unit "
+ " SELECT ?output "
" WHERE { "
-
" <%1> vamp:output ?output . "
-
- " ?output vamp:identifier ?output_id ; "
- " a ?output_type . "
-
- " OPTIONAL { "
- " ?output vamp:unit ?unit "
- " } . "
-
" } "
)
.arg(m_pluginUri));
@@ -305,7 +296,7 @@
}
if (results.empty()) {
- SVDEBUG << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <"
+ cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <"
<< m_pluginUri << ">" << endl;
return false;
}
@@ -316,9 +307,48 @@
for (int i = 0; i < results.size(); ++i) {
+ if (results[i]["output"].type != SimpleSPARQLQuery::URIValue ||
+ results[i]["output"].value == "") {
+ cerr << "ERROR: PluginRDFDescription::indexURL: No valid URI for output " << i << " of plugin <" << m_pluginUri << ">" << endl;
+ return false;
+ }
+
QString outputUri = results[i]["output"].value;
- QString outputId = results[i]["output_id"].value;
- QString outputType = results[i]["output_type"].value;
+
+ SimpleSPARQLQuery::Value v;
+
+ v = SimpleSPARQLQuery::singleResultQuery
+ (m,
+ QString(" PREFIX vamp: "
+ " SELECT ?output_id "
+ " WHERE { <%1> vamp:identifier ?output_id } ")
+ .arg(outputUri), "output_id");
+
+ if (v.type != SimpleSPARQLQuery::LiteralValue || v.value == "") {
+ cerr << "ERROR: PluginRDFDescription::indexURL: No identifier for output <" << outputUri << ">" << endl;
+ return false;
+ }
+ QString outputId = v.value;
+
+ v = SimpleSPARQLQuery::singleResultQuery
+ (m,
+ QString(" PREFIX vamp: "
+ " SELECT ?output_type "
+ " WHERE { <%1> a ?output_type } ")
+ .arg(outputUri), "output_type");
+
+ QString outputType;
+ if (v.type == SimpleSPARQLQuery::URIValue) outputType = v.value;
+
+ v = SimpleSPARQLQuery::singleResultQuery
+ (m,
+ QString(" PREFIX vamp: "
+ " SELECT ?unit "
+ " WHERE { <%1> vamp:unit ?unit } ")
+ .arg(outputUri), "unit");
+
+ QString outputUnit;
+ if (v.type == SimpleSPARQLQuery::LiteralValue) outputUnit = v.value;
m_outputUriMap[outputId] = outputUri;
@@ -332,23 +362,16 @@
m_outputDispositions[outputId] = OutputDispositionUnknown;
}
- if (results[i]["unit"].type == SimpleSPARQLQuery::LiteralValue) {
-
- QString unit = results[i]["unit"].value;
-
- if (unit != "") {
- m_outputUnitMap[outputId] = unit;
- }
+ if (outputUnit != "") {
+ m_outputUnitMap[outputId] = outputUnit;
}
- SimpleSPARQLQuery::Value v;
-
v = SimpleSPARQLQuery::singleResultQuery
(m,
QString(" PREFIX vamp: "
" PREFIX dc: "
" SELECT ?title "
- " WHERE { <%2> dc:title ?title } ")
+ " WHERE { <%1> dc:title ?title } ")
.arg(outputUri), "title");
if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") {
@@ -357,8 +380,8 @@
QString queryTemplate =
QString(" PREFIX vamp: "
- " SELECT ?%3 "
- " WHERE { <%2> vamp:computes_%3 ?%3 } ")
+ " SELECT ?%2 "
+ " WHERE { <%1> vamp:computes_%2 ?%2 } ")
.arg(outputUri);
v = SimpleSPARQLQuery::singleResultQuery
diff -r d6d76088e632 -r 685e0234c4cd rdf/PluginRDFIndexer.cpp
--- a/rdf/PluginRDFIndexer.cpp Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/PluginRDFIndexer.cpp Fri Jan 13 17:21:31 2012 +0000
@@ -80,7 +80,7 @@
// rdf extension.
for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) {
-
+
QDir dir(i->c_str());
if (!dir.exists()) continue;
@@ -89,6 +89,7 @@
for (QStringList::const_iterator j = entries.begin();
j != entries.end(); ++j) {
+
QFileInfo fi(dir.filePath(*j));
pullFile(fi.absoluteFilePath());
}
@@ -98,6 +99,7 @@
for (QStringList::const_iterator j = subdirs.begin();
j != subdirs.end(); ++j) {
+
QDir subdir(dir.filePath(*j));
if (subdir.exists()) {
entries = subdir.entryList
@@ -293,7 +295,7 @@
}
if (results.empty()) {
- SVDEBUG << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl;
+ cerr << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl;
return false;
}
@@ -308,13 +310,13 @@
QString identifier = (*i)["plugin_id"].value;
if (identifier == "") {
- SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <"
+ cerr << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <"
<< pluginUri << ">"
<< endl;
continue;
}
if (soUri == "") {
- SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <"
+ cerr << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <"
<< pluginUri << ">"
<< endl;
continue;
@@ -334,7 +336,7 @@
SimpleSPARQLQuery::singleResultQuery(m, sonameQuery, "library_id");
QString soname = sonameValue.value;
if (soname == "") {
- SVDEBUG << "PluginRDFIndexer::reindex: NOTE: No identifier for library <"
+ cerr << "PluginRDFIndexer::reindex: NOTE: No identifier for library <"
<< soUri << ">"
<< endl;
continue;
@@ -355,7 +357,7 @@
if (pluginUri != "") {
if (m_uriToIdMap.find(pluginUri) != m_uriToIdMap.end()) {
- SVDEBUG << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl;
+ cerr << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl;
cerr << " 1. Plugin id \"" << m_uriToIdMap[pluginUri] << "\"" << endl;
cerr << " 2. Plugin id \"" << pluginId << "\"" << endl;
cerr << "both claim URI <" << pluginUri << ">" << endl;
@@ -366,7 +368,7 @@
}
if (!foundSomething) {
- SVDEBUG << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl;
+ cerr << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl;
}
return addedSomething;
diff -r d6d76088e632 -r 685e0234c4cd rdf/RDFFeatureWriter.cpp
--- a/rdf/RDFFeatureWriter.cpp Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/RDFFeatureWriter.cpp Fri Jan 13 17:21:31 2012 +0000
@@ -141,10 +141,10 @@
m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId);
if (m_rdfDescriptions[pluginId].haveDescription()) {
- SVDEBUG << "NOTE: Have RDF description for plugin ID \""
+ cerr << "NOTE: Have RDF description for plugin ID \""
<< pluginId << "\"" << endl;
} else {
- SVDEBUG << "NOTE: No RDF description for plugin ID \""
+ cerr << "NOTE: No RDF description for plugin ID \""
<< pluginId << "\"" << endl;
if (!m_network) {
cerr << " Consider using the --rdf-network option to retrieve plugin descriptions" << endl;
diff -r d6d76088e632 -r 685e0234c4cd rdf/SimpleSPARQLQuery.cpp
--- a/rdf/SimpleSPARQLQuery.cpp Fri Jan 13 17:21:18 2012 +0000
+++ b/rdf/SimpleSPARQLQuery.cpp Fri Jan 13 17:21:31 2012 +0000
@@ -619,7 +619,7 @@
SimpleSPARQLQuery q(type, query);
ResultList results = q.execute();
if (!q.isOK()) {
- SVDEBUG << "SimpleSPARQLQuery::singleResultQuery: ERROR: "
+ cerr << "SimpleSPARQLQuery::singleResultQuery: ERROR: "
<< q.getErrorString() << endl;
return Value();
}
diff -r d6d76088e632 -r 685e0234c4cd transform/FeatureExtractionModelTransformer.cpp
--- a/transform/FeatureExtractionModelTransformer.cpp Fri Jan 13 17:21:18 2012 +0000
+++ b/transform/FeatureExtractionModelTransformer.cpp Fri Jan 13 17:21:31 2012 +0000
@@ -176,9 +176,8 @@
{
DenseTimeValueModel *input = getConformingInput();
-// std::cerr << "FeatureExtractionModelTransformer: output sample type "
-// << m_descriptor->sampleType << std::endl;
-
+// std::cerr << "FeatureExtractionModelTransformer::createOutputModel: sample type " << m_descriptor->sampleType << ", rate " << m_descriptor->sampleRate << std::endl;
+
PluginRDFDescription description(m_transform.getPluginIdentifier());
QString outputId = m_transform.getOutput();
@@ -201,7 +200,7 @@
size_t modelRate = input->getSampleRate();
size_t modelResolution = 1;
-
+
switch (m_descriptor->sampleType) {
case Vamp::Plugin::OutputDescriptor::VariableSampleRate:
@@ -636,8 +635,11 @@
{
size_t inputRate = m_input.getModel()->getSampleRate();
-// SVDEBUG << "FeatureExtractionModelTransformer::addFeature("
-// << blockFrame << ")" << endl;
+// std::cerr << "FeatureExtractionModelTransformer::addFeature: blockFrame = "
+// << blockFrame << ", hasTimestamp = " << feature.hasTimestamp
+// << ", timestamp = " << feature.timestamp << ", hasDuration = "
+// << feature.hasDuration << ", duration = " << feature.duration
+// << std::endl;
int binCount = 1;
if (m_descriptor->hasFixedBinCount) {