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

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • 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 _NEPOMUK2_SEARCH_TERM_H_
21 #define _NEPOMUK2_SEARCH_TERM_H_
22 
23 #include <QtCore/QList>
24 #include <QtCore/QUrl>
25 #include <QtCore/QSharedDataPointer>
26 
27 #include <Soprano/LiteralValue>
28 
29 #include "nepomuk_export.h"
30 
31 namespace Nepomuk2 {
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 NEPOMUK_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 
179  void setUserData( const QString& key, const QVariant& value );
180 
188  QVariant userData( const QString& key ) const;
189 
201  Term optimized() const;
202 
206  bool isLiteralTerm() const;
207 
211  bool isResourceTerm() const;
212 
216  bool isNegationTerm() const;
217 
223  bool isOptionalTerm() const;
224 
228  bool isAndTerm() const;
229 
233  bool isOrTerm() const;
234 
238  bool isComparisonTerm() const;
239 
243  bool isResourceTypeTerm() const;
244 
251  LiteralTerm toLiteralTerm() const;
252 
259  ResourceTerm toResourceTerm() const;
260 
267  NegationTerm toNegationTerm() const;
268 
277  OptionalTerm toOptionalTerm() const;
278 
285  AndTerm toAndTerm() const;
286 
293  OrTerm toOrTerm() const;
294 
301  ComparisonTerm toComparisonTerm() const;
302 
309  ResourceTypeTerm toResourceTypeTerm() const;
310 
318  LiteralTerm& toLiteralTerm();
319 
327  ResourceTerm& toResourceTerm();
328 
336  NegationTerm& toNegationTerm();
337 
347  OptionalTerm& toOptionalTerm();
348 
356  AndTerm& toAndTerm();
357 
365  OrTerm& toOrTerm();
366 
374  ComparisonTerm& toComparisonTerm();
375 
383  ResourceTypeTerm& toResourceTypeTerm();
384 
394  QString toString() const;
395 
405  static Term fromString( const QString& s );
406 
418  static Term fromVariant( const Variant& variant );
419 
432  static Term fromProperty( const Types::Property& property, const Variant& variant );
433 
439  bool operator==( const Term& term ) const;
440 
448  bool operator!=( const Term& term ) const;
449 
450  // FIXME: the compiler does not find this operator!
451  QDebug operator<<( QDebug ) const;
452 
454  protected:
455  Term( TermPrivate* );
456 
457  QSharedDataPointer<TermPrivate> d_ptr;
458 
459  friend class TermPrivate;
460  friend class GroupTermPrivate;
461  friend class AndTermPrivate;
462  friend class OrTermPrivate;
463  friend class ComparisonTermPrivate;
464  friend class NegationTermPrivate;
465  friend class OptionalTermPrivate;
466  friend class Query;
467  friend class QueryPrivate;
469  };
470 
479  NEPOMUK_EXPORT Term operator&&( const Term& term1, const Term& term2 );
480 
489  NEPOMUK_EXPORT Term operator||( const Term& term1, const Term& term2 );
490 
500  NEPOMUK_EXPORT Term operator!( const Term& term );
501 
516  NEPOMUK_EXPORT ComparisonTerm operator<( const Types::Property& property, const Term& term );
517 
532  NEPOMUK_EXPORT ComparisonTerm operator>( const Types::Property& property, const Term& term );
533 
548  NEPOMUK_EXPORT ComparisonTerm operator<=( const Types::Property& property, const Term& term );
549 
564  NEPOMUK_EXPORT ComparisonTerm operator>=( const Types::Property& property, const Term& term );
565 
580  NEPOMUK_EXPORT ComparisonTerm operator==( const Types::Property& property, const Term& term );
581 
598  NEPOMUK_EXPORT Term operator!=( const Types::Property& property, const Term& term );
599 
600  NEPOMUK_EXPORT uint qHash( const Nepomuk2::Query::Term& );
601  }
602 
603 }
604 
606 // there is a hand written instantiation of clone()
607 template<> Nepomuk2::Query::TermPrivate* QSharedDataPointer<Nepomuk2::Query::TermPrivate>::clone();
610 // FIXME: the compiler does not find the operator in the class
611 NEPOMUK_EXPORT QDebug operator<<( QDebug, const Nepomuk2::Query::Term& );
612 
613 #endif
Nepomuk2::Query::Term::Comparison
A comparison.
Definition: term.h:113
Nepomuk2::Query::AndTerm
Match resource that match all sub terms.
Definition: andterm.h:43
Nepomuk2::Query::Term::Negation
A negation term inverts the meaning of its sub term.
Definition: term.h:127
Nepomuk2::Query::Term
The base class for all term types.
Definition: term.h:64
Nepomuk2::Query::ResourceTypeTerm
Matching resources by type.
Definition: resourcetypeterm.h:48
Nepomuk2::operator<<
QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResource &)
Definition: simpleresource.cpp:307
Nepomuk2::Query::Term::And
Match all resources that match all sub terms.
Definition: term.h:98
Nepomuk2::Query::qHash
uint qHash(const Nepomuk2::Query::Query &)
Definition: query.cpp:738
Nepomuk2::Query::NegationTerm
Negate an arbitrary term.
Definition: negationterm.h:47
Nepomuk2::Variant
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding...
Definition: variant.h:65
Nepomuk2::Query::operator&&
Query operator&&(const Query &query, const Term &term)
Logical and operator which combines term into the term of query to match both.
Definition: query.cpp:708
Nepomuk2::Query::ComparisonTerm
A term matching the value of a property.
Definition: comparisonterm.h:70
Nepomuk2::Query::OptionalTerm
Make a term optional.
Definition: optionalterm.h:46
Nepomuk2::Query::Query
A Nepomuk desktop query.
Definition: query.h:76
Nepomuk2::Query::OrTerm
Match resource that match at least one of the sub terms.
Definition: orterm.h:43
Nepomuk2::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: libnepomukcore/types/property.h:52
Nepomuk2::Query::Term::ResourceType
Matches all resources of a specific type.
Definition: term.h:120
Nepomuk2::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.
Definition: query.cpp:716
Property
Represents the property of a resource.
Definition: rcgen/property.h:29
Nepomuk2::Query::Term::Type
Type
The type of a term identifying its meaning.
Definition: term.h:72
Nepomuk2::Query::Term::Resource
A resource term matches one resource by URI.
Definition: term.h:91
operator<<
QDebug operator<<(QDebug, const Nepomuk2::Query::Term &)
Definition: term.cpp:396
Nepomuk2::Query::operator!
Query operator!(const Query &query)
Logical negation operator which negates the meaning of a query.
Definition: query.cpp:724
nepomuk_export.h
Nepomuk2::Query::Term::Or
Match all resources that match one of the sub terms.
Definition: term.h:105
Nepomuk2::Query::Term::Literal
A literal term is the simplest form of Term.
Definition: term.h:84
Nepomuk2::Query::Term::Invalid
An invalid term matching nothing.
Definition: term.h:76
Nepomuk2::Query::LiteralTerm
Match literal properties via full text.
Definition: literalterm.h:86
Nepomuk2::Query::ResourceTerm
Matches exactly one resource.
Definition: resourceterm.h:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • 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