Mercurial > hg > svcore
diff rdf/RDFFeatureWriter.cpp @ 510:af7b6e55895b
* Ensure text models are exported with text properties in RDF, and
imported back into text models again (instead of time/value models)
author | Chris Cannam |
---|---|
date | Mon, 08 Dec 2008 11:53:10 +0000 |
parents | 1b8c748fd7ea |
children | e7a39c45a7a4 |
line wrap: on
line diff
--- a/rdf/RDFFeatureWriter.cpp Mon Dec 08 11:15:13 2008 +0000 +++ b/rdf/RDFFeatureWriter.cpp Mon Dec 08 11:53:10 2008 +0000 @@ -87,6 +87,12 @@ } void +RDFFeatureWriter::setFixedEventTypeURI(QString uri) +{ + m_fixedEventTypeURI = uri; +} + +void RDFFeatureWriter::write(QString trackId, const Transform &transform, const Plugin::OutputDescriptor& output, @@ -357,7 +363,7 @@ << endl; } - if (needEventType) { + if (needEventType && m_fixedEventTypeURI == "") { QString uri; if (m_syntheticEventTypeURIs.find(transform) != @@ -420,16 +426,20 @@ stream << ":event_" << featureNumber << " a "; - QString eventTypeURI = desc.getOutputEventTypeURI(outputId); - if (plain || eventTypeURI == "") { - if (m_syntheticEventTypeURIs.find(transform) != - m_syntheticEventTypeURIs.end()) { - stream << m_syntheticEventTypeURIs[transform] << " ;\n"; + if (m_fixedEventTypeURI != "") { + stream << m_fixedEventTypeURI << " ;\n"; + } else { + QString eventTypeURI = desc.getOutputEventTypeURI(outputId); + if (plain || eventTypeURI == "") { + if (m_syntheticEventTypeURIs.find(transform) != + m_syntheticEventTypeURIs.end()) { + stream << m_syntheticEventTypeURIs[transform] << " ;\n"; + } else { + stream << ":event_type_" << outputId << " ;\n"; + } } else { - stream << ":event_type_" << outputId << " ;\n"; + stream << "<" << eventTypeURI << "> ;\n"; } - } else { - stream << "<" << eventTypeURI << "> ;\n"; } QString timestamp = feature.timestamp.toString().c_str(); @@ -465,7 +475,7 @@ if (feature.label.length() > 0) { stream << ";\n"; - stream << " rdfs:label \"" << feature.label.c_str() << "\" "; + stream << " rdfs:label \"\"\"" << feature.label.c_str() << "\"\"\" "; } if (!feature.values.empty()) {