• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/tmp/buildd/soprano-2.5.0.e5.20100910.1174752/index/indexfiltermodel.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef _SOPRANO_INDEX_MODEL_FILTER_H_
00023 #define _SOPRANO_INDEX_MODEL_FILTER_H_
00024 
00025 #include "filtermodel.h"
00026 #include "soprano_export.h"
00027 
00028 namespace Soprano {
00029 
00030     namespace Query {
00031         class Query;
00032     }
00033 
00044     namespace Index {
00045 
00046         class CLuceneIndex;
00047         class QueryResult;
00048         class IndexFilterModelPrivate;
00049 
00061         class SOPRANO_INDEX_EXPORT IndexFilterModel : public Soprano::FilterModel
00062         {
00063         public:
00073             IndexFilterModel( const QString& indexDir, Soprano::Model* model = 0 );
00074 
00083             IndexFilterModel( CLuceneIndex* index, Soprano::Model* model = 0 );
00084         
00088             ~IndexFilterModel();
00089 
00093             CLuceneIndex* index() const;
00094 
00102             Soprano::Error::ErrorCode addStatement( const Soprano::Statement &statement );
00103 
00109             Soprano::Error::ErrorCode removeStatement( const Soprano::Statement &statement );
00110 
00116             Soprano::Error::ErrorCode removeAllStatements( const Soprano::Statement &statement );
00117 
00142             QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const;
00143 
00144             /*
00145              * Extract full text matching parts of a %query and replace them with
00146              * results from an index %query.
00147              *
00148              * \param query The query to rewrite.
00149              *
00150              * \return A rewritten query stripped of all full test and regexp matching parts
00151              * and replaced by results from an index query.
00152              */
00153 //        Query::Query evaluateAndRewriteQuery( const Query::Query& query ) const;
00154 
00165             void setTransactionCacheSize( int size );
00166         
00172             int transactionCacheSize() const;
00173 
00182             void rebuildIndex();
00183 
00192             void optimizeIndex();
00193 
00206             void addIndexOnlyPredicate( const QUrl& predicate );
00207 
00220             void setIndexOnlyPredicates( const QList<QUrl>& predicates );
00221 
00235             QList<QUrl> indexOnlyPredicates() const;
00236 
00248             void addForceIndexPredicate( const QUrl& predicate );
00249 
00279             void setForceIndexPredicates( const QList<QUrl>& predicates );
00280 
00291             QList<QUrl> forceIndexPredicates() const;
00292 
00310             static QString encodeStringForLuceneQuery( const QString& value );
00311 
00329             static QString encodeUriForLuceneQuery( const QUrl& uri );
00330 
00331             using FilterModel::addStatement;
00332             using FilterModel::removeStatement;
00333             using FilterModel::removeAllStatements;
00334 
00335         private:
00336             IndexFilterModelPrivate* const d;
00337         };
00338     }
00339 }
00340 
00341 #endif

Generated on Mon Sep 13 2010 08:51:56 for Soprano by  doxygen 1.7.1