[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/nepomuk/strigibackend
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-01-27 16:43:39
Message-ID: 1264610619.424921.4475.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1081061 by trueg:
Fixed removing of file metadata for filex:/ URLs from removable media.
M +21 -12 nepomukindexwriter.cpp
M +5 -1 nepomukindexwriter.h
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/nepomukindexwriter.cpp \
#1081060:1081061 @@ -359,7 +359,7 @@
FileMetaData* data = new FileMetaData( createFileUrl( idx ) );
// remove previously indexed data
- removeIndexedData( data->fileUrl );
+ removeIndexedData( data->resourceUri, true );
// It is important to keep the resource URI between updates (especially for \
sharing of files)
// However, when updating data from pre-KDE 4.4 times we want to get rid of old \
file:/ resource @@ -610,35 +610,44 @@
}
-void Strigi::NepomukIndexWriter::removeIndexedData( const KUrl& url )
+void Strigi::NepomukIndexWriter::removeIndexedData( const KUrl& url, bool \
isResourceUri ) {
// kDebug() << url;
+ if ( url.isEmpty() )
+ return;
+
//
// We are compatible with old Xesam data where the url was encoded as a string \
instead of a url, // thus the weird query
//
- QString query = QString( "select ?g ?mg where { "
- "{ ?r %3 %1 . } "
- "UNION "
- "{ ?r %3 %2 . } "
- "UNION "
- "{ ?r %4 %2 . } . "
- "?g %5 ?r . }" )
+ QString query;
+ if ( isResourceUri ) {
+ query = QString::fromLatin1( "select ?g where { ?g %1 %2 . }" )
+ .arg( Soprano::Node::resourceToN3( \
Strigi::Ontology::indexGraphFor() ), + \
Soprano::Node::resourceToN3( url ) ); + }
+ else {
+ query = QString::fromLatin1( "select ?g ?mg where { "
+ "{ ?r %3 %1 . } "
+ "UNION "
+ "{ ?r %3 %2 . } "
+ "UNION "
+ "{ ?r %4 %2 . } . "
+ "?g %5 ?r . }" )
.arg( Node::literalToN3( url.path() ),
Node::resourceToN3( url ),
Node::resourceToN3( Vocabulary::Xesam::url() ),
Node::resourceToN3( Nepomuk::Vocabulary::NIE::url() ),
Node::resourceToN3( Strigi::Ontology::indexGraphFor() ) );
+ }
// kDebug() << "deleteEntries query:" << query;
QueryResultIterator result = d->repository->executeQuery( query, \
Soprano::Query::QueryLanguageSparql );
- if ( result.next() ) {
+ while ( result.next() ) {
Node indexGraph = result.binding( "g" );
- result.close();
-
// delete the indexed data (The Soprano::NRLModel in the storage service \
will take care of // the metadata graph)
d->repository->removeContext( indexGraph );
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/nepomukindexwriter.h \
#1081060:1081061 @@ -74,7 +74,11 @@
void finishAnalysis( const AnalysisResult* );
private:
- void removeIndexedData( const KUrl& url );
+ /**
+ * \param isResourceUri if true \p url is a resource URI, otherwise it
+ * is a local file URL
+ */
+ void removeIndexedData( const KUrl& url, bool isResourceUri = false );
QUrl determineFolderResourceUri( const KUrl& fileUrl );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic