[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/akonadi/server
From: Tobias Koenig <tokoe () kde ! org>
Date: 2009-11-15 6:34:26
Message-ID: 1258266866.986263.14839.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1049360 by tokoe:
Remove Query and Term classes, they are not needed since
we use only SPARQL strings in the query API in Akonadi.
M +0 -2 CMakeLists.txt
M +0 -210 src/search/dbusoperators.cpp
M +0 -8 src/search/dbusoperators.h
D src/search/query.cpp
D src/search/query.h
M +0 -3 src/search/querymetatype.h
D src/search/term.cpp
D src/search/term.h
--- trunk/kdesupport/akonadi/server/CMakeLists.txt #1049359:1049360
@@ -93,10 +93,8 @@
src/handler/transaction.cpp
src/search/dbusoperators.cpp
- src/search/query.cpp
src/search/queryserviceclient.cpp
src/search/result.cpp
- src/search/term.cpp
src/storage/collectionqueryhelper.cpp
src/storage/entity.cpp
--- trunk/kdesupport/akonadi/server/src/search/dbusoperators.cpp #1049359:1049360
@@ -25,7 +25,6 @@
Q_DECLARE_METATYPE(Nepomuk::Search::Result)
-Q_DECLARE_METATYPE(Nepomuk::Search::Term)
Q_DECLARE_METATYPE(Soprano::Node)
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QList<Nepomuk::Search::Result>)
@@ -35,8 +34,6 @@
{
qDBusRegisterMetaType<Nepomuk::Search::Result>();
qDBusRegisterMetaType<QList<Nepomuk::Search::Result> >();
- qDBusRegisterMetaType<Nepomuk::Search::Term>();
- qDBusRegisterMetaType<Nepomuk::Search::Query>();
qDBusRegisterMetaType<Soprano::Node>();
qDBusRegisterMetaType<RequestPropertyMapDBus>();
}
@@ -99,213 +96,6 @@
}
-QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Search::Term& term )
-{
- //
- // Signature: (ii(isss)sss)
- // i -> type
- // i -> comparator type
- // (isss) -> Soprano::LiteralValue encoded as a Soprano::Node for simplicity
- // s -> resource
- // s -> field
- // s -> property
- //
-
- arg.beginStructure();
- arg << ( int )term.type()
- << ( int )term.comparator()
- << Soprano::Node( term.value() )
- << QString::fromAscii( term.resource().toEncoded() )
- << term.field()
- << QString::fromAscii( term.property().toEncoded() );
- arg.endStructure();
-
- return arg;
-}
-
-
-const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Search::Term& \
term )
-{
- //
- // Signature: (ii(isss)sss)
- // i -> type
- // i -> comparator type
- // (isss) -> Soprano::LiteralValue encoded as a Soprano::Node for simplicity
- // s -> resource
- // s -> field
- // s -> property
- //
-
- arg.beginStructure();
- int type = Nepomuk::Search::Term::InvalidTerm;
- int comparator = Nepomuk::Search::Term::Equal;
- Soprano::Node valueNode;
- QString resource, field, property;
- arg >> type
- >> comparator
- >> valueNode
- >> resource
- >> field
- >> property;
- term.setType( Nepomuk::Search::Term::Type( type ) );
- term.setComparator( Nepomuk::Search::Term::Comparator( comparator ) );
- if ( valueNode.isLiteral() )
- term.setValue( valueNode.literal() );
- if ( !resource.isEmpty() )
- term.setResource( QUrl::fromEncoded( resource.toAscii() ) );
- if ( !field.isEmpty() )
- term.setField( field );
- if ( !property.isEmpty() )
- term.setProperty( QUrl::fromEncoded( property.toAscii() ) );
- arg.endStructure();
-
- return arg;
-}
-
-
-// streaming a Query object is a bit tricky as it is a set of nested Term objects
-// DBus does not allow arbitrary nesting of objects, thus we use a little trick:
-// We store all used Term objects in a list and use integer indices pointing into
-// this list to describe the nesting within the Term objects. This also means that
-// a Term's subTerm list is replaced with a list of indices
-namespace {
- /**
- * Build term relations for the last term in the list
- */
- void buildTermRelations( QList<Nepomuk::Search::Term>& terms, QHash<int, \
QList<int> >& termRelations ) {
- QList<Nepomuk::Search::Term> subTerms = terms.last().subTerms();
- int termIndex = terms.count()-1;
- for ( int i = 0; i < subTerms.count(); ++i ) {
- terms.append( subTerms[i] );
- termRelations[termIndex].append( terms.count()-1 );
- buildTermRelations( terms, termRelations );
- }
- }
-}
-
-QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Search::Query& query )
-{
- //
- // Signature: (isa(ii(isss)sss)a{iai}ia{sb})
- // i -> type
- // s -> sparql query
- // a(ii(isss)sss) -> array of terms (first is root term)
- // a{iai} -> hash of term relations
- // i -> limit
- // a{sb} -> request properties
- //
-
- arg.beginStructure();
-
- arg << ( int )query.type() << query.sparqlQuery();
-
- QList<Nepomuk::Search::Term> terms;
- QHash<int, QList<int> > termRelations;
- if ( query.type() == Nepomuk::Search::Query::PlainQuery ) {
- terms.append( query.term() );
- buildTermRelations( terms, termRelations );
- }
- arg << terms;
-
- arg.beginMap( QVariant::Int, qMetaTypeId<QList<int> >() );
- for( QHash<int, QList<int> >::const_iterator it = termRelations.constBegin();
- it != termRelations.constEnd(); ++it ) {
- arg.beginMapEntry();
- arg << it.key() << it.value();
- arg.endMapEntry();
- }
- arg.endMap();
- arg << query.limit();
-
- arg.beginMap( QVariant::String, QVariant::Bool );
- QList<Nepomuk::Search::Query::RequestProperty> requestProperties = \
query.requestProperties();
- foreach( const Nepomuk::Search::Query::RequestProperty& rp, requestProperties ) \
{
- arg.beginMapEntry();
- arg << QString::fromAscii( rp.first.toEncoded() ) << rp.second;
- arg.endMapEntry();
- }
- arg.endMap();
-
- arg.endStructure();
-
- return arg;
-}
-
-
-namespace {
- Nepomuk::Search::Term rebuildTermFromTermList( const \
QList<Nepomuk::Search::Term>& terms,
- const QHash<int, QList<int> >& \
termRelations,
- int index = 0 ) {
- Nepomuk::Search::Term root = terms[index];
- foreach( int i, termRelations[index] ) {
- root.addSubTerm( rebuildTermFromTermList( terms, termRelations, i ) );
- }
- return root;
- }
-}
-
-const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Search::Query& \
query )
-{
- //
- // Signature: (isa(ii(isss)sss)a{iai}ia{sb})
- // i -> type
- // s -> sparql query
- // a(ii(isss)sss) -> array of terms (first is root term)
- // a{iai} -> hash of term relations
- // i -> limit
- // a{sb} -> request properties
- //
-
- arg.beginStructure();
-
- int type = Nepomuk::Search::Query::InvalidQuery;
- QString sparqlQuery;
- QList<Nepomuk::Search::Term> terms;
- QHash<int, QList<int> > termRelations;
- int limit = 0;
-
- arg >> type
- >> sparqlQuery
- >> terms;
-
- arg.beginMap();
- while ( !arg.atEnd() ) {
- int termIndex = 0;
- QList<int> indices;
- arg.beginMapEntry();
- arg >> termIndex >> indices;
- arg.endMapEntry();
- termRelations.insert( termIndex, indices );
- }
- arg.endMap();
-
- arg >> limit;
-
- arg.beginMap();
- while ( !arg.atEnd() ) {
- QString prop;
- bool optional = true;
- arg.beginMapEntry();
- arg >> prop >> optional;
- arg.endMapEntry();
- query.addRequestProperty( QUrl::fromEncoded( prop.toAscii() ), optional );
- }
- arg.endMap();
-
- arg.endStructure();
-
- if ( Nepomuk::Search::Query::Type( type ) == Nepomuk::Search::Query::PlainQuery \
) {
- query.setTerm( rebuildTermFromTermList( terms, termRelations ) );
- }
- else {
- query.setSparqlQuery( sparqlQuery );
- }
- query.setLimit( limit );
-
- return arg;
-}
-
-
QDBusArgument& operator<<( QDBusArgument& arg, const Soprano::Node& node )
{
arg.beginStructure();
--- trunk/kdesupport/akonadi/server/src/search/dbusoperators.h #1049359:1049360
@@ -22,8 +22,6 @@
#include <QtDBus/QDBusArgument>
#include "result.h"
-#include "query.h"
-#include "term.h"
namespace Nepomuk {
namespace Search {
@@ -34,12 +32,6 @@
QDBusArgument& operator<<( QDBusArgument& arg, const Soprano::Node& );
const QDBusArgument& operator>>( const QDBusArgument& arg, Soprano::Node& );
-QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Search::Term& term );
-const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Search::Term& );
-
-QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Search::Query& query \
);
-const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Search::Query& \
);
-
QDBusArgument& operator<<( QDBusArgument& arg, const Nepomuk::Search::Result& );
const QDBusArgument& operator>>( const QDBusArgument& arg, Nepomuk::Search::Result& \
);
--- trunk/kdesupport/akonadi/server/src/search/querymetatype.h #1049359:1049360
@@ -24,9 +24,6 @@
#ifndef _NEPOMUK_QUERY_META_TYPE_H_
#define _NEPOMUK_QUERY_META_TYPE_H_
-#include "query.h"
-
-Q_DECLARE_METATYPE(Nepomuk::Search::Query)
typedef QHash<QString, QString> RequestPropertyMapDBus;
Q_DECLARE_METATYPE( RequestPropertyMapDBus )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic