This file is indexed.

/usr/include/soprano/cluceneindex.h is in libsoprano-dev 2.9.4+dfsg-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/*
 * This file is part of Soprano Project.
 *
 * Copyright (C) 2007-2009 Sebastian Trueg <trueg@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef _SOPRANO_CLUCENE_INDEX_H_
#define _SOPRANO_CLUCENE_INDEX_H_

#include <QtCore/QString>

#include "statement.h"
#include "soprano_export.h"
#include "error.h"
#include "iterator.h"
#include "indexqueryhit.h"


namespace lucene {
    namespace search {
        class Hits;
        class Query;
    }
    namespace analysis {
        class Analyzer;
    }
    namespace document {
        class Document;
        class Field;
    }
}

namespace Soprano {

    namespace Index {

        /**
         * \class CLuceneIndex cluceneindex.h Soprano/Index/CLuceneIndex
         *
         * \brief The CLuceneIndex provides a wrapper around a CLucene index
         * which stores RDF statements.
         *
         * It is used by the IndexFilterModel to actually handle the index. It has been
         * made visible in the public API to provide the possibility for advanced queries
         * and data modifications.
         *
         * CLuceneIndex is thread-safe.
         *
         * <b>Data organization</b>
         *
         * In the %Soprano index each resource gets its own clucene document. Only statements with literal
         * objects are indexed. The clucene is identified through the statements' subject and then a new
         * field is created that uses the statement's predicate as field name and the statement's object
         * as value. The index ignores all context information.
         *
         * \warning <b>The API is subject to change. Most likely CLucene classes will be wrapped and hidden from the public API.</b>
         *
         * \author Sebastian Trueg <trueg@kde.org>
         */
        class SOPRANO_INDEX_EXPORT CLuceneIndex : public Error::ErrorCache
        {
        public:
            //@{
            /**
             * \param analyzer The analyzer to be used. If 0 a standard analyzer will be created.
             */
            CLuceneIndex( lucene::analysis::Analyzer* analyzer = 0 );

            /**
             * Destructor.
             *
             * Calls close().
             */
            ~CLuceneIndex();
            //@}

            //@{
            /**
             * Open the index.
             * \param folder The folder where the index is stored.
             * \param force If true any CLucene locks on the folder are removed. This is useful
             * if a previous session crashed and left an unused lock lying around.
             */
            bool open( const QString& folder, bool force = false );

            /**
             * Close the index. Write back any changes, close any open transactions. (Is called in ~CLuceneIndex())
             */
            void close();

            /**
             * \return \p true If the index has been opened successfully.
             * \sa open()
             */
            bool isOpen() const;
            //@}

            //@{
            /**
             * Optionally set the analyzer to be used for query parsing. By default the index
             * analyzer specified in the constructor is used.
             *
             * CLuceneIndex will not take ownership of the analyzer.
             *
             * \sa search(const QString&)
             *
             * \since 2.3
             */
            void setQueryAnalyzer( lucene::analysis::Analyzer* analyzer );

            /**
             * Get the query analyzer set in setQueryAnalyzer. This method is only
             * provided for convenience.
             *
             * \return The analyzer set in setQueryAnalyzer or 0 if none was set.
             *
             * \since 2.3
             */
            lucene::analysis::Analyzer* queryAnalyzer() const;
            //@}

            //@{
            /**
             * Get the number of indexed resources.
             *
             * \return The number of indexed resoruces or -1 on error (In the case of error
             * lastError() provides more information.
             */
            int resourceCount() const;
            //@}

            //@{
            /**
             * Start a new transaction. After calling this method multiple fields and statements may be added to the
             * index and nothing is written back to disk. A transaction has to be closed. Otherwise the data will not be written to the index.
             * (All transactions are closed on deletion.)
             *
             * Methods such as addStatement will start and close a transaction internally if none has been started
             * before.
             *
             * \return A transaction id that has to be used to close the transaction. This is a safety mechanism to ensure
             * that no other user closes one's transaction. If another transaction has already been started 0 is returned.
             */
            int startTransaction();

            /**
             * Close a transaction and write the changes back to the index.
             *
             * \param id The transaction ID as returned by startTransaction()
             *
             * \return \p true if the transaction was closed,  false if no transaction was started,
             * a wrong transaction id has been supplied, or a clucene error occured.
             */
            bool closeTransaction( int id );
            //@}

            //@{
            /**
             * Indexes a statement.
             * \return An error code or 0 on success
             */
            Error::ErrorCode addStatement( const Soprano::Statement& );

            /**
             * Removes a statement from the index.
             * \return An error code or 0 on success
             */
            Error::ErrorCode removeStatement( const Soprano::Statement& );
            //@}

            //@{
            /**
             * Get a document for a specific resource. This is only possible after starting a transaction.
             *
             * \param resource The resource for which a document is requested.
             *
             * \return The document representing the resource or 0 if no transaction has been started or
             * a clucene error occured.
             *
             * \warning This is an advanced method. Calling this method is thread-safe but using the
             * returned document is not.
             */
            lucene::document::Document* documentForResource( const Node& resource );
            //@}

            //@{
            /**
             * Evaluates the given query.
             * Each hit is a resource and a score. Resource properties may be read from the model.
             *
             * \param query The query in the CLucene query language.
             *
             * \return The results as an iterator over QueryHit objects or an invalid iterator
             * on error.
             */
            Iterator<QueryHit> search( const QString& query );

            /**
             * Evaluates the given query.
             * Each hit is a resource and a score. Resource properties may be read from the model.
             *
             * \param query The query to evaluate. The iterator takes ownership of the query.
             * Do not delete.it! (If anyone using this understands the weird CLucene memory
             * management enough to fix this issue, please...)
             *
             * \return The results as an iterator over QueryHit objects or an invalid iterator
             * on error.
             *
             * \warning The result iterator uses the query object.
             */
            Iterator<QueryHit> search( lucene::search::Query* query );
            //@}

#if 0
            /**
             * Gets the score for a particular Resource and query. Returns a value < 0
             * when the Resource does not match the query.
             */
            double getScore( const Soprano::Node& resource, const QString& query );

            /**
             * Gets the score for a particular Resource and query. Returns a value < 0
             * when the Resource does not match the query.
             */
            double getScore( const Soprano::Node& resource, lucene::search::Query* query );
#endif

            /**
             * Returns the Resource corresponding with the specified Document.
             */
            static Soprano::Node getResource( lucene::document::Document* document );

            /**
             * This is a temporary method which supports the advanced query interface based on
             * CLucene classes.
             *
             * The %Soprano index creates one special field for each indexed resource which contains
             * all data to allow simple queries without property names or URIs.
             *
             * \return The name of the default CLucene search field to be queried when no properties
             * are known.
             */
            static QString defaultSearchField();

            //@{
            /**
             * Dump the index contents to the stream
             */
            void dump( QTextStream& ) const;

            /**
             * Clear the index, i.e. delete all entries.
             *
             * \since 2.1
             */
            void clear();

            /**
             * Optimize the index for search. This makes sense after adding or
             * removing a large number of statements.
             *
             * \since 2.2
             */
            void optimize();
            //@}

        private:
            class Private;
            Private* const d;
        };
    }
}

#endif