# HG changeset patch # User Chris Cannam # Date 1231512912 0 # Node ID 8878efd21dbc96813ac9ccae1f60b4d0a35d4235 # Parent 7419a063878b4e6f3d5ef0fca938c7039fab2761 * The main fix here is to the arguments of SVApplication -- the first one should be int& rather than int (was causing a crash! gah!) Various other tiny fixes diff -r 7419a063878b -r 8878efd21dbc rdf/SimpleSPARQLQuery.cpp --- a/rdf/SimpleSPARQLQuery.cpp Mon Jan 05 21:51:27 2009 +0000 +++ b/rdf/SimpleSPARQLQuery.cpp Fri Jan 09 14:55:12 2009 +0000 @@ -255,7 +255,7 @@ protected: static QMutex m_mutex; - static WredlandWorldWrapper m_redland; + static WredlandWorldWrapper *m_redland; ResultList executeDirectParser(); ResultList executeDatastore(); @@ -268,7 +268,7 @@ bool m_cancelled; }; -WredlandWorldWrapper SimpleSPARQLQuery::Impl::m_redland; +WredlandWorldWrapper *SimpleSPARQLQuery::Impl::m_redland = 0; QMutex SimpleSPARQLQuery::Impl::m_mutex; @@ -355,7 +355,11 @@ QMutexLocker locker(&m_mutex); - if (!m_redland.isOK()) { + if (!m_redland) { + m_redland = new WredlandWorldWrapper(); + } + + if (!m_redland->isOK()) { cerr << "ERROR: SimpleSPARQLQuery::execute: Failed to initialise Redland datastore" << endl; return list; } @@ -433,7 +437,7 @@ { Profiler p("SimpleSPARQLQuery: Prepare LIBRDF query"); query = librdf_new_query - (m_redland.getWorld(), "sparql", NULL, + (m_redland->getWorld(), "sparql", NULL, (const unsigned char *)m_query.toUtf8().data(), NULL); } @@ -445,7 +449,7 @@ librdf_query_results *results; { Profiler p("SimpleSPARQLQuery: Execute LIBRDF query"); - results = librdf_query_execute(query, m_redland.getModel(modelUri)); + results = librdf_query_execute(query, m_redland->getModel(modelUri)); } if (!results) { @@ -579,12 +583,12 @@ QMutexLocker locker(&m_mutex); - if (!m_redland.isOK()) { + if (!m_redland->isOK()) { std::cerr << "SimpleSPARQLQuery::addSourceToModel: Failed to initialise Redland datastore" << std::endl; return false; } - if (!m_redland.loadUriIntoDefaultModel(sourceUri, err)) { + if (!m_redland->loadUriIntoDefaultModel(sourceUri, err)) { std::cerr << "SimpleSPARQLQuery::addSourceToModel: Failed to add source URI \"" << sourceUri.toStdString() << ": " << err.toStdString() << std::endl; return false; } @@ -596,7 +600,7 @@ { QMutexLocker locker(&m_mutex); - m_redland.freeModel(sourceUri); + m_redland->freeModel(sourceUri); } SimpleSPARQLQuery::Value