// Copyright 2010 Simon Edwards <simon@simonzone.com>

//                 Generated by twine2

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details

// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

namespace Nepomuk
{
namespace Query
{
typedef QHash<QString,Nepomuk::Types::Property> RequestPropertyMap;
class Query
{
%TypeHeaderCode
#include <nepomuk/query.h>
%End

public:
                            Query ();
    explicit                Query (const Nepomuk::Query::Term& term);
                            Query (const Nepomuk::Query::Query&);
    ~Query ();
    bool                    isValid () const;
    Nepomuk::Query::Term    term () const;
    int                     limit () const;
    void                    setTerm (const Nepomuk::Query::Term&);
    void                    setLimit (int);
    class RequestProperty
    {
%TypeHeaderCode
#include <nepomuk/query.h>
%End

    public:
                                RequestProperty (const Nepomuk::Types::Property& property, bool optional = 1);
                                RequestProperty (const Nepomuk::Query::Query::RequestProperty&);
        ~RequestProperty ();
        bool                    operator == (const Nepomuk::Query::Query::RequestProperty& other) const;
        Nepomuk::Types::Property  property () const;
        bool                    optional () const;
    };
    void                    addRequestProperty (const Nepomuk::Query::Query::RequestProperty& property);
    void                    setRequestProperties (const QList<Nepomuk::Query::Query::RequestProperty>& properties);
    QList<Nepomuk::Query::Query::RequestProperty>  requestProperties () const;
    enum SparqlFlag
    {
        NoFlags,
        CreateCountQuery,
        HandleInverseProperties,
        CreateAskQuery
    };
    typedef QFlags<Nepomuk::Query::Query::SparqlFlag> SparqlFlags;
    QString                 toSparqlQuery (Nepomuk::Query::Query::SparqlFlags flags = Nepomuk::Query::Query::NoFlags) const;
    KUrl                    toSearchUrl (Nepomuk::Query::Query::SparqlFlags flags = Nepomuk::Query::Query::NoFlags) const;
    Nepomuk::Query::RequestPropertyMap  requestPropertyMap () const;
    bool                    operator == (const Nepomuk::Query::Query& query) const;
    int                     offset () const;
    void                    setOffset (int offset);
    bool                    isFileQuery () const;
    KUrl                    toSearchUrl (const QString& customTitle, Nepomuk::Query::Query::SparqlFlags flags = Nepomuk::Query::Query::NoFlags) const;
    QString                 toString () const;
    static Nepomuk::Query::Query  fromString (const QString& queryString);
    static Nepomuk::Query::Query  fromQueryUrl (const KUrl& url);
    static QString          sparqlFromQueryUrl (const KUrl& url);
    static QString          titleFromQueryUrl (const KUrl& url);
    Nepomuk::Query::FileQuery  toFileQuery () const;
    void                    setFullTextScoringEnabled (bool enabled);
    void                    setFullTextScoringSortOrder (Qt::SortOrder order);
    bool                    fullTextScoringEnabled () const;
    Qt::SortOrder           fullTextScoringSortOrder () const;
    enum QueryFlag
    {
        NoQueryFlags,
        NoResultRestrictions,
        WithoutFullTextExcerpt
    };
    typedef QFlags<Nepomuk::Query::Query::QueryFlag> QueryFlags;
    void                    setQueryFlags (Nepomuk::Query::Query::QueryFlags flags);
    Nepomuk::Query::Query::QueryFlags  queryFlags () const;
    bool                    operator != (const Nepomuk::Query::Query& query) const;
    Nepomuk::Query::Query   optimized () const;
};
uint                    qHash (const Nepomuk::Query::Query&);
//ig Nepomuk::Query::Query   operator && (const Nepomuk::Query::Query& query, const Nepomuk::Query::Term& term);
//ig Nepomuk::Query::Query   operator || (const Nepomuk::Query::Query& query, const Nepomuk::Query::Term& term);
//ig Nepomuk::Query::Query   operator ! (const Nepomuk::Query::Query& query);
};
};
//ig QDebug                  operator << (QDebug, const Nepomuk::Query::Query&);
