Nepomuk-Core
Go to the documentation of this file.
23 #include <QtCore/QFile>
24 #include <QtCore/QMutableListIterator>
25 #include <QtCore/QSettings>
27 #include <Soprano/Node>
28 #include <Soprano/PluginManager>
29 #include <Soprano/Parser>
30 #include <Soprano/Serializer>
31 #include <Soprano/Util/SimpleStatementIterator>
34 #include <KTemporaryFile>
44 Soprano::StatementIterator BackupFile::iterator()
51 KTar tarFile( url.toLocalFile(), QString::fromLatin1(
"application/x-gzip") );
52 if( !tarFile.open( QIODevice::ReadOnly ) ) {
53 kWarning() <<
"File could not be opened : " << url.toLocalFile();
57 const KArchiveDirectory * dir = tarFile.directory();
62 dir->copyTo( tempDir.name() );
64 QUrl fileUrl = QUrl::fromLocalFile(tempDir.name() +
"data" );
65 QFile file( fileUrl.toLocalFile() );
66 if( !file.open( QIODevice::ReadOnly ) ) {
70 const Soprano::Parser* parser = Soprano::PluginManager::instance()->discoverParserForSerialization( Soprano::SerializationNQuads );
73 bf.m_stIter = parser->parseFile( fileUrl.toLocalFile(), QUrl(), Soprano::SerializationNQuads );
76 QString metadataFileUrl = tempDir.name() + QLatin1String(
"metadata");
77 QSettings iniFile( metadataFileUrl, QSettings::IniFormat );
79 bf.m_numStatements = iniFile.value(
"NumStatements").toInt();
80 bf.m_created = QDateTime::fromString( iniFile.value(
"Created").toString() );
92 return m_numStatements;
static BackupFile fromUrl(const QUrl &url)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.