• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

NepomukDaemons

migration1.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE Project
00002    Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
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     // we just do our data updating and afterwards we idle
00035 
00036     // 1. nao:label
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     // update the data
00044     // (keep all metametadata like graphs and creation dates since the actual data does not change)
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     // 2. nao:rating
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     // update the data
00061     // (keep all metametadata like graphs and creation dates since the actual data does not change)
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"

NepomukDaemons

Skip menu "NepomukDaemons"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal