Hello community, here is the log from the commit of package soprano for openSUSE:Factory checked in at 2013-07-22 17:21:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/soprano (Old) and /work/SRC/openSUSE:Factory/.soprano.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "soprano" Changes: -------- --- /work/SRC/openSUSE:Factory/soprano/soprano-backend-sesame.changes 2013-06-14 15:48:35.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.soprano.new/soprano-backend-sesame.changes 2013-07-22 17:21:19.000000000 +0200 @@ -1,0 +2,9 @@ +Thu Jul 11 07:16:30 UTC 2013 - [email protected] + +- Update to 2.9.3 + * Fix bugs in FilterModel + * Optimize literal to N3 conversion + * Virtuoso Backend - Optimize by around 5x + * Fix potential memory leak in ErrorCache + +------------------------------------------------------------------- soprano-backend-virtuoso.changes: same change soprano.changes: same change Old: ---- soprano-2.9.2.tar.bz2 New: ---- soprano-2.9.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ soprano-backend-sesame.spec ++++++ --- /var/tmp/diff_new_pack.qVlTb0/_old 2013-07-22 17:21:20.000000000 +0200 +++ /var/tmp/diff_new_pack.qVlTb0/_new 2013-07-22 17:21:20.000000000 +0200 @@ -22,7 +22,7 @@ Group: System/Libraries # COMMON1-BEGIN # COMMON1-BEGIN -Version: 2.9.2 +Version: 2.9.3 Release: 0 Url: http://soprano.sourceforge.net/ Source0: http://downloads.sourceforge.net/soprano/soprano-%{version}.tar.bz2 soprano-backend-virtuoso.spec: same change ++++++ soprano.spec ++++++ --- /var/tmp/diff_new_pack.qVlTb0/_old 2013-07-22 17:21:20.000000000 +0200 +++ /var/tmp/diff_new_pack.qVlTb0/_new 2013-07-22 17:21:20.000000000 +0200 @@ -21,7 +21,7 @@ License: LGPL-2.1+ and GPL-2.0+ Group: System/Libraries # COMMON1-BEGIN -Version: 2.9.2 +Version: 2.9.3 Release: 0 Url: http://soprano.sourceforge.net/ Source0: http://downloads.sourceforge.net/soprano/soprano-%{version}.tar.bz2 ++++++ soprano-2.9.2.tar.bz2 -> soprano-2.9.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/CMakeLists.txt new/soprano-2.9.3/CMakeLists.txt --- old/soprano-2.9.2/CMakeLists.txt 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/CMakeLists.txt 2013-07-10 23:39:15.000000000 +0200 @@ -14,7 +14,7 @@ ################## Soprano version ################################ set(CMAKE_SOPRANO_VERSION_MAJOR 2) set(CMAKE_SOPRANO_VERSION_MINOR 9) -set(CMAKE_SOPRANO_VERSION_RELEASE 2) +set(CMAKE_SOPRANO_VERSION_RELEASE 3) set(CMAKE_SOPRANO_VERSION_STRING "${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/ChangeLog new/soprano-2.9.3/ChangeLog --- old/soprano-2.9.2/ChangeLog 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/ChangeLog 2013-07-10 23:39:15.000000000 +0200 @@ -1,3 +1,9 @@ +2.9.3 + * Fix bugs in FilterModel + * Optimize literal to N3 conversion + * Virtuoso Backend - Optimize by around 5x + * Fix potential memory leak in ErrorCache + 2.9.2 * Fix a crash in ServerCore on shutdown * Do no require X11 - not needed for compilation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/redland/redlandmodel.cpp new/soprano-2.9.3/backends/redland/redlandmodel.cpp --- old/soprano-2.9.2/backends/redland/redlandmodel.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/redland/redlandmodel.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -242,11 +242,12 @@ // there is a bug (at least IMHO it is a bug) in redland which allows to add the same statement to one graph // multiple times. // + // However, calling redlandContainsStatement each time is very expensive so I'm skipping it librdf_node* redlandContext = d->world->createNode( statement.context() ); - if ( d->redlandContainsStatement( redlandStatement, redlandContext ) > 0 ) { + /*if ( d->redlandContainsStatement( redlandStatement, redlandContext ) > 0 ) { added = false; } - else { + else {*/ if ( librdf_model_context_add_statement( d->model, redlandContext, redlandStatement ) ) { d->world->freeStatement( redlandStatement ); d->world->freeNode( redlandContext ); @@ -255,7 +256,7 @@ d->readWriteLock.unlock(); return Error::ErrorUnknown; } - } + //} d->world->freeNode( redlandContext ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/redland/redlandworld.cpp new/soprano-2.9.3/backends/redland/redlandworld.cpp --- old/soprano-2.9.2/backends/redland/redlandworld.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/redland/redlandworld.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -194,7 +194,7 @@ librdf_uri* datatype = librdf_node_get_literal_value_datatype_uri( node ); if ( !datatype ) { return Soprano::Node( Soprano::LiteralValue::createPlainLiteral( QString::fromUtf8( (const char *)librdf_node_get_literal_value( node ) ), - QString::fromAscii( librdf_node_get_literal_value_language( node ) ) ) ); + QString::fromLatin1( librdf_node_get_literal_value_language( node ) ) ) ); } else { return Soprano::Node( Soprano::LiteralValue::fromString( QString::fromUtf8( (const char *)librdf_node_get_literal_value( node ) ), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/CMakeLists.txt new/soprano-2.9.3/backends/virtuoso/CMakeLists.txt --- old/soprano-2.9.2/backends/virtuoso/CMakeLists.txt 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/CMakeLists.txt 2013-07-10 23:39:15.000000000 +0200 @@ -57,3 +57,27 @@ ${CMAKE_CURRENT_BINARY_DIR}/virtuosobackend.desktop DESTINATION share/soprano/plugins ) + +if(SOPRANO_BUILD_TESTS) + add_executable(odbctest + test.cpp + virtuosomodel.cpp + virtuosobackend.cpp + virtuosocontroller.cpp + virtuosotools.cpp + virtuosoqueryresultiteratorbackend.cpp + virtuosoconfigurator.cpp + odbcenvironment.cpp + odbcconnection.cpp + odbcconnectionpool.cpp + odbcqueryresult.cpp + ${soprano_core_SOURCE_DIR}/sopranodirs.cpp + ${soprano_SOURCE_DIR}/server/lockfile.cpp + ) + + target_link_libraries(odbctest + soprano + ${QT_QTCORE_LIBRARY} + ${IODBC_LIBRARIES} + ) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/odbcqueryresult.cpp new/soprano-2.9.3/backends/virtuoso/odbcqueryresult.cpp --- old/soprano-2.9.2/backends/virtuoso/odbcqueryresult.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/odbcqueryresult.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -180,25 +180,24 @@ // // Retrieve lang and type strings which are cached in the server for faster lookups // - SQLCHAR langBuf[100]; SQLCHAR typeBuf[100]; - SQLINTEGER langBufLen = 0; SQLINTEGER typeBufLen = 0; - if ( !SQL_SUCCEEDED( SQLGetDescField( hdesc, colNum, SQL_DESC_COL_LITERAL_LANG, langBuf, sizeof( langBuf ), &langBufLen ) ) || - !SQL_SUCCEEDED( SQLGetDescField( hdesc, colNum, SQL_DESC_COL_LITERAL_TYPE, typeBuf, sizeof( typeBuf ), &typeBufLen ) ) ) { - setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, QLatin1String( "SQLGetDescField SQL_DESC_COL_LITERAL_* failed" ) ) ); - return Node(); - } + + bool fetchTypeSucceded = SQL_SUCCEEDED( SQLGetDescField( hdesc, colNum, + SQL_DESC_COL_LITERAL_TYPE, + typeBuf, sizeof( typeBuf ), &typeBufLen ) ); const char* str = reinterpret_cast<const char*>( data ); - const char* typeStr = reinterpret_cast<const char*>( typeBuf ); - if ( typeBufLen > 0 ) { + if( fetchTypeSucceded ) { + const char* typeStr = reinterpret_cast<const char*>( typeBuf ); + if ( !qstrncmp( typeStr, Virtuoso::fakeBooleanTypeString(), typeBufLen ) ) { node = Node( LiteralValue( !qstrcmp( "true", str ) ) ); } else { QUrl type; + // FIXME: Disable these checks based on the backend settings! if ( !qstrncmp( typeStr, Virtuoso::fakeBase64BinaryTypeString(), typeBufLen ) ) type = Soprano::Vocabulary::XMLSchema::base64Binary(); else @@ -207,8 +206,22 @@ } } else { - QString lang = QString::fromLatin1( reinterpret_cast<const char*>( langBuf ), langBufLen ); - node = Node( LiteralValue::createPlainLiteral( QString::fromUtf8( str ), lang ) ); + SQLCHAR langBuf[100]; + SQLINTEGER langBufLen = 0; + + bool fetchLangSucceded = SQL_SUCCEEDED( SQLGetDescField( hdesc, colNum, + SQL_DESC_COL_LITERAL_LANG, + langBuf, sizeof( langBuf ), &langBufLen ) ); + + if( fetchLangSucceded ) { + QString lang = QString::fromLatin1( reinterpret_cast<const char*>( langBuf ), langBufLen ); + node = Node( LiteralValue::createPlainLiteral( QString::fromUtf8( str ), lang ) ); + } + else { + setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, + QLatin1String( "SQLGetDescField SQL_DESC_COL_LITERAL_* failed" ) ) ); + return Node(); + } } break; } @@ -302,28 +315,40 @@ bool Soprano::ODBC::QueryResult::getCharData( int colNum, SQLCHAR** buffer, SQLLEN* length ) { - SQLCHAR dummyBuffer[1]; // dummy buffer only used to determine length + // We pre alocate a buffer which can hold most of the values that we get. + // If it cannot, only then do we allocate the proper size + // This way we avoid the extra SQLGetData call + const static int bufSize = 100; + *buffer = new SQLCHAR[ bufSize ]; - int r = SQLGetData( d->m_hstmt, colNum, SQL_C_CHAR, dummyBuffer, 0, length ); + int r = SQLGetData( d->m_hstmt, colNum, SQL_C_CHAR, *buffer, bufSize, length ); if ( SQL_SUCCEEDED( r ) ) { // // Treat a 0 length and null data as an empty node // if ( *length == SQL_NULL_DATA || *length == 0 ) { + delete [] *buffer; *buffer = 0; *length = 0; clearError(); return true; } - // - // again with real length buffer - // - else { - *buffer = new SQLCHAR[*length+4]; // FIXME: why +4 (I got this from the redland plugin) - r = SQLGetData ( d->m_hstmt, colNum, SQL_C_CHAR, *buffer, *length+4, length ); - if ( SQL_SUCCEEDED( r ) ) { + // The -1 is because it is a null terminated string + if( *length > bufSize-1 ) { + SQLCHAR* oldBuffer = *buffer; + + *buffer = new SQLCHAR[ *length + 4 ]; // FIXME: Why the +4 (I got this from the redland plugin) + memcpy( *buffer, oldBuffer, bufSize ); + delete [] oldBuffer; + + // The -1 is cause SQLGetData returns a null terminated string + SQLCHAR* newBuffer = (*buffer) + bufSize - 1; + int len = *length - ( bufSize - 1 ) + 1; // The +1 is for the null char + + int r = SQLGetData( d->m_hstmt, colNum, SQL_C_CHAR, newBuffer, len, length ); + if( SQL_SUCCEEDED( r ) ) { clearError(); return true; } @@ -331,13 +356,22 @@ delete [] *buffer; *buffer = 0; *length = 0; - setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, QLatin1String( "SQLGetData failed" ) ) ); + setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, + QLatin1String( "SQLGetData failed" ) ) ); return false; } } + else { + clearError(); + return true; + } } else { - setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, QLatin1String( "SQLGetData for data length failed" ) ) ); + delete [] *buffer; + *buffer = 0; + *length = 0; + setError( Virtuoso::convertSqlError( SQL_HANDLE_STMT, d->m_hstmt, + QLatin1String( "SQLGetData failed" ) ) ); return false; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/test.cpp new/soprano-2.9.3/backends/virtuoso/test.cpp --- old/soprano-2.9.2/backends/virtuoso/test.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/test.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -1,10 +1,11 @@ #include <QtCore/QCoreApplication> #include <QtCore/QDebug> +#include <QTime> #include "soprano.h" -#include "iodbcmodel.h" #include "virtuosobackend.h" +#include "virtuosomodel.h" using namespace Soprano; @@ -15,16 +16,25 @@ Soprano::Virtuoso::BackendPlugin bp; bp.isAvailable(); - VirtuosoModel model( 0 ); - if ( !model.connect( "host=localhost:1111;uid=dba;pwd=dba;driver=/usr/local/lib/virtodbc.so;" ) ) { - qDebug() << "Failed to connect to db"; - return 1; - } - QueryResultIterator it = model.executeQuery( argv[1], Query::QueryLanguageSparql ); - qDebug() << "bindingCount:" << it.bindingCount(); - qDebug() << "bindingNames:" << it.bindingNames(); + Soprano::BackendSettings settings; + settings << Soprano::BackendSetting( Soprano::BackendOptionHost, "localhost" ); + settings << Soprano::BackendSetting( Soprano::BackendOptionPort, "1113" ); + settings << Soprano::BackendSetting( Soprano::BackendOptionUsername, "dba" ); + settings << Soprano::BackendSetting( Soprano::BackendOptionPassword, "dba" ); + settings << Soprano::BackendSetting( "noStatementSignals", true ); + settings << Soprano::BackendSetting( "fakeBooleans", false ); + settings << Soprano::BackendSetting( "emptyGraphs", false ); + + StorageModel* model = bp.createModel(settings); + QueryResultIterator it = model->executeQuery( argv[1], Query::QueryLanguageSparql ); + //qDebug() << "bindingCount:" << it.bindingCount(); + //qDebug() << "bindingNames:" << it.bindingNames(); + QTime timer; + timer.start(); while ( it.next() ) { - qDebug() << *it; + *it; } + qDebug() << timer.elapsed()/1000.0; + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/virtuosobackend.cpp new/soprano-2.9.3/backends/virtuoso/virtuosobackend.cpp --- old/soprano-2.9.2/backends/virtuoso/virtuosobackend.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/virtuosobackend.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -161,6 +161,9 @@ controller->setParent( model ); connect(controller, SIGNAL(stopped(Soprano::VirtuosoController::ExitStatus)), model, SLOT(slotVirtuosoStopped(Soprano::VirtuosoController::ExitStatus))); } + + // HACK: Ideally we need a better way of communicating what parameters have been set + emit virtuosoInitParameters( port, virtuosoVersion ); return model; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/virtuosobackend.h new/soprano-2.9.3/backends/virtuoso/virtuosobackend.h --- old/soprano-2.9.2/backends/virtuoso/virtuosobackend.h 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/virtuosobackend.h 2013-07-10 23:39:15.000000000 +0200 @@ -50,6 +50,12 @@ static QString locateVirtuosoBinary(); + signals: + // This is a hack so that Nepomuk can be informed of the port number which virtuoso + // has been started on and which version of virtuoso is running so that runtime checks + // can be performed + void virtuosoInitParameters( int port, const QString& version ) const; + #ifndef Q_OS_WIN private: static QString findVirtuosoDriver(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/backends/virtuoso/virtuosoqueryresultiteratorbackend.cpp new/soprano-2.9.3/backends/virtuoso/virtuosoqueryresultiteratorbackend.cpp --- old/soprano-2.9.2/backends/virtuoso/virtuosoqueryresultiteratorbackend.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/backends/virtuoso/virtuosoqueryresultiteratorbackend.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -142,8 +142,13 @@ // we need to cache the values already here since there are situations where // the query succeeds but getting values fails for ( int i = 0; i < bindingCount(); ++i ) { - binding( i ); - if ( lastError() ) { + // Avoid calling binding since it is more expensive! + d->bindingCache[i] = d->m_queryResult->getData( i+1 ); + d->bindingCachedFlags.setBit( i ); + + Error::Error error = d->m_queryResult->lastError(); + if( error ) { + setError( error ); return false; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/index/cluceneindex.cpp new/soprano-2.9.3/index/cluceneindex.cpp --- old/soprano-2.9.2/index/cluceneindex.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/index/cluceneindex.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -148,7 +148,7 @@ QString getId( const Soprano::Node& node ) { if ( node.isResource() ) { - return QString::fromAscii( node.uri().toEncoded() ); + return QString::fromLatin1( node.uri().toEncoded() ); } else if ( node.isBlank() ) { return bnodeIdPrefix() + node.toString(); @@ -440,9 +440,9 @@ clearError(); - QString field = QString::fromAscii( statement.predicate().uri().toEncoded() ); + QString field = QString::fromLatin1( statement.predicate().uri().toEncoded() ); QString text = statement.object().isResource() - ? QString::fromAscii( statement.object().uri().toEncoded() ) + ? QString::fromLatin1( statement.object().uri().toEncoded() ) : statement.object().toString(); if( text.isEmpty() ) { @@ -493,9 +493,9 @@ bool success = false; - QString field = QString::fromAscii( statement.predicate().uri().toEncoded() ); + QString field = QString::fromLatin1( statement.predicate().uri().toEncoded() ); QString text = statement.object().isResource() - ? QString::fromAscii( statement.object().uri().toEncoded() ) + ? QString::fromLatin1( statement.object().uri().toEncoded() ) : statement.object().toString(); if( text.isEmpty() ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/index/indexfiltermodel.cpp new/soprano-2.9.3/index/indexfiltermodel.cpp --- old/soprano-2.9.2/index/indexfiltermodel.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/index/indexfiltermodel.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -320,5 +320,5 @@ QString Soprano::Index::IndexFilterModel::encodeUriForLuceneQuery( const QUrl& uri ) { - return encodeStringForLuceneQuery( QString::fromAscii( uri.toEncoded() ) ); + return encodeStringForLuceneQuery( QString::fromLatin1( uri.toEncoded() ) ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/server/dbus/dbusoperators.cpp new/soprano-2.9.3/server/dbus/dbusoperators.cpp --- old/soprano-2.9.2/server/dbus/dbusoperators.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/server/dbus/dbusoperators.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -27,12 +27,12 @@ arg.beginStructure(); arg << ( int )node.type(); if ( node.type() == Soprano::Node::ResourceNode ) { - arg << QString::fromAscii( node.uri().toEncoded() ); + arg << QString::fromLatin1( node.uri().toEncoded() ); } else { arg << node.toString(); } - arg << node.language() << QString::fromAscii( node.dataType().toEncoded() ); + arg << node.language() << QString::fromLatin1( node.dataType().toEncoded() ); arg.endStructure(); return arg; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/server/serverconnection.cpp new/soprano-2.9.3/server/serverconnection.cpp --- old/soprano-2.9.2/server/serverconnection.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/server/serverconnection.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -174,6 +174,14 @@ stream.readUnsignedInt16( command ); currentCommand = command; switch( command ) { + case COMMAND_ITERATOR_NEXT: + iteratorNext(); + break; + + case COMMAND_ITERATOR_CURRENT_BINDINGSET: + queryIteratorCurrent(); + break; + case COMMAND_SUPPORTS_PROTOCOL_VERSION: supportsProtocolVersion(); break; @@ -230,10 +238,6 @@ query(); break; - case COMMAND_ITERATOR_NEXT: - iteratorNext(); - break; - case COMMAND_ITERATOR_CURRENT_STATEMENT: statementIteratorCurrent(); break; @@ -242,10 +246,6 @@ nodeIteratorCurrent(); break; - case COMMAND_ITERATOR_CURRENT_BINDINGSET: - queryIteratorCurrent(); - break; - case COMMAND_ITERATOR_CLOSE: iteratorClose(); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/soprano/error.cpp new/soprano-2.9.3/soprano/error.cpp --- old/soprano-2.9.2/soprano/error.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/soprano/error.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -236,8 +236,7 @@ void Soprano::Error::ErrorCache::clearError() const { QMutexLocker locker( &d->errorMapMutex ); - if ( !d->errorMap.isEmpty() ) - d->errorMap[QThread::currentThread()] = Error(); + d->errorMap.remove( QThread::currentThread() ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/soprano/filtermodel.cpp new/soprano-2.9.3/soprano/filtermodel.cpp --- old/soprano-2.9.2/soprano/filtermodel.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/soprano/filtermodel.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -73,14 +73,21 @@ if ( model != d->parent ) { if ( d->parent ) { - d->parent->disconnect( this ); + disconnect( d->parent, SIGNAL(statementsAdded()), this, SLOT(slotStatementsAdded()) ); + disconnect( d->parent, SIGNAL(statementsRemoved()), this, SLOT(slotStatementsRemoved()) ); + disconnect( d->parent, SIGNAL(statementAdded(Soprano::Statement)), + this, SLOT(slotStatementAdded(Soprano::Statement)) ); + disconnect( d->parent, SIGNAL(statementRemoved(Soprano::Statement)), + this, SLOT(slotStatementRemoved(Soprano::Statement)) ); } d->parent = model; if ( d->parent ) { connect( d->parent, SIGNAL(statementsAdded()), this, SLOT(slotStatementsAdded()) ); connect( d->parent, SIGNAL(statementsRemoved()), this, SLOT(slotStatementsRemoved()) ); - connect( d->parent, SIGNAL(statementAdded(const Soprano::Statement&)), this, SLOT(slotStatementAdded(const Soprano::Statement&)) ); - connect( d->parent, SIGNAL(statementRemoved(const Soprano::Statement&)), this, SLOT(slotStatementRemoved(const Soprano::Statement&)) ); + connect( d->parent, SIGNAL(statementAdded(Soprano::Statement)), + this, SLOT(slotStatementAdded(Soprano::Statement)) ); + connect( d->parent, SIGNAL(statementRemoved(Soprano::Statement)), + this, SLOT(slotStatementRemoved(Soprano::Statement)) ); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/soprano/inference/nodepattern.cpp new/soprano-2.9.3/soprano/inference/nodepattern.cpp --- old/soprano-2.9.2/soprano/inference/nodepattern.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/soprano/inference/nodepattern.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -123,7 +123,7 @@ } } else if( d->node.isResource() ) { - return '<' + QString::fromAscii( d->node.uri().toEncoded() ) + '>'; + return '<' + QString::fromLatin1( d->node.uri().toEncoded() ) + '>'; } else { return "_:" + d->node.toString(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/soprano/literalvalue.cpp new/soprano-2.9.3/soprano/literalvalue.cpp --- old/soprano-2.9.2/soprano/literalvalue.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/soprano/literalvalue.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -516,7 +516,7 @@ else if( isDateTime() ) d->stringCache = DateTime::toString( toDateTime() ); else if ( isByteArray() ) - d->stringCache = QString::fromAscii( toByteArray().toBase64() ); + d->stringCache = QString::fromLatin1( toByteArray().toBase64() ); else d->stringCache = d->value.toString(); @@ -637,6 +637,15 @@ Soprano::LiteralValue Soprano::LiteralValue::fromString( const QString& value, QVariant::Type type ) { switch( type ) { + case QVariant::String: + return LiteralValue( value ); + case QVariant::DateTime: { + QDateTime date = DateTime::fromDateTimeString( value ); + if( date.isValid() ) + return LiteralValue( date ); + else + return LiteralValue(); + } case QVariant::Int: { bool ok = false; int val = value.toInt(&ok); @@ -691,13 +700,6 @@ else return LiteralValue(); } - case QVariant::DateTime: { - QDateTime date = DateTime::fromDateTimeString( value ); - if( date.isValid() ) - return LiteralValue( date ); - else - return LiteralValue(); - } case QVariant::Bool: { bool ok = false; int v = value.toInt(&ok); @@ -712,8 +714,6 @@ } case QVariant::ByteArray: return LiteralValue( QByteArray::fromBase64( value.toAscii() ) ); - case QVariant::String: - return LiteralValue( value ); default: // qDebug() << "(Soprano::LiteralValue) unknown type: " << type << "storing as string value." << endl; return LiteralValue( value ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/soprano/node.cpp new/soprano-2.9.3/soprano/node.cpp --- old/soprano-2.9.2/soprano/node.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/soprano/node.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -3,6 +3,7 @@ * * Copyright (C) 2006-2007 Daniele Galdi <[email protected]> * Copyright (C) 2007-2009 Sebastian Trueg <[email protected]> + * Copyright (C) 2012 Vishesh Handa <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +27,7 @@ #include <QtCore/QString> #include <QtCore/QUrl> #include <QtCore/QDebug> +#include <QMutex> @@ -389,7 +391,7 @@ QString Soprano::Node::resourceToN3( const QUrl& uri ) { QByteArray a = uri.toEncoded(); - return '<' + QString::fromAscii( a ) + '>'; + return '<' + QString::fromLatin1( a ) + '>'; } @@ -402,24 +404,48 @@ return "_:" + blank; } +namespace { + QHash<QChar, QString> createEscapeHash() { + QHash<QChar, QString> escapeHash; + escapeHash.insert( QChar::fromLatin1('\\'), QString::fromLatin1("\\\\") ); + escapeHash.insert( QChar::fromLatin1('\n'), QString::fromLatin1("\\n") ); + escapeHash.insert( QChar::fromLatin1('\r'), QString::fromLatin1("\\r") ); + escapeHash.insert( QChar::fromLatin1('\b'), QString::fromLatin1("\\b") ); + escapeHash.insert( QChar::fromLatin1('\t'), QString::fromLatin1("\\t") ); + escapeHash.insert( QChar::fromLatin1('\f'), QString::fromLatin1("\\f") ); + escapeHash.insert( QChar::fromLatin1('\"'), QString::fromLatin1("\\\"") ); + escapeHash.insert( QChar::fromLatin1('\''), QString::fromLatin1("\\\'") ); + + return escapeHash; + } + + QHash<QVariant::Type, QString> typeHash; + QMutex typeMutex; +} + +typedef QHash<QChar, QString> CharStringHash; +Q_GLOBAL_STATIC_WITH_ARGS( CharStringHash, g_escapeHash, (createEscapeHash()) ); // static QString Soprano::Node::literalToN3( const LiteralValue& literal ) { + QString str = literal.toString(); + + QString s; + s.reserve( str.size() ); + // // Escape control chars: \t \b \n \r \f \\ \" \' // - QString s = literal.toString(); - - // FIXME: this can be done faster by running through the string only once. - s.replace( '\\', "\\\\" ); - s.replace( '\"', "\\\"" ); - s.replace( '\'', "\\\'" ); - s.replace( '\n', "\\n" ); - s.replace( '\r', "\\r" ); - s.replace( '\b', "\\b" ); - s.replace( '\t', "\\t" ); - s.replace( '\f', "\\f" ); + foreach(const QChar& ch, str) { + QHash< QChar, QString >::const_iterator it = g_escapeHash()->constFind( ch ); + if( it == g_escapeHash()->constEnd() ) { + s.append( ch ); + } + else { + s.append( it.value() ); + } + } if( literal.isPlain() ) { if ( literal.language().isEmpty() ) { @@ -430,8 +456,19 @@ } } else { - return QString( "\"%1\"^^<%2>" ) - .arg( s, QString::fromAscii( literal.dataTypeUri().toEncoded() ) ); + QString type; + + QMutexLocker lock( &typeMutex ); + QHash<QVariant::Type, QString>::const_iterator it = typeHash.constFind( literal.type() ); + if( it == typeHash.constEnd() ) { + type = QString::fromAscii( literal.dataTypeUri().toEncoded() ); + typeHash.insert( literal.type(), type ); + } + else { + type = it.value(); + } + + return QString::fromLatin1( "\"%1\"^^<%2>" ) .arg( s, type ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.9.2/test/sopranoliteraltest.cpp new/soprano-2.9.3/test/sopranoliteraltest.cpp --- old/soprano-2.9.2/test/sopranoliteraltest.cpp 2013-05-10 18:42:16.000000000 +0200 +++ new/soprano-2.9.3/test/sopranoliteraltest.cpp 2013-07-10 23:39:15.000000000 +0200 @@ -151,7 +151,7 @@ QTest::newRow( "dateTime2 (from constructor)" ) << LiteralValue( QDateTime( QDate( 1977, 8, 9 ), QTime( 17, 38, 2, 23 ), Qt::UTC ) ) << QString( "1977-08-09T17:38:02.023Z" ); QTest::newRow( "boolean-false (from constructor)" ) << LiteralValue( false ) << QString( "false" ); QTest::newRow( "boolean-true (from constructor)" ) << LiteralValue( true ) << QString( "true" ); - QTest::newRow( "binaryData (from constructor)" ) << LiteralValue( QByteArray( "Hello World" ) ) << QString::fromAscii( QByteArray( "Hello World" ).toBase64() ); + QTest::newRow( "binaryData (from constructor)" ) << LiteralValue( QByteArray( "Hello World" ) ) << QString::fromLatin1( QByteArray( "Hello World" ).toBase64() ); QTest::newRow( "int (from operator=)" ) << ( LiteralValue() = (int)-17 ) << QString( "-17" ); QTest::newRow( "long (from operator=)" ) << ( LiteralValue() = (qlonglong)17927948235235LL ) << QString("17927948235235"); @@ -165,7 +165,7 @@ QTest::newRow( "dateTime2 (from constructor)" ) << ( LiteralValue() = QDateTime( QDate( 1977, 8, 9 ), QTime( 17, 38, 2, 23 ), Qt::UTC ) ) << QString( "1977-08-09T17:38:02.023Z" ); QTest::newRow( "boolean-false (from operator=)" ) << ( LiteralValue() = false ) << QString( "false" ); QTest::newRow( "boolean-true (from operator=)" ) << ( LiteralValue() = true ) << QString( "true" ); - QTest::newRow( "binaryData (from operator=)" ) << ( LiteralValue() = QByteArray( "Hello World" ) ) << QString::fromAscii( QByteArray( "Hello World" ).toBase64() ); + QTest::newRow( "binaryData (from operator=)" ) << ( LiteralValue() = QByteArray( "Hello World" ) ) << QString::fromLatin1( QByteArray( "Hello World" ).toBase64() ); } ++++++ soprano-backend-sesame.spec.in ++++++ --- /var/tmp/diff_new_pack.qVlTb0/_old 2013-07-22 17:21:21.000000000 +0200 +++ /var/tmp/diff_new_pack.qVlTb0/_new 2013-07-22 17:21:21.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package soprano-backend-sesame # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed ++++++ soprano-backend-virtuoso.spec.in ++++++ --- /var/tmp/diff_new_pack.qVlTb0/_old 2013-07-22 17:21:21.000000000 +0200 +++ /var/tmp/diff_new_pack.qVlTb0/_new 2013-07-22 17:21:21.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package soprano-backend-virtuoso # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
