[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/nepomuk-kde/scribo/plugins/pimo
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-05-04 10:42:28
Message-ID: 20100504104228.68267AC8AB () svn ! kde ! org
[Download RAW message or body]
SVN commit 1122622 by trueg:
Ported PIMO Scribo plugin to new Query API.
M +1 -1 CMakeLists.txt
M +18 -10 pimotextmatchplugin.cpp
--- trunk/playground/base/nepomuk-kde/scribo/plugins/pimo/CMakeLists.txt \
#1122621:1122622 @@ -14,8 +14,8 @@
kde4_add_plugin(scribo_pimotextmatchplugin ${pimotextmatchplugin_SRCS})
target_link_libraries(scribo_pimotextmatchplugin
${NEPOMUK_LIBRARIES}
+ ${NEPOMUK_QUERY_LIBRARIES}
${SOPRANO_LIBRARIES}
- ${SOPRANO_INDEX_LIBRARIES}
${KDE4_KDECORE_LIBS}
scribo
nepomukutils
--- trunk/playground/base/nepomuk-kde/scribo/plugins/pimo/pimotextmatchplugin.cpp \
#1122621:1122622 @@ -26,13 +26,18 @@
#include <Soprano/Model>
#include <Soprano/QueryResultIterator>
#include <Soprano/Node>
-#include <Soprano/Index/IndexFilterModel>
#include <Soprano/Vocabulary/NAO>
#include <Soprano/Graph>
#include <Nepomuk/ResourceManager>
#include <Nepomuk/Resource>
#include <Nepomuk/Types/Class>
+#include <Nepomuk/Query/Query>
+#include <Nepomuk/Query/ComparisonTerm>
+#include <Nepomuk/Query/ResourceTypeTerm>
+#include <Nepomuk/Query/LiteralTerm>
+#include <Nepomuk/Query/AndTerm>
+#include <Nepomuk/Query/OrTerm>
#include <KPluginFactory>
#include <KDebug>
@@ -107,17 +112,21 @@
// kDebug() << "checking word" << word;
- QString query
- = Soprano::Index::IndexFilterModel::encodeUriForLuceneQuery( \
Soprano::Vocabulary::NAO::prefLabel() )
- + ':'
- + Soprano::Index::IndexFilterModel::encodeStringForLuceneQuery( word );
+ Nepomuk::Query::Query query =
+ Nepomuk::Query::Query(
+ Nepomuk::Query::AndTerm(
+ Nepomuk::Query::OrTerm(
+ Nepomuk::Query::ResourceTypeTerm( \
Nepomuk::Vocabulary::PIMO::Thing() ), + \
Nepomuk::Query::ResourceTypeTerm( Soprano::Vocabulary::NAO::Tag() ) ), + \
Nepomuk::Query::LiteralTerm( word ) ) ); +
+ kDebug() << query.toSparqlQuery();
+
Soprano::QueryResultIterator it
- = Nepomuk::ResourceManager::instance()->mainModel()->executeQuery( query,
- \
Soprano::Query::QueryLanguageUser,
- "lucene" \
); + = Nepomuk::ResourceManager::instance()->mainModel()->executeQuery( \
query.toSparqlQuery(), + \
Soprano::Query::QueryLanguageSparql ); while ( it.next() ) {
Nepomuk::Resource res( it[0].uri() );
- if ( res.hasType( Nepomuk::Vocabulary::PIMO::Thing() ) ) {
Scribo::Entity entity( res.genericLabel(), res.resourceType(), \
Soprano::Graph(), res );
Scribo::TextOccurrence oc;
@@ -128,7 +137,6 @@
addNewMatch( entity );
}
- }
return true;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic