NepomukDaemons
migration1.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "migration1.h"
00020
00021 #include <Soprano/Model>
00022 #include <Soprano/Node>
00023 #include <Soprano/Statement>
00024 #include <Soprano/StatementIterator>
00025 #include <Soprano/Vocabulary/NAO>
00026
00027 #include <kpluginfactory.h>
00028 #include <kpluginloader.h>
00029
00030
00031 Nepomuk::Migration1::Migration1( QObject* parent, const QList<QVariant>& )
00032 : Service( parent )
00033 {
00034
00035
00036
00037
00038 QList<Soprano::Statement> oldLabelStatements
00039 = mainModel()->listStatements( Soprano::Node(),
00040 QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#label" ),
00041 Soprano::Node() ).allStatements();
00042
00043
00044
00045 foreach( Soprano::Statement s, oldLabelStatements ) {
00046 s.setPredicate( Soprano::Vocabulary::NAO::prefLabel() );
00047 mainModel()->addStatement( s );
00048 }
00049
00050 mainModel()->removeStatements( oldLabelStatements );
00051
00052
00053
00054
00055 QList<Soprano::Statement> oldRatingStatements
00056 = mainModel()->listStatements( Soprano::Node(),
00057 QUrl::fromEncoded( "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#rating" ),
00058 Soprano::Node() ).allStatements();
00059
00060
00061
00062 foreach( Soprano::Statement s, oldRatingStatements ) {
00063 s.setPredicate( Soprano::Vocabulary::NAO::numericRating() );
00064 mainModel()->addStatement( s );
00065 }
00066
00067 mainModel()->removeStatements( oldLabelStatements );
00068 }
00069
00070
00071 Nepomuk::Migration1::~Migration1()
00072 {
00073 }
00074
00075 NEPOMUK_EXPORT_SERVICE( Nepomuk::Migration1, "nepomukmigration1" )
00076
00077 #include "migration1.moc"