Mercurial > hg > svcore
comparison rdf/RDFFeatureWriter.cpp @ 504:3376dc26dece
* Add FeatureWriter method to set basic track metadata; write it out from
RDFFeatureWriter if present
author | Chris Cannam |
---|---|
date | Fri, 05 Dec 2008 11:09:44 +0000 |
parents | 83eae5239db6 |
children | 0944d13689b2 |
comparison
equal
deleted
inserted
replaced
503:3176aade1a03 | 504:3376dc26dece |
---|---|
76 m_suri = i->second.c_str(); | 76 m_suri = i->second.c_str(); |
77 } | 77 } |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void RDFFeatureWriter::write(QString trackId, | 81 void |
82 const Transform &transform, | 82 RDFFeatureWriter::setTrackMetadata(QString trackId, |
83 const Plugin::OutputDescriptor& output, | 83 TrackMetadata metadata) |
84 const Plugin::FeatureList& features, | 84 { |
85 std::string summaryType) | 85 std::cerr << "RDFFeatureWriter::setTrackMetadata: \"" |
86 << trackId.toStdString() << "\" -> \"" << metadata.title.toStdString() << "\",\"" << metadata.maker.toStdString() << "\"" << std::endl; | |
87 m_metadata[trackId] = metadata; | |
88 } | |
89 | |
90 void | |
91 RDFFeatureWriter::write(QString trackId, | |
92 const Transform &transform, | |
93 const Plugin::OutputDescriptor& output, | |
94 const Plugin::FeatureList& features, | |
95 std::string summaryType) | |
86 { | 96 { |
87 QString pluginId = transform.getPluginIdentifier(); | 97 QString pluginId = transform.getPluginIdentifier(); |
88 | 98 |
89 if (m_rdfDescriptions.find(pluginId) == m_rdfDescriptions.end()) { | 99 if (m_rdfDescriptions.find(pluginId) == m_rdfDescriptions.end()) { |
90 | 100 |
168 QTextStream &stream = *sptr; | 178 QTextStream &stream = *sptr; |
169 | 179 |
170 stream << "@prefix dc: <http://purl.org/dc/elements/1.1/> .\n" | 180 stream << "@prefix dc: <http://purl.org/dc/elements/1.1/> .\n" |
171 << "@prefix mo: <http://purl.org/ontology/mo/> .\n" | 181 << "@prefix mo: <http://purl.org/ontology/mo/> .\n" |
172 << "@prefix af: <http://purl.org/ontology/af/> .\n" | 182 << "@prefix af: <http://purl.org/ontology/af/> .\n" |
183 << "@prefix foaf: <http://xmlns.com/foaf/0.1/> . \n" | |
173 << "@prefix event: <http://purl.org/NET/c4dm/event.owl#> .\n" | 184 << "@prefix event: <http://purl.org/NET/c4dm/event.owl#> .\n" |
174 << "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" | 185 << "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" |
175 << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" | 186 << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" |
176 << "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n" | 187 << "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n" |
177 << "@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .\n" | 188 << "@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .\n" |
228 stream << signalURI << " a mo:Signal ;\n"; | 239 stream << signalURI << " a mo:Signal ;\n"; |
229 | 240 |
230 if (trackId != "") { | 241 if (trackId != "") { |
231 stream << " mo:available_as <" << url.toEncoded().data() | 242 stream << " mo:available_as <" << url.toEncoded().data() |
232 << "> ;\n"; | 243 << "> ;\n"; |
244 } | |
245 | |
246 if (m_metadata.find(trackId) != m_metadata.end()) { | |
247 TrackMetadata tm = m_metadata[trackId]; | |
248 if (tm.title != "") { | |
249 stream << " dc:title \"\"\"" << tm.title << "\"\"\" ;\n"; | |
250 } | |
251 if (tm.maker != "") { | |
252 stream << " dc:creator [ a mo:MusicArtist; foaf:name \"\"\"" << tm.maker << "\"\"\" ] ;\n"; | |
253 } | |
233 } | 254 } |
234 | 255 |
235 stream << " mo:time [\n" | 256 stream << " mo:time [\n" |
236 << " a tl:Interval ;\n" | 257 << " a tl:Interval ;\n" |
237 << " tl:onTimeLine " | 258 << " tl:onTimeLine " |