Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/rdf/RDFFeatureWriter.cpp Fri Dec 05 09:40:42 2008 +0000 +++ b/rdf/RDFFeatureWriter.cpp Fri Dec 05 11:09:44 2008 +0000 @@ -78,11 +78,21 @@ } } -void RDFFeatureWriter::write(QString trackId, - const Transform &transform, - const Plugin::OutputDescriptor& output, - const Plugin::FeatureList& features, - std::string summaryType) +void +RDFFeatureWriter::setTrackMetadata(QString trackId, + TrackMetadata metadata) +{ + std::cerr << "RDFFeatureWriter::setTrackMetadata: \"" + << trackId.toStdString() << "\" -> \"" << metadata.title.toStdString() << "\",\"" << metadata.maker.toStdString() << "\"" << std::endl; + m_metadata[trackId] = metadata; +} + +void +RDFFeatureWriter::write(QString trackId, + const Transform &transform, + const Plugin::OutputDescriptor& output, + const Plugin::FeatureList& features, + std::string summaryType) { QString pluginId = transform.getPluginIdentifier(); @@ -170,6 +180,7 @@ stream << "@prefix dc: <http://purl.org/dc/elements/1.1/> .\n" << "@prefix mo: <http://purl.org/ontology/mo/> .\n" << "@prefix af: <http://purl.org/ontology/af/> .\n" + << "@prefix foaf: <http://xmlns.com/foaf/0.1/> . \n" << "@prefix event: <http://purl.org/NET/c4dm/event.owl#> .\n" << "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" @@ -232,6 +243,16 @@ << "> ;\n"; } + if (m_metadata.find(trackId) != m_metadata.end()) { + TrackMetadata tm = m_metadata[trackId]; + if (tm.title != "") { + stream << " dc:title \"\"\"" << tm.title << "\"\"\" ;\n"; + } + if (tm.maker != "") { + stream << " dc:creator [ a mo:MusicArtist; foaf:name \"\"\"" << tm.maker << "\"\"\" ] ;\n"; + } + } + stream << " mo:time [\n" << " a tl:Interval ;\n" << " tl:onTimeLine "