[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akonadi/agents
From: Volker Krause <vkrause () kde ! org>
Date: 2009-09-22 8:27:20
Message-ID: 1253608040.535660.13509.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1026675 by vkrause:
Change the remaining handcoded queries to use the SPARQL query builder.
M +14 -10 nepomuk_calendar_feeder/nepomukcalendarfeeder.cpp
M +11 -4 nepomukfeeder/nepomukfeederagent.cpp
M +3 -0 nie_fast/CMakeLists.txt
--- trunk/KDE/kdepim/akonadi/agents/nepomuk_calendar_feeder/nepomukcalendarfeeder.cpp \
#1026674:1026675 @@ -18,6 +18,8 @@
*/
#include "nepomukcalendarfeeder.h"
+#include "selectsqarqlbuilder.h"
+#include "nco.h"
#include <akonadi/changerecorder.h>
#include <akonadi/item.h>
@@ -60,18 +62,20 @@
static NepomukFast::Contact findNepomukContact( const QString &name, const QString \
&email ) {
// find person using name and email
- QList<Soprano::Node> list = \
Nepomuk::ResourceManager::instance()->mainModel()->executeQuery(
- QString( "prefix \
nco:<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#>"
- "select ?person where {"
- " ?person nco:fullname \
\"%1\"^^<http://www.w3.org/2001/XMLSchema#string> ."
- " ?person nco:hasEmailAddress ?email ."
- " ?email nco:emailAddress \
\"%2\"^^<http://www.w3.org/2001/XMLSchema#string> ."
- "}" )
- .arg( name, email ),
- Soprano::Query::QueryLanguageSparql ).iterateBindings( 0 \
).allNodes();
- foreach ( const Soprano::Node &node, list )
+ SparqlBuilder::BasicGraphPattern graph;
+ graph.addTriple( "?person", Vocabulary::NCO::fullname(), name );
+ graph.addTriple( "?person", Vocabulary::NCO::hasEmailAddress(), \
SparqlBuilder::QueryVariable( "?email" ) ); + graph.addTriple( "?email", \
Vocabulary::NCO::emailAddress(), email ); + SelectSparqlBuilder qb;
+ qb.addQueryVariable( "?person" );
+ qb.setGraphPattern( graph );
+ const QList<Soprano::Node> list = \
Nepomuk::ResourceManager::instance()->mainModel()->executeQuery( qb.query(), + \
Soprano::Query::QueryLanguageSparql ).iterateBindings( 0 ).allNodes(); +
+ foreach ( const Soprano::Node &node, list ) {
if ( node.isResource () )
return NepomukFast::Contact( node.uri() );
+ }
return NepomukFast::Contact();
}
--- trunk/KDE/kdepim/akonadi/agents/nepomukfeeder/nepomukfeederagent.cpp \
#1026674:1026675 @@ -20,6 +20,8 @@
*/
#include "nepomukfeederagent.h"
+#include "selectsqarqlbuilder.h"
+#include "nie.h"
#include <akonadi/item.h>
#include <akonadi/changerecorder.h>
@@ -62,10 +64,15 @@
void NepomukFeederAgent::removeItemFromNepomuk( const Akonadi::Item &item )
{
// find the graph that contains our item and delete the complete graph
- QList<Soprano::Node> list = \
Nepomuk::ResourceManager::instance()->mainModel()->executeQuery(
- QString( "select ?g where { ?g \
<http://www.semanticdesktop.org/ontologies/2007/01/19/nie#dataGraphFor> \
%1. }")
- .arg( Soprano::Node::resourceToN3( item.url() ) ),
- Soprano::Query::QueryLanguageSparql ).iterateBindings( 0 \
).allNodes(); + SparqlBuilder::BasicGraphPattern graph;
+ // FIXME: why isn't that in the ontology?
+// graph.addTriple( "?g", Vocabulary::Nie::dataGraphFor(), item.url() );
+ graph.addTriple( "?g", QUrl( \
"http://www.semanticdesktop.org/ontologies/2007/01/19/nie#dataGraphFor" ), item.url() \
); + SelectSparqlBuilder qb;
+ qb.addQueryVariable( "?g" );
+ qb.setGraphPattern( graph );
+ const QList<Soprano::Node> list = \
Nepomuk::ResourceManager::instance()->mainModel()->executeQuery( qb.query(), + \
Soprano::Query::QueryLanguageSparql ).iterateBindings( 0 ).allNodes();
foreach ( const Soprano::Node &node, list )
Nepomuk::ResourceManager::instance()->mainModel()->removeContext( node );
--- trunk/KDE/kdepim/akonadi/agents/nie_fast/CMakeLists.txt #1026674:1026675
@@ -10,5 +10,8 @@
${CMAKE_CURRENT_SOURCE_DIR}/ncal.rdfs
)
+soprano_add_ontology(nie_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/nie.rdfs "NIE" \
"Vocabulary" "rdfxml") +soprano_add_ontology(nie_SRCS \
${CMAKE_CURRENT_SOURCE_DIR}/nco.rdfs "NCO" "Vocabulary" "rdfxml") +
kde4_add_library(niefast STATIC ${nie_SRCS})
target_link_libraries(niefast ${QT_QTCORE_LIBRARY} ${NEPOMUK_LIBRARIES})
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic