Soprano  2.9.4
cluceneindex.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2007-2009 Sebastian Trueg <trueg@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _SOPRANO_CLUCENE_INDEX_H_
23 #define _SOPRANO_CLUCENE_INDEX_H_
24 
25 #include <QtCore/QString>
26 
27 #include "statement.h"
28 #include "soprano_export.h"
29 #include "error.h"
30 #include "iterator.h"
31 #include "indexqueryhit.h"
32 
33 
34 namespace lucene {
35  namespace search {
36  class Hits;
37  class Query;
38  }
39  namespace analysis {
40  class Analyzer;
41  }
42  namespace document {
43  class Document;
44  class Field;
45  }
46 }
47 
48 namespace Soprano {
49 
50  namespace Index {
51 
76  {
77  public:
79 
82  CLuceneIndex( lucene::analysis::Analyzer* analyzer = 0 );
83 
91 
93 
99  bool open( const QString& folder, bool force = false );
100 
104  void close();
105 
110  bool isOpen() const;
112 
114 
124  void setQueryAnalyzer( lucene::analysis::Analyzer* analyzer );
125 
134  lucene::analysis::Analyzer* queryAnalyzer() const;
136 
138 
144  int resourceCount() const;
146 
148 
160 
169  bool closeTransaction( int id );
171 
173 
178 
185 
187 
200 
202 
212 
226  Iterator<QueryHit> search( lucene::search::Query* query );
228 
229 #if 0
234  double getScore( const Soprano::Node& resource, const QString& query );
235 
240  double getScore( const Soprano::Node& resource, lucene::search::Query* query );
241 #endif
242 
247 
259 
261 
264  void dump( QTextStream& ) const;
265 
271  void clear();
272 
279  void optimize();
281 
282  private:
283  class Private;
284  Private* const d;
285  };
286  }
287 }
288 
289 #endif
Core class of Soprano's exception system.
Definition: error.h:235
The CLuceneIndex provides a wrapper around a CLucene index which stores RDF statements.
Definition: cluceneindex.h:76
bool open(const QString &folder, bool force=false)
static QString defaultSearchField()
CLuceneIndex(lucene::analysis::Analyzer *analyzer=0)
lucene::analysis::Analyzer * queryAnalyzer() const
static Soprano::Node getResource(lucene::document::Document *document)
lucene::document::Document * documentForResource(const Node &resource)
Iterator< QueryHit > search(lucene::search::Query *query)
Iterator< QueryHit > search(const QString &query)
Error::ErrorCode addStatement(const Soprano::Statement &)
void dump(QTextStream &) const
void setQueryAnalyzer(lucene::analysis::Analyzer *analyzer)
Error::ErrorCode removeStatement(const Soprano::Statement &)
The basic Soprano iterator class.
Definition: iterator.h:79
A Node represents one RDF resource.
Definition: node.h:54
A Statement instance represents one RDF quadruple.
Definition: statement.h:48
SOPRANO_EXPORT QUrl Document()
#define SOPRANO_INDEX_EXPORT