comparison rdf/RDFFeatureWriter.cpp @ 508:1b8c748fd7ea

* Support recording the summary type in transform
author Chris Cannam
date Fri, 05 Dec 2008 16:18:04 +0000
parents 0944d13689b2
children af7b6e55895b
comparison
equal deleted inserted replaced
507:0944d13689b2 508:1b8c748fd7ea
21 #include "RDFFeatureWriter.h" 21 #include "RDFFeatureWriter.h"
22 #include "RDFTransformFactory.h" 22 #include "RDFTransformFactory.h"
23 23
24 #include <QTextStream> 24 #include <QTextStream>
25 #include <QUrl> 25 #include <QUrl>
26 #include <QFileInfo>
26 #include <QRegExp> 27 #include <QRegExp>
27 28
28 using namespace std; 29 using namespace std;
29 using Vamp::Plugin; 30 using Vamp::Plugin;
30 using Vamp::PluginBase; 31 using Vamp::PluginBase;
221 bool local = (scheme == "" || scheme == "file" || scheme.length() == 1); 222 bool local = (scheme == "" || scheme == "file" || scheme.length() == 1);
222 223
223 if (local) { 224 if (local) {
224 if (scheme == "") { 225 if (scheme == "") {
225 url.setScheme("file"); 226 url.setScheme("file");
227 url.setPath(QFileInfo(url.path()).absoluteFilePath());
226 } else if (scheme.length() == 1) { // DOS drive letter! 228 } else if (scheme.length() == 1) { // DOS drive letter!
227 url.setScheme("file"); 229 url.setScheme("file");
228 url.setPath(scheme + ":" + url.path()); 230 url.setPath(scheme + ":" + url.path());
229 } 231 }
230 } 232 }
312 } else if (desc.getOutputDisposition(outputId) == 314 } else if (desc.getOutputDisposition(outputId) ==
313 PluginRDFDescription::OutputTrackLevel) { 315 PluginRDFDescription::OutputTrackLevel) {
314 316
315 // see note above -- need to generate an event type if no 317 // see note above -- need to generate an event type if no
316 // feature type given, or if in plain mode 318 // feature type given, or if in plain mode
317
318 cerr << "Note: track level output" << endl;
319 319
320 if (m_plain) { 320 if (m_plain) {
321 321
322 needEventType = true; 322 needEventType = true;
323 323
350 transformUri = QString(":transform_%1_%2").arg(m_count++).arg(outputId); 350 transformUri = QString(":transform_%1_%2").arg(m_count++).arg(outputId);
351 m_transformURIs[transform] = transformUri; 351 m_transformURIs[transform] = transformUri;
352 } 352 }
353 353
354 if (transform.getIdentifier() != "") { 354 if (transform.getIdentifier() != "") {
355 stream << RDFTransformFactory::writeTransformToRDF(transform, transformUri) 355 stream << endl
356 << RDFTransformFactory::writeTransformToRDF(transform, transformUri)
356 << endl; 357 << endl;
357 } 358 }
358 359
359 if (needEventType) { 360 if (needEventType) {
360 361
508 509
509 if (feature.values.empty()) { 510 if (feature.values.empty()) {
510 511
511 if (feature.label == "") continue; 512 if (feature.label == "") continue;
512 513
513 stream << signalURI << " " << featureUri << " \"" 514 stream << signalURI << " " << featureUri << " \"\"\""
514 << feature.label.c_str() << "\" .\n"; 515 << feature.label.c_str() << "\"\"\" .\n";
515 516
516 } else { 517 } else {
517 518
518 stream << signalURI << " " << featureUri << " \"" 519 stream << signalURI << " " << featureUri << " \""
519 << feature.values[0] << "\"^^xsd:float .\n"; 520 << feature.values[0] << "\"^^xsd:float .\n";