00001 /**************************************************************************** 00002 ** This file is part of Cubi, a Sparql query builder for the Qt framework 00003 ** 00004 ** Copyright (c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). 00005 ** 00006 ** Contact: Nokia Corporation (info@qt.nokia.com) 00007 ** 00008 ** 00009 ** GNU Lesser General Public License Usage 00010 ** 00011 ** This file may be used under the terms of the GNU Lesser General Public 00012 ** License version 2.1 as published by the Free Software Foundation and 00013 ** appearing in the file LICENSE.LGPL included in the packaging of this file. 00014 ** Please review the following information to ensure the GNU Lesser General 00015 ** Public License version 2.1 requirements will be met: 00016 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00017 ** 00018 ** In addition, as a special exception, Nokia gives you certain additional 00019 ** rights. These rights are described in the Nokia Qt LGPL Exception 00020 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 00021 ** 00022 ** Other Usage 00023 ** 00024 ** Alternatively, this file may be used in accordance with the terms and 00025 ** conditions contained in a signed written agreement between you and Nokia. 00026 ** 00027 ** If you have questions regarding the use of this file, please contact 00028 ** Nokia at info@qt.nokia.com. 00029 ****************************************************************************/ 00030 00031 #ifndef CUBI_SELECT_H 00032 #define CUBI_SELECT_H 00033 00034 #include "filter.h" 00035 #include "function.h" 00036 #include "pattern.h" 00037 #include "projection.h" 00038 #include "value.h" 00039 #include "variable.h" 00040 00041 CUBI_BEGIN_NAMESPACE 00042 00043 class SelectData; 00044 00045 class Select 00046 { 00047 00048 public: 00049 Select(); 00050 Select(const Select &other); 00051 Select& operator=(const Select &other); 00052 bool operator==(const Select &other) const; 00053 bool operator!=(const Select &other) const; 00054 ~Select(); 00055 00056 void addProjection(const Projection &projection); 00057 void addProjection(const Variable &variable); 00058 void addProjection(const Function &function, const Variable &alias = Variable::invalid()); 00059 void addProjection(const Select &select, const Variable &alias = Variable::invalid()); 00060 void addProjection(const LiteralValue &literalValue); 00061 00062 void addRestriction(const PatternBase &pattern); 00063 void addRestriction(const Value &s, const Value &p, const Value &o); 00064 void addRestriction(const Value &s, const ValueChain &chain, const Value &o); 00065 00066 Filter filter() const; 00067 void setFilter(const Filter &filter); 00068 00069 void setLimit(long limit); 00070 void setOffset(long offset); 00071 void setOrderBy(const Value &order); 00072 00073 bool isEmpty() const; 00074 00075 QList<Projection> projections() const; 00076 QList<PatternBase> restrictions() const; 00077 long limit() const; 00078 long offset() const; 00079 Value orderBy() const; 00080 00081 QString sparql(Options::SparqlOptions options = Options::DefaultSparqlOptions) const; 00082 00083 private: 00084 Variable getTmpVar(); 00085 00086 QSharedDataPointer<SelectData> d; 00087 }; 00088 00089 CUBI_END_NAMESPACE 00090 00091 #endif