Mercurial > hg > svcore
comparison rdf/PluginRDFDescription.cpp @ 730:27c861cce97b dataquay
Further fixes for Dataquay compatibility
author | Chris Cannam |
---|---|
date | Mon, 21 May 2012 14:33:35 +0100 |
parents | 211efc770335 |
children | 87a9168efd71 |
comparison
equal
deleted
inserted
replaced
729:11289d40a57a | 730:27c861cce97b |
---|---|
182 | 182 |
183 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); | 183 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); |
184 const BasicStore *index = indexer->getIndex(); | 184 const BasicStore *index = indexer->getIndex(); |
185 Uri plugin(m_pluginUri); | 185 Uri plugin(m_pluginUri); |
186 | 186 |
187 Node n = index->matchFirst(Triple(plugin, "vamp:name", Node())).c; | 187 Node n = index->complete |
188 (Triple(plugin, index->expand("vamp:name"), Node())); | |
189 | |
188 if (n.type == Node::Literal && n.value != "") { | 190 if (n.type == Node::Literal && n.value != "") { |
189 m_pluginName = n.value; | 191 m_pluginName = n.value; |
190 } | 192 } |
191 | 193 |
192 n = index->matchFirst(Triple(plugin, "dc:description", Node())).c; | 194 n = index->complete |
195 (Triple(plugin, index->expand("dc:description"), Node())); | |
196 | |
193 if (n.type == Node::Literal && n.value != "") { | 197 if (n.type == Node::Literal && n.value != "") { |
194 m_pluginDescription = n.value; | 198 m_pluginDescription = n.value; |
195 } | 199 } |
196 | 200 |
197 n = index->matchFirst(Triple(plugin, "foaf:maker", Node())).c; | 201 n = index->complete |
202 (Triple(plugin, index->expand("foaf:maker"), Node())); | |
203 | |
198 if (n.type == Node::URI || n.type == Node::Blank) { | 204 if (n.type == Node::URI || n.type == Node::Blank) { |
199 n = index->matchFirst(Triple(n, "foaf:name", Node())).c; | 205 n = index->complete(Triple(n, index->expand("foaf:name"), Node())); |
200 if (n.type == Node::Literal && n.value != "") { | 206 if (n.type == Node::Literal && n.value != "") { |
201 m_pluginMaker = n.value; | 207 m_pluginMaker = n.value; |
202 } | 208 } |
203 } | 209 } |
204 | 210 |
205 // If we have a more-information URL for this plugin, then we take | 211 // If we have a more-information URL for this plugin, then we take |
206 // that. Otherwise, a more-information URL for the plugin library | 212 // that. Otherwise, a more-information URL for the plugin library |
207 // would do nicely. | 213 // would do nicely. |
208 | 214 |
209 n = index->matchFirst(Triple(plugin, "foaf:page", Node())).c; | 215 n = index->complete |
216 (Triple(plugin, index->expand("foaf:page"), Node())); | |
217 | |
210 if (n.type == Node::URI && n.value != "") { | 218 if (n.type == Node::URI && n.value != "") { |
211 m_pluginInfoURL = n.value; | 219 m_pluginInfoURL = n.value; |
212 } | 220 } |
213 | 221 |
214 n = index->matchFirst(Triple(Node(), "vamp:available_plugin", plugin)).a; | 222 n = index->complete |
223 (Triple(Node(), index->expand("vamp:available_plugin"), plugin)); | |
224 | |
215 if (n.value != "") { | 225 if (n.value != "") { |
216 n = index->matchFirst(Triple(n, "foaf:page", Node())).c; | 226 n = index->complete(Triple(n, index->expand("foaf:page"), Node())); |
217 if (n.type == Node::URI && n.value != "") { | 227 if (n.type == Node::URI && n.value != "") { |
218 m_pluginInfoURL = n.value; | 228 m_pluginInfoURL = n.value; |
219 } | 229 } |
220 } | 230 } |
221 | 231 |
229 | 239 |
230 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); | 240 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); |
231 const BasicStore *index = indexer->getIndex(); | 241 const BasicStore *index = indexer->getIndex(); |
232 Uri plugin(m_pluginUri); | 242 Uri plugin(m_pluginUri); |
233 | 243 |
234 Nodes outputs = index->match(Triple(plugin, "vamp:output", Node())).a(); | 244 Nodes outputs = index->match |
245 (Triple(plugin, index->expand("vamp:output"), Node())).objects(); | |
235 | 246 |
236 if (outputs.empty()) { | 247 if (outputs.empty()) { |
237 cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <" | 248 cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <" |
238 << m_pluginUri << ">" << endl; | 249 << m_pluginUri << ">" << endl; |
239 return false; | 250 return false; |
245 output.value == "") { | 256 output.value == "") { |
246 cerr << "ERROR: PluginRDFDescription::indexURL: No valid URI for output " << output << " of plugin <" << m_pluginUri << ">" << endl; | 257 cerr << "ERROR: PluginRDFDescription::indexURL: No valid URI for output " << output << " of plugin <" << m_pluginUri << ">" << endl; |
247 return false; | 258 return false; |
248 } | 259 } |
249 | 260 |
250 Node n = index->matchFirst(Triple(output, "vamp:identifier", Node())).c; | 261 Node n = index->complete(Triple(output, index->expand("vamp:identifier"), Node())); |
251 if (n.type != Node::Literal || n.value == "") { | 262 if (n.type != Node::Literal || n.value == "") { |
252 cerr << "ERROR: PluginRDFDescription::indexURL: No vamp:identifier for output <" << output << ">" << endl; | 263 cerr << "ERROR: PluginRDFDescription::indexURL: No vamp:identifier for output <" << output << ">" << endl; |
253 return false; | 264 return false; |
254 } | 265 } |
255 QString outputId = n.value; | 266 QString outputId = n.value; |
256 | 267 |
257 n = index->matchFirst(Triple(output, "a", Node())).c; | 268 m_outputUriMap[outputId] = output.value; |
269 | |
270 n = index->complete(Triple(output, Uri("a"), Node())); | |
258 QString outputType; | 271 QString outputType; |
259 if (n.type == Node::URI) outputType = n.value; | 272 if (n.type == Node::URI) outputType = n.value; |
260 | 273 |
261 n = index->matchFirst(Triple(output, "vamp:unit", Node())).c; | 274 n = index->complete(Triple(output, index->expand("vamp:unit"), Node())); |
262 QString outputUnit; | 275 QString outputUnit; |
263 if (n.type == Node::Literal) outputUnit = n.value; | 276 if (n.type == Node::Literal) outputUnit = n.value; |
264 | |
265 m_outputUriMap[outputId] = output.value; | |
266 | 277 |
267 if (outputType.contains("DenseOutput")) { | 278 if (outputType.contains("DenseOutput")) { |
268 m_outputDispositions[outputId] = OutputDense; | 279 m_outputDispositions[outputId] = OutputDense; |
269 } else if (outputType.contains("SparseOutput")) { | 280 } else if (outputType.contains("SparseOutput")) { |
270 m_outputDispositions[outputId] = OutputSparse; | 281 m_outputDispositions[outputId] = OutputSparse; |
271 } else if (outputType.contains("TrackLevelOutput")) { | 282 } else if (outputType.contains("TrackLevelOutput")) { |
272 m_outputDispositions[outputId] = OutputTrackLevel; | 283 m_outputDispositions[outputId] = OutputTrackLevel; |
273 } else { | 284 } else { |
274 m_outputDispositions[outputId] = OutputDispositionUnknown; | 285 m_outputDispositions[outputId] = OutputDispositionUnknown; |
275 } | 286 } |
287 cerr << "output " << output << " -> id " << outputId << ", type " << outputType << ", unit " | |
288 << outputUnit << ", disposition " << m_outputDispositions[outputId] << endl; | |
276 | 289 |
277 if (outputUnit != "") { | 290 if (outputUnit != "") { |
278 m_outputUnitMap[outputId] = outputUnit; | 291 m_outputUnitMap[outputId] = outputUnit; |
279 } | 292 } |
280 | 293 |
281 n = index->matchFirst(Triple(output, "dc:title", Node())).c; | 294 n = index->complete(Triple(output, index->expand("dc:title"), Node())); |
282 if (n.type == Node::Literal && n.value != "") { | 295 if (n.type == Node::Literal && n.value != "") { |
283 m_outputNames[outputId] = n.value; | 296 m_outputNames[outputId] = n.value; |
284 } | 297 } |
285 | 298 |
286 n = index->matchFirst(Triple(output, "vamp:computes_event_type", Node())).c; | 299 n = index->complete(Triple(output, index->expand("vamp:computes_event_type"), Node())); |
300 cerr << output << " -> computes_event_type " << n << endl; | |
287 if (n.type == Node::URI && n.value != "") { | 301 if (n.type == Node::URI && n.value != "") { |
288 m_outputEventTypeURIMap[outputId] = n.value; | 302 m_outputEventTypeURIMap[outputId] = n.value; |
289 } | 303 } |
290 | 304 |
291 n = index->matchFirst(Triple(output, "vamp:computes_feature", Node())).c; | 305 n = index->complete(Triple(output, index->expand("vamp:computes_feature"), Node())); |
292 if (n.type == Node::URI && n.value != "") { | 306 if (n.type == Node::URI && n.value != "") { |
293 m_outputFeatureAttributeURIMap[outputId] = n.value; | 307 m_outputFeatureAttributeURIMap[outputId] = n.value; |
294 } | 308 } |
295 | 309 |
296 n = index->matchFirst(Triple(output, "vamp:computes_signal_type", Node())).c; | 310 n = index->complete(Triple(output, index->expand("vamp:computes_signal_type"), Node())); |
297 if (n.type == Node::URI && n.value != "") { | 311 if (n.type == Node::URI && n.value != "") { |
298 m_outputSignalTypeURIMap[outputId] = n.value; | 312 m_outputSignalTypeURIMap[outputId] = n.value; |
299 } | 313 } |
300 } | 314 } |
301 | 315 |