Hello community, here is the log from the commit of package soprano for openSUSE:Factory checked in at Fri Jul 22 14:53:14 CEST 2011.
-------- soprano-backend-virtuoso.changes: same change --- soprano/soprano.changes 2011-05-16 20:08:59.000000000 +0200 +++ /mounts/work_src_done/STABLE/soprano/soprano.changes 2011-07-21 16:03:38.000000000 +0200 @@ -1,0 +2,5 @@ +Thu Jul 21 14:03:21 UTC 2011 - [email protected] + +- Update to 2.6.51 needed for KDE 4.7rc2 + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- soprano-2.6.0.tar.bz2 New: ---- soprano-2.6.51.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ soprano-backend-sesame.spec ++++++ --- /var/tmp/diff_new_pack.mozcpx/_old 2011-07-22 14:52:56.000000000 +0200 +++ /var/tmp/diff_new_pack.mozcpx/_new 2011-07-22 14:52:56.000000000 +0200 @@ -25,7 +25,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build # COMMON1-BEGIN # COMMON1-BEGIN -Version: 2.6.0 +Version: 2.6.51 Release: 1 Source0: http://sourceforge.net/projects/soprano/files/Soprano/%{version}/soprano-%{version}.tar.bz2 Source100: baselibs.conf soprano-backend-virtuoso.spec: same change ++++++ soprano.spec ++++++ --- /var/tmp/diff_new_pack.mozcpx/_old 2011-07-22 14:52:56.000000000 +0200 +++ /var/tmp/diff_new_pack.mozcpx/_new 2011-07-22 14:52:56.000000000 +0200 @@ -24,7 +24,7 @@ Summary: C++/Qt based interface library for RDF BuildRoot: %{_tmppath}/%{name}-%{version}-build # COMMON1-BEGIN -Version: 2.6.0 +Version: 2.6.51 Release: 1 Source0: http://sourceforge.net/projects/soprano/files/Soprano/%{version}/soprano-%{version}.tar.bz2 Source100: baselibs.conf ++++++ soprano-2.6.0.tar.bz2 -> soprano-2.6.51.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/CMakeLists.txt new/soprano-2.6.51/CMakeLists.txt --- old/soprano-2.6.0/CMakeLists.txt 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 @@ -7,7 +7,7 @@ ################## Soprano version ################################ set(CMAKE_SOPRANO_VERSION_MAJOR 2) set(CMAKE_SOPRANO_VERSION_MINOR 6) -set(CMAKE_SOPRANO_VERSION_RELEASE 0) +set(CMAKE_SOPRANO_VERSION_RELEASE 51) set(CMAKE_SOPRANO_VERSION_STRING "${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}") @@ -242,13 +242,13 @@ add_custom_target( stabledox - COMMAND rsync -zrtq docs/html/ $ENV{USER},[email protected]:/home/groups/s/so/soprano/htdocs/apidox/stable + COMMAND rsync -zrtq docs/html/ $ENV{USER},[email protected]:/home/project-web/soprano/htdocs/apidox/stable DEPENDS onlineapidox COMMENT "Uploading stable API docs to Sourceforge...") add_custom_target( trunkdox - COMMAND rsync -zrtq docs/html/ $ENV{USER},[email protected]:/home/groups/s/so/soprano/htdocs/apidox/trunk + COMMAND rsync -zrtq docs/html/ $ENV{USER},[email protected]:/home/project-web/soprano/htdocs/apidox/trunk DEPENDS onlineapidox COMMENT "Uploading trunk API docs to Sourceforge...") endif(DOXYGEN_EXECUTABLE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/ChangeLog new/soprano-2.6.51/ChangeLog --- old/soprano-2.6.0/ChangeLog 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/ChangeLog 2011-06-05 10:38:25.000000000 +0200 @@ -1,3 +1,13 @@ +2.7.0 + * Use the new Virtuoso parameter XAnyNormalization to use normalized accents for full-text searching by default. + * Updated NAO Vocabulary namespace to include changes from SDO 0.7. + * Added method LiteralValue::fromVariant which provides some useful type conversions. + +2.6.1 + * Let onto2vocabularyclass convert dots in entity names to underscores to create valid C++ names. + * Register DBus types in Client::DBusModel to make sure it can be used without Client::DBusClient. + * Fixed error propagation in Utils::AsyncQuery. + 2.6.0 * Fixed handling of xsd:boolean in SPARQL queries in the Virtuoso backend (this is a hack that might not work in all situations) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/backends/virtuoso/README new/soprano-2.6.51/backends/virtuoso/README --- old/soprano-2.6.0/backends/virtuoso/README 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/backends/virtuoso/README 2011-06-05 10:38:25.000000000 +0200 @@ -5,13 +5,13 @@ * Virtuoso/SPAURL has no notion of the empty/default graph. Thus, it is not possible to add statements to the empty/default graph. We work around this problem by introducing a special default named graph which is used internally to store triples. - Thus, IODBCModel changes triples to quadruples using the default graph while - IODBCQueryResultIteratorBackend converts the default graph back to an empty Node. + Thus, VirtuosoModel changes triples to quadruples using the default graph while + Virtuoso::QueryResultIteratorBackend converts the default graph back to an empty Node. This should work fine until someone decides to use exactly that URI in a db. * Since Soprano's query system is amazingly simple (only strings) we do not know the type of query (bindings/graph/boolean). Virtuoso also does not provide this - information. Thus, in IODBCQueryResultIteratorBackend we do some guesswork based + information. Thus, in Virtuoso::QueryResultIteratorBackend we do some guesswork based on the column names (__ASK_RETVAL for boolean queries and the very shaky callret-0 for graph queries). This should work all the time but still needs to stand the test of time. @@ -23,8 +23,4 @@ * Virtuoso does not make a distinction between boolean and integer (actually all signed and unsigned decimals are integer). Thus, we introduced a fake datatype and in iodbcmodel.cpp boolean literals are converted to literals using the fake datatype: a non-empty string - means true while an empty string means false. This is converted back in iodbcstatementhandler.cpp - -* The same hack used for boolean values is used for dataTime and time until we find out why Virtuoso - looses the fractions of seconds. This also means that queries which compare datetime or time values - will not work as expected. + means true while an empty string means false. This is converted back in odbcqueryresult.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/backends/virtuoso/odbcqueryresult.cpp new/soprano-2.6.51/backends/virtuoso/odbcqueryresult.cpp --- old/soprano-2.6.0/backends/virtuoso/odbcqueryresult.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/backends/virtuoso/odbcqueryresult.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -61,6 +61,8 @@ } else { clearError(); + d->m_columns.reserve( numCols ); + d->m_columTypes.reserve( numCols ); for ( int col = 1; col <= numCols; ++col ) { SQLTCHAR colName[51]; colName[50] = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/backends/virtuoso/virtuosobackend.cpp new/soprano-2.6.51/backends/virtuoso/virtuosobackend.cpp --- old/soprano-2.6.0/backends/virtuoso/virtuosobackend.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/backends/virtuoso/virtuosobackend.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -75,10 +75,10 @@ return 0; } - host = "localhost"; + host = QLatin1String("localhost"); port = controller->usedPort(); - uid = "dba"; - pwd = "dba"; + uid = QLatin1String("dba"); + pwd = QLatin1String("dba"); } #ifdef Q_OS_WIN @@ -91,7 +91,7 @@ } #endif - const QString connectString = QString( "host=%1:%2;uid=%3;pwd=%4;driver=%5" ) + const QString connectString = QString::fromLatin1( "host=%1:%2;uid=%3;pwd=%4;driver=%5" ) .arg( host, QString::number( port ), uid, pwd, odbcDriver ); QStringList connectionSetupCommands; if ( queryTimeout > 1000 ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/backends/virtuoso/virtuosocontroller.cpp new/soprano-2.6.51/backends/virtuoso/virtuosocontroller.cpp --- old/soprano-2.6.0/backends/virtuoso/virtuosocontroller.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/backends/virtuoso/virtuosocontroller.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -33,6 +33,7 @@ #include <QtCore/QDebug> #include <QtCore/QMutex> #include <QtCore/QMutexLocker> +#include <QtCore/QCoreApplication> #ifndef Q_OS_WIN #include <sys/types.h> @@ -363,6 +364,12 @@ cfs.setValue( "MinAutoCheckpointSize", minAutoCheckpointSize ); cfs.endGroup(); + + // normalize all free-text indexes and bif:contains terms (remove accents) + // Only supported by Virtuoso >= 6.2; older versions will simply ignore it + cfs.beginGroup( QLatin1String("I18N") ); + cfs.setValue( QLatin1String("XAnyNormalization"), "3" ); + cfs.endGroup(); } @@ -374,6 +381,9 @@ const QString virtuosoHome = QDir::fromNativeSeparators( qgetenv("VIRTUOSO_HOME") ); if ( !virtuosoHome.isEmpty() ) dirs << virtuosoHome + QLatin1String("/bin"); + else { + dirs << QCoreApplication::applicationDirPath(); + } #endif foreach( const QString& dir, dirs ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/backends/virtuoso/virtuosomodel.cpp new/soprano-2.6.51/backends/virtuoso/virtuosomodel.cpp --- old/soprano-2.6.0/backends/virtuoso/virtuosomodel.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/backends/virtuoso/virtuosomodel.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -109,7 +109,7 @@ Soprano::QueryResultIterator Soprano::VirtuosoModelPrivate::sparqlQuery( const QString& query ) { QString finalQuery( query ); - finalQuery.prepend( QLatin1String( s_queryPrefix ) + ' ' ); + finalQuery.prepend( QLatin1String( s_queryPrefix ) ); // qDebug() << Q_FUNC_INFO << finalQuery; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/client/dbus/dbusclient.cpp new/soprano-2.6.51/client/dbus/dbusclient.cpp --- old/soprano-2.6.0/client/dbus/dbusclient.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/client/dbus/dbusclient.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -36,10 +36,6 @@ : QObject( parent ), d( new Private() ) { - qDBusRegisterMetaType<Soprano::Node>(); - qDBusRegisterMetaType<Soprano::Statement>(); - qDBusRegisterMetaType<Soprano::BindingSet>(); - d->interface = new DBusServerInterface( servicename.isEmpty() ? QString( "org.soprano.Server" ) : servicename, "/org/soprano/Server", QDBusConnection::sessionBus(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/client/dbus/dbusmodel.cpp new/soprano-2.6.51/client/dbus/dbusmodel.cpp --- old/soprano-2.6.0/client/dbus/dbusmodel.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/client/dbus/dbusmodel.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -31,7 +31,7 @@ #include "nodeiterator.h" #include "statementiterator.h" #include "queryresultiterator.h" - +#include "dbusoperators.h" class Soprano::Client::DBusModel::Private { @@ -45,6 +45,10 @@ : StorageModel( backend ), d( new Private() ) { + qDBusRegisterMetaType<Soprano::Node>(); + qDBusRegisterMetaType<Soprano::Statement>(); + qDBusRegisterMetaType<Soprano::BindingSet>(); + d->interface = new DBusModelInterface( serviceName, dbusObject, QDBusConnection::sessionBus(), this ); d->callMode = QDBus::Block; connect( d->interface, SIGNAL( statementsAdded() ), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/client/dbus/dbusmodelinterface.h new/soprano-2.6.51/client/dbus/dbusmodelinterface.h --- old/soprano-2.6.0/client/dbus/dbusmodelinterface.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/client/dbus/dbusmodelinterface.h 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -34,9 +34,7 @@ #include <QtDBus/QtDBus> #include "statement.h" - -Q_DECLARE_METATYPE(Soprano::Statement) -Q_DECLARE_METATYPE(Soprano::Node) +#include "dbusoperators.h" namespace Soprano { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/graph.cpp new/soprano-2.6.51/soprano/graph.cpp --- old/soprano-2.6.0/soprano/graph.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/graph.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -272,6 +272,12 @@ } +QSet<Soprano::Statement> Soprano::Graph::toSet() const +{ + return d->statements; +} + + Soprano::Graph& Soprano::Graph::operator=( const Graph& other ) { d = other.d; @@ -360,3 +366,10 @@ { return d->statements != g.d->statements; } + + +QDebug Soprano::operator<<(QDebug dbg, const Soprano::Graph& graph) +{ + dbg << graph.toSet(); + return dbg; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/graph.h new/soprano-2.6.51/soprano/graph.h --- old/soprano-2.6.0/soprano/graph.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/graph.h 2011-06-05 10:38:25.000000000 +0200 @@ -24,6 +24,7 @@ #include <QtCore/QList> #include <QtCore/QSharedDataPointer> +#include <QtCore/QDebug> #include "soprano_export.h" #include "error.h" @@ -249,6 +250,13 @@ QList<Statement> toList() const; //@} + //@{ + /** + * Convert the Graph into a set + */ + QSet<Statement> toSet() const; + //@} + /** * \name Operators */ @@ -340,6 +348,8 @@ class Private; QSharedDataPointer<Private> d; }; + + SOPRANO_EXPORT QDebug operator<<(QDebug dbg, const Graph& graph); } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/literalvalue.cpp new/soprano-2.6.51/soprano/literalvalue.cpp --- old/soprano-2.6.0/soprano/literalvalue.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/literalvalue.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007-2010 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * Copyright (C) 2009 Greg Beauchesne <[email protected]> * * This library is free software; you can redistribute it and/or @@ -637,28 +637,83 @@ Soprano::LiteralValue Soprano::LiteralValue::fromString( const QString& value, QVariant::Type type ) { switch( type ) { - case QVariant::Int: - return LiteralValue( value.toInt() ); - case QVariant::LongLong: - return LiteralValue( value.toLongLong() ); - case QVariant::UInt: - return LiteralValue( value.toUInt() ); - case QVariant::ULongLong: - return LiteralValue( value.toULongLong() ); - case QVariant::Bool: - return LiteralValue( ( value.toLower() == "true" || value.toLower() == "yes" || value.toInt() != 0 ) ); - case QVariant::Double: - return LiteralValue( value.toDouble() ); - case QVariant::String: - return LiteralValue( value ); - case QVariant::Date: - return LiteralValue( DateTime::fromDateString( value ) ); - case QVariant::Time: - return LiteralValue( DateTime::fromTimeString( value ) ); - case QVariant::DateTime: - return LiteralValue( DateTime::fromDateTimeString( value ) ); + case QVariant::Int: { + bool ok = false; + int val = value.toInt(&ok); + if(ok) + return LiteralValue( val ); + else + return LiteralValue(); + } + case QVariant::LongLong: { + bool ok = false; + qlonglong val = value.toLongLong(&ok); + if(ok) + return LiteralValue( val ); + else + return LiteralValue(); + } + case QVariant::UInt: { + bool ok = false; + uint val = value.toUInt(&ok); + if(ok) + return LiteralValue( val ); + else + return LiteralValue(); + } + case QVariant::ULongLong: { + bool ok = false; + qulonglong val = value.toULongLong(&ok); + if(ok) + return LiteralValue( val ); + else + return LiteralValue(); + } + case QVariant::Double: { + bool ok = false; + double val = value.toDouble(&ok); + if(ok) + return LiteralValue( val ); + else + return LiteralValue(); + } + case QVariant::Date: { + QDate date = DateTime::fromDateString( value ); + if( date.isValid() ) + return LiteralValue( date ); + else + return LiteralValue(); + } + case QVariant::Time: { + QTime date = DateTime::fromTimeString( value ); + if( date.isValid() ) + return LiteralValue( date ); + 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); + if(ok) + return LiteralValue(v != 0); + else if( value.toLower() == "true" || value.toLower() == "yes" ) + return LiteralValue( true ); + else if( value.toLower() == "false" || value.toLower() == "no" ) + return LiteralValue( false ); + else + return LiteralValue(); + } 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 ); @@ -674,11 +729,76 @@ else { LiteralValue v = LiteralValue::fromString( value, typeFromDataTypeUri( type ) ); Q_ASSERT(!v.isPlain()); - static_cast<const TypedData*>(v.d.constData())->dtUri = type; + if( v.isValid() ) { + static_cast<const TypedData*>(v.d.constData())->dtUri = type; + } return v; } } + +Soprano::LiteralValue Soprano::LiteralValue::fromVariant( const QVariant& value, const QUrl& dataType ) +{ + // + // Special case: time_t -> datetime + // + if( dataType == Vocabulary::XMLSchema::dateTime() && + value.canConvert(QVariant::Int) ) { + bool ok = false; + int time = value.toInt(&ok); + if(ok) { + return Soprano::LiteralValue( QDateTime::fromTime_t(time) ); + } + } + + const QVariant::Type literalType = typeFromDataTypeUri( dataType ); + if( value.canConvert(literalType) ) { + LiteralValue v; + bool ok = false; + + // + // We map 5 different XSD types to Int. + // Thus, we need to handle them separately since the constructor will fall + // back to xsd:int + // + if( literalType == QVariant::Int ) { + v = value.toInt(&ok); + } + + // + // Handle xsd:unsignedInt and xsd:nonNegativeInteger + // + else if( literalType == QVariant::UInt ) { + v = value.toUInt(&ok); + } + + // + // Handle xsd:float and xsd:double + // + else if( literalType == QVariant::Double ) { + v = value.toDouble(&ok); + } + + // + // The perfect match + // + else if( value.type() == literalType ) { + v = value; + ok = true; + } + + if( v.isValid() && ok ) { + // fixup the datatype + static_cast<const TypedData*>(v.d.constData())->dtUri = dataType; + return v; + } + } + + // fallback + return fromString(value.toString(), dataType); +} + + Soprano::LiteralValue Soprano::LiteralValue::createPlainLiteral( const QString& value, const LanguageTag& lang ) { LiteralValue v; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/literalvalue.h new/soprano-2.6.51/soprano/literalvalue.h --- old/soprano-2.6.0/soprano/literalvalue.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/literalvalue.h 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -86,6 +86,8 @@ * Creates a new LiteralValue from a QVariant. * User types are not supported. If v contains an * unsupported type an invalid LiteralValue is created. + * + * \sa fromVariant() */ LiteralValue( const QVariant& v ); @@ -395,6 +397,30 @@ static LiteralValue fromString( const QString& value, const QUrl& dataTypeUri ); /** + * Create a LiteralValue object by converting \p value to the given \p dataType. + * + * If the type of the variant matches the \p dataType this method has the same + * effect as the constructor which takes a QVariant as parameter. However, this + * method supports automatic conversion for a set of types including: + * + * \li Conversion of different decimal types + * \li Conversion of everything to xsd:string + * \li Conversion of decimal types to xsd:dateTime (using QDateTime::fromTime_t()) + * + * \param value The value the created LiteralValue should have. If invalid an + * invalid LiteralValue will be created. + * \param dataType The RDF literal data type the created LiteralValue should have. + * If empty the result will be the same as providing \p value to the constructor + * of LiteralValue. No conversion will take place. + * + * \return A newly created Literalvalue instance based on the given \p value and + * \p dataType. + * + * \since 2.7 + */ + static LiteralValue fromVariant( const QVariant& value, const QUrl& dataType ); + + /** * Create a plain LiteralValue object with an optional language tag. * * \param value The value of the literal. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/util/asyncquery.cpp new/soprano-2.6.51/soprano/util/asyncquery.cpp --- old/soprano-2.6.0/soprano/util/asyncquery.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/util/asyncquery.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -72,6 +72,10 @@ QStringList m_bindingNames; ResultType m_type; + // we need to cache the error since it needs to jump threads + // and ErrorCache does store errors by thread + Error::Error m_lastError; + AsyncQuery* q; }; @@ -121,12 +125,15 @@ } // finished, set the error, finished will be emitted in _s_finished - q->setError( m_model->lastError() ); + m_lastError = m_model->lastError(); + if(!m_lastError) + m_lastError = it.lastError(); } void Soprano::Util::AsyncQuery::Private::_s_finished() { + q->setError(m_lastError); emit q->finished( q ); q->deleteLater(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/vocabulary/nao.cpp new/soprano-2.6.51/soprano/vocabulary/nao.cpp --- old/soprano-2.6.0/soprano/vocabulary/nao.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/vocabulary/nao.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,6 +1,6 @@ /* * This file has been generated by the onto2vocabularyclass tool - * copyright (C) 2007-2010 Sebastian Trueg <[email protected]> + * copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -64,7 +64,9 @@ nao_serializationLanguage( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#serializationLanguage", QUrl::StrictMode ) ), nao_status( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#status", QUrl::StrictMode ) ), nao_userVisible( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible", QUrl::StrictMode ) ), - nao_version( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#version", QUrl::StrictMode ) ) { + nao_version( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#version", QUrl::StrictMode ) ), + nao_Agent( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#Agent", QUrl::StrictMode ) ), + nao_maintainedBy( QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#maintainedBy", QUrl::StrictMode ) ) { } QUrl nao_namespace; @@ -108,6 +110,8 @@ QUrl nao_status; QUrl nao_userVisible; QUrl nao_version; + QUrl nao_Agent; + QUrl nao_maintainedBy; }; Q_GLOBAL_STATIC( NaoPrivate, s_nao ) @@ -316,3 +320,13 @@ { return s_nao()->nao_version; } + +QUrl Soprano::Vocabulary::NAO::Agent() +{ + return s_nao()->nao_Agent; +} + +QUrl Soprano::Vocabulary::NAO::maintainedBy() +{ + return s_nao()->nao_maintainedBy; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/soprano/vocabulary/nao.h new/soprano-2.6.51/soprano/vocabulary/nao.h --- old/soprano-2.6.0/soprano/vocabulary/nao.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/soprano/vocabulary/nao.h 2011-06-05 10:38:25.000000000 +0200 @@ -1,6 +1,6 @@ /* * This file has been generated by the onto2vocabularyclass tool - * copyright (C) 2007-2010 Sebastian Trueg <[email protected]> + * copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -333,6 +333,20 @@ * Specifies the version of a graph, in numeric format */ SOPRANO_EXPORT QUrl version(); + + /** + * http://www.semanticdesktop.org/ontologies/2007/08/15/nao#Agent + * + * An agent is the artificial counterpart to nao:Party. It can be a software component or some service. + */ + SOPRANO_EXPORT QUrl Agent(); + + /** + * http://www.semanticdesktop.org/ontologies/2007/08/15/nao#maintainedBy + * + * The agent that maintains this resource, ie. created it and knows what to do with it. + */ + SOPRANO_EXPORT QUrl maintainedBy(); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/test/SopranoModelTest.cpp new/soprano-2.6.51/test/SopranoModelTest.cpp --- old/soprano-2.6.0/test/SopranoModelTest.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/test/SopranoModelTest.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -61,6 +61,17 @@ } +namespace QTest { +template<> +char* toString(const Soprano::LiteralValue& v) { + return qstrdup( Soprano::Node::literalToN3(v).toUtf8().data() ); +} + +char* toString(const Soprano::Node& v) { + return qstrdup( v.toN3().toUtf8().data() ); +} +} + SopranoModelTest::SopranoModelTest() : m_model( 0 ), m_features( BackendFeatureAll ), @@ -916,16 +927,12 @@ QFETCH( LiteralValue, literal ); QFETCH( QUrl, predicate ); - qDebug() << "testing literal: " << literal; - QUrl sub( "http://soprano.org/literalTest#X" ); QVERIFY( m_model->addStatement( Statement( sub, predicate, literal ) ) == Error::ErrorNone ); StatementIterator it = m_model->listStatements( Statement( sub, predicate, Node() ) ); QVERIFY( it.next() ); - if ( it.current().object().literal() != literal ) - qDebug() << Node( it.current().object().literal() ).toN3() << Node( literal ).toN3(); QCOMPARE( it.current().object().literal(), literal ); it.close(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/test/asyncquerytest.cpp new/soprano-2.6.51/test/asyncquerytest.cpp --- old/soprano-2.6.0/test/asyncquerytest.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/test/asyncquerytest.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -80,6 +80,7 @@ void AsyncQueryHandler::slotFinished() { + setError(m_query->lastError()); m_finished = true; if ( m_finishedLoop ) { m_finishedLoop->exit(); @@ -192,9 +193,25 @@ QCOMPARE( nodes[i++], it[0] ); } QCOMPARE( i, 4 ); + + delete model; } +void AsyncQueryTest::testError() +{ + Model* model = Soprano::createModel(); + QVERIFY( model != 0 ); + + // use an invalid query + const QString query = QLatin1String("I am an invalid query - I will eat your cat."); + AsyncQuery* q = AsyncQuery::executeQuery( model, query, Query::QueryLanguageSparql ); + QVERIFY( q ); + AsyncQueryHandler h( q ); + QVERIFY( h.waitForFinished() ); + QVERIFY(h.lastError()); +} + QTEST_MAIN( AsyncQueryTest ) #include "asyncquerytest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/test/asyncquerytest.h new/soprano-2.6.51/test/asyncquerytest.h --- old/soprano-2.6.0/test/asyncquerytest.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/test/asyncquerytest.h 2011-06-05 10:38:25.000000000 +0200 @@ -25,6 +25,8 @@ #include <QtTest/QtTest> #include <QtCore/QObject> +#include "error.h" + namespace Soprano { class Model; namespace Util { @@ -33,7 +35,7 @@ } class QEventLoop; -class AsyncQueryHandler : public QObject +class AsyncQueryHandler : public QObject, public Soprano::Error::ErrorCache { Q_OBJECT @@ -64,6 +66,7 @@ void testBindingNames(); void testQueryType(); void testBindingsQuery(); + void testError(); }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/test/sopranoliteraltest.cpp new/soprano-2.6.51/test/sopranoliteraltest.cpp --- old/soprano-2.6.0/test/sopranoliteraltest.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/test/sopranoliteraltest.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,10 +29,11 @@ using namespace Soprano; +using namespace Soprano::Vocabulary; Q_DECLARE_METATYPE(Soprano::LiteralValue) - void SopranoLiteralTest::initTestCase() +void SopranoLiteralTest::initTestCase() { m_model = Soprano::createModel(); QVERIFY( m_model != 0 ); @@ -177,6 +178,142 @@ } +void SopranoLiteralTest::testFromVariant_data() +{ + QTest::addColumn<QVariant>( "value" ); + QTest::addColumn<QUrl>( "dataType" ); + QTest::addColumn<QVariant>( "convertedValue" ); + + const QDateTime dt = QDateTime::currentDateTime(); + + // simple conversions 1-to-1 + QTest::newRow( "simple - xsd:int" ) << QVariant(42) << XMLSchema::xsdInt() << QVariant(42); + QTest::newRow( "simple - xsd:integer" ) << QVariant(42) << XMLSchema::integer() << QVariant(42); + QTest::newRow( "simple - xsd:negativeInteger" ) << QVariant(-42) << XMLSchema::negativeInteger() << QVariant(-42); + QTest::newRow( "simple - xsd:decimal" ) << QVariant(42) << XMLSchema::decimal() << QVariant(42); + QTest::newRow( "simple - xsd:short" ) << QVariant(42) << XMLSchema::xsdShort() << QVariant(42); + QTest::newRow( "simple - xsd:nonNegativeInteger" ) << QVariant(uint(42)) << XMLSchema::nonNegativeInteger() << QVariant(uint(42)); + QTest::newRow( "simple - xsd:unsignedInt" ) << QVariant(uint(42)) << XMLSchema::unsignedInt() << QVariant(uint(42)); + QTest::newRow( "simple - xsd:unsignedShort" ) << QVariant(uint(42)) << XMLSchema::unsignedShort() << QVariant(uint(42)); + QTest::newRow( "simple - xsd:long" ) << QVariant(42) << XMLSchema::xsdLong() << QVariant(42); + QTest::newRow( "simple - xsd:unsignedLong" ) << QVariant(uint(42)) << XMLSchema::unsignedLong() << QVariant(uint(42)); + QTest::newRow( "simple - xsd:boolean (true)" ) << QVariant(true) << XMLSchema::boolean() << QVariant(true); + QTest::newRow( "simple - xsd:boolean (false)" ) << QVariant(false) << XMLSchema::boolean() << QVariant(false); + QTest::newRow( "simple - xsd:double" ) << QVariant(double(42.5)) << XMLSchema::xsdDouble() << QVariant(double(42.5)); + QTest::newRow( "simple - xsd:float" ) << QVariant(float(42.5)) << XMLSchema::xsdFloat() << QVariant(float(42.5)); + QTest::newRow( "simple - xsd:string" ) << QVariant(QLatin1String("foobar")) << XMLSchema::string() << QVariant(QLatin1String("foobar")); + QTest::newRow( "simple - xsd:date" ) << QVariant(dt.date()) << XMLSchema::date() << QVariant(dt.date()); + QTest::newRow( "simple - xsd:time" ) << QVariant(dt.time()) << XMLSchema::time() << QVariant(dt.time()); + QTest::newRow( "simple - xsd:dateTime" ) << QVariant(dt) << XMLSchema::dateTime() << QVariant(dt); + + // anything to int + QTest::newRow( "uint -> xsd:int" ) << QVariant(42) << XMLSchema::xsdInt() << QVariant(42); + QTest::newRow( "string -> xsd:int" ) << QVariant("42") << XMLSchema::xsdInt() << QVariant(42); + + // anything to integer + QTest::newRow( "uint -> xsd:integer" ) << QVariant(42) << XMLSchema::integer() << QVariant(42); + QTest::newRow( "string -> xsd:integer" ) << QVariant("42") << XMLSchema::integer() << QVariant(42); + + // anything to negativeInteger + QTest::newRow( "string -> xsd:integer" ) << QVariant("-42") << XMLSchema::negativeInteger() << QVariant(-42); + + // anything to decimal + QTest::newRow( "uint -> xsd:decimal" ) << QVariant(42) << XMLSchema::decimal() << QVariant(42); + QTest::newRow( "string -> xsd:decimal" ) << QVariant("42") << XMLSchema::decimal() << QVariant(42); + + // anything to short + QTest::newRow( "uint -> xsd:short" ) << QVariant(42) << XMLSchema::xsdShort() << QVariant(42); + QTest::newRow( "string -> xsd:short" ) << QVariant("42") << XMLSchema::xsdShort() << QVariant(42); + + // anything to unsignedInteger + QTest::newRow( "int -> xsd:nonNegativeInteger" ) << QVariant(42) << XMLSchema::nonNegativeInteger() << QVariant(uint(42)); + QTest::newRow( "string -> xsd:nonNegativeInteger" ) << QVariant("42") << XMLSchema::nonNegativeInteger() << QVariant(uint(42)); + + // anything to unsignedInt + QTest::newRow( "int -> xsd:unsignedInt" ) << QVariant(42) << XMLSchema::unsignedInt() << QVariant(uint(42)); + QTest::newRow( "string -> xsd:unsignedInt" ) << QVariant("42") << XMLSchema::unsignedInt() << QVariant(uint(42)); + + // anything to unsignedShort + QTest::newRow( "int -> xsd:unsignedShort" ) << QVariant(42) << XMLSchema::unsignedShort() << QVariant(uint(42)); + QTest::newRow( "string -> xsd:unsignedShort" ) << QVariant("42") << XMLSchema::unsignedShort() << QVariant(uint(42)); + + // anything to long + QTest::newRow( "int -> xsd:long" ) << QVariant(42) << XMLSchema::xsdLong() << QVariant(int(42)); + QTest::newRow( "uint -> xsd:long" ) << QVariant(uint(42)) << XMLSchema::xsdLong() << QVariant(int(42)); + QTest::newRow( "long -> xsd:long" ) << QVariant(int(42)) << XMLSchema::xsdLong() << QVariant(int(42)); + QTest::newRow( "string -> xsd:long" ) << QVariant("42") << XMLSchema::xsdLong() << QVariant(int(42)); + + // anything to unsignedLong + QTest::newRow( "int -> xsd:unsignedLong" ) << QVariant(42) << XMLSchema::unsignedLong() << QVariant(42); + QTest::newRow( "long -> xsd:unsignedLong" ) << QVariant(int(42)) << XMLSchema::unsignedLong() << QVariant(42); + QTest::newRow( "uint -> xsd:unsignedLong" ) << QVariant(uint(42)) << XMLSchema::unsignedLong() << QVariant(42); + QTest::newRow( "string -> xsd:unsignedLong" ) << QVariant("42") << XMLSchema::unsignedLong() << QVariant(42); + + // anything to boolean + QTest::newRow( "int -> xsd:boolean (true)" ) << QVariant(1) << XMLSchema::boolean() << QVariant(true); + QTest::newRow( "int -> xsd:boolean (false)" ) << QVariant(0) << XMLSchema::boolean() << QVariant(false); + QTest::newRow( "uint -> xsd:boolean (true)" ) << QVariant(uint(1)) << XMLSchema::boolean() << QVariant(true); + QTest::newRow( "uint -> xsd:boolean (false)" ) << QVariant(uint(0)) << XMLSchema::boolean() << QVariant(false); + QTest::newRow( "string -> xsd:boolean (true)" ) << QVariant("true") << XMLSchema::boolean() << QVariant(true); + QTest::newRow( "string -> xsd:boolean (false)" ) << QVariant("false") << XMLSchema::boolean() << QVariant(false); + QTest::newRow( "string -> xsd:boolean (1)" ) << QVariant("1") << XMLSchema::boolean() << QVariant(true); + QTest::newRow( "string -> xsd:boolean (0)" ) << QVariant("0") << XMLSchema::boolean() << QVariant(false); + + // anything to double + QTest::newRow( "float -> xsd:double" ) << QVariant(float(42.5)) << XMLSchema::xsdDouble() << QVariant(double(42.5)); + QTest::newRow( "string -> xsd:double" ) << QVariant("42.5") << XMLSchema::xsdDouble() << QVariant(double(42.5)); + + // anything to float + QTest::newRow( "double -> xsd:float" ) << QVariant(double(42.5)) << XMLSchema::xsdFloat() << QVariant(double(42.5)); + QTest::newRow( "string -> xsd:float" ) << QVariant("42.5") << XMLSchema::xsdFloat() << QVariant(double(42.5)); + + // anything to dateTime (we loose accuracy in toTIme_t(), thus, the weird conversion at the end) + QTest::newRow( "int -> xsd:dateTime" ) << QVariant(dt.toTime_t()) << XMLSchema::dateTime() << QVariant(QDateTime::fromTime_t(dt.toTime_t())); + + // the special case - rdfs:Literal + QTest::newRow("rdfs:Literal") << QVariant(QLatin1String("foobar")) << RDFS::Literal() << QVariant(QLatin1String("foobar")); + + // conversions which should fail and result in invalid LiteralValues + QTest::newRow( "from-string-invalid - xsd:int" ) << QVariant(QLatin1String("foobar")) << XMLSchema::xsdInt() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:integer" ) << QVariant(QLatin1String("foobar")) << XMLSchema::integer() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:negativeInteger" ) << QVariant(QLatin1String("foobar")) << XMLSchema::negativeInteger() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:decimal" ) << QVariant(QLatin1String("foobar")) << XMLSchema::decimal() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:short" ) << QVariant(QLatin1String("foobar")) << XMLSchema::xsdShort() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:nonNegativeInteger" ) << QVariant(QLatin1String("foobar")) << XMLSchema::nonNegativeInteger() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:unsignedInt" ) << QVariant(QLatin1String("foobar")) << XMLSchema::unsignedInt() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:unsignedShort" ) << QVariant(QLatin1String("foobar")) << XMLSchema::unsignedShort() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:long" ) << QVariant(QLatin1String("foobar")) << XMLSchema::xsdLong() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:unsignedLong" ) << QVariant(QLatin1String("foobar")) << XMLSchema::unsignedLong() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:boolean (true)" ) << QVariant(QLatin1String("foobar")) << XMLSchema::boolean() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:boolean (false)" ) << QVariant(QLatin1String("foobar")) << XMLSchema::boolean() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:double" ) << QVariant(QLatin1String("foobar")) << XMLSchema::xsdDouble() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:float" ) << QVariant(QLatin1String("foobar")) << XMLSchema::xsdFloat() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:date" ) << QVariant(QLatin1String("foobar")) << XMLSchema::date() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:time" ) << QVariant(QLatin1String("foobar")) << XMLSchema::time() << QVariant(); + QTest::newRow( "from-string-invalid - xsd:dateTime" ) << QVariant(QLatin1String("foobar")) << XMLSchema::dateTime() << QVariant(); + + QTest::newRow( "invalid-type" ) << QVariant(QLatin1String("foobar")) << QUrl() << QVariant(QLatin1String("foobar")); + QTest::newRow( "invalid-value" ) << QVariant() << XMLSchema::integer() << QVariant(); +} + + +void SopranoLiteralTest::testFromVariant() +{ + QFETCH( QVariant, value ); + QFETCH( QUrl, dataType ); + QFETCH( QVariant, convertedValue ); + + const LiteralValue v = LiteralValue::fromVariant( value, dataType ); + if(convertedValue.isValid()) { + QCOMPARE(v.variant(), convertedValue); + if(dataType.isValid()) + QCOMPARE(v.dataTypeUri(), dataType); + } + else { + QVERIFY(!v.isValid()); + } +} + QTEST_MAIN(SopranoLiteralTest) #include "sopranoliteraltest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/test/sopranoliteraltest.h new/soprano-2.6.51/test/sopranoliteraltest.h --- old/soprano-2.6.0/test/sopranoliteraltest.h 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/test/sopranoliteraltest.h 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project. * - * Copyright (C) 2007 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -41,6 +41,8 @@ void testPlainLiterals(); void testToString_data(); void testToString(); + void testFromVariant_data(); + void testFromVariant(); private: Soprano::Model* m_model; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/soprano-2.6.0/tools/onto2vocabularyclass.cpp new/soprano-2.6.51/tools/onto2vocabularyclass.cpp --- old/soprano-2.6.0/tools/onto2vocabularyclass.cpp 2011-02-01 15:51:41.000000000 +0100 +++ new/soprano-2.6.51/tools/onto2vocabularyclass.cpp 2011-06-05 10:38:25.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of Soprano Project * - * Copyright (C) 2007-2010 Sebastian Trueg <[email protected]> + * Copyright (C) 2007-2011 Sebastian Trueg <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -64,13 +64,13 @@ " */\n"; -#define VERSION "1.1" +#define VERSION "1.2" int version() { QTextStream s( stderr ); s << "onto2vocabularyclass " << VERSION << " (using Soprano " << Soprano::versionString() << ")" << endl; - s << " Copyright (C) 2007-2010 Sebastian Trueg <[email protected]>" << endl; + s << " Copyright (C) 2007-2011 Sebastian Trueg <[email protected]>" << endl; s << " This program is free software; you can redistribute it and/or modify" << endl << " it under the terms of the GNU General Public License as published by" << endl << " the Free Software Foundation; either version 2 of the License, or" << endl @@ -147,8 +147,11 @@ QString normalizeName( const QString& name ) { + QString normalized(name); // TODO: add more invalid characters here - return QString( name ).replace( '-', QString() ); + normalized.replace( '-', QString() ); + normalized.replace( '.', QLatin1String("_") ); + return normalized; } QString disambiguateKeyword( const QString& name, const QString &className ) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
