comparison rdf/RDFFeatureWriter.cpp @ 586:4ab8e8f7d7ed

* Replace not very useful signal-uri option with more useful audiofile-uri
author Chris Cannam
date Wed, 13 May 2009 12:49:22 +0000
parents cbc884787a08
children 94054c97c76a
comparison
equal deleted inserted replaced
585:cbc884787a08 586:4ab8e8f7d7ed
53 p.name = "plain"; 53 p.name = "plain";
54 p.description = "Use \"plain\" RDF even if transform metadata is available."; 54 p.description = "Use \"plain\" RDF even if transform metadata is available.";
55 p.hasArg = false; 55 p.hasArg = false;
56 pl.push_back(p); 56 pl.push_back(p);
57 57
58 p.name = "signal-uri"; 58 p.name = "audiofile-uri";
59 p.description = "Link the output RDF to the given signal URI."; 59 p.description = "Link the output RDF to the given audio file URI instead of its actual location.";
60 p.hasArg = true; 60 p.hasArg = true;
61 pl.push_back(p); 61 pl.push_back(p);
62 62
63 return pl; 63 return pl;
64 } 64 }
71 for (map<string, string>::iterator i = params.begin(); 71 for (map<string, string>::iterator i = params.begin();
72 i != params.end(); ++i) { 72 i != params.end(); ++i) {
73 if (i->first == "plain") { 73 if (i->first == "plain") {
74 m_plain = true; 74 m_plain = true;
75 } 75 }
76 if (i->first == "signal-uri") { 76 if (i->first == "audiofile-uri") {
77 m_suri = i->second.c_str(); 77 m_suri = i->second.c_str();
78 } 78 }
79 } 79 }
80 } 80 }
81 81
250 uint64_t signalCount = m_count++; 250 uint64_t signalCount = m_count++;
251 251
252 if (m_trackSignalURIs.find(trackId) == m_trackSignalURIs.end()) { 252 if (m_trackSignalURIs.find(trackId) == m_trackSignalURIs.end()) {
253 m_trackSignalURIs[trackId] = QString(":signal_%1").arg(signalCount); 253 m_trackSignalURIs[trackId] = QString(":signal_%1").arg(signalCount);
254 } 254 }
255
256 if (m_suri != NULL) {
257 m_trackSignalURIs[trackId] = "<" + m_suri + ">";
258 }
259 QString signalURI = m_trackSignalURIs[trackId]; 255 QString signalURI = m_trackSignalURIs[trackId];
260 256
261 if (m_trackTrackURIs.find(trackId) == m_trackTrackURIs.end()) { 257 if (m_trackTrackURIs.find(trackId) == m_trackTrackURIs.end()) {
262 m_trackTrackURIs[trackId] = QString(":track_%1").arg(signalCount); 258 m_trackTrackURIs[trackId] = QString(":track_%1").arg(signalCount);
263 } 259 }
265 261
266 if (m_trackTimelineURIs.find(trackId) == m_trackTimelineURIs.end()) { 262 if (m_trackTimelineURIs.find(trackId) == m_trackTimelineURIs.end()) {
267 m_trackTimelineURIs[trackId] = QString(":signal_timeline_%1").arg(signalCount); 263 m_trackTimelineURIs[trackId] = QString(":signal_timeline_%1").arg(signalCount);
268 } 264 }
269 QString timelineURI = m_trackTimelineURIs[trackId]; 265 QString timelineURI = m_trackTimelineURIs[trackId];
266
267 QString afURI = url.toEncoded().data();
268 if (m_suri != NULL) afURI = m_suri;
270 269
271 if (m_metadata.find(trackId) != m_metadata.end()) { 270 if (m_metadata.find(trackId) != m_metadata.end()) {
272 TrackMetadata tm = m_metadata[trackId]; 271 TrackMetadata tm = m_metadata[trackId];
273 if (tm.title != "" || tm.maker != "") { 272 if (tm.title != "" || tm.maker != "") {
274 // We only write a Track at all if we have some 273 // We only write a Track at all if we have some
285 } 284 }
286 if (tm.maker != "") { 285 if (tm.maker != "") {
287 stream << ";\n foaf:maker [ a mo:MusicArtist; foaf:name \"\"\"" << tm.maker << "\"\"\" ] "; 286 stream << ";\n foaf:maker [ a mo:MusicArtist; foaf:name \"\"\"" << tm.maker << "\"\"\" ] ";
288 } 287 }
289 if (trackId != "") { 288 if (trackId != "") {
290 stream << ";\n mo:available_as <" << url.toEncoded().data() << "> "; 289 stream << ";\n mo:available_as <" << afURI << "> ";
291 } 290 }
292 stream << ".\n\n"; 291 stream << ".\n\n";
293 } 292 }
294 } 293 }
295 294
296 if (trackId != "") { 295 if (trackId != "") {
297 stream << "<" << url.toEncoded().data() << "> a mo:AudioFile ;\n"; 296 stream << "<" << afURI << "> a mo:AudioFile ;\n";
298 stream << " mo:encodes " << signalURI << ".\n\n"; 297 stream << " mo:encodes " << signalURI << ".\n\n";
299 } 298 }
300 299
301 stream << signalURI << " a mo:Signal ;\n"; 300 stream << signalURI << " a mo:Signal ;\n";
302 301