Mercurial > hg > svcore
diff rdf/PluginRDFIndexer.cpp @ 481:a82645e788fc
* Auto-select RDF datastore/parsing backend; use trees datastore if
available
* Make CachedFile remember whether a file has already been successfully
located locally (avoiding system call out to look at filesystem)
author | Chris Cannam |
---|---|
date | Fri, 14 Nov 2008 10:10:05 +0000 |
parents | 3ffce691c9bf |
children | f54381e01141 |
line wrap: on
line diff
--- a/rdf/PluginRDFIndexer.cpp Thu Nov 13 14:23:23 2008 +0000 +++ b/rdf/PluginRDFIndexer.cpp Fri Nov 14 10:10:05 2008 +0000 @@ -261,7 +261,7 @@ } // cerr << "PluginRDFIndexer::indexURL: url = <" << urlString.toStdString() << ">" << endl; - +/*!!! SimpleSPARQLQuery query (localString, QString @@ -293,6 +293,26 @@ " } " ) .arg(localString)); +*/ + SimpleSPARQLQuery query + (localString, + QString + ( + " PREFIX vamp: <http://purl.org/ontology/vamp/> " + + " SELECT ?plugin ?library ?plugin_id " + " FROM <%1> " + + " WHERE { " + " ?plugin a vamp:Plugin . " + " ?plugin vamp:identifier ?plugin_id . " + + " OPTIONAL { " + " ?library vamp:available_plugin ?plugin " + " } " + " } " + ) + .arg(localString)); SimpleSPARQLQuery::ResultList results = query.execute(); @@ -317,7 +337,8 @@ i != results.end(); ++i) { QString pluginUri = (*i)["plugin"].value; - QString soname = (*i)["library_id"].value; +//!!! QString soname = (*i)["library_id"].value; + QString soUri = (*i)["library"].value; QString identifier = (*i)["plugin_id"].value; if (identifier == "") { @@ -328,13 +349,38 @@ << endl; continue; } - if (soname == "") { + if (soUri == "") { cerr << "PluginRDFIndexer::indexURL: NOTE: Document at <" << urlString.toStdString() << "> does not associate plugin <" << pluginUri.toStdString() << "> with any implementation library" << endl; continue; } + + QString sonameQuery = + QString( + " PREFIX vamp: <http://purl.org/ontology/vamp/> " + " SELECT ?library_id " + " FROM <%1> " + " WHERE { " + " <%2> vamp:identifier ?library_id " + " } " + ) + .arg(localString) + .arg(soUri); + + SimpleSPARQLQuery::Value sonameValue = + SimpleSPARQLQuery::singleResultQuery(localString, sonameQuery, "library_id"); + QString soname = sonameValue.value; + if (soname == "") { + cerr << "PluginRDFIndexer::indexURL: NOTE: Document at <" + << urlString.toStdString() << "> omits identifier for library <" + << soUri.toStdString() << ">" + << endl; + continue; + } + + /* cerr << "PluginRDFIndexer::indexURL: Document for plugin \"" << soname.toStdString() << ":" << identifier.toStdString()