• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Nepomuk

  • nepomuk
  • query
query.h
Go to the documentation of this file.
1/*
2 This file is part of the Nepomuk KDE project.
3 Copyright (C) 2008-2010 Sebastian Trueg <trueg@kde.org>
4
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.
8
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.
13
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.
18 */
19
20#ifndef _NEPOMUK_QUERY_QUERY_H_
21#define _NEPOMUK_QUERY_QUERY_H_
22
23#include <QtCore/QSharedDataPointer>
24#include <QtCore/QList>
25#include <QtCore/QPair>
26#include <QtCore/QDebug>
27
28#include <kurl.h>
29
30#include "property.h"
31
32#include "nepomukquery_export.h"
33
34class QTextStream;
35
36namespace Nepomuk {
37 namespace Query {
38
39 class Term;
40 class QueryPrivate;
41 class FileQuery;
42
47 typedef QHash<QString, Nepomuk::Types::Property> RequestPropertyMap;
48
76 class NEPOMUKQUERY_EXPORT Query
77 {
78 public:
82 Query();
83
87 explicit Query( const Term& term );
88
92 Query( const Query& );
93
97 ~Query();
98
102 Query& operator=( const Query& );
103
111 Query& operator=( const Term& term );
112
117 bool isValid() const;
118
127 bool isFileQuery() const;
128
134 FileQuery toFileQuery() const;
135
142 Term term() const;
143
149 int limit() const;
150
158 int offset() const;
159
165 void setTerm( const Term& );
166
173 void setLimit( int );
174
181 void setOffset( int offset );
182
196 void setFullTextScoringEnabled( bool enabled );
197
208 void setFullTextScoringSortOrder( Qt::SortOrder order );
209
217 bool fullTextScoringEnabled() const;
218
224 Qt::SortOrder fullTextScoringSortOrder() const;
225
233 enum QueryFlag {
237 NoQueryFlags = 0x0,
238
245 NoResultRestrictions = 0x1,
246
253 WithoutFullTextExcerpt = 0x2
254 };
255 Q_DECLARE_FLAGS( QueryFlags, QueryFlag )
256
257
264 void setQueryFlags( QueryFlags flags );
265
273 QueryFlags queryFlags() const;
274
288 class NEPOMUKQUERY_EXPORT RequestProperty {
289 public:
296 RequestProperty( const Nepomuk::Types::Property& property,
297 bool optional = true );
298
302 RequestProperty( const RequestProperty& );
303
307 ~RequestProperty();
308
312 RequestProperty& operator=( const RequestProperty& );
313
319 bool operator==( const RequestProperty& other ) const;
320
324 Nepomuk::Types::Property property() const;
325
329 bool optional() const;
330
331 private:
332 class Private;
333 QSharedDataPointer<Private> d;
334 };
335
346 void addRequestProperty( const RequestProperty& property );
347
358 void setRequestProperties( const QList<RequestProperty>& properties );
359
364 QList<RequestProperty> requestProperties() const;
365
369 enum SparqlFlag {
373 NoFlags = 0x0,
374
380 CreateCountQuery = 0x1,
381
387 HandleInverseProperties = 0x2,
388
395 CreateAskQuery = 0x4
396 };
397 Q_DECLARE_FLAGS( SparqlFlags, SparqlFlag )
398
399
423 QString toSparqlQuery( SparqlFlags flags = NoFlags ) const;
424
438 KUrl toSearchUrl( SparqlFlags flags = NoFlags ) const;
439
461 KUrl toSearchUrl( const QString& customTitle, SparqlFlags flags = NoFlags ) const;
462
469 RequestPropertyMap requestPropertyMap() const;
470
476 bool operator==( const Query& query ) const;
477
485 bool operator!=( const Query& query ) const;
486
498 Query optimized() const;
499
509 QString toString() const;
510
520 static Query fromString( const QString& queryString );
521
534 static Query fromQueryUrl( const KUrl& url );
535
547 static QString sparqlFromQueryUrl( const KUrl& url );
548
561 static QString titleFromQueryUrl( const KUrl& url );
562
563 protected:
565 QSharedDataPointer<QueryPrivate> d;
567 };
568
577 NEPOMUKQUERY_EXPORT Query operator&&( const Query& query, const Term& term );
578
587 NEPOMUKQUERY_EXPORT Query operator||( const Query& query, const Term& term );
588
597 NEPOMUKQUERY_EXPORT Query operator!( const Query& query );
598
599 NEPOMUKQUERY_EXPORT uint qHash( const Nepomuk::Query::Query& );
600 }
601}
602
603Q_DECLARE_OPERATORS_FOR_FLAGS( Nepomuk::Query::Query::SparqlFlags )
604Q_DECLARE_OPERATORS_FOR_FLAGS( Nepomuk::Query::Query::QueryFlags )
605
606NEPOMUKQUERY_EXPORT QDebug operator<<( QDebug, const Nepomuk::Query::Query& );
607
608#endif
Nepomuk::Query::FileQuery
A Nepomuk desktop query specialized for file searches.
Definition: filequery.h:45
Nepomuk::Query::Query::RequestProperty
A request property can be added to a Query to retrieve additional information about the results.
Definition: query.h:288
Nepomuk::Query::Query::RequestProperty::operator==
bool operator==(const RequestProperty &other) const
Comparison operator.
Nepomuk::Query::Query::RequestProperty::optional
bool optional() const
Nepomuk::Query::Query::RequestProperty::property
Nepomuk::Types::Property property() const
Nepomuk::Query::Query::RequestProperty::RequestProperty
RequestProperty(const Nepomuk::Types::Property &property, bool optional=true)
Create a new request property.
Nepomuk::Query::Query::RequestProperty::operator=
RequestProperty & operator=(const RequestProperty &)
Copy operator.
Nepomuk::Query::Query::RequestProperty::RequestProperty
RequestProperty(const RequestProperty &)
Copy constructor.
Nepomuk::Query::Query::RequestProperty::~RequestProperty
~RequestProperty()
Destructor.
Nepomuk::Query::Query
A Nepomuk desktop query.
Definition: query.h:77
Nepomuk::Query::Query::setOffset
void setOffset(int offset)
The first result that should be retrieved.
Nepomuk::Query::Query::Query
Query(const Query &)
Copy constructor.
Nepomuk::Query::Query::requestProperties
QList< RequestProperty > requestProperties() const
Nepomuk::Query::Query::isValid
bool isValid() const
Nepomuk::Query::Query::fullTextScoringEnabled
bool fullTextScoringEnabled() const
Nepomuk::Query::Query::isFileQuery
bool isFileQuery() const
Nepomuk::Query::Query::Query
Query(const Term &term)
Create a query with root term term.
Nepomuk::Query::Query::setRequestProperties
void setRequestProperties(const QList< RequestProperty > &properties)
Set the properties that should be reported with each search result.
Nepomuk::Query::Query::~Query
~Query()
Destructor.
Nepomuk::Query::Query::limit
int limit() const
The maximum number of results that this query should yield.
Nepomuk::Query::Query::term
Term term() const
The root term of the query.
Nepomuk::Query::Query::QueryFlag
QueryFlag
A set of flags that influence the result of the query.
Definition: query.h:233
Nepomuk::Query::Query::fullTextScoringSortOrder
Qt::SortOrder fullTextScoringSortOrder() const
Nepomuk::Query::Query::toFileQuery
FileQuery toFileQuery() const
Nepomuk::Query::Query::setTerm
void setTerm(const Term &)
Set the root term of the query.
Nepomuk::Query::Query::Query
Query()
Create an empty invalid query object.
Nepomuk::Query::Query::operator=
Query & operator=(const Query &)
Assignment operator.
Nepomuk::Query::Query::setFullTextScoringSortOrder
void setFullTextScoringSortOrder(Qt::SortOrder order)
Set the full text scoring sort order.
Nepomuk::Query::Query::operator=
Query & operator=(const Term &term)
Assignment operator.
Nepomuk::Query::Query::offset
int offset() const
The first result that should be retrieved.
Nepomuk::Query::Query::setLimit
void setLimit(int)
Set the maximum number of results this query should yield.
Nepomuk::Query::Query::SparqlFlag
SparqlFlag
Aditional flags modifying the behaviour of toSparqlQuery() and toSearchUrl().
Definition: query.h:369
Nepomuk::Query::Query::setFullTextScoringEnabled
void setFullTextScoringEnabled(bool enabled)
Nepomuk supports scoring the results based on any full text matching used in the query (full text mat...
Nepomuk::Query::Query::addRequestProperty
void addRequestProperty(const RequestProperty &property)
Add a property that should be reported with each search result.
Nepomuk::Query::Term
The base class for all term types.
Definition: term.h:65
Nepomuk::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: property.h:53
Nepomuk::Query::RequestPropertyMap
QHash< QString, Nepomuk::Types::Property > RequestPropertyMap
Convinience definition for request property mappings as used in QueryServiceClient::sparqlQuery() and...
Definition: query.h:47
Nepomuk
nepomukquery_export.h
property.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal