Mercurial > hg > svcore
diff rdf/RDFImporter.cpp @ 489:82ab61fa9223
* Reorganise our sparql queries on the basis that Redland must be
available, not only optional. So for anything querying the pool
of data about plugins, we use a single datastore and model which
is initialised at the outset by PluginRDFIndexer and then queried
directly; for anything that "reads from a file" (e.g. loading
annotations) we query directly using Rasqal, going to the
datastore when we need additional plugin-related information.
This may improve performance, but mostly it simplifies the code
and fixes a serious issue with RDF import in the previous versions
(namely that multiple sequential RDF imports would end up sharing
the same RDF data pool!)
author | Chris Cannam |
---|---|
date | Fri, 21 Nov 2008 16:12:29 +0000 |
parents | 1c66e199e7d9 |
children | c3fb8258e34d |
line wrap: on
line diff
--- a/rdf/RDFImporter.cpp Fri Nov 21 14:25:33 2008 +0000 +++ b/rdf/RDFImporter.cpp Fri Nov 21 16:12:29 2008 +0000 @@ -142,7 +142,7 @@ ProgressReporter *reporter) { SimpleSPARQLQuery query = SimpleSPARQLQuery - (m_uristring, + (SimpleSPARQLQuery::QueryFromSingleSource, QString ( " PREFIX mo: <http://purl.org/ontology/mo/>" @@ -258,6 +258,8 @@ int &sampleRate, int &windowLength, int &hopSize, int &width, int &height) { + SimpleSPARQLQuery::QueryType s = SimpleSPARQLQuery::QueryFromSingleSource; + QString dimensionsQuery ( " PREFIX mo: <http://purl.org/ontology/mo/>" @@ -274,10 +276,8 @@ ); SimpleSPARQLQuery::Value dimensionsValue = - SimpleSPARQLQuery::singleResultQuery(m_uristring, - dimensionsQuery - .arg(m_uristring).arg(featureUri), - "dimensions"); + SimpleSPARQLQuery::singleResultQuery + (s, dimensionsQuery.arg(m_uristring).arg(featureUri), "dimensions"); cerr << "Dimensions = \"" << dimensionsValue.value.toStdString() << "\"" << endl; @@ -316,7 +316,7 @@ // multiple optionals properly SimpleSPARQLQuery::Value srValue = - SimpleSPARQLQuery::singleResultQuery(m_uristring, + SimpleSPARQLQuery::singleResultQuery(s, queryTemplate .arg(m_uristring).arg(featureUri) .arg("sampleRate"), @@ -326,7 +326,7 @@ } SimpleSPARQLQuery::Value hopValue = - SimpleSPARQLQuery::singleResultQuery(m_uristring, + SimpleSPARQLQuery::singleResultQuery(s, queryTemplate .arg(m_uristring).arg(featureUri) .arg("hopSize"), @@ -336,7 +336,7 @@ } SimpleSPARQLQuery::Value winValue = - SimpleSPARQLQuery::singleResultQuery(m_uristring, + SimpleSPARQLQuery::singleResultQuery(s, queryTemplate .arg(m_uristring).arg(featureUri) .arg("windowLength"), @@ -352,6 +352,8 @@ RDFImporterImpl::getDataModelsSparse(std::vector<Model *> &models, ProgressReporter *reporter) { + SimpleSPARQLQuery::QueryType s = SimpleSPARQLQuery::QueryFromSingleSource; + // Our query is intended to retrieve every thing that has a time, // and every feature type and value associated with a thing that // has a time. @@ -443,7 +445,7 @@ ).arg(m_uristring); - SimpleSPARQLQuery query(m_uristring, queryString); + SimpleSPARQLQuery query(s, queryString); query.setProgressReporter(reporter); cerr << "Query will be: " << queryString.toStdString() << endl; @@ -505,9 +507,9 @@ bool haveDuration = false; QString label = SimpleSPARQLQuery::singleResultQuery - (m_uristring, labelQueryString.arg(thinguri), "label").value; + (s, labelQueryString.arg(thinguri), "label").value; - SimpleSPARQLQuery rangeQuery(m_uristring, rangeQueryString.arg(thinguri)); + SimpleSPARQLQuery rangeQuery(s, rangeQueryString.arg(thinguri)); SimpleSPARQLQuery::ResultList rangeResults = rangeQuery.execute(); if (!rangeResults.empty()) { // std::cerr << rangeResults.size() << " range results" << std::endl; @@ -520,7 +522,7 @@ haveDuration = true; } else { QString timestring = SimpleSPARQLQuery::singleResultQuery - (m_uristring, timeQueryString.arg(thinguri), "time").value; + (s, timeQueryString.arg(thinguri), "time").value; if (timestring != "") { time = RealTime::fromXsdDuration(timestring.toStdString()); haveTime = true;