comparison rdf/SimpleSPARQLQuery.cpp @ 687:06f13a3b9e9e debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:09 +0100
parents b4a8d8221eaf
children 1424aa29ae95
comparison
equal deleted inserted replaced
686:b4a8d8221eaf 687:06f13a3b9e9e
176 176
177 void 177 void
178 WredlandWorldWrapper::freeModel(QString forUri) 178 WredlandWorldWrapper::freeModel(QString forUri)
179 { 179 {
180 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 180 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
181 std::cerr << "SimpleSPARQLQuery::freeModel: Model uri = \"" << forUri << "\"" << std::endl; 181 DEBUG << "SimpleSPARQLQuery::freeModel: Model uri = \"" << forUri << "\"" << endl;
182 #endif 182 #endif
183 183
184 QMutexLocker locker(&m_mutex); 184 QMutexLocker locker(&m_mutex);
185 if (forUri == "") { 185 if (forUri == "") {
186 std::cerr << "SimpleSPARQLQuery::freeModel: ERROR: Can't free default model" << std::endl; 186 DEBUG << "SimpleSPARQLQuery::freeModel: ERROR: Can't free default model" << endl;
187 return; 187 return;
188 } 188 }
189 if (m_ownModelUris.find(forUri) == m_ownModelUris.end()) { 189 if (m_ownModelUris.find(forUri) == m_ownModelUris.end()) {
190 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 190 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
191 std::cerr << "SimpleSPARQLQuery::freeModel: NOTE: Unknown or already-freed model (uri = \"" << forUri << "\")" << std::endl; 191 DEBUG << "SimpleSPARQLQuery::freeModel: NOTE: Unknown or already-freed model (uri = \"" << forUri << "\")" << endl;
192 #endif 192 #endif
193 return; 193 return;
194 } 194 }
195 195
196 librdf_model *model = m_ownModelUris[forUri]; 196 librdf_model *model = m_ownModelUris[forUri];
386 386
387 SimpleSPARQLQuery::ResultList 387 SimpleSPARQLQuery::ResultList
388 SimpleSPARQLQuery::Impl::executeDirectParser() 388 SimpleSPARQLQuery::Impl::executeDirectParser()
389 { 389 {
390 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 390 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
391 std::cerr << "SimpleSPARQLQuery::executeDirectParser: Query is: \"" << m_query << "\"" << std::endl; 391 DEBUG << "SimpleSPARQLQuery::executeDirectParser: Query is: \"" << m_query << "\"" << endl;
392 #endif 392 #endif
393 393
394 ResultList list; 394 ResultList list;
395 395
396 Profiler profiler("SimpleSPARQLQuery::executeDirectParser"); 396 Profiler profiler("SimpleSPARQLQuery::executeDirectParser");
397 397
398 static QRegExp fromRE("from\\s+<([^>]+)>", Qt::CaseInsensitive); 398 static QRegExp fromRE("from\\s+<([^>]+)>", Qt::CaseInsensitive);
399 QString fromUri; 399 QString fromUri;
400 400
401 if (fromRE.indexIn(m_query) < 0) { 401 if (fromRE.indexIn(m_query) < 0) {
402 std::cerr << "SimpleSPARQLQuery::executeDirectParser: Query contains no FROM clause, nothing to parse from" << std::endl; 402 DEBUG << "SimpleSPARQLQuery::executeDirectParser: Query contains no FROM clause, nothing to parse from" << endl;
403 return list; 403 return list;
404 } else { 404 } else {
405 fromUri = fromRE.cap(1); 405 fromUri = fromRE.cap(1);
406 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 406 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
407 std::cerr << "SimpleSPARQLQuery::executeDirectParser: FROM URI is <" 407 DEBUG << "SimpleSPARQLQuery::executeDirectParser: FROM URI is <"
408 << fromUri << ">" << std::endl; 408 << fromUri << ">" << endl;
409 #endif 409 #endif
410 } 410 }
411 411
412 return executeFor(fromUri); 412 return executeFor(fromUri);
413 } 413 }
414 414
415 SimpleSPARQLQuery::ResultList 415 SimpleSPARQLQuery::ResultList
416 SimpleSPARQLQuery::Impl::executeDatastore() 416 SimpleSPARQLQuery::Impl::executeDatastore()
417 { 417 {
418 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 418 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
419 std::cerr << "SimpleSPARQLQuery::executeDatastore: Query is: \"" << m_query << "\"" << std::endl; 419 DEBUG << "SimpleSPARQLQuery::executeDatastore: Query is: \"" << m_query << "\"" << endl;
420 #endif 420 #endif
421 421
422 ResultList list; 422 ResultList list;
423 423
424 Profiler profiler("SimpleSPARQLQuery::executeDatastore"); 424 Profiler profiler("SimpleSPARQLQuery::executeDatastore");
574 574
575 librdf_free_query_results(results); 575 librdf_free_query_results(results);
576 librdf_free_query(query); 576 librdf_free_query(query);
577 577
578 #ifdef DEBUG_SIMPLE_SPARQL_QUERY 578 #ifdef DEBUG_SIMPLE_SPARQL_QUERY
579 cerr << "SimpleSPARQLQuery::executeDatastore: All results retrieved (" << resultCount << " of them)" << endl; 579 DEBUG << "SimpleSPARQLQuery::executeDatastore: All results retrieved (" << resultCount << " of them)" << endl;
580 #endif 580 #endif
581 581
582 return list; 582 return list;
583 } 583 }
584 584
618 QString query, QString binding) 618 QString query, QString binding)
619 { 619 {
620 SimpleSPARQLQuery q(type, query); 620 SimpleSPARQLQuery q(type, query);
621 ResultList results = q.execute(); 621 ResultList results = q.execute();
622 if (!q.isOK()) { 622 if (!q.isOK()) {
623 cerr << "SimpleSPARQLQuery::singleResultQuery: ERROR: " 623 DEBUG << "SimpleSPARQLQuery::singleResultQuery: ERROR: "
624 << q.getErrorString() << endl; 624 << q.getErrorString() << endl;
625 return Value(); 625 return Value();
626 } 626 }
627 if (results.empty()) { 627 if (results.empty()) {
628 return Value(); 628 return Value();