2 This file is part of the Nepomuk KDE project.
3 Copyright (C) 2008 Sebastian Trueg <trueg@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef _NEPOMUK_SEARCH_QUERY_H_
21 #define _NEPOMUK_SEARCH_QUERY_H_
23 #include <QtCore/QSharedDataPointer>
24 #include <QtCore/QList>
25 #include <QtCore/QPair>
26 #include <QtCore/QDebug>
28 #include <nepomuk/nepomuk_export.h>
38 * \class Query query.h nepomuk/query.h
40 * \brief A Nepomuk desktop query.
42 * A query can either be based on Term or a more complex
45 * \author Sebastian Trueg <trueg@kde.org>
47 class NEPOMUK_EXPORT Query
57 * Create an empty invalid query object.
62 * Create a query of type PlainQuery based on
65 Query( const Term
& term
);
68 * Create a SPARQL query. The query has to have one select variable called "?r"
70 explicit Query( const QString
& sparqlQuery
);
75 Query( const Query
& );
85 Query
& operator=( const Query
& );
89 QString
sparqlQuery() const;
92 void setTerm( const Term
& );
93 void setSparqlQuery( const QString
& );
97 * Add a property that should be reported with each search result.
98 * \param property The requested property.
99 * \param optional If \p true the property is optional, meaning it can
100 * be empty ins earch results.
102 void addRequestProperty( const QUrl
& property
, bool optional
= true );
103 void clearRequestProperties();
105 typedef QPair
<QUrl
, bool> RequestProperty
;
107 QList
<RequestProperty
> requestProperties() const;
109 bool operator==( const Query
& ) const;
113 QSharedDataPointer
<Private
> d
;
116 NEPOMUK_EXPORT uint
qHash( const Nepomuk::Search::Query
& );
120 NEPOMUK_EXPORT QDebug
operator<<( QDebug
, const Nepomuk::Search::Query
& );