comparison rdf/PluginRDFDescription.cpp @ 480:3ffce691c9bf

* Add Redland datastore support to SimpleSPARQLQuery
author Chris Cannam
date Thu, 13 Nov 2008 14:23:23 +0000
parents 0dc158c1a6c9
children a82645e788fc
comparison
equal deleted inserted replaced
479:f933062a7f80 480:3ffce691c9bf
199 .arg(label); 199 .arg(label);
200 200
201 SimpleSPARQLQuery::Value v; 201 SimpleSPARQLQuery::Value v;
202 202
203 v = SimpleSPARQLQuery::singleResultQuery 203 v = SimpleSPARQLQuery::singleResultQuery
204 (queryTemplate.arg("vamp:name").arg("name"), "name"); 204 (url, queryTemplate.arg("vamp:name").arg("name"), "name");
205 205
206 if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") { 206 if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") {
207 m_pluginName = v.value; 207 m_pluginName = v.value;
208 } 208 }
209 209
210 v = SimpleSPARQLQuery::singleResultQuery 210 v = SimpleSPARQLQuery::singleResultQuery
211 (queryTemplate.arg("dc:description").arg("description"), "description"); 211 (url, queryTemplate.arg("dc:description").arg("description"), "description");
212 212
213 if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") { 213 if (v.type == SimpleSPARQLQuery::LiteralValue && v.value != "") {
214 m_pluginDescription = v.value; 214 m_pluginDescription = v.value;
215 } 215 }
216 216
217 v = SimpleSPARQLQuery::singleResultQuery 217 v = SimpleSPARQLQuery::singleResultQuery
218 (QString( 218 (url,
219 QString(
219 " PREFIX vamp: <http://purl.org/ontology/vamp/> " 220 " PREFIX vamp: <http://purl.org/ontology/vamp/> "
220 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " 221 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
221 " SELECT ?name FROM <%1> " 222 " SELECT ?name FROM <%1> "
222 " WHERE { " 223 " WHERE { "
223 " ?plugin a vamp:Plugin ; " 224 " ?plugin a vamp:Plugin ; "
237 // library would do nicely. Failing that, we could perhaps use 238 // library would do nicely. Failing that, we could perhaps use
238 // any foaf:page URL at all that appears in the file -- but 239 // any foaf:page URL at all that appears in the file -- but
239 // perhaps that would be unwise 240 // perhaps that would be unwise
240 241
241 v = SimpleSPARQLQuery::singleResultQuery 242 v = SimpleSPARQLQuery::singleResultQuery
242 (QString( 243 (url,
244 QString(
243 " PREFIX vamp: <http://purl.org/ontology/vamp/> " 245 " PREFIX vamp: <http://purl.org/ontology/vamp/> "
244 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " 246 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
245 " SELECT ?page from <%1> " 247 " SELECT ?page from <%1> "
246 " WHERE { " 248 " WHERE { "
247 " ?plugin a vamp:Plugin ; " 249 " ?plugin a vamp:Plugin ; "
256 m_pluginInfoURL = v.value; 258 m_pluginInfoURL = v.value;
257 259
258 } else { 260 } else {
259 261
260 v = SimpleSPARQLQuery::singleResultQuery 262 v = SimpleSPARQLQuery::singleResultQuery
261 (QString( 263 (url,
264 QString(
262 " PREFIX vamp: <http://purl.org/ontology/vamp/> " 265 " PREFIX vamp: <http://purl.org/ontology/vamp/> "
263 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " 266 " PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
264 " SELECT ?page from <%1> " 267 " SELECT ?page from <%1> "
265 " WHERE { " 268 " WHERE { "
266 " ?library a vamp:PluginLibrary ; " 269 " ?library a vamp:PluginLibrary ; "
285 PluginRDFDescription::indexOutputs(QString url, QString label) 288 PluginRDFDescription::indexOutputs(QString url, QString label)
286 { 289 {
287 Profiler profiler("PluginRDFDescription::indexOutputs"); 290 Profiler profiler("PluginRDFDescription::indexOutputs");
288 291
289 SimpleSPARQLQuery query 292 SimpleSPARQLQuery query
290 (QString 293 (url,
294 QString
291 ( 295 (
292 " PREFIX vamp: <http://purl.org/ontology/vamp/> " 296 " PREFIX vamp: <http://purl.org/ontology/vamp/> "
293 297
294 " SELECT ?output ?output_id ?output_type ?unit " 298 " SELECT ?output ?output_id ?output_type ?unit "
295 " FROM <%1> " 299 " FROM <%1> "
359 } 363 }
360 364
361 SimpleSPARQLQuery::Value v; 365 SimpleSPARQLQuery::Value v;
362 366
363 v = SimpleSPARQLQuery::singleResultQuery 367 v = SimpleSPARQLQuery::singleResultQuery
364 (QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> " 368 (url,
369 QString(" PREFIX vamp: <http://purl.org/ontology/vamp/> "
365 " PREFIX dc: <http://purl.org/dc/elements/1.1/> " 370 " PREFIX dc: <http://purl.org/dc/elements/1.1/> "
366 " SELECT ?title FROM <%1> " 371 " SELECT ?title FROM <%1> "
367 " WHERE { <%2> dc:title ?title } ") 372 " WHERE { <%2> dc:title ?title } ")
368 .arg(url).arg(outputUri), "title"); 373 .arg(url).arg(outputUri), "title");
369 374
376 " SELECT ?%3 FROM <%1> " 381 " SELECT ?%3 FROM <%1> "
377 " WHERE { <%2> vamp:computes_%3 ?%3 } ") 382 " WHERE { <%2> vamp:computes_%3 ?%3 } ")
378 .arg(url).arg(outputUri); 383 .arg(url).arg(outputUri);
379 384
380 v = SimpleSPARQLQuery::singleResultQuery 385 v = SimpleSPARQLQuery::singleResultQuery
381 (queryTemplate.arg("event_type"), "event_type"); 386 (url, queryTemplate.arg("event_type"), "event_type");
382 387
383 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") { 388 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") {
384 m_outputEventTypeURIMap[outputId] = v.value; 389 m_outputEventTypeURIMap[outputId] = v.value;
385 } 390 }
386 391
387 v = SimpleSPARQLQuery::singleResultQuery 392 v = SimpleSPARQLQuery::singleResultQuery
388 (queryTemplate.arg("feature_attribute"), "feature_attribute"); 393 (url, queryTemplate.arg("feature_attribute"), "feature_attribute");
389 394
390 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") { 395 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") {
391 m_outputFeatureAttributeURIMap[outputId] = v.value; 396 m_outputFeatureAttributeURIMap[outputId] = v.value;
392 } 397 }
393 398
394 v = SimpleSPARQLQuery::singleResultQuery 399 v = SimpleSPARQLQuery::singleResultQuery
395 (queryTemplate.arg("signal_type"), "signal_type"); 400 (url, queryTemplate.arg("signal_type"), "signal_type");
396 401
397 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") { 402 if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") {
398 m_outputSignalTypeURIMap[outputId] = v.value; 403 m_outputSignalTypeURIMap[outputId] = v.value;
399 } 404 }
400 } 405 }