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

Nepomuk

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk
  • query
term.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2007-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_SEARCH_TERM_H_
21 #define _NEPOMUK_SEARCH_TERM_H_
22 
23 #include <QtCore/QList>
24 #include <QtCore/QUrl>
25 #include <QtCore/QSharedDataPointer>
26 
27 #include <Soprano/LiteralValue>
28 
29 #include "nepomukquery_export.h"
30 
31 namespace Nepomuk {
32 
33  class Variant;
34 
35  namespace Types {
36  class Property;
37  }
38 
39  namespace Query {
40 
41  class LiteralTerm;
42  class ResourceTerm;
43  class NegationTerm;
44  class AndTerm;
45  class OrTerm;
46  class ComparisonTerm;
47  class ResourceTypeTerm;
48  class OptionalTerm;
49 
50  class TermPrivate;
51 
64  class NEPOMUKQUERY_EXPORT Term
65  {
66  public:
72  enum Type {
76  Invalid,
77 
84  Literal,
85 
91  Resource,
92 
98  And,
99 
105  Or,
106 
113  Comparison,
114 
120  ResourceType,
121 
127  Negation,
128 
136  Optional
137  };
138 
142  Term();
143 
147  Term( const Term& other );
148 
152  ~Term();
153 
157  Term& operator=( const Term& other );
158 
163  bool isValid() const;
164 
168  Type type() const;
169 
181  Term optimized() const;
182 
186  bool isLiteralTerm() const;
187 
191  bool isResourceTerm() const;
192 
196  bool isNegationTerm() const;
197 
203  bool isOptionalTerm() const;
204 
208  bool isAndTerm() const;
209 
213  bool isOrTerm() const;
214 
218  bool isComparisonTerm() const;
219 
223  bool isResourceTypeTerm() const;
224 
231  LiteralTerm toLiteralTerm() const;
232 
239  ResourceTerm toResourceTerm() const;
240 
247  NegationTerm toNegationTerm() const;
248 
257  OptionalTerm toOptionalTerm() const;
258 
265  AndTerm toAndTerm() const;
266 
273  OrTerm toOrTerm() const;
274 
281  ComparisonTerm toComparisonTerm() const;
282 
289  ResourceTypeTerm toResourceTypeTerm() const;
290 
298  LiteralTerm& toLiteralTerm();
299 
307  ResourceTerm& toResourceTerm();
308 
316  NegationTerm& toNegationTerm();
317 
327  OptionalTerm& toOptionalTerm();
328 
336  AndTerm& toAndTerm();
337 
345  OrTerm& toOrTerm();
346 
354  ComparisonTerm& toComparisonTerm();
355 
363  ResourceTypeTerm& toResourceTypeTerm();
364 
374  QString toString() const;
375 
385  static Term fromString( const QString& s );
386 
398  static Term fromVariant( const Variant& variant );
399 
412  static Term fromProperty( const Types::Property& property, const Variant& variant );
413 
419  bool operator==( const Term& term ) const;
420 
428  bool operator!=( const Term& term ) const;
429 
430  // FIXME: the compiler does not find this operator!
431  QDebug operator<<( QDebug ) const;
432 
434  protected:
435  Term( TermPrivate* );
436 
437  QSharedDataPointer<TermPrivate> d_ptr;
438 
439  friend class TermPrivate;
440  friend class GroupTermPrivate;
441  friend class AndTermPrivate;
442  friend class OrTermPrivate;
443  friend class ComparisonTermPrivate;
444  friend class NegationTermPrivate;
445  friend class OptionalTermPrivate;
446  friend class Query;
447  friend class QueryPrivate;
449  };
450 
459  NEPOMUKQUERY_EXPORT Term operator&&( const Term& term1, const Term& term2 );
460 
469  NEPOMUKQUERY_EXPORT Term operator||( const Term& term1, const Term& term2 );
470 
480  NEPOMUKQUERY_EXPORT Term operator!( const Term& term );
481 
496  NEPOMUKQUERY_EXPORT ComparisonTerm operator<( const Types::Property& property, const Term& term );
497 
512  NEPOMUKQUERY_EXPORT ComparisonTerm operator>( const Types::Property& property, const Term& term );
513 
528  NEPOMUKQUERY_EXPORT ComparisonTerm operator<=( const Types::Property& property, const Term& term );
529 
544  NEPOMUKQUERY_EXPORT ComparisonTerm operator>=( const Types::Property& property, const Term& term );
545 
560  NEPOMUKQUERY_EXPORT ComparisonTerm operator==( const Types::Property& property, const Term& term );
561 
578  NEPOMUKQUERY_EXPORT Term operator!=( const Types::Property& property, const Term& term );
579 
580  NEPOMUKQUERY_EXPORT uint qHash( const Nepomuk::Query::Term& );
581  }
582 
583 }
584 
586 // there is a hand written instantiation of clone()
587 template<> Nepomuk::Query::TermPrivate* QSharedDataPointer<Nepomuk::Query::TermPrivate>::clone();
590 // FIXME: the compiler does not find the operator in the class
591 NEPOMUKQUERY_EXPORT QDebug operator<<( QDebug, const Nepomuk::Query::Term& );
592 
593 #endif
Nepomuk::Query::operator!
Query operator!(const Query &query)
Logical negation operator which negates the meaning of a query.
Nepomuk::Query::Term::And
Match all resources that match all sub terms.
Definition: term.h:98
Nepomuk::Query::ComparisonTerm
A term matching the value of a property.
Definition: comparisonterm.h:70
Nepomuk::Query::Term::Or
Match all resources that match one of the sub terms.
Definition: term.h:105
Nepomuk::Query::LiteralTerm
Match literal properties via full text.
Definition: literalterm.h:86
Nepomuk::Query::Term::Literal
A literal term is the simplest form of Term.
Definition: term.h:84
Nepomuk::Query::Query
A Nepomuk desktop query.
Definition: query.h:76
Nepomuk::Query::Term::Type
Type
The type of a term identifying its meaning.
Definition: term.h:72
Nepomuk::Query::ResourceTerm
Matches exactly one resource.
Definition: resourceterm.h:52
operator<<
QDebug operator<<(QDebug, const Nepomuk::Query::Term &)
Nepomuk::Query::OrTerm
Match resource that match at least one of the sub terms.
Definition: orterm.h:43
Nepomuk::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: property.h:52
Nepomuk::Query::Term::ResourceType
Matches all resources of a specific type.
Definition: term.h:120
Nepomuk::Query::Term::Comparison
A comparison.
Definition: term.h:113
Nepomuk::Query::AndTerm
Match resource that match all sub terms.
Definition: andterm.h:43
Nepomuk::Query::Term
The base class for all term types.
Definition: term.h:64
Nepomuk::Query::OptionalTerm
Make a term optional.
Definition: optionalterm.h:46
nepomukquery_export.h
Nepomuk::Query::Term::Invalid
An invalid term matching nothing.
Definition: term.h:76
Nepomuk::Variant
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding...
Definition: variant.h:65
Nepomuk::Query::Term::Negation
A negation term inverts the meaning of its sub term.
Definition: term.h:127
Nepomuk::Query::ResourceTypeTerm
Matching resources by type.
Definition: resourcetypeterm.h:48
Nepomuk::Query::operator&&
Query operator&&(const Query &query, const Term &term)
Logical and operator which combines term into the term of query to match both.
Nepomuk::Query::operator||
Query operator||(const Query &query, const Term &term)
Logical or operator which combines term into the term of query to match either one.
Nepomuk::Query::Term::Resource
A resource term matches one resource by URI.
Definition: term.h:91
DateRange::operator<<
QDebug operator<<(QDebug dbg, const DateRange &range)
Debug streaming operator.
Nepomuk::Query::NegationTerm
Negate an arbitrary term.
Definition: negationterm.h:47
Nepomuk::Query::qHash
uint qHash(const Nepomuk::Query::Query &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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